Title: [157919] trunk/Source/WebCore
Revision
157919
Author
[email protected]
Date
2013-10-24 02:59:12 -0700 (Thu, 24 Oct 2013)

Log Message

RenderSVGResource: Pass RenderElement to fill/strokePaintingResource.
<https://webkit.org/b/123242>

We never pass text renderers to these functions, so make them take
RenderElement instead.

Reviewed by Anders Carlsson.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (157918 => 157919)


--- trunk/Source/WebCore/ChangeLog	2013-10-24 09:08:48 UTC (rev 157918)
+++ trunk/Source/WebCore/ChangeLog	2013-10-24 09:59:12 UTC (rev 157919)
@@ -1,3 +1,13 @@
+2013-10-24  Andreas Kling  <[email protected]>
+
+        RenderSVGResource: Pass RenderElement to fill/strokePaintingResource.
+        <https://webkit.org/b/123242>
+
+        We never pass text renderers to these functions, so make them take
+        RenderElement instead.
+
+        Reviewed by Anders Carlsson.
+
 2013-10-24  Carlos Garcia Campos  <[email protected]>
 
         [GObject bindings] Make EventTarget interface introspectable

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResource.cpp (157918 => 157919)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResource.cpp	2013-10-24 09:08:48 UTC (rev 157918)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResource.cpp	2013-10-24 09:59:12 UTC (rev 157919)
@@ -39,20 +39,19 @@
 
 namespace WebCore {
 
-static inline bool inheritColorFromParentStyleIfNeeded(RenderObject* object, bool applyToFill, Color& color)
+static inline bool inheritColorFromParentStyleIfNeeded(RenderElement& object, bool applyToFill, Color& color)
 {
     if (color.isValid())
         return true;
-    if (!object->parent() || !object->parent()->style())
+    if (!object.parent())
         return false;
-    const SVGRenderStyle* parentSVGStyle = object->parent()->style()->svgStyle();
+    const SVGRenderStyle* parentSVGStyle = object.parent()->style()->svgStyle();
     color = applyToFill ? parentSVGStyle->fillPaintColor() : parentSVGStyle->strokePaintColor();
     return true;
 }
 
-static inline RenderSVGResource* requestPaintingResource(RenderSVGResourceMode mode, RenderObject* object, const RenderStyle* style, Color& fallbackColor)
+static inline RenderSVGResource* requestPaintingResource(RenderSVGResourceMode mode, RenderElement& object, const RenderStyle* style, Color& fallbackColor)
 {
-    ASSERT(object);
     ASSERT(style);
 
     // If we have no style at all, ignore it.
@@ -60,7 +59,7 @@
     if (!svgStyle)
         return 0;
 
-    bool isRenderingMask = object->view().frameView().paintBehavior() & PaintBehaviorRenderingSVGMask;
+    bool isRenderingMask = object.view().frameView().paintBehavior() & PaintBehaviorRenderingSVGMask;
 
     // If we have no fill/stroke, return 0.
     if (mode == ApplyToFillMode) {
@@ -119,7 +118,7 @@
     }
 
     // If no resources are associated with the given renderer, return the color resource.
-    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object);
+    SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(&object);
     if (!resources) {
         if (paintType == SVGPaint::SVG_PAINTTYPE_URI_NONE || !inheritColorFromParentStyleIfNeeded(object, applyToFill, color))
             return 0;
@@ -144,12 +143,12 @@
     return uriResource;
 }
 
-RenderSVGResource* RenderSVGResource::fillPaintingResource(RenderObject* object, const RenderStyle* style, Color& fallbackColor)
+RenderSVGResource* RenderSVGResource::fillPaintingResource(RenderElement& object, const RenderStyle* style, Color& fallbackColor)
 {
     return requestPaintingResource(ApplyToFillMode, object, style, fallbackColor);
 }
 
-RenderSVGResource* RenderSVGResource::strokePaintingResource(RenderObject* object, const RenderStyle* style, Color& fallbackColor)
+RenderSVGResource* RenderSVGResource::strokePaintingResource(RenderElement& object, const RenderStyle* style, Color& fallbackColor)
 {
     return requestPaintingResource(ApplyToStrokeMode, object, style, fallbackColor);
 }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResource.h (157918 => 157919)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResource.h	2013-10-24 09:08:48 UTC (rev 157918)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResource.h	2013-10-24 09:59:12 UTC (rev 157919)
@@ -78,8 +78,8 @@
     }
 
     // Helper utilities used in the render tree to access resources used for painting shapes/text (gradients & patterns & solid colors only)
