From bfcb4d88cfe1c01dd7e7ce28ea7c4bdeedaef73c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 9 Sep 2022 15:10:11 +0200 Subject: [PATCH] LibWeb: Treat percentage heights as "auto" if unresolvable If the containing block has indefinite height, we can't resolve percentage heights against it. Instead of treating it as 0 by accident, let's treat it as "auto" on purpose. This brings back the cheek borders on Acid2. --- .../Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index 6775341179..891db783b3 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -318,10 +318,13 @@ float BlockFormattingContext::compute_theoretical_height(LayoutState const& stat if (is(box)) { height = compute_height_for_replaced_element(state, verify_cast(box)); } else { - if (box.computed_values().height().is_auto()) + // NOTE: We treat percentage heights as "auto" if the containing block has indefinite height. + if (box.computed_values().height().is_auto() + || (box.computed_values().height().is_percentage() && !state.get(*box.containing_block()).has_definite_height())) { height = compute_auto_height_for_block_level_element(state, box); - else + } else { height = computed_values.height().resolved(box, containing_block_height).to_px(box); + } } auto specified_max_height = computed_values.max_height().resolved(box, containing_block_height).resolved(box);