mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibWeb: Use the correct dimension when computing the max grid size
When deciding if the grid containers min size should be limited by a max size. Check for a max height or width depending on the dimension, instead of just always checking for a max width.
This commit is contained in:
parent
a56a2faf51
commit
ef037b4152
Notes:
github-actions[bot]
2024-09-04 20:42:25 +00:00
Author: https://github.com/BenJilks
Commit: ef037b4152
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1279
3 changed files with 70 additions and 5 deletions
|
@ -2248,12 +2248,22 @@ CSSPixels GridFormattingContext::calculate_limited_min_content_contribution(Grid
|
|||
if (min_content_contribution < minimum_contribution)
|
||||
return minimum_contribution;
|
||||
|
||||
auto should_treat_max_size_as_none = [&]() {
|
||||
switch (dimension) {
|
||||
case GridDimension::Row:
|
||||
return should_treat_max_height_as_none(grid_container(), m_available_space->height);
|
||||
case GridDimension::Column:
|
||||
return should_treat_max_width_as_none(grid_container(), m_available_space->width);
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}();
|
||||
|
||||
// FIXME: limit by max track sizing function instead of grid container maximum size
|
||||
auto const& available_size = dimension == GridDimension::Column ? m_available_space->width : m_available_space->height;
|
||||
if (!should_treat_max_width_as_none(grid_container(), available_size)) {
|
||||
auto max_width = calculate_grid_container_maximum_size(dimension);
|
||||
if (min_content_contribution > max_width)
|
||||
return max_width;
|
||||
if (!should_treat_max_size_as_none) {
|
||||
auto max_size = calculate_grid_container_maximum_size(dimension);
|
||||
if (min_content_contribution > max_size)
|
||||
return max_size;
|
||||
}
|
||||
|
||||
return min_content_contribution;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue