Title: [158008] trunk/Source/WebCore

Diff

Modified: trunk/Source/WebCore/ChangeLog (158007 => 158008)


--- trunk/Source/WebCore/ChangeLog	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/ChangeLog	2013-10-25 13:48:19 UTC (rev 158008)
@@ -1,3 +1,13 @@
+2013-10-25  Andreas Kling  <[email protected]>
+
+        SVG: postApplyResource() should take a RenderElement&.
+        <https://webkit.org/b/123334>
+
+        This function is always called with an object, and that object
+        is guaranteed to never be a text renderer.
+
+        Reviewed by Antti Koivisto.
+
 2013-10-25  Antti Koivisto  <[email protected]>
 
         REGRESSION(r157950): It made many tests assert on Windows, EFL, GTK

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResource.h (158007 => 158008)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResource.h	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResource.h	2013-10-25 13:48:19 UTC (rev 158008)
@@ -63,7 +63,7 @@
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true) = 0;
 
     virtual bool applyResource(RenderElement&, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) = 0;
-    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short, const Path*, const RenderSVGShape*) { }
+    virtual void postApplyResource(RenderElement&, GraphicsContext*&, unsigned short, const Path*, const RenderSVGShape*) { }
     virtual FloatRect resourceBoundingBox(const RenderObject&) = 0;
 
     virtual RenderSVGResourceType resourceType() const = 0;

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp (158007 => 158008)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp	2013-10-25 13:48:19 UTC (rev 158008)
@@ -241,19 +241,18 @@
     return true;
 }
 
-void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsContext*& context, unsigned short resourceMode, const Path*, const RenderSVGShape*)
+void RenderSVGResourceFilter::postApplyResource(RenderElement& renderer, GraphicsContext*& context, unsigned short resourceMode, const Path*, const RenderSVGShape*)
 {
-    ASSERT(object);
     ASSERT(context);
     ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
 
-    FilterData* filterData = m_filter.get(object);
+    FilterData* filterData = m_filter.get(&renderer);
     if (!filterData)
         return;
 
     switch (filterData->state) {
     case FilterData::MarkedForRemoval:
-        m_filter.remove(object);
+        m_filter.remove(&renderer);
         return;
 
     case FilterData::CycleDetected:
@@ -267,7 +266,7 @@
 
     case FilterData::PaintingSource:
         if (!filterData->savedContext) {
-            removeClientFromCache(object);
+            removeClientFromCache(&renderer);
             return;
         }
 
@@ -301,7 +300,7 @@
             context->concatCTM(filterData->shearFreeAbsoluteTransform.inverse());
 
             context->scale(FloatSize(1 / filterData->filter->filterResolution().width(), 1 / filterData->filter->filterResolution().height()));
-            context->drawImageBuffer(resultImage, object->style()->colorSpace(), lastEffect->absolutePaintRect());
+            context->drawImageBuffer(resultImage, renderer.style()->colorSpace(), lastEffect->absolutePaintRect());
             context->scale(filterData->filter->filterResolution());
 
             context->concatCTM(filterData->shearFreeAbsoluteTransform);

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h (158007 => 158008)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h	2013-10-25 13:48:19 UTC (rev 158008)
@@ -75,7 +75,7 @@
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
     virtual bool applyResource(RenderElement&, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) OVERRIDE;
-    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*);
+    virtual void postApplyResource(RenderElement&, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*) OVERRIDE;
 
     virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE;
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp (158007 => 158008)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp	2013-10-25 13:48:19 UTC (rev 158008)
@@ -205,7 +205,7 @@
     return true;
 }
 
-void RenderSVGResourceGradient::postApplyResource(RenderObject* object, GraphicsContext*& context, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape)
+void RenderSVGResourceGradient::postApplyResource(RenderElement& renderer, GraphicsContext*& context, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape)
 {
     ASSERT(context);
     ASSERT(resourceMode != ApplyToDefaultMode);
@@ -214,7 +214,7 @@
 #if USE(CG)
         // CG requires special handling for gradient on text
         GradientData* gradientData;
-        if (m_savedContext && (gradientData = m_gradientMap.get(object))) {
+        if (m_savedContext && (gradientData = m_gradientMap.get(&renderer))) {
             // Restore on-screen drawing context
             context = m_savedContext;
             m_savedContext = 0;
@@ -223,14 +223,14 @@
             calculateGradientTransform(gradientTransform);
 
             FloatRect targetRect;
-            gradientData->gradient->setGradientSpaceTransform(clipToTextMask(context, m_imageBuffer, targetRect, object, gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX, gradientTransform));
+            gradientData->gradient->setGradientSpaceTransform(clipToTextMask(context, m_imageBuffer, targetRect, &renderer, gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX, gradientTransform));
             context->setFillGradient(gradientData->gradient);
 
             context->fillRect(targetRect);
             m_imageBuffer.clear();
         }
 #else
-        UNUSED_PARAM(object);
+        UNUSED_PARAM(renderer);
 #endif
     } else {
         if (resourceMode & ApplyToFillMode) {

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h (158007 => 158008)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h	2013-10-25 13:48:19 UTC (rev 158008)
@@ -51,7 +51,7 @@
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true) OVERRIDE FINAL;
 
     virtual bool applyResource(RenderElement&, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) OVERRIDE FINAL;
-    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*) OVERRIDE FINAL;
+    virtual void postApplyResource(RenderElement&, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*) OVERRIDE FINAL;
     virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE FINAL { return FloatRect(); }
 
 protected:

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp (158007 => 158008)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp	2013-10-25 13:48:19 UTC (rev 158008)
@@ -190,7 +190,7 @@
     return true;
 }
 
