[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

andreas.kling at nokia.com andreas.kling at nokia.com
Wed Dec 22 17:48:11 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit bc1e1623cc54b2f447cede44fec762540e427040
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 30 18:13:59 2010 +0000

    2010-11-30  Andreas Kling  <kling at webkit.org>
    
            Reviewed by Dirk Schulze.
    
            GraphicsContext: Remove "current path" and have strokePath, fillPath and clipPath take a Path argument.
            https://bugs.webkit.org/show_bug.cgi?id=48516
    
            No new tests, this is refactoring only.
    
            fillPath() -> fillPath(const Path&)
            strokePath() -> strokePath(const Path&)
            clipPath(WindRule) -> clipPath(const Path&, WindRule)
    
            drawPath() was only used by CG, so made it PLATFORM(CG) specific.
    
            The Qt, CG and Cairo implementations are best-effort.
            For the rest, I've put beginPath/addPath and FIXMEs in the three affected methods.
    
            * WebCore.exp.in:
            * html/canvas/CanvasRenderingContext2D.cpp:
            (WebCore::CanvasRenderingContext2D::fill):
            (WebCore::CanvasRenderingContext2D::stroke):
            * inspector/InspectorController.cpp:
            (WebCore::drawOutlinedQuad):
            * mathml/RenderMathMLRoot.cpp:
            (WebCore::RenderMathMLRoot::paint):
            * mathml/RenderMathMLSquareRoot.cpp:
            (WebCore::RenderMathMLSquareRoot::paint):
            * platform/graphics/GraphicsContext.h:
            * platform/graphics/GraphicsContextPrivate.h:
            * platform/graphics/cairo/GraphicsContextCairo.cpp:
            (WebCore::GraphicsContext::fillPath):
            (WebCore::GraphicsContext::strokePath):
            (WebCore::GraphicsContext::clipPath):
            * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
            * platform/graphics/cg/GraphicsContextCG.cpp:
            (WebCore::GraphicsContext::drawEllipse):
            (WebCore::addConvexPolygonToPath):
            (WebCore::GraphicsContext::drawConvexPolygon):
            (WebCore::GraphicsContext::clipConvexPolygon):
            (WebCore::GraphicsContext::drawPath):
            (WebCore::GraphicsContext::fillPath):
            (WebCore::GraphicsContext::strokePath):
            (WebCore::GraphicsContext::fillRoundedRect):
            (WebCore::GraphicsContext::clipPath):
            * platform/graphics/haiku/GraphicsContextHaiku.cpp:
            (WebCore::GraphicsContext::strokePath):
            (WebCore::GraphicsContext::fillPath):
            * platform/graphics/openvg/GraphicsContextOpenVG.cpp:
            (WebCore::GraphicsContext::fillPath):
            (WebCore::GraphicsContext::strokePath):
            (WebCore::GraphicsContext::clipPath):
            * platform/graphics/qt/GraphicsContextQt.cpp:
            (WebCore::GraphicsContext::restorePlatformState):
            (WebCore::GraphicsContext::fillPath):
            (WebCore::GraphicsContext::strokePath):
            (WebCore::GraphicsContext::clipPath):
            (WebCore::GraphicsContext::strokeRect):
            (WebCore::GraphicsContext::translate):
            (WebCore::GraphicsContext::rotate):
            (WebCore::GraphicsContext::scale):
            (WebCore::GraphicsContext::concatCTM):
            * platform/graphics/skia/GraphicsContextSkia.cpp:
            (WebCore::GraphicsContext::clipPath):
            (WebCore::GraphicsContext::fillPath):
            (WebCore::GraphicsContext::strokePath):
            * platform/graphics/wince/GraphicsContextWinCE.cpp:
            (WebCore::GraphicsContext::fillPath):
            (WebCore::GraphicsContext::strokePath):
            (WebCore::GraphicsContext::clipPath):
            * platform/graphics/wx/GraphicsContextWx.cpp:
            (WebCore::GraphicsContext::clipPath):
            (WebCore::GraphicsContext::fillPath):
            (WebCore::GraphicsContext::strokePath):
            * rendering/RenderBoxModelObject.cpp:
            (WebCore::RenderBoxModelObject::paintBorder):
            (WebCore::RenderBoxModelObject::paintBoxShadow):
            * rendering/RenderEmbeddedObject.cpp:
            (WebCore::RenderEmbeddedObject::paintReplaced):
            * rendering/RenderObject.cpp:
            (WebCore::RenderObject::drawBoxSideFromPath):
            * rendering/RenderSVGResource.h:
            (WebCore::RenderSVGResource::postApplyResource):
            * rendering/RenderSVGResourceClipper.cpp:
            (WebCore::RenderSVGResourceClipper::pathOnlyClipping):
            * rendering/RenderSVGResourceFilter.cpp:
            (WebCore::RenderSVGResourceFilter::postApplyResource):
            * rendering/RenderSVGResourceFilter.h:
            * rendering/RenderSVGResourceGradient.cpp:
            (WebCore::RenderSVGResourceGradient::applyResource):
            * rendering/RenderSVGResourceGradient.h:
            * rendering/RenderSVGResourcePattern.cpp:
            (WebCore::RenderSVGResourcePattern::postApplyResource):
            * rendering/RenderSVGResourcePattern.h:
            * rendering/RenderSVGResourceSolidColor.cpp:
            (WebCore::RenderSVGResourceSolidColor::postApplyResource):
            * rendering/RenderSVGResourceSolidColor.h:
            * rendering/SVGRenderSupport.cpp:
            (WebCore::SVGRenderSupport::finishRenderSVGContent):
            * rendering/svg/RenderSVGPath.cpp:
            (WebCore::RenderSVGPath::fillAndStrokePath):
            * rendering/svg/SVGInlineTextBox.cpp:
            (WebCore::SVGInlineTextBox::releasePaintingResource):
            (WebCore::SVGInlineTextBox::restoreGraphicsContextAfterTextPainting):
            (WebCore::SVGInlineTextBox::paintDecorationWithStyle):
            * rendering/svg/SVGInlineTextBox.h:
            * svg/SVGFont.cpp:
            (WebCore::Font::drawTextUsingSVGFont):
    2010-11-30  Andreas Kling  <kling at webkit.org>
    
            Reviewed by Dirk Schulze.
    
            GraphicsContext: Remove "current path" and have strokePath, fillPath and clipPath take a Path argument
            https://bugs.webkit.org/show_bug.cgi?id=48516
    
            * UIProcess/FindIndicator.cpp:
            (WebKit::FindIndicator::draw):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72926 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 684a48c..10a74d8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,112 @@
+2010-11-30  Andreas Kling  <kling at webkit.org>
+
+        Reviewed by Dirk Schulze.
+
+        GraphicsContext: Remove "current path" and have strokePath, fillPath and clipPath take a Path argument.
+        https://bugs.webkit.org/show_bug.cgi?id=48516
+
+        No new tests, this is refactoring only.
+
+        fillPath() -> fillPath(const Path&)
+        strokePath() -> strokePath(const Path&)
+        clipPath(WindRule) -> clipPath(const Path&, WindRule)
+
+        drawPath() was only used by CG, so made it PLATFORM(CG) specific.
+
+        The Qt, CG and Cairo implementations are best-effort.
+        For the rest, I've put beginPath/addPath and FIXMEs in the three affected methods.
+
+        * WebCore.exp.in:
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::fill):
+        (WebCore::CanvasRenderingContext2D::stroke):
+        * inspector/InspectorController.cpp:
+        (WebCore::drawOutlinedQuad):
+        * mathml/RenderMathMLRoot.cpp:
+        (WebCore::RenderMathMLRoot::paint):
+        * mathml/RenderMathMLSquareRoot.cpp:
+        (WebCore::RenderMathMLSquareRoot::paint):
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/GraphicsContextPrivate.h:
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::clipPath):
+        * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::drawEllipse):
+        (WebCore::addConvexPolygonToPath):
+        (WebCore::GraphicsContext::drawConvexPolygon):
+        (WebCore::GraphicsContext::clipConvexPolygon):
+        (WebCore::GraphicsContext::drawPath):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::fillRoundedRect):
+        (WebCore::GraphicsContext::clipPath):
+        * platform/graphics/haiku/GraphicsContextHaiku.cpp:
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::fillPath):
+        * platform/graphics/openvg/GraphicsContextOpenVG.cpp:
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::clipPath):
+        * platform/graphics/qt/GraphicsContextQt.cpp:
+        (WebCore::GraphicsContext::restorePlatformState):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::clipPath):
+        (WebCore::GraphicsContext::strokeRect):
+        (WebCore::GraphicsContext::translate):
+        (WebCore::GraphicsContext::rotate):
+        (WebCore::GraphicsContext::scale):
+        (WebCore::GraphicsContext::concatCTM):
+        * platform/graphics/skia/GraphicsContextSkia.cpp:
+        (WebCore::GraphicsContext::clipPath):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        * platform/graphics/wince/GraphicsContextWinCE.cpp:
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::clipPath):
+        * platform/graphics/wx/GraphicsContextWx.cpp:
+        (WebCore::GraphicsContext::clipPath):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintBorder):
+        (WebCore::RenderBoxModelObject::paintBoxShadow):
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::RenderEmbeddedObject::paintReplaced):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::drawBoxSideFromPath):
+        * rendering/RenderSVGResource.h:
+        (WebCore::RenderSVGResource::postApplyResource):
+        * rendering/RenderSVGResourceClipper.cpp:
+        (WebCore::RenderSVGResourceClipper::pathOnlyClipping):
+        * rendering/RenderSVGResourceFilter.cpp:
+        (WebCore::RenderSVGResourceFilter::postApplyResource):
+        * rendering/RenderSVGResourceFilter.h:
+        * rendering/RenderSVGResourceGradient.cpp:
+        (WebCore::RenderSVGResourceGradient::applyResource):
+        * rendering/RenderSVGResourceGradient.h:
+        * rendering/RenderSVGResourcePattern.cpp:
+        (WebCore::RenderSVGResourcePattern::postApplyResource):
+        * rendering/RenderSVGResourcePattern.h:
+        * rendering/RenderSVGResourceSolidColor.cpp:
+        (WebCore::RenderSVGResourceSolidColor::postApplyResource):
+        * rendering/RenderSVGResourceSolidColor.h:
+        * rendering/SVGRenderSupport.cpp:
+        (WebCore::SVGRenderSupport::finishRenderSVGContent):
+        * rendering/svg/RenderSVGPath.cpp:
+        (WebCore::RenderSVGPath::fillAndStrokePath):
+        * rendering/svg/SVGInlineTextBox.cpp:
+        (WebCore::SVGInlineTextBox::releasePaintingResource):
+        (WebCore::SVGInlineTextBox::restoreGraphicsContextAfterTextPainting):
+        (WebCore::SVGInlineTextBox::paintDecorationWithStyle):
+        * rendering/svg/SVGInlineTextBox.h:
+        * svg/SVGFont.cpp:
+        (WebCore::Font::drawTextUsingSVGFont):
+
 2010-11-30  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler and Geoff Garen.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index f400c06..30aa525 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -358,9 +358,8 @@ __ZN7WebCore15GraphicsContext4clipERKNS_4PathE
 __ZN7WebCore15GraphicsContext4clipERKNS_9FloatRectE
 __ZN7WebCore15GraphicsContext4saveEv
 __ZN7WebCore15GraphicsContext5scaleERKNS_9FloatSizeE
-__ZN7WebCore15GraphicsContext7addPathERKNS_4PathE
 __ZN7WebCore15GraphicsContext7restoreEv
-__ZN7WebCore15GraphicsContext8fillPathEv
+__ZN7WebCore15GraphicsContext8fillPathERKNS_4PathE
 __ZN7WebCore15GraphicsContext8fillRectERKNS_9FloatRectE
 __ZN7WebCore15GraphicsContext8fillRectERKNS_9FloatRectERKNS_5ColorENS_10ColorSpaceE
 __ZN7WebCore15GraphicsContext9setShadowERKNS_9FloatSizeEfRKNS_5ColorENS_10ColorSpaceE
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index b9f86ce..eb552c6 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -813,9 +813,7 @@ void CanvasRenderingContext2D::fill()
         return;
 
     if (!m_path.isEmpty()) {
-        c->beginPath();
-        c->addPath(m_path);
-        c->fillPath();
+        c->fillPath(m_path);
         didDraw(m_path.boundingRect());
     }
 
@@ -833,9 +831,6 @@ void CanvasRenderingContext2D::stroke()
         return;
 
     if (!m_path.isEmpty()) {
-        c->beginPath();
-        c->addPath(m_path);
-
 #if PLATFORM(QT)
         // Fast approximation of the stroke's bounding rect.
         // This yields a slightly oversized rect but is very fast
@@ -846,7 +841,7 @@ void CanvasRenderingContext2D::stroke()
         CanvasStrokeStyleApplier strokeApplier(this);
         FloatRect boundingRect = m_path.strokeBoundingRect(&strokeApplier);
 #endif
-        c->strokePath();
+        c->strokePath(m_path);
         didDraw(boundingRect);
     }
 
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 92282e4..ed319f3 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -1537,21 +1537,18 @@ static void drawOutlinedQuad(GraphicsContext& context, const FloatQuad& quad, co
     // of outline (because inflating a quad is hard)
     {
         context.save();
-        context.addPath(quadPath);
         context.clipOut(quadPath);
 
-        context.addPath(quadPath);
         context.setStrokeThickness(outlineThickness);
         context.setStrokeColor(outlineColor, ColorSpaceDeviceRGB);
-        context.strokePath();
+        context.strokePath(quadPath);
 
         context.restore();
     }
 
     // Now do the fill
-    context.addPath(quadPath);
     context.setFillColor(fillColor, ColorSpaceDeviceRGB);
-    context.fillPath();
+    context.fillPath(quadPath);
 }
 
 static void drawOutlinedQuadWithClip(GraphicsContext& context, const FloatQuad& quad, const FloatQuad& clipQuad, const Color& fillColor)
diff --git a/WebCore/mathml/RenderMathMLRoot.cpp b/WebCore/mathml/RenderMathMLRoot.cpp
index ba60c9f..f0a7abb 100644
--- a/WebCore/mathml/RenderMathMLRoot.cpp
+++ b/WebCore/mathml/RenderMathMLRoot.cpp
@@ -167,9 +167,7 @@ void RenderMathMLRoot::paint(PaintInfo& info, int tx, int ty)
     // draw to end
     root.addLineTo(leftEnd);
     
-    info.context->beginPath();
-    info.context->addPath(root);
-    info.context->strokePath();
+    info.context->strokePath(root);
     
     info.context->save();
     
@@ -181,8 +179,6 @@ void RenderMathMLRoot::paint(PaintInfo& info, int tx, int ty)
     mask.addLineTo(topLeft);
     mask.addLineTo(FloatPoint(2 * topLeft.x() - leftEnd.x(), 2 * topLeft.y() - leftEnd.y()));
     
-    info.context->beginPath();
-    info.context->addPath(mask);
     info.context->clip(mask);
     
     // Draw the thick part of the root.
@@ -193,9 +189,7 @@ void RenderMathMLRoot::paint(PaintInfo& info, int tx, int ty)
     line.moveTo(bottomLeft);
     line.addLineTo(topLeft);
 
-    info.context->beginPath();
-    info.context->addPath(line);
-    info.context->strokePath();
+    info.context->strokePath(line);
     
     info.context->restore();
     
diff --git a/WebCore/mathml/RenderMathMLSquareRoot.cpp b/WebCore/mathml/RenderMathMLSquareRoot.cpp
index 862d8a4..1285acd 100644
--- a/WebCore/mathml/RenderMathMLSquareRoot.cpp
+++ b/WebCore/mathml/RenderMathMLSquareRoot.cpp
@@ -132,10 +132,8 @@ void RenderMathMLSquareRoot::paint(PaintInfo& info, int tx, int ty)
     root.addLineTo(topLeft);
     // draw to end
     root.addLineTo(leftEnd);
-    
-    info.context->beginPath();
-    info.context->addPath(root);
-    info.context->strokePath();
+
+    info.context->strokePath(root);
     
     info.context->save();
     
@@ -147,8 +145,6 @@ void RenderMathMLSquareRoot::paint(PaintInfo& info, int tx, int ty)
     mask.addLineTo(topLeft);
     mask.addLineTo(FloatPoint(2 * topLeft.x() - leftEnd.x(), 2 * topLeft.y() - leftEnd.y()));
     
-    info.context->beginPath();
-    info.context->addPath(mask);
     info.context->clip(mask);
     
     // Draw the thick part of the root.
@@ -159,9 +155,7 @@ void RenderMathMLSquareRoot::paint(PaintInfo& info, int tx, int ty)
     line.moveTo(bottomLeft);
     line.addLineTo(topLeft);
     
-    info.context->beginPath();
-    info.context->addPath(line);
-    info.context->strokePath();
+    info.context->strokePath(line);
     
     info.context->restore();
     
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index 6adc90b..9425bf6 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -127,7 +127,6 @@ namespace WebCore {
     class GraphicsContextPrivate;
     class ImageBuffer;
     class KURL;
-    class Path;
     class Pattern;
     class SharedGraphicsContext3D;
     class TextRun;
@@ -196,6 +195,7 @@ namespace WebCore {
 #if PLATFORM(CG)
         void applyStrokePattern();
         void applyFillPattern();
+        void drawPath(const Path&);
 #endif
 
         void save();
@@ -210,9 +210,8 @@ namespace WebCore {
         void drawEllipse(const IntRect&);
         void drawConvexPolygon(size_t numPoints, const FloatPoint*, bool shouldAntialias = false);
 
-        void drawPath();
-        void fillPath();
-        void strokePath();
+        void fillPath(const Path&);
+        void strokePath(const Path&);
 
         // Arc drawing (used by border-radius in CSS) just supports stroking at the moment.
         void strokeArc(const IntRect&, int startAngle, int angleSpan);
@@ -253,7 +252,7 @@ namespace WebCore {
         void addInnerRoundedRectClip(const IntRect&, int thickness);
         void clipOut(const IntRect&);
         void clipOutRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
-        void clipPath(WindRule);
+        void clipPath(const Path&, WindRule);
         void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true);
         void clipToImageBuffer(ImageBuffer*, const FloatRect&);
 
@@ -302,8 +301,10 @@ namespace WebCore {
 
         void setCompositeOperation(CompositeOperator);
 
+#if PLATFORM(SKIA) || PLATFORM(WX) || PLATFORM(OPENVG) || OS(WINCE)
         void beginPath();
         void addPath(const Path&);
+#endif
 
         void clip(const Path&);
 
@@ -393,7 +394,6 @@ namespace WebCore {
 
 #if PLATFORM(QT)
         bool inTransparencyLayer() const;
-        PlatformPath* currentPath();
         void pushTransparencyLayerInternal(const QRect &rect, qreal opacity, QPixmap& alphaMask);
         void takeOwnershipOfPlatformContext();
         static QPainter::CompositionMode toQtCompositionMode(CompositeOperator op);
diff --git a/WebCore/platform/graphics/GraphicsContextPrivate.h b/WebCore/platform/graphics/GraphicsContextPrivate.h
index 985cad9..696932e 100644
--- a/WebCore/platform/graphics/GraphicsContextPrivate.h
+++ b/WebCore/platform/graphics/GraphicsContextPrivate.h
@@ -29,7 +29,6 @@
 #include "Gradient.h"
 #include "GraphicsContext.h"
 #include "Pattern.h"
-#include "TransformationMatrix.h"
 
 namespace WebCore {
 
@@ -79,8 +78,6 @@ namespace WebCore {
         bool shadowsIgnoreTransforms;
 #if PLATFORM(CAIRO)
         float globalAlpha;
-#elif PLATFORM(QT)
-        TransformationMatrix pathTransform;
 #endif
     };
 
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
index 1032dc2..9c2ff82 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
+++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
@@ -531,44 +531,26 @@ void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin
     cairo_set_fill_rule(cr, savedFillRule);
 }
 
-void GraphicsContext::fillPath()
+void GraphicsContext::fillPath(const Path& path)
 {
     if (paintingDisabled())
         return;
 
     cairo_t* cr = m_data->cr;
-
-    setPathOnCairoContext(cr, m_data->m_pendingPath.context());
+    setPathOnCairoContext(cr, path.platformPath()->context());
     fillCurrentCairoPath(this, m_common, cr);
 }
 
-void GraphicsContext::strokePath()
+void GraphicsContext::strokePath(const Path& path)
 {
     if (paintingDisabled())
         return;
 
     cairo_t* cr = m_data->cr;
-    setPathOnCairoContext(cr, m_data->m_pendingPath.context());
+    setPathOnCairoContext(cr, path.platformPath()->context());
     strokeCurrentCairoPath(this, m_common, cr);
 }
 
-void GraphicsContext::drawPath()
-{
-    if (paintingDisabled())
-        return;
-
-    cairo_t* cr = m_data->cr;
-
-    setPathOnCairoContext(cr, m_data->m_pendingPath.context());
-
-    cairo_set_fill_rule(cr, fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
-    drawPathShadow(this, m_common, FillAndStroke);
-
-    setPlatformFill(this, cr, m_common);
-    setPlatformStroke(this, cr, m_common);
-    cairo_new_path(cr);
-}
-
 void GraphicsContext::fillRect(const FloatRect& rect)
 {
     if (paintingDisabled())
@@ -607,12 +589,13 @@ void GraphicsContext::clip(const FloatRect& rect)
     m_data->clip(rect);
 }
 
-void GraphicsContext::clipPath(WindRule clipRule)
+void GraphicsContext::clipPath(const Path& path, WindRule clipRule)
 {
     if (paintingDisabled())
         return;
 
     cairo_t* cr = m_data->cr;
+    setPathOnCairoContext(cr, path.platformPath()->context());
     cairo_set_fill_rule(cr, clipRule == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
     cairo_clip(cr);
 }
@@ -994,25 +977,6 @@ void GraphicsContext::setCompositeOperation(CompositeOperator op)
     cairo_set_operator(m_data->cr, toCairoOperator(op));
 }
 
-void GraphicsContext::beginPath()
-{
-    if (paintingDisabled())
-        return;
-
-    cairo_new_path(m_data->m_pendingPath.context());
-}
-
-void GraphicsContext::addPath(const Path& path)
-{
-    if (paintingDisabled())
-        return;
-
-    cairo_matrix_t currentMatrix;
-    cairo_get_matrix(m_data->cr, &currentMatrix);
-    cairo_set_matrix(m_data->m_pendingPath.context(), &currentMatrix);
-    appendWebCorePathToCairoContext(m_data->m_pendingPath.context(), path);
-}
-
 void GraphicsContext::clip(const Path& path)
 {
     if (paintingDisabled())
diff --git a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
index 527cb72..494b40d 100644
--- a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
+++ b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
@@ -27,7 +27,6 @@
 
 #include "GraphicsContext.h"
 
-#include "CairoPath.h"
 #include "ContextShadow.h"
 #include <cairo.h>
 #include <math.h>
@@ -97,7 +96,6 @@ public:
 
     cairo_t* cr;
     Vector<float> layers;
-    CairoPath m_pendingPath;
 
     ContextShadow shadow;
     Vector<ContextShadow> shadowStack;
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index 8d72b85..2eb929e 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -299,21 +299,12 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
 // This method is only used to draw the little circles used in lists.
 void GraphicsContext::drawEllipse(const IntRect& rect)
 {
-    // FIXME: CG added CGContextAddEllipseinRect in Tiger, so we should be able to quite easily draw an ellipse.
-    // This code can only handle circles, not ellipses. But khtml only
-    // uses it for circles.
-    ASSERT(rect.width() == rect.height());
-
     if (paintingDisabled())
         return;
 
-    CGContextRef context = platformContext();
-    CGContextBeginPath(context);
-    float r = (float)rect.width() / 2;
-    CGContextAddArc(context, rect.x() + r, rect.y() + r, r, 0.0f, 2.0f * piFloat, 0);
-    CGContextClosePath(context);
-
-    drawPath();
+    Path path;
+    path.addEllipse(rect);
+    drawPath(path);
 }
 
 
@@ -405,21 +396,22 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp
     CGContextRestoreGState(context);
 }
 
-static void addConvexPolygonToContext(CGContextRef context, size_t numPoints, const FloatPoint* points)
+static void addConvexPolygonToPath(Path& path, size_t numberOfPoints, const FloatPoint* points)
 {
-    CGContextBeginPath(context);
-    CGContextMoveToPoint(context, points[0].x(), points[0].y());
-    for (size_t i = 1; i < numPoints; i++)
-        CGContextAddLineToPoint(context, points[i].x(), points[i].y());
-    CGContextClosePath(context);
+    ASSERT(numberOfPoints > 0);
+
+    path.moveTo(points[0]);
+    for (size_t i = 1; i < numberOfPoints; ++i)
+        path.addLineTo(points[i]);
+    path.closeSubpath();
 }
 
-void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points, bool antialiased)
+void GraphicsContext::drawConvexPolygon(size_t numberOfPoints, const FloatPoint* points, bool antialiased)
 {
     if (paintingDisabled())
         return;
 
-    if (npoints <= 1)
+    if (numberOfPoints <= 1)
         return;
 
     CGContextRef context = platformContext();
@@ -427,28 +419,30 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points
     if (antialiased != shouldAntialias())
         CGContextSetShouldAntialias(context, antialiased);
 
-    addConvexPolygonToContext(context, npoints, points);
-    drawPath();
+    Path path;
+    addConvexPolygonToPath(path, numberOfPoints, points);
+    drawPath(path);
 
     if (antialiased != shouldAntialias())
         CGContextSetShouldAntialias(context, shouldAntialias());
 }
 
-void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* points, bool antialias)
+void GraphicsContext::clipConvexPolygon(size_t numberOfPoints, const FloatPoint* points, bool antialias)
 {
     if (paintingDisabled())
         return;
 
-    if (numPoints <= 1)
+    if (numberOfPoints <= 1)
         return;
 
     CGContextRef context = platformContext();
 
     if (antialias != shouldAntialias())
         CGContextSetShouldAntialias(context, antialias);
-    
-    addConvexPolygonToContext(context, numPoints, points);
-    clipPath(RULE_NONZERO);
+
+    Path path;
+    addConvexPolygonToPath(path, numberOfPoints, points);
+    clipPath(path, RULE_NONZERO);
 
     if (antialias != shouldAntialias())
         CGContextSetShouldAntialias(context, shouldAntialias());
@@ -511,7 +505,7 @@ static inline bool calculateDrawingMode(const GraphicsContextState& state, CGPat
     return shouldFill || shouldStroke;
 }
 
-void GraphicsContext::drawPath()
+void GraphicsContext::drawPath(const Path& path)
 {
     if (paintingDisabled())
         return;
@@ -521,11 +515,15 @@ void GraphicsContext::drawPath()
 
     if (state.fillGradient || state.strokeGradient) {
         // We don't have any optimized way to fill & stroke a path using gradients
-        fillPath();
-        strokePath();
+        // FIXME: Be smarter about this.
+        fillPath(path);
+        strokePath(path);
         return;
     }
 
+    CGContextBeginPath(context);
+    CGContextAddPath(context, path.platformPath());
+
     if (state.fillPattern)
         applyFillPattern();
     if (state.strokePattern)
@@ -544,13 +542,16 @@ static inline void fillPathWithFillRule(CGContextRef context, WindRule fillRule)
         CGContextFillPath(context);
 }
 
-void GraphicsContext::fillPath()
+void GraphicsContext::fillPath(const Path& path)
 {
     if (paintingDisabled())
         return;
 
     CGContextRef context = platformContext();
 
+    CGContextBeginPath(context);
+    CGContextAddPath(context, path.platformPath());
+
     if (m_common->state.fillGradient) {
         CGContextSaveGState(context);
         if (fillRule() == RULE_EVENODD)
@@ -568,13 +569,16 @@ void GraphicsContext::fillPath()
     fillPathWithFillRule(context, fillRule());
 }
 
-void GraphicsContext::strokePath()
+void GraphicsContext::strokePath(const Path& path)
 {
     if (paintingDisabled())
         return;
 
     CGContextRef context = platformContext();
 
+    CGContextBeginPath(context);
+    CGContextAddPath(context, path.platformPath());
+
     if (m_common->state.strokeGradient) {
         CGContextSaveGState(context);
         CGContextReplacePathWithStrokedPath(context);
@@ -643,8 +647,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef
 
     Path path;
     path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight);
-    addPath(path);
-    fillPath();
+    fillPath(path);
 
     if (oldFillColor != color || oldColorSpace != colorSpace)
         setCGFillColor(context, oldFillColor, oldColorSpace);
@@ -669,19 +672,23 @@ void GraphicsContext::clipOut(const IntRect& rect)
     CGContextEOClip(platformContext());
 }
 
-void GraphicsContext::clipPath(WindRule clipRule)
+void GraphicsContext::clipPath(const Path& path, WindRule clipRule)
 {
     if (paintingDisabled())
         return;
 
+    if (path.isEmpty())
+        return;
+
     CGContextRef context = platformContext();
 
-    if (!CGContextIsPathEmpty(context)) {
-        if (clipRule == RULE_EVENODD)
-            CGContextEOClip(context);
-        else
-            CGContextClip(context);
-    }
+    CGContextBeginPath(platformContext());
+    CGContextAddPath(platformContext(), path.platformPath());
+
+    if (clipRule == RULE_EVENODD)
+        CGContextEOClip(context);
+    else
+        CGContextClip(context);
 }
 
 void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness)
@@ -863,16 +870,6 @@ void GraphicsContext::setLineJoin(LineJoin join)
     }
 }
 
-void GraphicsContext::beginPath()
-{
-    CGContextBeginPath(platformContext());
-}
-
-void GraphicsContext::addPath(const Path& path)
-{
-    CGContextAddPath(platformContext(), path.platformPath());
-}
-
 void GraphicsContext::clip(const Path& path)
 {
     if (paintingDisabled())
diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
index 05012e8..7dda245 100644
--- a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
@@ -132,7 +132,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp
     m_data->m_view->StrokeArc(rect, startAngle, angleSpan, getHaikuStrokeStyle());
 }
 
-void GraphicsContext::strokePath()
+void GraphicsContext::strokePath(const Path&)
 {
     notImplemented();
 }
@@ -191,17 +191,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef
     // FillRect and FillArc calls are needed.
 }
 
-void GraphicsContext::fillPath()
-{
-    notImplemented();
-}
-
-void GraphicsContext::beginPath()
-{
-    notImplemented();
-}
-
-void GraphicsContext::addPath(const Path& path)
+void GraphicsContext::fillPath(const Path&)
 {
     notImplemented();
 }
diff --git a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
index 0d16d4d..04a5e26 100644
--- a/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
@@ -139,28 +139,28 @@ void GraphicsContext::drawConvexPolygon(size_t numPoints, const FloatPoint* poin
     UNUSED_PARAM(shouldAntialias); // FIXME
 }
 
-void GraphicsContext::fillPath()
+void GraphicsContext::fillPath(const Path& path)
 {
     if (paintingDisabled())
         return;
 
+    // FIXME: Be smarter about this.
+    beginPath();
+    addPath(path);
+
     m_data->drawPath(VG_FILL_PATH, m_common->state.fillRule);
 }
 
-void GraphicsContext::strokePath()
+void GraphicsContext::strokePath(const Path& path)
 {
     if (paintingDisabled())
         return;
 
-    m_data->drawPath(VG_STROKE_PATH, m_common->state.fillRule);
-}
+    // FIXME: Be smarter about this.
+    beginPath();
+    addPath(path);
 
-void GraphicsContext::drawPath()
-{
-    if (paintingDisabled())
-        return;
-
-    m_data->drawPath(VG_FILL_PATH | VG_STROKE_PATH, m_common->state.fillRule);
+    m_data->drawPath(VG_STROKE_PATH, m_common->state.fillRule);
 }
 
 void GraphicsContext::fillRect(const FloatRect& rect)
@@ -221,11 +221,15 @@ void GraphicsContext::clip(const FloatRect& rect)
     m_data->intersectClipRect(rect);
 }
 
-void GraphicsContext::clipPath(WindRule clipRule)
+void GraphicsContext::clipPath(const Path& path, WindRule clipRule)
 {
     if (paintingDisabled())
         return;
 
+    // FIXME: Be smarter about this.
+    beginPath();
+    addPath(path);
+
     m_data->clipPath(*(m_data->currentPath()), PainterOpenVG::IntersectClip, clipRule);
 }
 
diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
index 86dabe1..3d8eb3c 100644
--- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
@@ -51,7 +51,6 @@
 #include "NotImplemented.h"
 #include "Path.h"
 #include "Pattern.h"
-#include "Pen.h"
 #include "TransparencyLayer.h"
 
 #include <QBrush>
@@ -201,9 +200,6 @@ public:
 
     InterpolationQuality imageInterpolationQuality;
 
-    // Only used by SVG for now.
-    QPainterPath currentPath;
-
     ContextShadow shadow;
     QStack<ContextShadow> shadowStack;
 
@@ -212,13 +208,6 @@ public:
         return shadow.m_type != ContextShadow::NoShadow;
     }
 
