mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Never split <svg> for inline continuations
This fixes an issue where we'd make an absolute mess from nested SVG roots with display:block. Before this fix, the inner SVG root would trigger the inline continuation logic and try to split the tree.
This commit is contained in:
parent
4e23882995
commit
8e49b69f42
Notes:
github-actions[bot]
2025-07-12 12:12:47 +00:00
Author: https://github.com/awesomekling
Commit: 8e49b69f42
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5417
Reviewed-by: https://github.com/gmta ✅
3 changed files with 25 additions and 6 deletions
|
@ -1444,12 +1444,8 @@ bool NodeWithStyleAndBoxModelMetrics::should_create_inline_continuation() const
|
||||||
if (is<SVG::SVGForeignObjectElement>(parent()->dom_node()))
|
if (is<SVG::SVGForeignObjectElement>(parent()->dom_node()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// SVGBoxes are appended directly to their layout parent without changing the parent's (non-)inline behavior.
|
// SVG related boxes should never be split.
|
||||||
if (is_svg_box())
|
if (is_svg_box() || is_svg_svg_box() || is_svg_foreign_object_box())
|
||||||
return false;
|
|
||||||
|
|
||||||
// SVGForeignObjectBoxes should never be split.
|
|
||||||
if (is_svg_foreign_object_box())
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||||
|
BlockContainer <html> at (0,0) content-size 800x66 [BFC] children: not-inline
|
||||||
|
BlockContainer <body> at (8,8) content-size 784x50 children: not-inline
|
||||||
|
SVGSVGBox <svg#outer> at (8,8) content-size 50x50 [SVG] children: not-inline
|
||||||
|
SVGGraphicsBox <g> at (8,8) content-size 25x25 children: not-inline
|
||||||
|
SVGSVGBox <svg#inner> at (8,8) content-size 25x25 [SVG] children: not-inline
|
||||||
|
SVGGeometryBox <rect> at (8,13) content-size 25x15 children: not-inline
|
||||||
|
|
||||||
|
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||||
|
PaintableWithLines (BlockContainer<HTML>) [0,0 800x66]
|
||||||
|
PaintableWithLines (BlockContainer<BODY>) [8,8 784x50]
|
||||||
|
SVGSVGPaintable (SVGSVGBox<svg>#outer) [8,8 50x50]
|
||||||
|
SVGGraphicsPaintable (SVGGraphicsBox<g>) [8,8 25x25]
|
||||||
|
SVGSVGPaintable (SVGSVGBox<svg>#inner) [8,8 25x25]
|
||||||
|
SVGPathPaintable (SVGGeometryBox<rect>) [8,13 25x15]
|
||||||
|
|
||||||
|
SC for Viewport<#document> [0,0 800x600] [children: 1] (z-index: auto)
|
||||||
|
SC for BlockContainer<HTML> [0,0 800x66] [children: 0] (z-index: auto)
|
|
@ -0,0 +1,5 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<style type="text/css">
|
||||||
|
* { outline: 1px solid black; }
|
||||||
|
svg { display: block; }
|
||||||
|
</style><svg id="outer" width="50" height="50" viewBox="0 0 50 50"><g><svg id="inner" width="25" height="25" viewBox="0 0 25 15"><rect fill="green" width="25" height="15" /></svg></g></svg>
|
Loading…
Add table
Add a link
Reference in a new issue