mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibWeb: Accept height: {min,max,fit}-content
And treat them as "auto" for now, per CSS-SIZING-3, with a FIXME about supporting more layout directions. This fixes an issue on MDN where `height: max-content` was not overriding height from non-CSS presentational hints.
This commit is contained in:
parent
90e95d38d7
commit
27ddfa84fa
4 changed files with 49 additions and 2 deletions
|
@ -1627,8 +1627,18 @@ bool FormattingContext::should_treat_width_as_auto(Box const& box, AvailableSpac
|
|||
|
||||
bool FormattingContext::should_treat_height_as_auto(Box const& box, AvailableSpace const& available_space)
|
||||
{
|
||||
if (box.computed_values().height().is_auto())
|
||||
auto computed_height = box.computed_values().height();
|
||||
if (computed_height.is_auto())
|
||||
return true;
|
||||
|
||||
// https://www.w3.org/TR/css-sizing-3/#valdef-width-min-content
|
||||
// https://www.w3.org/TR/css-sizing-3/#valdef-width-max-content
|
||||
// https://www.w3.org/TR/css-sizing-3/#valdef-width-fit-content
|
||||
// For a box’s block size, unless otherwise specified, this is equivalent to its automatic size.
|
||||
// FIXME: If height is not the block axis size, then we should be concerned with the width instead.
|
||||
if (computed_height.is_min_content() || computed_height.is_max_content() || computed_height.is_fit_content())
|
||||
return true;
|
||||
|
||||
if (box.computed_values().height().contains_percentage()) {
|
||||
if (available_space.height.is_max_content())
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue