Skip to content

Commit

Permalink
LibWeb: Do not consider <foreignObject> for inline continuation
Browse files Browse the repository at this point in the history
We used to have an exception for this element that erroneously got
removed in 336684b.
  • Loading branch information
gmta committed Feb 19, 2025
1 parent dda1573 commit 48c5d03
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions Libraries/LibWeb/Layout/TreeBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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>)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!DOCTYPE html>
<svg width="100" height="100"><foreignObject width="100" height="100"><div>foo

0 comments on commit 48c5d03

Please sign in to comment.