-void RenderSVGResourcePattern::postApplyResource(RenderObject*, GraphicsContext*& context, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape)
+void RenderSVGResourcePattern::postApplyResource(RenderElement&, GraphicsContext*& context, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape)
 {
     ASSERT(context);
     ASSERT(resourceMode != ApplyToDefaultMode);

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h (158007 => 158008)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h	2013-10-25 13:48:19 UTC (rev 158008)
@@ -51,8 +51,8 @@
     virtual void removeAllClientsFromCache(bool markForInvalidation = true);
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
-    virtual bool applyResource(RenderElement&, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
-    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*);
+    virtual bool applyResource(RenderElement&, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) OVERRIDE;
+    virtual void postApplyResource(RenderElement&, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*) OVERRIDE;
     virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE { return FloatRect(); }
 
     virtual RenderSVGResourceType resourceType() const { return s_resourceType; }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp (158007 => 158008)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp	2013-10-25 13:48:19 UTC (rev 158008)
@@ -79,7 +79,7 @@
     return true;
 }
 
-void RenderSVGResourceSolidColor::postApplyResource(RenderObject*, GraphicsContext*& context, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape)
+void RenderSVGResourceSolidColor::postApplyResource(RenderElement&, GraphicsContext*& context, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape)
 {
     ASSERT(context);
     ASSERT(resourceMode != ApplyToDefaultMode);

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.h (158007 => 158008)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.h	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.h	2013-10-25 13:48:19 UTC (rev 158008)
@@ -36,7 +36,7 @@
     virtual void removeClientFromCache(RenderObject*, bool = true) { }
 
     virtual bool applyResource(RenderElement&, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) OVERRIDE;
-    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*);
+    virtual void postApplyResource(RenderElement&, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*) OVERRIDE;
     virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE { return FloatRect(); }
 
     virtual RenderSVGResourceType resourceType() const { return s_resourceType; }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp (158007 => 158008)


--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2013-10-25 13:48:19 UTC (rev 158008)
@@ -220,12 +220,12 @@
     Color fallbackColor;
     if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(*this, style, fallbackColor)) {
         if (fillPaintingResource->applyResource(*this, style, context, ApplyToFillMode))
-            fillPaintingResource->postApplyResource(this, context, ApplyToFillMode, 0, this);
+            fillPaintingResource->postApplyResource(*this, context, ApplyToFillMode, 0, this);
         else if (fallbackColor.isValid()) {
             RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
             fallbackResource->setColor(fallbackColor);
             if (fallbackResource->applyResource(*this, style, context, ApplyToFillMode))
-                fallbackResource->postApplyResource(this, context, ApplyToFillMode, 0, this);
+                fallbackResource->postApplyResource(*this, context, ApplyToFillMode, 0, this);
         }
     }
 }
@@ -235,12 +235,12 @@
     Color fallbackColor;
     if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(*this, style, fallbackColor)) {
         if (strokePaintingResource->applyResource(*this, style, context, ApplyToStrokeMode))
-            strokePaintingResource->postApplyResource(this, context, ApplyToStrokeMode, 0, this);
+            strokePaintingResource->postApplyResource(*this, context, ApplyToStrokeMode, 0, this);
         else if (fallbackColor.isValid()) {
             RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
             fallbackResource->setColor(fallbackColor);
             if (fallbackResource->applyResource(*this, style, context, ApplyToStrokeMode))
-                fallbackResource->postApplyResource(this, context, ApplyToStrokeMode, 0, this);
+                fallbackResource->postApplyResource(*this, context, ApplyToStrokeMode, 0, this);
         }
     }
 }

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (158007 => 158008)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2013-10-25 13:48:19 UTC (rev 158008)
@@ -370,9 +370,8 @@
 {
     ASSERT(m_paintingResource);
 
-    RenderObject& parentRenderer = parent()->renderer();
-    m_paintingResource->postApplyResource(&parentRenderer, context, m_paintingResourceMode, path, /*RenderSVGShape*/ 0);
-    m_paintingResource = 0;
+    m_paintingResource->postApplyResource(parent()->renderer(), context, m_paintingResourceMode, path, /*RenderSVGShape*/ 0);
+    m_paintingResource = nullptr;
 }
 
 bool SVGInlineTextBox::prepareGraphicsContextForTextPainting(GraphicsContext*& context, float scalingFactor, TextRun& textRun, RenderStyle* style)

Modified: trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp (158007 => 158008)


--- trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp	2013-10-25 13:48:19 UTC (rev 158008)
@@ -61,7 +61,7 @@
 #if ENABLE(FILTERS)
     if (m_renderingFlags & EndFilterLayer) {
         ASSERT(m_filter);
-        m_filter->postApplyResource(m_renderer, m_paintInfo->context, ApplyToDefaultMode, 0, 0);
+        m_filter->postApplyResource(*m_renderer, m_paintInfo->context, ApplyToDefaultMode, 0, 0);
         m_paintInfo->context = m_savedContext;
         m_paintInfo->rect = m_savedPaintRect;
     }

Modified: trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp (158007 => 158008)


--- trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp	2013-10-25 13:46:55 UTC (rev 158007)
+++ trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp	2013-10-25 13:48:19 UTC (rev 158008)
@@ -169,7 +169,7 @@
             float strokeThickness = context->strokeThickness();
             if (renderer().isSVGInlineText())
                 context->setStrokeThickness(strokeThickness * toRenderSVGInlineText(renderer()).scalingFactor());
-            activePaintingResource->postApplyResource(&elementRenderer, context, resourceMode, &glyphPath, 0);
+            activePaintingResource->postApplyResource(elementRenderer, context, resourceMode, &glyphPath, 0);
             context->setStrokeThickness(strokeThickness);
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to