summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-22 18:55:38 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-22 18:56:48 +0100
commit2c3376f9d45667cb02888df9f45c5fbec88e7965 (patch)
tree334d82f55f0e30e3edfa03be356e1db932c2935c /Userland/Libraries/LibWeb/Layout
parent543dd54a1d1077b287e9c6538b57a147d2a0e693 (diff)
downloadserenity-2c3376f9d45667cb02888df9f45c5fbec88e7965.zip
LibWeb: Respect explicitly specified CSS "height" on block elements
Don't size blocks to fit their contents if they have an explicit (non-auto) height specified.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout')
-rw-r--r--Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
index 44798d7724..bb7def7bb5 100644
--- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
@@ -351,8 +351,10 @@ void BlockFormattingContext::layout_block_level_children(Box& box, LayoutMode la
box.set_width(content_width);
}
- // FIXME: It's not right to always shrink-wrap the box to the content here.
- box.set_height(content_height);
+ if (box.computed_values().height().is_undefined_or_auto())
+ box.set_height(content_height);
+ else
+ box.set_height(box.computed_values().height().resolved_or_zero(box, context_box().height()).to_px(box));
}
void BlockFormattingContext::place_block_level_replaced_element_in_normal_flow(Box& child_box, Box& containing_block)