mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:48:12 +00:00
LibWeb: Don't touch flex items after they we've been frozen
When using the flex shrink factor, the flexible length resolution algorithm was incorrectly ignoring the `frozen` flag on items and would update the same items again, causing overconsumption of the remaining free space on the flex line.
This commit is contained in:
parent
0808463a7d
commit
f3556f239e
3 changed files with 46 additions and 0 deletions
|
@ -972,10 +972,14 @@ void FlexFormattingContext::resolve_flexible_lengths_for_line(FlexLine& line)
|
|||
else if (used_flex_factor == FlexFactor::FlexShrinkFactor) {
|
||||
// For every unfrozen item on the line, multiply its flex shrink factor by its inner flex base size, and note this as its scaled flex shrink factor.
|
||||
for (auto& item : line.items) {
|
||||
if (item.frozen)
|
||||
continue;
|
||||
item.scaled_flex_shrink_factor = item.flex_factor.value() * item.flex_base_size.value();
|
||||
}
|
||||
auto sum_of_scaled_flex_shrink_factors_of_all_unfrozen_items_on_line = line.sum_of_scaled_flex_shrink_factor_of_unfrozen_items();
|
||||
for (auto& item : line.items) {
|
||||
if (item.frozen)
|
||||
continue;
|
||||
// Find the ratio of the item’s scaled flex shrink factor to the sum of the scaled flex shrink factors of all unfrozen items on the line.
|
||||
float ratio = 1.0f;
|
||||
if (sum_of_scaled_flex_shrink_factors_of_all_unfrozen_items_on_line != 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue