mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibWeb: Clamp growth limit after adding planned increase in GFC
Fixes implementation of the following line from the spec: "However, limit the growth of any fit-content() tracks by their fit-content() argument." Now we correctly apply a limit to increased growth limit rather than to the planned increase. Change in "Tests/LibWeb/Layout/input/grid/fit-content-2.html" is a progression and "Item as wide as the content." is actually as wide as a content.
This commit is contained in:
parent
2c8fb49578
commit
07aa25ce50
Notes:
github-actions[bot]
2024-09-09 09:42:02 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 07aa25ce50
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1334
4 changed files with 80 additions and 20 deletions
|
@ -867,10 +867,14 @@ void GridFormattingContext::increase_sizes_to_accommodate_spanning_items_crossin
|
|||
});
|
||||
for (auto& track : spanned_tracks) {
|
||||
if (track.max_track_sizing_function.is_fit_content()) {
|
||||
track.growth_limit = css_clamp(
|
||||
track.planned_increase,
|
||||
track.base_size,
|
||||
track.max_track_sizing_function.css_size().to_px(grid_container(), available_size.to_px_or_zero()));
|
||||
track.growth_limit.value() += track.planned_increase;
|
||||
if (track.growth_limit.value() < track.base_size)
|
||||
track.growth_limit = track.base_size;
|
||||
if (available_size.is_definite()) {
|
||||
auto fit_content_limit = track.max_track_sizing_function.css_size().to_px(grid_container(), available_size.to_px_or_zero());
|
||||
if (track.growth_limit.value() > fit_content_limit)
|
||||
track.growth_limit = fit_content_limit;
|
||||
}
|
||||
} else if (!track.growth_limit.has_value()) {
|
||||
// If the affected size is an infinite growth limit, set it to the track’s base size plus the planned increase.
|
||||
track.growth_limit = track.base_size + track.planned_increase;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue