mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
LibWeb: Limit affected size of grid tracks instead of only increase
The spec says that the sum of affected size + item-incurred increase should reach the limit, rather than just the item-incurred increase. This seems to improve layout on the testcase `row-span-2-with-gaps`. The extra line of space at the bottom of the left div (`div.grid-item.item-span-two`) is not present anymore, matching other browsers' layout much more closely.
This commit is contained in:
parent
dac443fbff
commit
eb7c2ee307
2 changed files with 27 additions and 24 deletions
|
@ -856,14 +856,17 @@ void GridFormattingContext::distribute_extra_space_across_spanned_tracks_base_si
|
|||
if (track.base_size_frozen)
|
||||
continue;
|
||||
|
||||
if (track.growth_limit.has_value() && increase_per_track >= track.growth_limit.value()) {
|
||||
track.base_size_frozen = true;
|
||||
track.item_incurred_increase = track.growth_limit.value();
|
||||
extra_space -= track.growth_limit.value();
|
||||
} else {
|
||||
track.item_incurred_increase += increase_per_track;
|
||||
extra_space -= increase_per_track;
|
||||
if (track.growth_limit.has_value()) {
|
||||
auto maximum_increase = track.growth_limit.value() - track.base_size;
|
||||
if (track.item_incurred_increase + increase_per_track >= maximum_increase) {
|
||||
track.base_size_frozen = true;
|
||||
track.item_incurred_increase = maximum_increase;
|
||||
extra_space -= maximum_increase - track.item_incurred_increase;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
track.item_incurred_increase += increase_per_track;
|
||||
extra_space -= increase_per_track;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue