Title: [158004] trunk/Source/WebCore
Revision
158004
Author
[email protected]
Date
2013-10-25 05:28:15 -0700 (Fri, 25 Oct 2013)

Log Message

SVG: applyResource() should take a RenderElement&.
<https://webkit.org/b/123286>

This function is always called with an object, and that object
is guaranteed to never be a text renderer.

Reviewed by Antti Koivisto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (158003 => 158004)


--- trunk/Source/WebCore/ChangeLog	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/ChangeLog	2013-10-25 12:28:15 UTC (rev 158004)
@@ -1,3 +1,13 @@
+2013-10-24  Andreas Kling  <[email protected]>
+
+        SVG: applyResource() should take a RenderElement&.
+        <https://webkit.org/b/123286>
+
+        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  Andreas Kling  <[email protected]>
 
         RenderElement::styleWillChange() should pass newStyle as reference.

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (158003 => 158004)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-10-25 12:28:15 UTC (rev 158004)
@@ -3730,7 +3730,7 @@
 
             // FIXME: This should use a safer cast such as toRenderSVGResourceContainer().
             // FIXME: Should this do a context->save() and return true so we restore the context?
-            static_cast<RenderSVGResourceClipper*>(element->renderer())->applyClippingToContext(&renderer(), rootRelativeBounds, paintingInfo.paintDirtyRect, context);
+            static_cast<RenderSVGResourceClipper*>(element->renderer())->applyClippingToContext(renderer(), rootRelativeBounds, paintingInfo.paintDirtyRect, context);
         }
     }
 #endif

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResource.h (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResource.h	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResource.h	2013-10-25 12:28:15 UTC (rev 158004)
@@ -62,7 +62,7 @@
     virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0;
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true) = 0;
 
-    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) = 0;
+    virtual bool applyResource(RenderElement&, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) = 0;
     virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short, const Path*, const RenderSVGShape*) { }
     virtual FloatRect resourceBoundingBox(const RenderObject&) = 0;
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp	2013-10-25 12:28:15 UTC (rev 158004)
@@ -79,13 +79,12 @@
     markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation);
 }
 
-bool RenderSVGResourceClipper::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode)
+bool RenderSVGResourceClipper::applyResource(RenderElement& renderer, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode)
 {
-    ASSERT(object);
     ASSERT(context);
     ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
 
-    return applyClippingToContext(object, object->objectBoundingBox(), object->repaintRectInLocalCoordinates(), context);
+    return applyClippingToContext(renderer, renderer.objectBoundingBox(), renderer.repaintRectInLocalCoordinates(), context);
 }
 
 bool RenderSVGResourceClipper::pathOnlyClipping(GraphicsContext* context, const AffineTransform& animatedLocalTransform, const FloatRect& objectBoundingBox)
@@ -143,16 +142,16 @@
     return true;
 }
 
-bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* object, const FloatRect& objectBoundingBox,
+bool RenderSVGResourceClipper::applyClippingToContext(RenderElement& renderer, const FloatRect& objectBoundingBox,
                                                       const FloatRect& repaintRect, GraphicsContext* context)
 {
-    bool missingClipperData = !m_clipper.contains(object);
+    bool missingClipperData = !m_clipper.contains(&renderer);
     if (missingClipperData)
-        m_clipper.set(object, std::make_unique<ClipperData>());
+        m_clipper.set(&renderer, std::make_unique<ClipperData>());
 
     bool shouldCreateClipData = false;
     AffineTransform animatedLocalTransform = clipPathElement().animatedLocalTransform();
-    ClipperData* clipperData = m_clipper.get(object);
+    ClipperData* clipperData = m_clipper.get(&renderer);
     if (!clipperData->clipMaskImage) {
         if (pathOnlyClipping(context, animatedLocalTransform, objectBoundingBox))
             return true;
@@ -160,7 +159,7 @@
     }
 
     AffineTransform absoluteTransform;
-    SVGRenderingContext::calculateTransformationToOutermostCoordinateSystem(object, absoluteTransform);
+    SVGRenderingContext::calculateTransformationToOutermostCoordinateSystem(&renderer, absoluteTransform);
 
     if (shouldCreateClipData && !repaintRect.isEmpty()) {
         if (!SVGRenderingContext::createImageBuffer(repaintRect, absoluteTransform, clipperData->clipMaskImage, ColorSpaceDeviceRGB, Unaccelerated))
@@ -178,7 +177,7 @@
         if (resources && (clipper = resources->clipper())) {
             GraphicsContextStateSaver stateSaver(*maskContext);
 
-            if (!clipper->applyClippingToContext(this, objectBoundingBox, repaintRect, maskContext))
+            if (!clipper->applyClippingToContext(*this, objectBoundingBox, repaintRect, maskContext))
                 return false;
 
             succeeded = drawContentIntoMaskImage(clipperData, objectBoundingBox);

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h	2013-10-25 12:28:15 UTC (rev 158004)
@@ -51,11 +51,11 @@
     virtual void removeAllClientsFromCache(bool markForInvalidation = true);
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
-    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
+    virtual bool applyResource(RenderElement&, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
     // clipPath can be clipped too, but don't have a boundingBox or repaintRect. So we can't call
     // applyResource directly and use the rects from the object, since they are empty for RenderSVGResources
     // FIXME: We made applyClippingToContext public because we cannot call applyResource on HTML elements (it asserts on RenderObject::objectBoundingBox)
-    bool applyClippingToContext(RenderObject*, const FloatRect&, const FloatRect&, GraphicsContext*);
+    bool applyClippingToContext(RenderElement&, const FloatRect&, const FloatRect&, GraphicsContext*);
     virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE;
 
     virtual RenderSVGResourceType resourceType() const { return ClipperResourceType; }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp	2013-10-25 12:28:15 UTC (rev 158004)
@@ -126,21 +126,20 @@
     return matchesFilterSize;
 }
 
-bool RenderSVGResourceFilter::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode)
+bool RenderSVGResourceFilter::applyResource(RenderElement& renderer, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode)
 {
-    ASSERT(object);
     ASSERT(context);
     ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
 
-    if (m_filter.contains(object)) {
-        FilterData* filterData = m_filter.get(object);
+    if (m_filter.contains(&renderer)) {
+        FilterData* filterData = m_filter.get(&renderer);
         if (filterData->state == FilterData::PaintingSource || filterData->state == FilterData::Applying)
             filterData->state = FilterData::CycleDetected;
         return false; // Already built, or we're in a cycle, or we're marked for removal. Regardless, just do nothing more now.
     }
 
     auto filterData = std::make_unique<FilterData>();
-    FloatRect targetBoundingBox = object->objectBoundingBox();
+    FloatRect targetBoundingBox = renderer.objectBoundingBox();
 
     filterData->boundaries = SVGLengthContext::resolveRectangle<SVGFilterElement>(&filterElement(), filterElement().filterUnits(), targetBoundingBox);
     if (filterData->boundaries.isEmpty())
@@ -148,7 +147,7 @@
 
     // Determine absolute transformation matrix for filter. 
     AffineTransform absoluteTransform;
-    SVGRenderingContext::calculateTransformationToOutermostCoordinateSystem(object, absoluteTransform);
+    SVGRenderingContext::calculateTransformationToOutermostCoordinateSystem(&renderer, absoluteTransform);
     if (!absoluteTransform.isInvertible())
         return false;
 
@@ -157,7 +156,7 @@
 
     // Determine absolute boundaries of the filter and the drawing region.
     FloatRect absoluteFilterBoundaries = filterData->shearFreeAbsoluteTransform.mapRect(filterData->boundaries);
-    filterData->drawingRegion = object->strokeBoundingBox();
+    filterData->drawingRegion = renderer.strokeBoundingBox();
     filterData->drawingRegion.intersect(filterData->boundaries);
     FloatRect absoluteDrawingRegion = filterData->shearFreeAbsoluteTransform.mapRect(filterData->drawingRegion);
 
@@ -205,9 +204,9 @@
     // If the drawingRegion is empty, we have something like <g filter=".."/>.
     // Even if the target objectBoundingBox() is empty, we still have to draw the last effect result image in postApplyResource.
     if (filterData->drawingRegion.isEmpty()) {
-        ASSERT(!m_filter.contains(object));
+        ASSERT(!m_filter.contains(&renderer));
         filterData->savedContext = context;
-        m_filter.set(object, std::move(filterData));
+        m_filter.set(&renderer, std::move(filterData));
         return false;
     }
 
@@ -217,11 +216,11 @@
     effectiveTransform.multiply(filterData->shearFreeAbsoluteTransform);
 
     OwnPtr<ImageBuffer> sourceGraphic;
-    RenderingMode renderingMode = object->frame().settings().acceleratedFiltersEnabled() ? Accelerated : Unaccelerated;
+    RenderingMode renderingMode = renderer.frame().settings().acceleratedFiltersEnabled() ? Accelerated : Unaccelerated;
     if (!SVGRenderingContext::createImageBuffer(filterData->drawingRegion, effectiveTransform, sourceGraphic, ColorSpaceLinearRGB, renderingMode)) {
-        ASSERT(!m_filter.contains(object));
+        ASSERT(!m_filter.contains(&renderer));
         filterData->savedContext = context;
-        m_filter.set(object, std::move(filterData));
+        m_filter.set(&renderer, std::move(filterData));
         return false;
     }
     
@@ -236,8 +235,8 @@
 
     context = sourceGraphicContext;
 
-    ASSERT(!m_filter.contains(object));
-    m_filter.set(object, std::move(filterData));
+    ASSERT(!m_filter.contains(&renderer));
+    m_filter.set(&renderer, std::move(filterData));
 
     return true;
 }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h	2013-10-25 12:28:15 UTC (rev 158004)
@@ -74,7 +74,7 @@
     virtual void removeAllClientsFromCache(bool markForInvalidation = true);
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
-    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
+    virtual bool applyResource(RenderElement&, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) OVERRIDE;
     virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*);
 
     virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE;

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp	2013-10-25 12:28:15 UTC (rev 158004)
@@ -110,9 +110,8 @@
 }
 #endif
 
-bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode)
+bool RenderSVGResourceGradient::applyResource(RenderElement& renderer, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode)
 {
-    ASSERT(object);
     ASSERT(style);
     ASSERT(context);
     ASSERT(resourceMode != ApplyToDefaultMode);
@@ -131,11 +130,11 @@
 
     // Spec: When the geometry of the applicable element has no width or height and objectBoundingBox is specified,
     // then the given effect (e.g. a gradient or a filter) will be ignored.
-    FloatRect objectBoundingBox = object->objectBoundingBox();
+    FloatRect objectBoundingBox = renderer.objectBoundingBox();
     if (gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX && objectBoundingBox.isEmpty())
         return false;
 
-    OwnPtr<GradientData>& gradientData = m_gradientMap.add(object, nullptr).iterator->value;
+    OwnPtr<GradientData>& gradientData = m_gradientMap.add(&renderer, nullptr).iterator->value;
     if (!gradientData)
         gradientData = adoptPtr(new GradientData);
 
@@ -165,7 +164,7 @@
             // Depending on font scaling factor, we may need to rescale the gradient here since
             // text painting removes the scale factor from the context.
             AffineTransform additionalTextTransform;
-            if (shouldTransformOnTextPainting(object, additionalTextTransform))
+            if (shouldTransformOnTextPainting(&renderer, additionalTextTransform))
                 gradientData->userspaceTransform *= additionalTextTransform;
         }
         gradientData->gradient->setGradientSpaceTransform(gradientData->userspaceTransform);