-    inline void clearCurrentPath()
-    {
-        if (!currentPath.elementCount())
-            return;
-        currentPath = QPainterPath();
-    }
-
     QRectF clipBoundingRect() const
     {
 #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
@@ -319,11 +308,6 @@ void GraphicsContext::restorePlatformState()
 
     m_data->p()->restore();
 
-    if (!m_data->currentPath.isEmpty() && m_common->state.pathTransform.isInvertible()) {
-        QTransform matrix = m_common->state.pathTransform;
-        m_data->currentPath = m_data->currentPath * matrix;
-    }
-
     if (m_data->shadowStack.isEmpty())
         m_data->shadow = ContextShadow();
     else
@@ -514,14 +498,14 @@ void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin
         p->setRenderHint(QPainter::Antialiasing, painterWasAntialiased);
 }
 
-void GraphicsContext::fillPath()
+void GraphicsContext::fillPath(const Path& path)
 {
     if (paintingDisabled())
         return;
 
     QPainter* p = m_data->p();
-    QPainterPath& path = m_data->currentPath; // Avoid detaching the QPainterPath
-    path.setFillRule(toQtFillRule(fillRule()));
+    QPainterPath platformPath = path.platformPath();
+    platformPath.setFillRule(toQtFillRule(fillRule()));
 
     if (m_data->hasShadow()) {
         ContextShadow* shadow = contextShadow();
@@ -535,19 +519,19 @@ void GraphicsContext::fillPath()
                 // so that the relative offset to its shape is kept.
                 QPointF translatedOffset(offset.x() / transform.m11(),
                                          offset.y() / transform.m22());
-                path.translate(translatedOffset);
-                p->fillPath(path, QColor(shadow->m_color));
-                path.translate(-translatedOffset);
+                platformPath.translate(translatedOffset);
+                p->fillPath(platformPath, QColor(shadow->m_color));
+                platformPath.translate(-translatedOffset);
             } else {
                 p->translate(offset);
-                p->fillPath(path, QColor(shadow->m_color));
+                p->fillPath(platformPath, QColor(shadow->m_color));
                 p->translate(-offset);
             }
         } else {
-            QPainter* shadowPainter = shadow->beginShadowLayer(p, path.controlPointRect());
+            QPainter* shadowPainter = shadow->beginShadowLayer(p, platformPath.controlPointRect());
             if (shadowPainter) {
                 shadowPainter->setCompositionMode(QPainter::CompositionMode_Source);
-                shadowPainter->fillPath(path, QColor(m_data->shadow.m_color));
+                shadowPainter->fillPath(platformPath, QColor(m_data->shadow.m_color));
                 shadow->endShadowLayer(p);
             }
         }