-    static RenderSVGResource* fillPaintingResource(RenderObject*, const RenderStyle*, Color& fallbackColor);
-    static RenderSVGResource* strokePaintingResource(RenderObject*, const RenderStyle*, Color& fallbackColor);
+    static RenderSVGResource* fillPaintingResource(RenderElement&, const RenderStyle*, Color& fallbackColor);
+    static RenderSVGResource* strokePaintingResource(RenderElement&, const RenderStyle*, Color& fallbackColor);
     static RenderSVGResourceSolidColor* sharedSolidPaintingResource();
 
     static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool needsLayout = true);

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp (157918 => 157919)


--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2013-10-24 09:08:48 UTC (rev 157918)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2013-10-24 09:59:12 UTC (rev 157919)
@@ -124,7 +124,7 @@
         return false;
 
     Color fallbackColor;
-    if (requiresFill && !RenderSVGResource::fillPaintingResource(this, style(), fallbackColor))
+    if (requiresFill && !RenderSVGResource::fillPaintingResource(*this, style(), fallbackColor))
         return false;
 
     return shapeDependentFillContains(point, fillRule);
@@ -136,7 +136,7 @@
         return false;
 
     Color fallbackColor;
-    if (requiresStroke && !RenderSVGResource::strokePaintingResource(this, style(), fallbackColor))
+    if (requiresStroke && !RenderSVGResource::strokePaintingResource(*this, style(), fallbackColor))
         return false;
 
     return shapeDependentStrokeContains(point);
@@ -218,7 +218,7 @@
 void RenderSVGShape::fillShape(RenderStyle* style, GraphicsContext* context)
 {
     Color fallbackColor;
-    if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(this, style, fallbackColor)) {
+    if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(*this, style, fallbackColor)) {
         if (fillPaintingResource->applyResource(this, style, context, ApplyToFillMode))
             fillPaintingResource->postApplyResource(this, context, ApplyToFillMode, 0, this);
         else if (fallbackColor.isValid()) {
@@ -233,7 +233,7 @@
 void RenderSVGShape::strokeShape(RenderStyle* style, GraphicsContext* context)
 {
     Color fallbackColor;
-    if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(this, style, fallbackColor)) {
+    if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(*this, style, fallbackColor)) {
         if (strokePaintingResource->applyResource(this, style, context, ApplyToStrokeMode))
             strokePaintingResource->postApplyResource(this, context, ApplyToStrokeMode, 0, this);
         else if (fallbackColor.isValid()) {

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (157918 => 157919)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2013-10-24 09:08:48 UTC (rev 157918)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2013-10-24 09:59:12 UTC (rev 157919)
@@ -339,9 +339,9 @@
 
     Color fallbackColor;
     if (m_paintingResourceMode & ApplyToFillMode)
-        m_paintingResource = RenderSVGResource::fillPaintingResource(&renderer, style, fallbackColor);
+        m_paintingResource = RenderSVGResource::fillPaintingResource(renderer, style, fallbackColor);
     else if (m_paintingResourceMode & ApplyToStrokeMode)
-        m_paintingResource = RenderSVGResource::strokePaintingResource(&renderer, style, fallbackColor);
+        m_paintingResource = RenderSVGResource::strokePaintingResource(renderer, style, fallbackColor);
     else {
         // We're either called for stroking or filling.
         ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp (157918 => 157919)


--- trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp	2013-10-24 09:08:48 UTC (rev 157918)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp	2013-10-24 09:59:12 UTC (rev 157919)
@@ -276,7 +276,7 @@
         const RenderSVGShape& shape = static_cast<const RenderSVGShape&>(object);
 
         Color fallbackColor;
-        if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderSVGShape*>(&shape), shape.style(), fallbackColor)) {
+        if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderSVGShape&>(shape), shape.style(), fallbackColor)) {
             TextStreamSeparator s(" ");
             ts << " [stroke={" << s;
             writeSVGPaintingResource(ts, strokePaintingResource);
@@ -303,7 +303,7 @@
             ts << "}]";
         }
 
-        if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(const_cast<RenderSVGShape*>(&shape), shape.style(), fallbackColor)) {
+        if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(const_cast<RenderSVGShape&>(shape), shape.style(), fallbackColor)) {
             TextStreamSeparator s(" ");
             ts << " [fill={" << s;
             writeSVGPaintingResource(ts, fillPaintingResource);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to