Title: [122875] trunk/Source/WebCore
Revision
122875
Author
[email protected]
Date
2012-07-17 14:43:02 -0700 (Tue, 17 Jul 2012)

Log Message

Move zero-length-subpaths from RenderSVGShape to RenderSVGPath
https://bugs.webkit.org/show_bug.cgi?id=90716

Reviewed by Nikolas Zimmermann.

Previously zero-length-subpath code was present in RenderSVGShape but it is
only needed in RenderSVGPath. This patch moves the zero-length-subpath code
to RenderSVGPath.

In this change, we gain:
1) Ellipses, Circles, and Rects will no longer carry an empty Vector nor
   checks for zero-length subpaths which (per the spec) they cannot have.
2) RenderSVGShape, the superclass of all shape rendering, has been
   drastically simplified by removing 70 lines of code that only applies
   to Path rendering. This generally aids in code understandability.

The patch is primarily a straightforward code move but useStrokeStyleToFill
needs further explanation:
Zero-length-subpaths are drawn using rectangular and circular paths which
are filled.
Previously in RenderSVGShape::fillAndStrokePath, strokePath was called for
the main path with ApplyToStrokeMode and then strokePath was called for
each zero-length-subpath with ApplyToFillMode.
ApplyToFillMode had the effect of setting the context's stroke style to
the fill style so zero-length-subpaths were "filled" with the stroke style.
After this patch, the context is only setup once (which is faster!) using
ApplyToStrokeMode so we manually set the stroke style to the fill style
using useStrokeStyleToFill.

No new tests, just a refactoring.

* rendering/svg/RenderSVGPath.cpp:
(WebCore::RenderSVGPath::updateShapeFromElement):
(WebCore):
(WebCore::RenderSVGPath::calculateUpdatedStrokeBoundingBox):
(WebCore::useStrokeStyleToFill):
(WebCore::RenderSVGPath::strokeShape):
(WebCore::RenderSVGPath::shapeDependentStrokeContains):
(WebCore::RenderSVGPath::shouldStrokeZeroLengthSubpath):
(WebCore::RenderSVGPath::zeroLengthLinecapPath):
(WebCore::RenderSVGPath::zeroLengthSubpathRect):
(WebCore::RenderSVGPath::updateZeroLengthSubpaths):
* rendering/svg/RenderSVGPath.h:
(RenderSVGPath):
* rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::updateShapeFromElement):
(WebCore::RenderSVGShape::strokeShape):
(WebCore::RenderSVGShape::strokeContains):
(WebCore):
(WebCore::RenderSVGShape::fillShape):
(WebCore::RenderSVGShape::fillAndStrokeShape):
(WebCore::RenderSVGShape::paint):
(WebCore::RenderSVGShape::calculateStrokeBoundingBox):
* rendering/svg/RenderSVGShape.h:
(WebCore::RenderSVGShape::hasPath):
(WebCore::RenderSVGShape::hasNonScalingStroke):
(RenderSVGShape):
(WebCore::RenderSVGShape::strokeBoundingBox):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122874 => 122875)


--- trunk/Source/WebCore/ChangeLog	2012-07-17 21:33:17 UTC (rev 122874)
+++ trunk/Source/WebCore/ChangeLog	2012-07-17 21:43:02 UTC (rev 122875)
@@ -1,3 +1,64 @@
+2012-07-17  Philip Rogers  <[email protected]>
+
+        Move zero-length-subpaths from RenderSVGShape to RenderSVGPath
+        https://bugs.webkit.org/show_bug.cgi?id=90716
+
+        Reviewed by Nikolas Zimmermann.
+
+        Previously zero-length-subpath code was present in RenderSVGShape but it is
+        only needed in RenderSVGPath. This patch moves the zero-length-subpath code
+        to RenderSVGPath.
+
+        In this change, we gain:
+        1) Ellipses, Circles, and Rects will no longer carry an empty Vector nor
+           checks for zero-length subpaths which (per the spec) they cannot have.
+        2) RenderSVGShape, the superclass of all shape rendering, has been
+           drastically simplified by removing 70 lines of code that only applies
+           to Path rendering. This generally aids in code understandability.
+
+        The patch is primarily a straightforward code move but useStrokeStyleToFill
+        needs further explanation:
+        Zero-length-subpaths are drawn using rectangular and circular paths which
+        are filled.
+        Previously in RenderSVGShape::fillAndStrokePath, strokePath was called for
+        the main path with ApplyToStrokeMode and then strokePath was called for
+        each zero-length-subpath with ApplyToFillMode.
+        ApplyToFillMode had the effect of setting the context's stroke style to
+        the fill style so zero-length-subpaths were "filled" with the stroke style.
+        After this patch, the context is only setup once (which is faster!) using
+        ApplyToStrokeMode so we manually set the stroke style to the fill style
+        using useStrokeStyleToFill.
+
+        No new tests, just a refactoring.
+
+        * rendering/svg/RenderSVGPath.cpp:
+        (WebCore::RenderSVGPath::updateShapeFromElement):
+        (WebCore):
+        (WebCore::RenderSVGPath::calculateUpdatedStrokeBoundingBox):
+        (WebCore::useStrokeStyleToFill):
+        (WebCore::RenderSVGPath::strokeShape):
+        (WebCore::RenderSVGPath::shapeDependentStrokeContains):
+        (WebCore::RenderSVGPath::shouldStrokeZeroLengthSubpath):
+        (WebCore::RenderSVGPath::zeroLengthLinecapPath):
+        (WebCore::RenderSVGPath::zeroLengthSubpathRect):
+        (WebCore::RenderSVGPath::updateZeroLengthSubpaths):
+        * rendering/svg/RenderSVGPath.h:
+        (RenderSVGPath):
+        * rendering/svg/RenderSVGShape.cpp:
+        (WebCore::RenderSVGShape::updateShapeFromElement):
+        (WebCore::RenderSVGShape::strokeShape):
+        (WebCore::RenderSVGShape::strokeContains):
+        (WebCore):
+        (WebCore::RenderSVGShape::fillShape):
+        (WebCore::RenderSVGShape::fillAndStrokeShape):
+        (WebCore::RenderSVGShape::paint):
+        (WebCore::RenderSVGShape::calculateStrokeBoundingBox):
+        * rendering/svg/RenderSVGShape.h:
+        (WebCore::RenderSVGShape::hasPath):
+        (WebCore::RenderSVGShape::hasNonScalingStroke):
+        (RenderSVGShape):
+        (WebCore::RenderSVGShape::strokeBoundingBox):
+
 2012-07-17  Ryosuke Niwa  <[email protected]>
 
         invalidateNodeListCachesInAncestors walks up ancestors even when an attribute that doesn't invalidate node lists changes

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGPath.cpp (122874 => 122875)


--- trunk/Source/WebCore/rendering/svg/RenderSVGPath.cpp	2012-07-17 21:33:17 UTC (rev 122874)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGPath.cpp	2012-07-17 21:43:02 UTC (rev 122875)
@@ -32,6 +32,7 @@
 
 #include "SVGPathElement.h"
 #include "SVGStyledTransformableElement.h"