@@ -555,26 +539,24 @@ void GraphicsContext::fillPath()
     }
     if (m_common->state.fillPattern) {
         AffineTransform affine;
-        p->fillPath(path, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
+        p->fillPath(platformPath, QBrush(m_common->state.fillPattern->createPlatformPattern(affine)));
     } else if (m_common->state.fillGradient) {
         QBrush brush(*m_common->state.fillGradient->platformGradient());
         brush.setTransform(m_common->state.fillGradient->gradientSpaceTransform());
-        p->fillPath(path, brush);
+        p->fillPath(platformPath, brush);
     } else
-        p->fillPath(path, p->brush());
-
-    m_data->clearCurrentPath();
+        p->fillPath(platformPath, p->brush());
 }
 
-void GraphicsContext::strokePath()
+void GraphicsContext::strokePath(const Path& path)
 {
     if (paintingDisabled())
         return;
 
     QPainter* p = m_data->p();
     QPen pen(p->pen());
-    QPainterPath& path = m_data->currentPath; // Avoid detaching the QPainterPath
-    path.setFillRule(toQtFillRule(fillRule()));
+    QPainterPath platformPath = path.platformPath();
+    platformPath.setFillRule(toQtFillRule(fillRule()));
 
     if (m_data->hasShadow()) {
         ContextShadow* shadow = contextShadow();
@@ -591,21 +573,21 @@ void GraphicsContext::strokePath()
                 // so that the relative offset to its shape is kept.
                 QPointF translatedOffset(offset.x() / transform.m11(),
                                          offset.y() / transform.m22());
-                path.translate(translatedOffset);
-                p->strokePath(path, shadowPen);
-                path.translate(-translatedOffset);
+                platformPath.translate(translatedOffset);
+                p->strokePath(platformPath, shadowPen);
+                platformPath.translate(-translatedOffset);
             } else {
                 p->translate(offset);
-                p->strokePath(path, shadowPen);
+                p->strokePath(platformPath, shadowPen);
                 p->translate(-offset);
             }
         } else {
-            FloatRect boundingRect = path.controlPointRect();
+            FloatRect boundingRect = platformPath.controlPointRect();
             boundingRect.inflate(pen.miterLimit() + pen.widthF());
             QPainter* shadowPainter = shadow->beginShadowLayer(p, boundingRect);
             if (shadowPainter) {
                 shadowPainter->setOpacity(static_cast<qreal>(m_data->shadow.m_color.alpha()) / 255);
-                shadowPainter->strokePath(path, pen);
+                shadowPainter->strokePath(platformPath, pen);
                 shadow->endShadowLayer(p);
             }
         }
@@ -615,16 +597,15 @@ void GraphicsContext::strokePath()
         AffineTransform affine;
         pen.setBrush(QBrush(m_common->state.strokePattern->createPlatformPattern(affine)));
         p->setPen(pen);
-        p->strokePath(path, pen);
+        p->strokePath(platformPath, pen);
     } else if (m_common->state.strokeGradient) {
         QBrush brush(*m_common->state.strokeGradient->platformGradient());
         brush.setTransform(m_common->state.strokeGradient->gradientSpaceTransform());
         pen.setBrush(brush);
         p->setPen(pen);
-        p->strokePath(path, pen);
+        p->strokePath(platformPath, pen);
     } else
-        p->strokePath(path, pen);
-    m_data->clearCurrentPath();
+        p->strokePath(platformPath, pen);
 }
 
 static inline void drawRepeatPattern(QPainter* p, QPixmap* image, const FloatRect& rect, const bool repeatX, const bool repeatY)
@@ -811,30 +792,11 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef
     p->fillPath(path.platformPath(), QColor(color));
 }
 
-void GraphicsContext::beginPath()
-{
-    m_data->clearCurrentPath();
-}
-
-void GraphicsContext::addPath(const Path& path)
-{
-    if (!m_data->currentPath.elementCount()) {
-        m_data->currentPath = path.platformPath();
-        return;
-    }
-    m_data->currentPath.addPath(path.platformPath());
-}
-
 bool GraphicsContext::inTransparencyLayer() const
 {
     return m_data->layerCount;
 }
 
-PlatformPath* GraphicsContext::currentPath()
-{
-    return &m_data->currentPath;
-}
-
 ContextShadow* GraphicsContext::contextShadow()
 {
     return &m_data->shadow;
@@ -848,15 +810,15 @@ void GraphicsContext::clip(const FloatRect& rect)
     m_data->p()->setClipRect(rect, Qt::IntersectClip);
 }
 
-void GraphicsContext::clipPath(WindRule clipRule)
+void GraphicsContext::clipPath(const Path& path, WindRule clipRule)
 {
     if (paintingDisabled())
         return;
 
     QPainter* p = m_data->p();
-    QPainterPath newPath = m_data->currentPath;
-    newPath.setFillRule(clipRule == RULE_EVENODD ? Qt::OddEvenFill : Qt::WindingFill);
-    p->setClipPath(newPath, Qt::IntersectClip);
+    QPainterPath platformPath = path.platformPath();
+    platformPath.setFillRule(clipRule == RULE_EVENODD ? Qt::OddEvenFill : Qt::WindingFill);
+    p->setClipPath(platformPath, Qt::IntersectClip);
 }
 
 void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)
@@ -1085,12 +1047,10 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float width)
     if (paintingDisabled())
         return;
 
-    QPainterPath path;
+    Path path;
     path.addRect(rect);
     setStrokeThickness(width);
-    m_data->currentPath = path;
-
-    strokePath();
+    strokePath(path);
 }
 
 void GraphicsContext::setLineCap(LineCap lc)
@@ -1210,12 +1170,6 @@ void GraphicsContext::translate(float x, float y)
         return;
 
     m_data->p()->translate(x, y);
-
-    if (!m_data->currentPath.isEmpty()) {
-        QTransform matrix;
-        m_data->currentPath = m_data->currentPath * matrix.translate(-x, -y);
-        m_common->state.pathTransform.translate(x, y);
-    }
 }
 
 void GraphicsContext::rotate(float radians)
@@ -1224,12 +1178,6 @@ void GraphicsContext::rotate(float radians)
         return;
 
     m_data->p()->rotate(180 / M_PI*radians);
-
-    if (!m_data->currentPath.isEmpty()) {
-        QTransform matrix;
-        m_data->currentPath = m_data->currentPath * matrix.rotate(-180 / M_PI*radians);
-        m_common->state.pathTransform.rotate(radians);
-    }
 }
 
 void GraphicsContext::scale(const FloatSize& s)
@@ -1238,12 +1186,6 @@ void GraphicsContext::scale(const FloatSize& s)
         return;
 
     m_data->p()->scale(s.width(), s.height());
