diff options
author | Andi Gallo <andigallo@proton.me> | 2023-05-26 13:47:40 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-05-26 21:20:56 +0200 |
commit | 1e526af430a5028302688996348f6aff2e4e93d5 (patch) | |
tree | 4881d5ec54a6f52d90f6c13606cc735ba3c4229d /Userland/Libraries/LibWeb/Layout | |
parent | 7cc20f4cb57be57822cfed9f9efb3e4ca8f48bfe (diff) | |
download | serenity-1e526af430a5028302688996348f6aff2e4e93d5.zip |
LibWeb: Fix width calculation for floating replaced elements
The path for floating, replaced elements must not fall through to the
path taken for floating, non-replaced elements. The former works like
inline replaced elements, while the latter uses a completely different
algorithm which doesn't account for intrinsic ratio. Falling through
overrides the correct value computed by the former.
Fixes #19061.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index 51941ab76c..cf50bf9d3f 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -137,10 +137,16 @@ void BlockFormattingContext::compute_width(Box const& box, AvailableSpace const& // FIXME: This const_cast is gross. const_cast<ReplacedBox&>(replaced).prepare_for_replaced_layout(); compute_width_for_block_level_replaced_element_in_normal_flow(replaced, remaining_available_space); - // NOTE: We don't return here. + if (box.is_floating()) { + // 10.3.6 Floating, replaced elements: + // https://www.w3.org/TR/CSS22/visudet.html#float-replaced-width + return; + } } if (box.is_floating()) { + // 10.3.5 Floating, non-replaced elements: + // https://www.w3.org/TR/CSS22/visudet.html#float-width compute_width_for_floating_box(box, available_space); return; } |