+#include "SVGSubpathData.h"
 
 namespace WebCore {
 
@@ -44,6 +45,123 @@
 {
 }
 
+void RenderSVGPath::updateShapeFromElement()
+{
+    RenderSVGShape::updateShapeFromElement();
+    updateZeroLengthSubpaths();
+
+    m_strokeBoundingBox = calculateUpdatedStrokeBoundingBox();
 }
 
+FloatRect RenderSVGPath::calculateUpdatedStrokeBoundingBox() const
+{
+    FloatRect strokeBoundingBox = m_strokeBoundingBox;
+
+    if (style()->svgStyle()->hasStroke()) {
+        // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-stroke.
+        float strokeWidth = this->strokeWidth();
+        for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i)
+            strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth));
+    }
+
+    return strokeBoundingBox;
+}
+
+static void useStrokeStyleToFill(GraphicsContext* context)
+{
+    if (Gradient* gradient = context->strokeGradient())
+        context->setFillGradient(gradient);
+    else if (Pattern* pattern = context->strokePattern())
+        context->setFillPattern(pattern);
+    else
+        context->setFillColor(context->strokeColor(), context->strokeColorSpace());
+}
+
+void RenderSVGPath::strokeShape(GraphicsContext* context) const
+{
+    if (!style()->svgStyle()->hasVisibleStroke())
+        return;
+
+    RenderSVGShape::strokeShape(context);
+
+    if (m_zeroLengthLinecapLocations.isEmpty())
+        return;
+
+    Path* usePath;
+    AffineTransform nonScalingTransform;
+
+    if (hasNonScalingStroke())
+        nonScalingTransform = nonScalingStrokeTransform();
+
+    GraphicsContextStateSaver stateSaver(*context, true);
+    useStrokeStyleToFill(context);
+    for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) {
+        usePath = zeroLengthLinecapPath(m_zeroLengthLinecapLocations[i]);
+        if (hasNonScalingStroke())
+            usePath = nonScalingStrokePath(usePath, nonScalingTransform);
+        context->fillPath(*usePath);
+    }
+}
+
+bool RenderSVGPath::shapeDependentStrokeContains(const FloatPoint& point)
+{
+    if (RenderSVGShape::shapeDependentStrokeContains(point))
+        return true;
+
+    const SVGRenderStyle* svgStyle = style()->svgStyle();
+    for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) {
+        ASSERT(svgStyle->hasStroke());
+        float strokeWidth = this->strokeWidth();
+        if (svgStyle->capStyle() == SquareCap) {
+            if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth).contains(point))
+                return true;
+        } else {
+            ASSERT(svgStyle->capStyle() == RoundCap);
+            FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i].x(), point.y() -  m_zeroLengthLinecapLocations[i].y());
+            if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f)
+                return true;
+        }
+    }
+    return false;
+}
+
+bool RenderSVGPath::shouldStrokeZeroLengthSubpath() const
+{
+    // Spec(11.4): Any zero length subpath shall not be stroked if the "stroke-linecap" property has a value of butt
+    // but shall be stroked if the "stroke-linecap" property has a value of round or square
+    return style()->svgStyle()->hasStroke() && style()->svgStyle()->capStyle() != ButtCap;
+}
+
+Path* RenderSVGPath::zeroLengthLinecapPath(const FloatPoint& linecapPosition) const
+{
+    DEFINE_STATIC_LOCAL(Path, tempPath, ());
+
+    tempPath.clear();
+    if (style()->svgStyle()->capStyle() == SquareCap)
+        tempPath.addRect(zeroLengthSubpathRect(linecapPosition, this->strokeWidth()));
+    else
+        tempPath.addEllipse(zeroLengthSubpathRect(linecapPosition, this->strokeWidth()));
+
+    return &tempPath;
+}
+
+FloatRect RenderSVGPath::zeroLengthSubpathRect(const FloatPoint& linecapPosition, float strokeWidth) const
+{
+    return FloatRect(linecapPosition.x() - strokeWidth / 2, linecapPosition.y() - strokeWidth / 2, strokeWidth, strokeWidth);
+}
+
+void RenderSVGPath::updateZeroLengthSubpaths()
+{
+    m_zeroLengthLinecapLocations.clear();
+
+    if (!strokeWidth() || !shouldStrokeZeroLengthSubpath())
+        return;
+
+    SVGSubpathData subpathData(m_zeroLengthLinecapLocations);
+    path().apply(&subpathData, SVGSubpathData::updateFromPathElement);
+    subpathData.pathIsDone();
+}
+
+}
+
 #endif // ENABLE(SVG)

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGPath.h (122874 => 122875)


--- trunk/Source/WebCore/rendering/svg/RenderSVGPath.h	2012-07-17 21:33:17 UTC (rev 122874)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGPath.h	2012-07-17 21:43:02 UTC (rev 122875)
@@ -39,6 +39,19 @@
 private:
     virtual bool isSVGPath() const { return true; }
     virtual const char* renderName() const { return "RenderSVGPath"; }
