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