From c0109039cb5e57368e4569901f47e9cf5a6d3ae1 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Wed, 19 Feb 2025 10:31:47 +0100 Subject: [PATCH] LibWeb: Do not consider `` for inline continuation We used to have an exception for this element that erroneously got removed in 336684bc5cb64c3d3a486f934d0a2d636d557b8f. Fixes #3453. --- Libraries/LibWeb/Layout/TreeBuilder.cpp | 1 + .../svg-foreign-object-with-block-element.txt | 18 ++++++++++++++++++ .../svg-foreign-object-with-block-element.html | 2 ++ 3 files changed, 21 insertions(+) create mode 100644 Tests/LibWeb/Layout/expected/svg/svg-foreign-object-with-block-element.txt create mode 100644 Tests/LibWeb/Layout/input/svg/svg-foreign-object-with-block-element.html diff --git a/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Libraries/LibWeb/Layout/TreeBuilder.cpp index 81d5ed9386d..94ef21171d5 100644 --- a/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -611,6 +611,7 @@ void TreeBuilder::update_layout_tree(DOM::Node& dom_node, TreeBuilder::Context& // because the restructuring adds new children after this node that become part of the ancestor stack. auto* layout_parent = layout_node->parent(); if (layout_parent && layout_parent->display().is_inline_outside() && !display.is_contents() + && !is(layout_parent->dom_node()) && !display.is_inline_outside() && layout_parent->display().is_flow_inside() && !layout_node->is_out_of_flow()) restructure_block_node_in_inline_parent(static_cast(*layout_node)); } diff --git a/Tests/LibWeb/Layout/expected/svg/svg-foreign-object-with-block-element.txt b/Tests/LibWeb/Layout/expected/svg/svg-foreign-object-with-block-element.txt new file mode 100644 index 00000000000..37fc6348088 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/svg/svg-foreign-object-with-block-element.txt @@ -0,0 +1,18 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x116 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x100 children: inline + frag 0 from SVGSVGBox start: 0, length: 0, rect: [8,8 100x100] baseline: 100 + SVGSVGBox at (8,8) content-size 100x100 [SVG] children: inline + SVGForeignObjectBox at (8,8) content-size 0x0 children: not-inline + BlockContainer
at (8,8) content-size 100x17 children: inline + frag 0 from TextNode start: 0, length: 3, rect: [8,8 27.15625x17] baseline: 13.296875 + "foo" + TextNode <#text> + +ViewportPaintable (Viewport<#document>) [0,0 800x600] + PaintableWithLines (BlockContainer) [0,0 800x116] + PaintableWithLines (BlockContainer) [8,8 784x100] + SVGSVGPaintable (SVGSVGBox) [8,8 100x100] + SVGForeignObjectPaintable (SVGForeignObjectBox) [8,8 0x0] overflow: [8,8 100x17] + PaintableWithLines (BlockContainer
) [8,8 100x17] + TextPaintable (TextNode<#text>) diff --git a/Tests/LibWeb/Layout/input/svg/svg-foreign-object-with-block-element.html b/Tests/LibWeb/Layout/input/svg/svg-foreign-object-with-block-element.html new file mode 100644 index 00000000000..81d893aa004 --- /dev/null +++ b/Tests/LibWeb/Layout/input/svg/svg-foreign-object-with-block-element.html @@ -0,0 +1,2 @@ + +
foo