+
+    virtual void updateShapeFromElement() OVERRIDE;
+    FloatRect calculateUpdatedStrokeBoundingBox() const;
+
+    virtual void strokeShape(GraphicsContext*) const OVERRIDE;
+    virtual bool shapeDependentStrokeContains(const FloatPoint&) OVERRIDE;
+
+    bool shouldStrokeZeroLengthSubpath() const;
+    Path* zeroLengthLinecapPath(const FloatPoint&) const;
+    FloatRect zeroLengthSubpathRect(const FloatPoint&, float) const;
+    void updateZeroLengthSubpaths();
+
+    Vector<FloatPoint> m_zeroLengthLinecapLocations;
 };
 
 }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp (122874 => 122875)


--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2012-07-17 21:33:17 UTC (rev 122874)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp	2012-07-17 21:43:02 UTC (rev 122875)
@@ -44,7 +44,6 @@
 #include "SVGResources.h"
 #include "SVGResourcesCache.h"
 #include "SVGStyledTransformableElement.h"
-#include "SVGSubpathData.h"
 #include "SVGTransformList.h"
 #include "SVGURIReference.h"
 #include "StrokeStyleApplier.h"
@@ -72,7 +71,6 @@
 
     SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node());
     updatePathFromGraphicsElement(element, path());
-    processZeroLengthSubpaths();
     processMarkerPositions();
 
     m_fillBoundingBox = calculateObjectBoundingBox();
@@ -91,8 +89,13 @@
 
 void RenderSVGShape::strokeShape(GraphicsContext* context) const
 {
-    if (style()->svgStyle()->hasVisibleStroke())
-        context->strokePath(path());
+    ASSERT(m_path);
+    Path* usePath = m_path.get();
+
+    if (hasNonScalingStroke())
+        usePath = nonScalingStrokePath(usePath, nonScalingStrokeTransform());
+
+    context->strokePath(*usePath);
 }
 
 bool RenderSVGShape::shapeDependentStrokeContains(const FloatPoint& point)
@@ -136,20 +139,6 @@
     if (requiresStroke && !RenderSVGResource::strokePaintingResource(this, style(), fallbackColor))
         return false;
 
-    for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) {
-        ASSERT(style()->svgStyle()->hasStroke());
-        float strokeWidth = this->strokeWidth();
-        if (style()->svgStyle()->capStyle() == SquareCap) {
-            if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth).contains(point))
-                return true;
-        } else {
-            ASSERT(style()->svgStyle()->capStyle() == RoundCap);
-            FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i].x(), point.y() -  m_zeroLengthLinecapLocations[i].y());
-            if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f)
-                return true;
-        }
-    }
-
     return shapeDependentStrokeContains(point);
 }
 
@@ -212,13 +201,6 @@
     return element->getScreenCTM(SVGLocatable::DisallowStyleUpdate);
 }
 
-bool RenderSVGShape::shouldStrokeZeroLengthSubpath() const
-{
-    // Spec(11.4): Any zero length subpath shall not be stroked if the "stroke-linecap" property has a value of butt
-    // but shall be stroked if the "stroke-linecap" property has a value of round or square
-    return style()->svgStyle()->hasStroke() && style()->svgStyle()->capStyle() != ButtCap;
-}
-
 bool RenderSVGShape::shouldGenerateMarkerPositions() const
 {
     if (!style()->svgStyle()->hasMarkers())
@@ -235,94 +217,55 @@
     return resources->markerStart() || resources->markerMid() || resources->markerEnd();
 }
 
