Also needed by anything else that wants to correctly style images (e.g. Stylo-Dioxus)
Changes made
Use SizingMode::Inherent when sizing absolute children of flexbox nodes. This basically turns on application of styles which is what we want.
Pass style: &Style into measure functions. This allows measure functions to access a node's styles which is necessary if they are to apply their aspect ratio to those styles.
Make MaybeMath, MaybeResolve and ResolveOrZero traits public. These were previously private to keep Taffy's API surface area smaller, but they're very useful when implementing the image measure function as above.
Notes
We may want more built-in support for replaced elements at some point (e.g. a Display::Replaced mode that knows about aspect ratios). This is the quick fix targeting the upcoming Bevy 0.14 release.
Somehow this wasn't an issue with Taffy 0.3. I think fixes for other issues have exposed this issue (IIRC we were previously passing the style size as a known_size but this breaks some other use cases that I can't remember right now)
Objective
Allow image measure functions to correctly apply their inherent aspect ratio to style sizes.
Context
Changes made
SizingMode::Inherent
when sizing absolute children of flexbox nodes. This basically turns on application of styles which is what we want.style: &Style
into measure functions. This allows measure functions to access a node's styles which is necessary if they are to apply their aspect ratio to those styles.MaybeMath
,MaybeResolve
andResolveOrZero
traits public. These were previously private to keep Taffy's API surface area smaller, but they're very useful when implementing the image measure function as above.Notes
Display::Replaced
mode that knows about aspect ratios). This is the quick fix targeting the upcoming Bevy 0.14 release.known_size
but this breaks some other use cases that I can't remember right now)