1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibWeb: Percentage 'height' should sometimes behave as 'auto'

Something like "height: 50%" is equivalent to "height: auto" unless the
containing block has explicitly specified height.
This commit is contained in:
Andreas Kling 2020-06-25 16:04:57 +02:00
parent afebbd1cd7
commit 8be74ea65c

View file

@ -659,7 +659,14 @@ void LayoutBlock::compute_height()
{
auto& containing_block = *this->containing_block();
auto specified_height = style().height().resolved_or_auto(*this, containing_block.height());
Length specified_height;
if (style().height().is_percentage() && !containing_block.style().height().is_absolute()) {
specified_height = Length::make_auto();
} else {
specified_height = style().height().resolved_or_auto(*this, containing_block.height());
}
auto specified_max_height = style().max_height().resolved_or_auto(*this, containing_block.height());
box_model().margin.top = style().margin().top.resolved_or_zero(*this, containing_block.width());