DioxusLabs / taffy

A high performance rust-powered UI layout library
https://docs.rs/taffy
Other
2.04k stars 102 forks source link

Add CSS calc #668

Closed kokoISnoTarget closed 1 month ago

kokoISnoTarget commented 2 months ago

Objective

Fixes: #225

Context

https://github.com/DioxusLabs/taffy/pull/232#issuecomment-1501163557 https://drafts.csswg.org/css-values/#funcdef-calc

Feedback wanted

Todo

nicoburns commented 2 months ago

@kokoISnoTarget I've been reading some of your commits, and regarding the "union", I suspect you may actually want a newtype around a u32 (or u64 if you need 64 bits). You can then use type casts and bit manipulation operators to access the tag and the value(s).

kokoISnoTarget commented 2 months ago

@nicoburns I'm not quite sure what the problem of my current approach is, but I appreciate the feedback.