Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / rendering / svg / RenderSVGResourceSolidColor.cpp
index 0c7684b..53e0bac 100644 (file)
@@ -42,37 +42,35 @@ RenderSVGResourceSolidColor::~RenderSVGResourceSolidColor()
 
 bool RenderSVGResourceSolidColor::applyResource(RenderObject* object, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode)
 {
-    // We are NOT allowed to ASSERT(object) here, unlike all other resources.
-    // RenderSVGResourceSolidColor is the only resource which may be used from HTML, when rendering
-    // SVG Fonts for a HTML document. This will be indicated by a null RenderObject pointer.
+    ASSERT(object);
+    ASSERT(style);
     ASSERT(context);
     ASSERT(resourceMode != ApplyToDefaultMode);
 
-    const SVGRenderStyle* svgStyle = style ? &style->svgStyle() : 0;
-
     bool isRenderingMask = false;
     if (object->frame() && object->frame()->view())
         isRenderingMask = object->frame()->view()->paintBehavior() & PaintBehaviorRenderingSVGMask;
 
+    const SVGRenderStyle& svgStyle = style->svgStyle();
+
     if (resourceMode & ApplyToFillMode) {
-        if (!isRenderingMask && svgStyle)
-            context->setAlphaAsFloat(svgStyle->fillOpacity());
+        if (!isRenderingMask)
+            context->setAlphaAsFloat(svgStyle.fillOpacity());
         else
             context->setAlphaAsFloat(1);
         context->setFillColor(m_color);
         if (!isRenderingMask)
-            context->setFillRule(svgStyle ? svgStyle->fillRule() : RULE_NONZERO);
+            context->setFillRule(svgStyle.fillRule());
 
         if (resourceMode & ApplyToTextMode)
             context->setTextDrawingMode(TextModeFill);
     } else if (resourceMode & ApplyToStrokeMode) {
         // When rendering the mask for a RenderSVGResourceClipper, the stroke code path is never hit.
         ASSERT(!isRenderingMask);
-        context->setAlphaAsFloat(svgStyle ? svgStyle->strokeOpacity() : 1);
+        context->setAlphaAsFloat(svgStyle.strokeOpacity());
         context->setStrokeColor(m_color);
 
-        if (style)
-            SVGRenderSupport::applyStrokeStyleToContext(context, style, object);
+        SVGRenderSupport::applyStrokeStyleToContext(context, style, object);
 
         if (resourceMode & ApplyToTextMode)
             context->setTextDrawingMode(TextModeStroke);
@@ -81,23 +79,4 @@ bool RenderSVGResourceSolidColor::applyResource(RenderObject* object, RenderStyl
     return true;
 }
 
-void RenderSVGResourceSolidColor::postApplyResource(RenderObject*, GraphicsContext*& context, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape)
-{
-    ASSERT(context);
-    ASSERT(resourceMode != ApplyToDefaultMode);
-
-    if (resourceMode & ApplyToFillMode) {
-        if (path)
-            context->fillPath(*path);
-        else if (shape)
-            shape->fillShape(context);
-    }
-    if (resourceMode & ApplyToStrokeMode) {
-        if (path)
-            context->strokePath(*path);
-        else if (shape)
-            shape->strokeShape(context);
-    }
-}
-
 }