-FloatRect RenderSVGShape::zeroLengthSubpathRect(const FloatPoint& linecapPosition, float strokeWidth) const
+void RenderSVGShape::fillShape(RenderStyle* style, GraphicsContext* context)
 {
-    return FloatRect(linecapPosition.x() - strokeWidth / 2, linecapPosition.y() - strokeWidth / 2, strokeWidth, strokeWidth);
-}
-
-Path* RenderSVGShape::zeroLengthLinecapPath(const FloatPoint& linecapPosition)
-{
-    // Spec(11.4): Any zero length subpath shall not be stroked if the "stroke-linecap" property has a value of butt
-    // but shall be stroked if the "stroke-linecap" property has a value of round or square
-    DEFINE_STATIC_LOCAL(Path, tempPath, ());
-
-    tempPath.clear();
-    float strokeWidth = this->strokeWidth();
-    if (style()->svgStyle()->capStyle() == SquareCap)
-        tempPath.addRect(zeroLengthSubpathRect(linecapPosition, strokeWidth));
-    else
-        tempPath.addEllipse(zeroLengthSubpathRect(linecapPosition, strokeWidth));
-
-    return &tempPath;
-}
-
-void RenderSVGShape::fillShape(RenderStyle* style, GraphicsContext* context, Path* path, RenderSVGShape* shape)
-{
     Color fallbackColor;
     if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(this, style, fallbackColor)) {
         if (fillPaintingResource->applyResource(this, style, context, ApplyToFillMode))
-            fillPaintingResource->postApplyResource(this, context, ApplyToFillMode, path, shape);
+            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, path, shape);
+                fallbackResource->postApplyResource(this, context, ApplyToFillMode, 0, this);
         }
     }
 }
 
-void RenderSVGShape::strokePath(RenderStyle* style, GraphicsContext* context, Path* path, RenderSVGResource* strokePaintingResource,
-                                const Color& fallbackColor, int applyMode)
+void RenderSVGShape::strokeShape(RenderStyle* style, GraphicsContext* context)
 {
-    if (!style->svgStyle()->hasVisibleStroke())
-        return;
-
-    if (strokePaintingResource->applyResource(this, style, context, applyMode)) {
-        strokePaintingResource->postApplyResource(this, context, applyMode, path, this);
-        return;
+    Color 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()) {
+            RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
+            fallbackResource->setColor(fallbackColor);
+            if (fallbackResource->applyResource(this, style, context, ApplyToStrokeMode))
+                fallbackResource->postApplyResource(this, context, ApplyToStrokeMode, 0, this);
+        }
     }
-
-    if (!fallbackColor.isValid())
-        return;
-
-    RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
-    fallbackResource->setColor(fallbackColor);
-    if (fallbackResource->applyResource(this, style, context, applyMode))
-        fallbackResource->postApplyResource(this, context, applyMode, path, this);
 }
 
-void RenderSVGShape::fillAndStrokePath(GraphicsContext* context)
+void RenderSVGShape::fillAndStrokeShape(GraphicsContext* context)
 {
     RenderStyle* style = this->style();
 
-    fillShape(style, context, 0, this);
+    fillShape(style, context);
 
-    Color fallbackColor = Color();
-    RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(this, style, fallbackColor);
-    if (!strokePaintingResource)
+    if (!style->svgStyle()->hasVisibleStroke())
         return;
 
-    Path* usePath = m_path.get();
     GraphicsContextStateSaver stateSaver(*context, false);
     AffineTransform nonScalingTransform;
 
     if (hasNonScalingStroke()) {
-        nonScalingTransform = nonScalingStrokeTransform();
+        AffineTransform nonScalingTransform = nonScalingStrokeTransform();
         if (!setupNonScalingStrokeContext(nonScalingTransform, stateSaver))
             return;
-        usePath = nonScalingStrokePath(usePath, nonScalingTransform);
     }
 
-    strokePath(style, context, usePath, strokePaintingResource, fallbackColor, ApplyToStrokeMode);
-
-    // Spec(11.4): Any zero length subpath shall not be stroked if the "stroke-linecap" property has a value of butt
-    // but shall be stroked if the "stroke-linecap" property has a value of round or square
-    for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) {
-        Path* usePath = zeroLengthLinecapPath(m_zeroLengthLinecapLocations[i]);
-        if (hasNonScalingStroke())
-            usePath = nonScalingStrokePath(usePath, nonScalingTransform);
-        strokePath(style, context, usePath, strokePaintingResource, fallbackColor, ApplyToFillMode);
-    }
+    strokeShape(style, context);
 }
 
 void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint&)