-
-    if (!m_data->currentPath.isEmpty()) {
-        QTransform matrix;
-        m_data->currentPath = m_data->currentPath * matrix.scale(1 / s.width(), 1 / s.height());
-        m_common->state.pathTransform.scaleNonUniform(s.width(), s.height());
-    }
 }
 
 void GraphicsContext::clipOut(const IntRect& rect)
@@ -1300,15 +1242,6 @@ void GraphicsContext::concatCTM(const AffineTransform& transform)
         return;
 
     m_data->p()->setWorldTransform(transform, true);
-
-    // Transformations to the context shouldn't transform the currentPath.
-    // We have to undo every change made to the context from the currentPath
-    // to avoid wrong drawings.
-    if (!m_data->currentPath.isEmpty() && transform.isInvertible()) {
-        QTransform matrix = transform.inverse();
-        m_data->currentPath = m_data->currentPath * matrix;
-        m_common->state.pathTransform.multiply(transform.toTransformationMatrix());
-    }
 }
 
 void GraphicsContext::setURLForRect(const KURL&, const IntRect&)
diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
index 7c0bcd1..6f6dce8 100644
--- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
@@ -420,11 +420,15 @@ void GraphicsContext::clipOut(const Path& p)
     platformContext()->canvas()->clipPath(path, SkRegion::kDifference_Op);
 }
 
-void GraphicsContext::clipPath(WindRule clipRule)
+void GraphicsContext::clipPath(const Path& pathToClip, WindRule clipRule)
 {
     if (paintingDisabled())
         return;
 
+    // FIXME: Be smarter about this.
+    beginPath();
+    addPath(pathToClip);
+
     SkPath path = platformContext()->currentPathInLocalCoordinates();
     if (!isPathSkiaSafe(getCTM(), path))
         return;
@@ -723,11 +727,15 @@ void GraphicsContext::drawRect(const IntRect& rect)
     platformContext()->drawRect(r);
 }
 
-void GraphicsContext::fillPath()
+void GraphicsContext::fillPath(const Path& pathToFill)
 {
     if (paintingDisabled())
         return;
 
+    // FIXME: Be smarter about this.
+    beginPath();
+    addPath(pathToFill);
+
     SkPath path = platformContext()->currentPathInLocalCoordinates();
     if (!isPathSkiaSafe(getCTM(), path))
       return;
@@ -1177,11 +1185,15 @@ void GraphicsContext::strokeArc(const IntRect& r, int startAngle, int angleSpan)
     platformContext()->canvas()->drawPath(path, paint);
 }
 
-void GraphicsContext::strokePath()
+void GraphicsContext::strokePath(const Path& pathToStroke)
 {
     if (paintingDisabled())
         return;
 
+    // FIXME: Be smarter about this.
+    beginPath();
+    addPath(pathToStroke);
+
     SkPath path = platformContext()->currentPathInLocalCoordinates();
     if (!isPathSkiaSafe(getCTM(), path))
         return;
diff --git a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
index 0802826..4faa29d 100644
--- a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
+++ b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
@@ -1325,8 +1325,12 @@ Color gradientAverageColor(const Gradient* gradient)
         , (stop.alpha + lastStop.alpha) * 0.5f);
 }
 
-void GraphicsContext::fillPath()
+void GraphicsContext::fillPath(const Path& path)
 {
+    // FIXME: Be smarter about this.
+    beginPath();
+    addPath(path);
+
     Color c = m_common->state.fillGradient
         ? gradientAverageColor(m_common->state.fillGradient.get())
         : fillColor();
@@ -1376,6 +1380,10 @@ void GraphicsContext::strokePath()
     if (!m_data->m_dc)
         return;
 
+    // FIXME: Be smarter about this.
+    beginPath();
+    addPath(path);
+
     OwnPtr<HPEN> pen = createPen(strokeColor(), strokeThickness(), strokeStyle());
 
     if (m_data->m_opacity < 1.0f || m_data->hasAlpha()) {
@@ -1900,7 +1908,7 @@ void GraphicsContext::setLineDash(const DashArray&, float)
     notImplemented();
 }
 
-void GraphicsContext::clipPath(WindRule)
+void GraphicsContext::clipPath(const Path&, WindRule)
 {
     notImplemented();
 }
diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
index 5007ffe..ba96352 100644
--- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
+++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
@@ -337,7 +337,7 @@ void GraphicsContext::clipOut(const IntRect&)
     notImplemented();
 }
 
-void GraphicsContext::clipPath(WindRule)
+void GraphicsContext::clipPath(const Path&, WindRule)
 {
     notImplemented();
 }
@@ -533,30 +533,32 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const
     return InterpolationDefault;
 }
 
-void GraphicsContext::fillPath()
+void GraphicsContext::fillPath(const Path& path)
 {
 #if USE(WXGC)
+    // FIXME: Be smarter about this.
+    beginPath();
+    addPath(path);
+
     wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
     if (gc)
         gc->FillPath(m_data->currentPath);
 #endif
 }
 
-void GraphicsContext::strokePath()
+void GraphicsContext::strokePath(const Path& path)
 {
 #if USE(WXGC)
+    // FIXME: Be smarter about this.
+    beginPath();
+    addPath(path);
+
     wxGraphicsContext* gc = m_data->context->GetGraphicsContext();
     if (gc)
         gc->StrokePath(m_data->currentPath);
 #endif
 }
 
-void GraphicsContext::drawPath()
-{
-    fillPath();
-    strokePath();
-}
-
 void GraphicsContext::fillRect(const FloatRect& rect)
 {
     if (paintingDisabled())
diff --git a/WebCore/rendering/RenderBoxModelObject.cpp b/WebCore/rendering/RenderBoxModelObject.cpp
index 143c72c..bd19165 100644
--- a/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/WebCore/rendering/RenderBoxModelObject.cpp
@@ -1064,7 +1064,6 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
             graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight);
             graphicsContext->clipOutRoundedRect(innerBorderRect, innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight);
             roundedPath.addRoundedRect(borderRect, topLeft, topRight, bottomLeft, bottomRight);
-            graphicsContext->addPath(roundedPath);
         }
     }
 
@@ -1805,13 +1804,10 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
             } else
                 path.addRect(holeRect);
 
-            context->beginPath();
-            context->addPath(path);
-
             context->setFillRule(RULE_EVENODD);
             context->setFillColor(fillColor, s->colorSpace());
             context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace());
-            context->fillPath();
+            context->fillPath(path);
 
             context->restore();
         }
diff --git a/WebCore/rendering/RenderEmbeddedObject.cpp b/WebCore/rendering/RenderEmbeddedObject.cpp
index b025394..294ffec 100644
--- a/WebCore/rendering/RenderEmbeddedObject.cpp
+++ b/WebCore/rendering/RenderEmbeddedObject.cpp
@@ -166,11 +166,9 @@ void RenderEmbeddedObject::paintReplaced(PaintInfo& paintInfo, int tx, int ty)
     
     context->save();
     context->clip(contentRect);
-    context->beginPath();
-    context->addPath(path);  
     context->setAlpha(m_missingPluginIndicatorIsPressed ? replacementTextPressedRoundedRectOpacity : replacementTextRoundedRectOpacity);
     context->setFillColor(m_missingPluginIndicatorIsPressed ? replacementTextRoundedRectPressedColor() : Color::white, style()->colorSpace());
-    context->fillPath();
+    context->fillPath(path);
 
     float labelX = roundf(replacementTextRect.location().x() + (replacementTextRect.size().width() - textWidth) / 2);
     float labelY = roundf(replacementTextRect.location().y() + (replacementTextRect.size().height() - font.height()) / 2 + font.ascent());
diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp
index b0e74ae..caff3bd 100644
--- a/WebCore/rendering/RenderObject.cpp
+++ b/WebCore/rendering/RenderObject.cpp
@@ -956,8 +956,7 @@ void RenderObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, IntRect
         lineDash.append(patWidth);
         lineDash.append(whiteSpaceWidth);
         graphicsContext->setLineDash(lineDash, patWidth);
-        graphicsContext->addPath(borderPath);
-        graphicsContext->strokePath();
+        graphicsContext->strokePath(borderPath);
         return;
     }
     case DOUBLE: {
diff --git a/WebCore/rendering/RenderSVGResource.h b/WebCore/rendering/RenderSVGResource.h
index 0230e98..6fc2dae 100644
--- a/WebCore/rendering/RenderSVGResource.h
+++ b/WebCore/rendering/RenderSVGResource.h
@@ -48,6 +48,7 @@ enum RenderSVGResourceMode {
 class Color;
 class FloatRect;
 class GraphicsContext;
+class Path;
 class RenderObject;
 class RenderStyle;
 class RenderSVGResourceSolidColor;
@@ -61,7 +62,7 @@ public:
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true) = 0;
 
     virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode) = 0;
