summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Layout/LayoutBlock.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-25 16:04:57 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-25 16:04:57 +0200
commit8be74ea65c4a1126e3e711fbccbaedcaf798ca1b (patch)
treeddef7103eb3502a06cf18900de898f1de073ad80 /Libraries/LibWeb/Layout/LayoutBlock.cpp
parentafebbd1cd75bf568fee83aeebcbad4e2cfe25628 (diff)
downloadserenity-8be74ea65c4a1126e3e711fbccbaedcaf798ca1b.zip
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.
Diffstat (limited to 'Libraries/LibWeb/Layout/LayoutBlock.cpp')
-rw-r--r--Libraries/LibWeb/Layout/LayoutBlock.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Libraries/LibWeb/Layout/LayoutBlock.cpp b/Libraries/LibWeb/Layout/LayoutBlock.cpp
index 863cec0b40..65579994e1 100644
--- a/Libraries/LibWeb/Layout/LayoutBlock.cpp
+++ b/Libraries/LibWeb/Layout/LayoutBlock.cpp
@@ -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());