@@ -179,7 +178,7 @@
 
     if (isPaintingText) {
 #if USE(CG)
-        if (!createMaskAndSwapContextForTextGradient(context, m_savedContext, m_imageBuffer, object)) {
+        if (!createMaskAndSwapContextForTextGradient(context, m_savedContext, m_imageBuffer, &renderer)) {
             context->restore();
             return false;
         }
@@ -197,10 +196,10 @@
         context->setFillRule(svgStyle->fillRule());
     } else if (resourceMode & ApplyToStrokeMode) {
         if (svgStyle->vectorEffect() == VE_NON_SCALING_STROKE)
-            gradientData->gradient->setGradientSpaceTransform(transformOnNonScalingStroke(object, gradientData->userspaceTransform));
+            gradientData->gradient->setGradientSpaceTransform(transformOnNonScalingStroke(&renderer, gradientData->userspaceTransform));
         context->setAlpha(svgStyle->strokeOpacity());
         context->setStrokeGradient(gradientData->gradient);
-        SVGRenderSupport::applyStrokeStyleToContext(context, style, object);
+        SVGRenderSupport::applyStrokeStyleToContext(context, style, &renderer);
     }
 
     return true;

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h	2013-10-25 12:28:15 UTC (rev 158004)
@@ -50,7 +50,7 @@
     virtual void removeAllClientsFromCache(bool markForInvalidation = true) OVERRIDE FINAL;
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true) OVERRIDE FINAL;
 
