LibWeb: Do not consider <foreignObject> for inline continuation

We used to have an exception for this element that erroneously got
removed in 336684bc5c.

Fixes #3453.
This commit is contained in:
Jelle Raaijmakers 2025-02-19 10:31:47 +01:00 committed by Andreas Kling
parent c9edb6ffc4
commit c0109039cb
Notes: github-actions[bot] 2025-02-19 12:50:31 +00:00
3 changed files with 21 additions and 0 deletions

View file

@ -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<SVG::SVGForeignObjectElement>(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<NodeWithStyleAndBoxModelMetrics&>(*layout_node));
}

View file

@ -0,0 +1,18 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x116 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x100 children: inline
frag 0 from SVGSVGBox start: 0, length: 0, rect: [8,8 100x100] baseline: 100
SVGSVGBox <svg> at (8,8) content-size 100x100 [SVG] children: inline
SVGForeignObjectBox <foreignObject> at (8,8) content-size 0x0 children: not-inline
BlockContainer <div> 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<HTML>) [0,0 800x116]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x100]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 100x100]
SVGForeignObjectPaintable (SVGForeignObjectBox<foreignObject>) [8,8 0x0] overflow: [8,8 100x17]
PaintableWithLines (BlockContainer<DIV>) [8,8 100x17]
TextPaintable (TextNode<#text>)

View file

@ -0,0 +1,2 @@
<!DOCTYPE html>
<svg width="100" height="100"><foreignObject width="100" height="100"><div>foo