Bläddra i källkod

LibWeb: Do not crash if "fill: none" is specified for svg text

Aliaksandr Kalenik 2 år sedan
förälder
incheckning
ca50da63e4

+ 8 - 0
Tests/LibWeb/Layout/expected/svg/text-fill-none.txt

@@ -0,0 +1,8 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+  BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
+    BlockContainer <body> at (8,8) content-size 784x163 children: inline
+      line 0 width: 300, height: 163, bottom: 163, baseline: 13.53125
+        frag 0 from SVGSVGBox start: 0, length: 0, rect: [8,21 300x150]
+      SVGSVGBox <svg> at (8,21) content-size 300x150 [SVG] children: not-inline
+        SVGTextBox <text> at (8,21) content-size 0x0 children: not-inline
+      TextNode <#text>

+ 1 - 0
Tests/LibWeb/Layout/input/svg/text-fill-none.html

@@ -0,0 +1 @@
+<svg><text fill="none"></text></svg>

+ 3 - 0
Userland/Libraries/LibWeb/Painting/SVGTextPaintable.cpp

@@ -31,6 +31,9 @@ void SVGTextPaintable::paint(PaintContext& context, PaintPhase phase) const
     if (!is_visible())
     if (!is_visible())
         return;
         return;
 
 
+    if (!layout_node().computed_values().fill().has_value())
+        return;
+
     SVGGraphicsPaintable::paint(context, phase);
     SVGGraphicsPaintable::paint(context, phase);
 
 
     if (phase != PaintPhase::Foreground)
     if (phase != PaintPhase::Foreground)