-    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) 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 FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE FINAL { return FloatRect(); }
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.h (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.h	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.h	2013-10-25 12:28:15 UTC (rev 158004)
@@ -55,7 +55,7 @@
     virtual const AffineTransform& localToParentTransform() const;
     AffineTransform markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const;
 
-    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short) { return false; }
+    virtual bool applyResource(RenderElement&, RenderStyle*, GraphicsContext*&, unsigned short) OVERRIDE { return false; }
     virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE { return FloatRect(); }
 
     FloatPoint referencePoint() const;

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp	2013-10-25 12:28:15 UTC (rev 158004)
@@ -67,22 +67,21 @@
     markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation);
 }
 
-bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode)
+bool RenderSVGResourceMasker::applyResource(RenderElement& renderer, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode)
 {
-    ASSERT(object);
     ASSERT(context);
     ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
 
-    bool missingMaskerData = !m_masker.contains(object);
+    bool missingMaskerData = !m_masker.contains(&renderer);
     if (missingMaskerData)
-        m_masker.set(object, std::make_unique<MaskerData>());
+        m_masker.set(&renderer, std::make_unique<MaskerData>());
 
-    MaskerData* maskerData = m_masker.get(object);
+    MaskerData* maskerData = m_masker.get(&renderer);
 
     AffineTransform absoluteTransform;
-    SVGRenderingContext::calculateTransformationToOutermostCoordinateSystem(object, absoluteTransform);
+    SVGRenderingContext::calculateTransformationToOutermostCoordinateSystem(&renderer, absoluteTransform);
 
-    FloatRect repaintRect = object->repaintRectInLocalCoordinates();
+    FloatRect repaintRect = renderer.repaintRectInLocalCoordinates();
 
     if (!maskerData->maskImage && !repaintRect.isEmpty()) {
         ASSERT(style());
@@ -92,7 +91,7 @@
         if (!SVGRenderingContext::createImageBuffer(repaintRect, absoluteTransform, maskerData->maskImage, colorSpace, Unaccelerated))
             return false;
 
-        if (!drawContentIntoMaskImage(maskerData, colorSpace, object)) {
+        if (!drawContentIntoMaskImage(maskerData, colorSpace, &renderer)) {
             maskerData->maskImage.clear();
         }
     }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.h (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.h	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.h	2013-10-25 12:28:15 UTC (rev 158004)
@@ -47,7 +47,7 @@
 
     virtual void removeAllClientsFromCache(bool markForInvalidation = true);
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
-    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
+    virtual bool applyResource(RenderElement&, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
     virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE;
 
     SVGUnitTypes::SVGUnitType maskUnits() const { return maskElement().maskUnits(); }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp	2013-10-25 12:28:15 UTC (rev 158004)
@@ -137,20 +137,19 @@
     return m_patternMap.set(object, patternData.release()).iterator->value.get();
 }
 
-bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode)
+bool RenderSVGResourcePattern::applyResource(RenderElement& renderer, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode)
 {
-    ASSERT(object);
     ASSERT(style);
     ASSERT(context);
     ASSERT(resourceMode != ApplyToDefaultMode);
 
     // Spec: When the geometry of the applicable element has no width or height and objectBoundingBox is specified,
     // then the given effect (e.g. a gradient or a filter) will be ignored.
-    FloatRect objectBoundingBox = object->objectBoundingBox();
+    FloatRect objectBoundingBox = renderer.objectBoundingBox();
     if (m_attributes.patternUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX && objectBoundingBox.isEmpty())
         return false;
 
-    PatternData* patternData = buildPattern(object, resourceMode);
+    PatternData* patternData = buildPattern(&renderer, resourceMode);
     if (!patternData)
         return false;
 
@@ -166,10 +165,10 @@
         context->setFillRule(svgStyle->fillRule());
     } else if (resourceMode & ApplyToStrokeMode) {
         if (svgStyle->vectorEffect() == VE_NON_SCALING_STROKE)
-            patternData->pattern->setPatternSpaceTransform(transformOnNonScalingStroke(object, patternData->transform));
+            patternData->pattern->setPatternSpaceTransform(transformOnNonScalingStroke(&renderer, patternData->transform));
         context->setAlpha(svgStyle->strokeOpacity());
         context->setStrokePattern(patternData->pattern);
-        SVGRenderSupport::applyStrokeStyleToContext(context, style, object);
+        SVGRenderSupport::applyStrokeStyleToContext(context, style, &renderer);
     }
 
     if (resourceMode & ApplyToTextMode) {

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h	2013-10-25 12:28:15 UTC (rev 158004)
@@ -51,7 +51,7 @@
     virtual void removeAllClientsFromCache(bool markForInvalidation = true);
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
-    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
+    virtual bool applyResource(RenderElement&, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
     virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*);
     virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE { return FloatRect(); }
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp	2013-10-25 12:28:15 UTC (rev 158004)
@@ -42,18 +42,15 @@
 {
 }
 
-bool RenderSVGResourceSolidColor::applyResource(RenderObject* object, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode)
+bool RenderSVGResourceSolidColor::applyResource(RenderElement& renderer, 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(context);
     ASSERT(resourceMode != ApplyToDefaultMode);
 
     const SVGRenderStyle* svgStyle = style ? style->svgStyle() : 0;
     ColorSpace colorSpace = style ? style->colorSpace() : ColorSpaceDeviceRGB;
 
-    bool isRenderingMask = object->view().frameView().paintBehavior() & PaintBehaviorRenderingSVGMask;
+    bool isRenderingMask = renderer.view().frameView().paintBehavior() & PaintBehaviorRenderingSVGMask;
 
     if (resourceMode & ApplyToFillMode) {
         if (!isRenderingMask && svgStyle)
@@ -73,7 +70,7 @@
         context->setStrokeColor(m_color, colorSpace);
 
         if (style)
-            SVGRenderSupport::applyStrokeStyleToContext(context, style, object);
+            SVGRenderSupport::applyStrokeStyleToContext(context, style, &renderer);
 
         if (resourceMode & ApplyToTextMode)
             context->setTextDrawingMode(TextModeStroke);

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.h (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.h	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.h	2013-10-25 12:28:15 UTC (rev 158004)
@@ -35,7 +35,7 @@
     virtual void removeAllClientsFromCache(bool = true) { }
     virtual void removeClientFromCache(RenderObject*, bool = true) { }
 
-    virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
+    virtual bool applyResource(RenderElement&, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) OVERRIDE;
     virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*);
     virtual FloatRect resourceBoundingBox(const RenderObject&) OVERRIDE { return FloatRect(); }
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2013-10-25 12:28:15 UTC (rev 158004)
@@ -219,12 +219,12 @@
 {
     Color fallbackColor;
     if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(*this, style, fallbackColor)) {
-        if (fillPaintingResource->applyResource(this, style, context, ApplyToFillMode))
+        if (fillPaintingResource->applyResource(*this, style, context, ApplyToFillMode))
             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))
+            if (fallbackResource->applyResource(*this, style, context, ApplyToFillMode))
                 fallbackResource->postApplyResource(this, context, ApplyToFillMode, 0, this);
         }
     }
@@ -234,12 +234,12 @@
 {
     Color fallbackColor;
     if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(*this, style, fallbackColor)) {
-        if (strokePaintingResource->applyResource(this, style, context, ApplyToStrokeMode))
+        if (strokePaintingResource->applyResource(*this, style, context, ApplyToStrokeMode))
             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))
+            if (fallbackResource->applyResource(*this, style, context, ApplyToStrokeMode))
                 fallbackResource->postApplyResource(this, context, ApplyToStrokeMode, 0, this);
         }
     }

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2013-10-25 12:28:15 UTC (rev 158004)
@@ -350,13 +350,13 @@
     if (!m_paintingResource)
         return false;
 
