Fix crash in the cairo implementation of the SVGPaintServer
For SVGFonts the RenderObject can be zero. The existing SVGFont
test cases is exposing this bug. Qt and other ports have fixed
this issue by adding null checks as well.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@39208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b2435dd..d691258 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2008-12-11 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Simon Hausmann.
+
+ Fix crash in the cairo implementation of the SVGPaintServer
+
+ For SVGFonts the RenderObject can be zero. The existing SVGFont
+ test cases is exposing this bug. Qt and other ports have fixed
+ this issue by adding null checks as well.
+
+ * svg/graphics/cairo/SVGPaintServerCairo.cpp:
+ (WebCore::SVGPaintServer::renderPath):
+
2008-12-11 Holger Freyther <zecke@selfish.org>
Reviewed by Simon Hausmann.
diff --git a/WebCore/svg/graphics/cairo/SVGPaintServerCairo.cpp b/WebCore/svg/graphics/cairo/SVGPaintServerCairo.cpp
index 37cab6f..272b3cd 100644
--- a/WebCore/svg/graphics/cairo/SVGPaintServerCairo.cpp
+++ b/WebCore/svg/graphics/cairo/SVGPaintServerCairo.cpp
@@ -47,14 +47,12 @@
void SVGPaintServer::renderPath(GraphicsContext*& context, const RenderObject* path, SVGPaintTargetType type) const
{
cairo_t* cr = context->platformContext();
- const SVGRenderStyle* style = path->style()->svgStyle();
+ const SVGRenderStyle* style = path ? path->style()->svgStyle(): 0;
- cairo_set_fill_rule(cr, style->fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
-
- if ((type & ApplyToFillTargetType) && style->hasFill())
+ if ((type & ApplyToFillTargetType) && (!style || style->hasFill()))
cairo_fill_preserve(cr);
- if ((type & ApplyToStrokeTargetType) && style->hasStroke())
+ if ((type & ApplyToStrokeTargetType) && (!style || style->hasStroke()))
cairo_stroke_preserve(cr);
cairo_new_path(cr);