LibWeb: Force paintable to exist for SVG <g> elements

This (along with the previous commit) fixes the missing tears on the
sad Duolingo owl.
This commit is contained in:
MacDue 2023-07-01 21:41:00 +01:00 committed by Jelle Raaijmakers
parent 7d26383426
commit 40fa07a6e1
Notes: sideshowbarker 2024-07-17 02:08:15 +09:00
3 changed files with 8 additions and 3 deletions

View file

@ -21,12 +21,12 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
frag 0 from SVGSVGBox start: 0, length: 0, rect: [50,450 200x200]
SVGSVGBox <svg> at (50,150) content-size 200x100 [SVG] children: inline
TextNode <#text>
SVGGraphicsBox <g> (not painted) children: inline
SVGGraphicsBox <g> at (50,150) content-size 0x0 children: inline
TextNode <#text>
SVGGeometryBox <path> at (45.693222,199.830932) content-size 118.782173x47.453796 children: not-inline
TextNode <#text>
TextNode <#text>
SVGGraphicsBox <g> (not painted) children: inline
SVGGraphicsBox <g> at (50,150) content-size 0x0 children: inline
TextNode <#text>
SVGGeometryBox <path> at (84.5,159.504878) content-size 81x80.995117 children: not-inline
TextNode <#text>

View file

@ -4,7 +4,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
line 0 width: 24, height: 24, bottom: 24, baseline: 24
frag 0 from SVGSVGBox start: 0, length: 0, rect: [8,8 24x24]
SVGSVGBox <svg> at (8,8) content-size 24x24 [SVG] children: inline
SVGGraphicsBox <g> (not painted) children: inline
SVGGraphicsBox <g> at (8,8) content-size 0x0 children: inline
SVGSVGBox <svg> at (8,8) content-size 24x24 [SVG] children: not-inline
SVGGeometryBox <rect> at (8,8) content-size 24x24 children: not-inline
TextNode <#text>

View file

@ -192,6 +192,11 @@ void SVGFormattingContext::run(Box const& box, LayoutMode layout_mode, Available
auto const& svg_text_box = static_cast<SVGTextBox const&>(descendant);
// NOTE: This hack creates a layout state to ensure the existence of a paintable box node in LayoutState::commit(), even when none of the values from UsedValues impact the SVG text.
m_state.get_mutable(svg_text_box);
} else if (is<SVGGraphicsBox>(descendant)) {
// Same hack as above.
// FIXME: This should be sized based on its children.
auto const& svg_graphics_box = static_cast<SVGGraphicsBox const&>(descendant);
m_state.get_mutable(svg_graphics_box);
}
return IterationDecision::Continue;