diff --git a/Libraries/LibWeb/Layout/SVGFormattingContext.cpp b/Libraries/LibWeb/Layout/SVGFormattingContext.cpp index bc17ba48410..4d81a6b14fe 100644 --- a/Libraries/LibWeb/Layout/SVGFormattingContext.cpp +++ b/Libraries/LibWeb/Layout/SVGFormattingContext.cpp @@ -279,7 +279,6 @@ void SVGFormattingContext::layout_svg_element(Box const& child) layout_nested_viewport(child); } else if (is(child.dom_node()) && is(child)) { Layout::BlockFormattingContext bfc(m_state, m_layout_mode, static_cast(child), this); - bfc.run(*m_available_space); auto& child_state = m_state.get_mutable(child); CSSPixelRect rect { { @@ -295,6 +294,9 @@ void SVGFormattingContext::layout_svg_element(Box const& child) child_state.set_content_offset(transformed_rect.location()); child_state.set_content_width(transformed_rect.width()); child_state.set_content_height(transformed_rect.height()); + + bfc.run(AvailableSpace(AvailableSize::make_definite(child_state.content_width()), AvailableSize::make_definite(child_state.content_height()))); + if (auto* mask_box = child.first_child_of_type()) layout_mask_or_clip(*mask_box); diff --git a/Tests/LibWeb/Layout/expected/svg/foreignObject-with-abspos-descendant.txt b/Tests/LibWeb/Layout/expected/svg/foreignObject-with-abspos-descendant.txt index eb2612f3ff7..55d9c18f01e 100644 --- a/Tests/LibWeb/Layout/expected/svg/foreignObject-with-abspos-descendant.txt +++ b/Tests/LibWeb/Layout/expected/svg/foreignObject-with-abspos-descendant.txt @@ -5,7 +5,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer <(anonymous)> (not painted) children: inline TextNode <#text> SVGForeignObjectBox at (8,8) content-size 100x200 [BFC] children: not-inline - BlockContainer <(anonymous)> at (8,8) content-size 300x0 children: inline + BlockContainer <(anonymous)> at (8,8) content-size 100x0 children: inline TextNode <#text> BlockContainer at (8,8) content-size 50x60 positioned [BFC] children: not-inline TextNode <#text> @@ -19,7 +19,7 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [8,8 784x150] SVGSVGPaintable (SVGSVGBox) [8,8 300x150] overflow: [8,8 300x200] SVGForeignObjectPaintable (SVGForeignObjectBox) [8,8 100x200] - PaintableWithLines (BlockContainer(anonymous)) [8,8 300x0] + PaintableWithLines (BlockContainer(anonymous)) [8,8 100x0] PaintableWithLines (BlockContainer
.el) [8,8 50x60] PaintableWithLines (BlockContainer(anonymous)) [8,158 784x0]