@@ -347,7 +290,7 @@
                 if (svgStyle->shapeRendering() == SR_CRISPEDGES)
                     childPaintInfo.context->setShouldAntialias(false);
 
-                fillAndStrokePath(childPaintInfo.context);
+                fillAndStrokeShape(childPaintInfo.context);
                 if (!m_markerPositions.isEmpty())
                     drawMarkers(childPaintInfo);
             }
@@ -453,11 +396,6 @@
             }
         } else
             strokeBoundingBox.unite(path().strokeBoundingRect(&strokeStyle));
-
-        // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-stroke.
-        float strokeWidth = this->strokeWidth();
-        for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i)
-            strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth));
     }
 
     if (!m_markerPositions.isEmpty())
@@ -510,21 +448,6 @@
     }
 }
 
-void RenderSVGShape::processZeroLengthSubpaths()
-{
-    m_zeroLengthLinecapLocations.clear();
-
-    float strokeWidth = this->strokeWidth();
-    if (!strokeWidth || !shouldStrokeZeroLengthSubpath())
-        return;
-
-    ASSERT(m_path);
-
-    SVGSubpathData subpathData(m_zeroLengthLinecapLocations);
-    m_path->apply(&subpathData, SVGSubpathData::updateFromPathElement);
-    subpathData.pathIsDone();
-}
-
 void RenderSVGShape::processMarkerPositions()
 {
     m_markerPositions.clear();

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.h (122874 => 122875)


--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.h	2012-07-17 21:33:17 UTC (rev 122874)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.h	2012-07-17 21:43:02 UTC (rev 122875)
@@ -89,9 +89,12 @@
     virtual bool shapeDependentFillContains(const FloatPoint&, const WindRule) const;
     float strokeWidth() const;
     bool hasPath() const { return m_path.get(); }
-    bool hasNonScalingStroke() const { return style()->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE; }
     bool hasSmoothStroke() const;
 
+    bool hasNonScalingStroke() const { return style()->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE; }
+    AffineTransform nonScalingStrokeTransform() const;
+    Path* nonScalingStrokePath(const Path*, const AffineTransform&) const;
+
     FloatRect m_fillBoundingBox;
     FloatRect m_strokeBoundingBox;
 
@@ -115,35 +118,25 @@
 
     virtual FloatRect objectBoundingBox() const { return m_fillBoundingBox; }
     virtual FloatRect strokeBoundingBox() const { return m_strokeBoundingBox; }
-
     FloatRect calculateObjectBoundingBox() const;
     FloatRect calculateStrokeBoundingBox() const;
     void updateRepaintBoundingBox();
 
-    AffineTransform nonScalingStrokeTransform() const;
     bool setupNonScalingStrokeContext(AffineTransform&, GraphicsContextStateSaver&);
-    Path* nonScalingStrokePath(const Path*, const AffineTransform&) const;
 
-    Path* zeroLengthLinecapPath(const FloatPoint&);
-    bool shouldStrokeZeroLengthSubpath() const;
-    FloatRect zeroLengthSubpathRect(const FloatPoint&, float) const;
-    void processZeroLengthSubpaths();
-
     bool shouldGenerateMarkerPositions() const;
     FloatRect markerRect(float strokeWidth) const;
     void processMarkerPositions();
 
-    void fillShape(RenderStyle*, GraphicsContext*, Path*, RenderSVGShape*);
-    void strokePath(RenderStyle*, GraphicsContext*, Path*, RenderSVGResource*,
-                    const Color&, int);
-    void fillAndStrokePath(GraphicsContext*);
+    void fillShape(RenderStyle*, GraphicsContext*);
+    void strokeShape(RenderStyle*, GraphicsContext*);
+    void fillAndStrokeShape(GraphicsContext*);
     void drawMarkers(PaintInfo&);
 
 private:
     FloatRect m_repaintBoundingBox;
     AffineTransform m_localTransform;
     OwnPtr<Path> m_path;
-    Vector<FloatPoint> m_zeroLengthLinecapLocations;
     Vector<MarkerPosition> m_markerPositions;
 
     bool m_needsBoundariesUpdate : 1;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to