1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:37:34 +00:00

LibWeb: Avoid leaking infinite remaining_free_space in FFC calculation

After switching to fixed-point arithmetic in CSSPixels, it no longer
supports representing infinite values, which was previously the case
for remaining_free_space in FFC. Using Optional that is not empty only
when value is finite to store remaining_free_space ensures that
infinity is avoided in layout calculations.
This commit is contained in:
Aliaksandr Kalenik 2023-07-25 22:18:08 +02:00 committed by Andreas Kling
parent de95a2fe33
commit 152ce88984
4 changed files with 36 additions and 17 deletions

View file

@ -109,7 +109,7 @@ private:
struct FlexLine {
Vector<FlexItem&> items;
CSSPixels cross_size { 0 };
CSSPixels remaining_free_space { 0 };
Optional<CSSPixels> remaining_free_space;
double chosen_flex_fraction { 0 };
double sum_of_flex_factor_of_unfrozen_items() const;