-    if (!m_paintingResource->applyResource(&renderer, style, context, m_paintingResourceMode)) {
+    if (!m_paintingResource->applyResource(renderer, style, context, m_paintingResourceMode)) {
         if (fallbackColor.isValid()) {
             RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
             fallbackResource->setColor(fallbackColor);
 
             m_paintingResource = fallbackResource;
-            m_paintingResource->applyResource(&renderer, style, context, m_paintingResourceMode);
+            m_paintingResource->applyResource(renderer, style, context, m_paintingResourceMode);
         }
     }
 

Modified: trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp	2013-10-25 12:28:15 UTC (rev 158004)
@@ -142,14 +142,14 @@
 
     if (!isRenderingMask) {
         if (RenderSVGResourceMasker* masker = resources->masker()) {
-            if (!masker->applyResource(m_renderer, style, m_paintInfo->context, ApplyToDefaultMode))
+            if (!masker->applyResource(*m_renderer, style, m_paintInfo->context, ApplyToDefaultMode))
                 return;
         }
     }
 
     RenderSVGResourceClipper* clipper = resources->clipper();
     if (!clipPathOperation && clipper) {
-        if (!clipper->applyResource(m_renderer, style, m_paintInfo->context, ApplyToDefaultMode))
+        if (!clipper->applyResource(*m_renderer, style, m_paintInfo->context, ApplyToDefaultMode))
             return;
     }
 
@@ -162,7 +162,7 @@
             // Return with false here may mean that we don't need to draw the content
             // (because it was either drawn before or empty) but we still need to apply the filter.
             m_renderingFlags |= EndFilterLayer;
-            if (!m_filter->applyResource(m_renderer, style, m_paintInfo->context, ApplyToDefaultMode))
+            if (!m_filter->applyResource(*m_renderer, style, m_paintInfo->context, ApplyToDefaultMode))
                 return;
 
             // Since we're caching the resulting bitmap and do not invalidate it on repaint rect

Modified: trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp (158003 => 158004)


--- trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp	2013-10-25 12:00:20 UTC (rev 158003)
+++ trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp	2013-10-25 12:28:15 UTC (rev 158004)
@@ -165,7 +165,7 @@
         Path glyphPath = svgGlyph.pathData;
         glyphPath.transform(glyphPathTransform);
 
-        if (activePaintingResource->applyResource(&elementRenderer, &style, context, resourceMode)) {
+        if (activePaintingResource->applyResource(elementRenderer, &style, context, resourceMode)) {
             float strokeThickness = context->strokeThickness();
             if (renderer().isSVGInlineText())
                 context->setStrokeThickness(strokeThickness * toRenderSVGInlineText(renderer()).scalingFactor());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to