summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2022-08-07 17:00:38 +0100
committerAndreas Kling <kling@serenityos.org>2022-08-07 22:52:22 +0200
commit0e8dafcbb88c7901b7dc925226e3f38a10f99cc1 (patch)
tree5c078829990b2f5c791c68013480fac69d949835 /Userland
parent5049a56d9675fde6fa184b1fe1040aba323cff00 (diff)
downloadserenity-0e8dafcbb88c7901b7dc925226e3f38a10f99cc1.zip
LibWeb: Allow absolute boxes to have a % height of a % height parent
Previously absolutely positioned boxes could only have a % height if their parent had a absolute height (a height in pixels, em, etc). This broke some websites/demos such as the "Francine CSS oil painting", which starts to appear after this commit. Francine: https://diana-adrianne.com/purecss-francine/
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/Layout/FormattingContext.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
index 1ada77a63d..68e1de5c66 100644
--- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
@@ -658,7 +658,6 @@ void FormattingContext::compute_height_for_absolutely_positioned_non_replaced_el
// FIXME: The section below is partly on-spec, partly ad-hoc.
auto& computed_values = box.computed_values();
- auto const& containing_block = *box.containing_block();
auto width_of_containing_block = containing_block_width_for(box);
auto height_of_containing_block = containing_block_height_for(box);
@@ -675,12 +674,8 @@ void FormattingContext::compute_height_for_absolutely_positioned_non_replaced_el
auto used_bottom = computed_bottom.resolved(box, height_of_containing_block_as_length).resolved(box).to_px(box);
auto tentative_height = CSS::Length::make_auto();
- if (computed_values.height().is_percentage()
- && !(containing_block.computed_values().height().is_length() && containing_block.computed_values().height().length().is_absolute())) {
- // tentative_height is already auto
- } else {
+ if (!computed_height.is_auto())
tentative_height = computed_values.height().resolved(box, height_of_containing_block_as_length).resolved(box);
- }
auto& box_state = m_state.get_mutable(box);
box_state.margin_top = computed_values.margin().top.resolved(box, width_of_containing_block_as_length).to_px(box);