-    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short) { }
+    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short, const Path*) { }
     virtual FloatRect resourceBoundingBox(RenderObject*) = 0;
 
     virtual RenderSVGResourceType resourceType() const = 0;
diff --git a/WebCore/rendering/RenderSVGResourceClipper.cpp b/WebCore/rendering/RenderSVGResourceClipper.cpp
index e7b9fbb..25ed1c3 100644
--- a/WebCore/rendering/RenderSVGResourceClipper.cpp
+++ b/WebCore/rendering/RenderSVGResourceClipper.cpp
@@ -151,9 +151,7 @@ bool RenderSVGResourceClipper::pathOnlyClipping(GraphicsContext* context, const
     // The SVG specification wants us to clip everything, if clip-path doesn't have a child.
     if (clipPath.isEmpty())
         clipPath.addRect(FloatRect());
-    context->beginPath();
-    context->addPath(clipPath);
-    context->clipPath(clipRule);
+    context->clipPath(clipPath, clipRule);
     return true;
 }
 
diff --git a/WebCore/rendering/RenderSVGResourceFilter.cpp b/WebCore/rendering/RenderSVGResourceFilter.cpp
index 72872f6..38d2357 100644
--- a/WebCore/rendering/RenderSVGResourceFilter.cpp
+++ b/WebCore/rendering/RenderSVGResourceFilter.cpp
@@ -254,7 +254,7 @@ bool RenderSVGResourceFilter::applyResource(RenderObject* object, RenderStyle*,
     return true;
 }
 
-void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsContext*& context, unsigned short resourceMode)
+void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsContext*& context, unsigned short resourceMode, const Path*)
 {
     ASSERT(object);
     ASSERT(context);
diff --git a/WebCore/rendering/RenderSVGResourceFilter.h b/WebCore/rendering/RenderSVGResourceFilter.h
index 32f61ea..5950c44 100644
--- a/WebCore/rendering/RenderSVGResourceFilter.h
+++ b/WebCore/rendering/RenderSVGResourceFilter.h
@@ -70,7 +70,7 @@ public:
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
     virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
-    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode);
+    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*);
 
     virtual FloatRect resourceBoundingBox(RenderObject*);
 
diff --git a/WebCore/rendering/RenderSVGResourceGradient.cpp b/WebCore/rendering/RenderSVGResourceGradient.cpp
index a757147..b76e7f8 100644
--- a/WebCore/rendering/RenderSVGResourceGradient.cpp
+++ b/WebCore/rendering/RenderSVGResourceGradient.cpp
@@ -230,7 +230,7 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle*
     return true;
 }
 
-void RenderSVGResourceGradient::postApplyResource(RenderObject* object, GraphicsContext*& context, unsigned short resourceMode)
+void RenderSVGResourceGradient::postApplyResource(RenderObject* object, GraphicsContext*& context, unsigned short resourceMode, const Path* path)
 {
     ASSERT(context);
     ASSERT(resourceMode != ApplyToDefaultMode);
@@ -258,11 +258,11 @@ void RenderSVGResourceGradient::postApplyResource(RenderObject* object, Graphics
 #else
         UNUSED_PARAM(object);
 #endif
-    } else {
+    } else if (path) {
         if (resourceMode & ApplyToFillMode)
-            context->fillPath();
+            context->fillPath(*path);
         else if (resourceMode & ApplyToStrokeMode)
-            context->strokePath();
+            context->strokePath(*path);
     }
 
     context->restore();
diff --git a/WebCore/rendering/RenderSVGResourceGradient.h b/WebCore/rendering/RenderSVGResourceGradient.h
index bc0b864..1c7f52d 100644
--- a/WebCore/rendering/RenderSVGResourceGradient.h
+++ b/WebCore/rendering/RenderSVGResourceGradient.h
@@ -51,7 +51,7 @@ public:
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
     virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
-    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode);
+    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*);
     virtual FloatRect resourceBoundingBox(RenderObject*) { return FloatRect(); }
 
 protected:
diff --git a/WebCore/rendering/RenderSVGResourcePattern.cpp b/WebCore/rendering/RenderSVGResourcePattern.cpp
index d2e4563..83754ad 100644
--- a/WebCore/rendering/RenderSVGResourcePattern.cpp
+++ b/WebCore/rendering/RenderSVGResourcePattern.cpp
@@ -182,16 +182,16 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle*
     return true;
 }
 
-void RenderSVGResourcePattern::postApplyResource(RenderObject*, GraphicsContext*& context, unsigned short resourceMode)
+void RenderSVGResourcePattern::postApplyResource(RenderObject*, GraphicsContext*& context, unsigned short resourceMode, const Path* path)
 {
     ASSERT(context);
     ASSERT(resourceMode != ApplyToDefaultMode);
 
-    if (!(resourceMode & ApplyToTextMode)) {
+    if (path && !(resourceMode & ApplyToTextMode)) {
         if (resourceMode & ApplyToFillMode)
-            context->fillPath();
+            context->fillPath(*path);
         else if (resourceMode & ApplyToStrokeMode)
-            context->strokePath();
+            context->strokePath(*path);
     }
 
     context->restore();
diff --git a/WebCore/rendering/RenderSVGResourcePattern.h b/WebCore/rendering/RenderSVGResourcePattern.h
index ba4aec4..ee3fb23 100644
--- a/WebCore/rendering/RenderSVGResourcePattern.h
+++ b/WebCore/rendering/RenderSVGResourcePattern.h
@@ -53,7 +53,7 @@ public:
     virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true);
 
     virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
-    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode);
+    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*);
     virtual FloatRect resourceBoundingBox(RenderObject*) { return FloatRect(); }
 
     virtual RenderSVGResourceType resourceType() const { return s_resourceType; }
diff --git a/WebCore/rendering/RenderSVGResourceSolidColor.cpp b/WebCore/rendering/RenderSVGResourceSolidColor.cpp
index 0c09652..1eb9da5 100644
--- a/WebCore/rendering/RenderSVGResourceSolidColor.cpp
+++ b/WebCore/rendering/RenderSVGResourceSolidColor.cpp
@@ -75,28 +75,17 @@ bool RenderSVGResourceSolidColor::applyResource(RenderObject* object, RenderStyl
     return true;
 }
 
-void RenderSVGResourceSolidColor::postApplyResource(RenderObject*, GraphicsContext*& context, unsigned short resourceMode)
+void RenderSVGResourceSolidColor::postApplyResource(RenderObject*, GraphicsContext*& context, unsigned short resourceMode, const Path* path)
 {
     ASSERT(context);
     ASSERT(resourceMode != ApplyToDefaultMode);
 
-    if (!(resourceMode & ApplyToTextMode)) {
+    if (path && !(resourceMode & ApplyToTextMode)) {
         if (resourceMode & ApplyToFillMode)
-            context->fillPath();
+            context->fillPath(*path);
         else if (resourceMode & ApplyToStrokeMode)
-            context->strokePath();
+            context->strokePath(*path);
     }
-
-#if PLATFORM(SKIA)
-    // FIXME: Move this into the GraphicsContext
-    // WebKit implicitly expects us to reset the path.
-    // For example in fillAndStrokePath() of RenderSVGPath.cpp the path is
-    // added back to the context after filling. This is because internally it
-    // calls CGContextFillPath() which closes the path.
-    context->beginPath();
-    context->platformContext()->setFillShader(0);
-    context->platformContext()->setStrokeShader(0);
-#endif
 }
 
 }
diff --git a/WebCore/rendering/RenderSVGResourceSolidColor.h b/WebCore/rendering/RenderSVGResourceSolidColor.h
index 44109db..72de3b2 100644
--- a/WebCore/rendering/RenderSVGResourceSolidColor.h
+++ b/WebCore/rendering/RenderSVGResourceSolidColor.h
@@ -37,7 +37,7 @@ public:
     virtual void removeClientFromCache(RenderObject*, bool = true) { }
 
     virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
-    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode);
+    virtual void postApplyResource(RenderObject*, GraphicsContext*&, unsigned short resourceMode, const Path*);
     virtual FloatRect resourceBoundingBox(RenderObject*) { return FloatRect(); }
 
     virtual RenderSVGResourceType resourceType() const { return s_resourceType; }
diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp
index 608cf4d..cbde49b 100644
--- a/WebCore/rendering/SVGRenderSupport.cpp
+++ b/WebCore/rendering/SVGRenderSupport.cpp
@@ -148,7 +148,7 @@ void SVGRenderSupport::finishRenderSVGContent(RenderObject* object, PaintInfo& p
     SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object);
     if (resources) {
         if (RenderSVGResourceFilter* filter = resources->filter()) {
-            filter->postApplyResource(object, paintInfo.context, ApplyToDefaultMode);
+            filter->postApplyResource(object, paintInfo.context, ApplyToDefaultMode, /* path */0);
             paintInfo.context = savedContext;
         }
     }
diff --git a/WebCore/rendering/svg/RenderSVGPath.cpp b/WebCore/rendering/svg/RenderSVGPath.cpp
index 483303f..0c8ac0c 100644
--- a/WebCore/rendering/svg/RenderSVGPath.cpp
+++ b/WebCore/rendering/svg/RenderSVGPath.cpp
@@ -148,19 +148,17 @@ void RenderSVGPath::layout()
 
 void RenderSVGPath::fillAndStrokePath(GraphicsContext* context)
 {
-    context->beginPath();
     RenderStyle* style = this->style();
 
     Color fallbackColor;
     if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(this, style, fallbackColor)) {
-        context->addPath(m_path);
         if (fillPaintingResource->applyResource(this, style, context, ApplyToFillMode))
-            fillPaintingResource->postApplyResource(this, context, ApplyToFillMode);
+            fillPaintingResource->postApplyResource(this, context, ApplyToFillMode, &m_path);
         else if (fallbackColor.isValid()) {
             RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
             fallbackResource->setColor(fallbackColor);
             if (fallbackResource->applyResource(this, style, context, ApplyToFillMode))
-                fallbackResource->postApplyResource(this, context, ApplyToFillMode);
+                fallbackResource->postApplyResource(this, context, ApplyToFillMode, &m_path);
         }
     }
 
@@ -169,30 +167,31 @@ void RenderSVGPath::fillAndStrokePath(GraphicsContext* context)
     if (!strokePaintingResource)
         return;
 
+    Path path;
+
+    bool nonScalingStroke = style->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE;
     bool restoreContext = false;
-    if (style->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE) {
+    if (nonScalingStroke) {
         SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(node());
         AffineTransform nonScalingStrokeTransform = element->getScreenCTM(SVGLocatable::DisallowStyleUpdate);
         if (!nonScalingStrokeTransform.isInvertible())
             return;
 
-        Path transformedPath = m_path;
-        transformedPath.transform(nonScalingStrokeTransform);
+        path = m_path;
+        path.transform(nonScalingStrokeTransform);
 
         context->save();
         context->concatCTM(nonScalingStrokeTransform.inverse());
-        context->addPath(transformedPath);
         restoreContext = true;
-    } else
-        context->addPath(m_path);
+    }
 
     if (strokePaintingResource->applyResource(this, style, context, ApplyToStrokeMode))
-        strokePaintingResource->postApplyResource(this, context, ApplyToStrokeMode);
+        strokePaintingResource->postApplyResource(this, context, ApplyToStrokeMode, nonScalingStroke ? &path : &m_path);
     else if (fallbackColor.isValid()) {
         RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
         fallbackResource->setColor(fallbackColor);
         if (fallbackResource->applyResource(this, style, context, ApplyToStrokeMode))
-            fallbackResource->postApplyResource(this, context, ApplyToStrokeMode);
+            fallbackResource->postApplyResource(this, context, ApplyToStrokeMode, nonScalingStroke ? &path : &m_path);
     }
 
     if (restoreContext)
diff --git a/WebCore/rendering/svg/SVGInlineTextBox.cpp b/WebCore/rendering/svg/SVGInlineTextBox.cpp
index d1f660a..5d0278b 100644
--- a/WebCore/rendering/svg/SVGInlineTextBox.cpp
+++ b/WebCore/rendering/svg/SVGInlineTextBox.cpp
@@ -318,14 +318,14 @@ bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, Render
     return true;
 }
 
-void SVGInlineTextBox::releasePaintingResource(GraphicsContext*& context)
+void SVGInlineTextBox::releasePaintingResource(GraphicsContext*& context, const Path* path)
 {
     ASSERT(m_paintingResource);
 
     RenderObject* parentRenderer = parent()->renderer();
     ASSERT(parentRenderer);
 
-    m_paintingResource->postApplyResource(parentRenderer, context, m_paintingResourceMode);
+    m_paintingResource->postApplyResource(parentRenderer, context, m_paintingResourceMode, path);
     m_paintingResource = 0;
 }
 
@@ -344,7 +344,7 @@ bool SVGInlineTextBox::prepareGraphicsContextForTextPainting(GraphicsContext*& c
 
 void SVGInlineTextBox::restoreGraphicsContextAfterTextPainting(GraphicsContext*& context, TextRun& textRun)
 {
-    releasePaintingResource(context);
+    releasePaintingResource(context, /* path */0);
 
 #if ENABLE(SVG_FONTS)
     textRun.setActivePaintingResource(0);
@@ -500,11 +500,9 @@ void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, ETextD
     path.addRect(FloatRect(fragment.x, y, fragment.width, thickness));
 
     context->save();
-    context->beginPath();
-    context->addPath(path);
 
     if (acquirePaintingResource(context, decorationRenderer, decorationStyle))
-        releasePaintingResource(context);
+        releasePaintingResource(context, &path);
 
     context->restore();
 }
diff --git a/WebCore/rendering/svg/SVGInlineTextBox.h b/WebCore/rendering/svg/SVGInlineTextBox.h
index 8e82dda..acc5e9f 100644
--- a/WebCore/rendering/svg/SVGInlineTextBox.h
+++ b/WebCore/rendering/svg/SVGInlineTextBox.h
@@ -68,7 +68,7 @@ private:
     TextRun constructTextRun(RenderStyle*, const SVGTextFragment&) const;
 
     bool acquirePaintingResource(GraphicsContext*&, RenderObject*, RenderStyle*);
-    void releasePaintingResource(GraphicsContext*&);
+    void releasePaintingResource(GraphicsContext*&, const Path*);
 
     bool prepareGraphicsContextForTextPainting(GraphicsContext*&, TextRun&, RenderStyle*);
     void restoreGraphicsContextAfterTextPainting(GraphicsContext*&, TextRun&);
diff --git a/WebCore/svg/SVGFont.cpp b/WebCore/svg/SVGFont.cpp
index 898c259..ffa01f2 100644
--- a/WebCore/svg/SVGFont.cpp
+++ b/WebCore/svg/SVGFont.cpp
@@ -534,12 +534,9 @@ void Font::drawTextUsingSVGFont(GraphicsContext* context, const TextRun& run,
                     Path glyphPath = identifier.pathData;
                     glyphPath.transform(glyphPathTransform);
 
-                    context->beginPath();
-                    context->addPath(glyphPath);
-
                     RenderStyle* style = run.referencingRenderObject() ? run.referencingRenderObject()->style() : 0;
                     if (activePaintingResource->applyResource(run.referencingRenderObject(), style, context, resourceMode))
-                        activePaintingResource->postApplyResource(run.referencingRenderObject(), context, resourceMode);
+                        activePaintingResource->postApplyResource(run.referencingRenderObject(), context, resourceMode, &glyphPath);
 
                     context->restore();
                 }
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index e4dc19d..7161503 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-30  Andreas Kling  <kling at webkit.org>
+
+        Reviewed by Dirk Schulze.
+
+        GraphicsContext: Remove "current path" and have strokePath, fillPath and clipPath take a Path argument
+        https://bugs.webkit.org/show_bug.cgi?id=48516
+
+        * UIProcess/FindIndicator.cpp:
+        (WebKit::FindIndicator::draw):
+
 2010-11-30  Steve Falkenburg  <sfalken at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/WebKit2/UIProcess/FindIndicator.cpp b/WebKit2/UIProcess/FindIndicator.cpp
index 159e3f0..1bab861 100644
--- a/WebKit2/UIProcess/FindIndicator.cpp
+++ b/WebKit2/UIProcess/FindIndicator.cpp
@@ -149,9 +149,8 @@ void FindIndicator::draw(GraphicsContext& graphicsContext, const IntRect& dirtyR
         graphicsContext.save();
         FloatRect outerPathRect = inflateRect(textRect, horizontalOutsetToCenterOfLightBorder, verticalOutsetToCenterOfLightBorder);
         graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, shadowColor(), ColorSpaceSRGB);
-        graphicsContext.addPath(pathWithRoundedRect(outerPathRect, cornerRadius));
         graphicsContext.setFillColor(lightBorderColor(), ColorSpaceDeviceRGB);
-        graphicsContext.fillPath();
+        graphicsContext.fillPath(pathWithRoundedRect(outerPathRect, cornerRadius));
         graphicsContext.restore();
 
         graphicsContext.save();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list