[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

zimmermann at webkit.org zimmermann at webkit.org
Thu Apr 8 00:50:19 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 5fee27a03e1cc59d2c5af5f1af4a06c81817f659
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Dec 27 14:38:34 2009 +0000

    2009-12-27  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            Cleanup RenderPath code, related to markers. Pass around
            PaintInfo objects instead of GraphicsContext directly, to
            avoid having to recreate a new PaintInfo object in
            SVGResourceMarker::draw().
    
            No layout test changes.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52579 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 81e5042..59ec637 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2009-12-27  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        Cleanup RenderPath code, related to markers. Pass around
+        PaintInfo objects instead of GraphicsContext directly, to
+        avoid having to recreate a new PaintInfo object in
+        SVGResourceMarker::draw().
+
+        No layout test changes.
+
+        * rendering/RenderPath.cpp:
+        (WebCore::RenderPath::paint):
+        (WebCore::DrawMarkersData::DrawMarkersData):
+        (WebCore::drawMarkerWithData):
+        (WebCore::drawStartAndMidMarkers):
+        (WebCore::RenderPath::drawMarkersIfNeeded):
+        * rendering/RenderPath.h:
+        * svg/graphics/SVGResourceMarker.cpp:
+        (WebCore::SVGResourceMarker::draw):
+        * svg/graphics/SVGResourceMarker.h:
+
 2009-12-27  Patrick Gansterer  <paroga at paroga.com>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp
index 4a7662f..cced56c 100644
--- a/WebCore/rendering/RenderPath.cpp
+++ b/WebCore/rendering/RenderPath.cpp
@@ -196,7 +196,7 @@ void RenderPath::paint(PaintInfo& paintInfo, int, int)
         fillAndStrokePath(m_path, paintInfo.context, style(), this);
 
         if (static_cast<SVGStyledElement*>(node())->supportsMarkers())
-            m_markerBounds = drawMarkersIfNeeded(paintInfo.context, paintInfo.rect, m_path);
+            m_markerBounds = drawMarkersIfNeeded(paintInfo, m_path);
 
         finishRenderSVGContent(this, paintInfo, filter, savedInfo.context);
     }
@@ -254,15 +254,15 @@ struct MarkerData {
 };
 
 struct DrawMarkersData {
-    DrawMarkersData(GraphicsContext*, SVGResourceMarker* startMarker, SVGResourceMarker* midMarker, double strokeWidth);
-    GraphicsContext* context;
+    DrawMarkersData(RenderObject::PaintInfo&, SVGResourceMarker* startMarker, SVGResourceMarker* midMarker, double strokeWidth);
+    RenderObject::PaintInfo& paintInfo;
     int elementIndex;
     MarkerData previousMarkerData;
     SVGResourceMarker* midMarker;
 };
 
-DrawMarkersData::DrawMarkersData(GraphicsContext* c, SVGResourceMarker *start, SVGResourceMarker *mid, double strokeWidth)
-    : context(c)
+DrawMarkersData::DrawMarkersData(RenderObject::PaintInfo& pi, SVGResourceMarker* start, SVGResourceMarker* mid, double strokeWidth)
+    : paintInfo(pi)
     , elementIndex(0)
     , midMarker(mid)
 {
@@ -273,7 +273,7 @@ DrawMarkersData::DrawMarkersData(GraphicsContext* c, SVGResourceMarker *start, S
     previousMarkerData.type = Start;
 }
 
-static void drawMarkerWithData(GraphicsContext* context, MarkerData &data)
+static void drawMarkerWithData(RenderObject::PaintInfo& paintInfo, MarkerData& data)
 {
     if (!data.marker)
         return;
@@ -296,7 +296,7 @@ static void drawMarkerWithData(GraphicsContext* context, MarkerData &data)
             angle = inslope;
     }
 
-    data.marker->draw(context, FloatRect(), data.origin.x(), data.origin.y(), data.strokeWidth, angle);
+    data.marker->draw(paintInfo, data.origin.x(), data.origin.y(), data.strokeWidth, angle);
 }
 
 static inline void updateMarkerDataForElement(MarkerData& previousMarkerData, const PathElement* element)
@@ -343,7 +343,7 @@ static void drawStartAndMidMarkers(void* info, const PathElement* element)
 
     // Draw the marker for the previous element
     if (elementIndex != 0)
-        drawMarkerWithData(data.context, previousMarkerData);
+        drawMarkerWithData(data.paintInfo, previousMarkerData);
 
     // Update our marker data for this element
     updateMarkerDataForElement(previousMarkerData, element);
@@ -357,7 +357,7 @@ static void drawStartAndMidMarkers(void* info, const PathElement* element)
     data.elementIndex++;
 }
 
-FloatRect RenderPath::drawMarkersIfNeeded(GraphicsContext* context, const FloatRect&, const Path& path) const
+FloatRect RenderPath::drawMarkersIfNeeded(PaintInfo& paintInfo, const Path& path) const
 {
     Document* doc = document();
 
@@ -394,13 +394,13 @@ FloatRect RenderPath::drawMarkersIfNeeded(GraphicsContext* context, const FloatR
         return FloatRect();
 
     double strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, svgStyle->strokeWidth(), 1.0f);
-    DrawMarkersData data(context, startMarker, midMarker, strokeWidth);
+    DrawMarkersData data(paintInfo, startMarker, midMarker, strokeWidth);
 
     path.apply(&data, drawStartAndMidMarkers);
 
     data.previousMarkerData.marker = endMarker;
     data.previousMarkerData.type = End;
-    drawMarkerWithData(context, data.previousMarkerData);
+    drawMarkerWithData(paintInfo, data.previousMarkerData);
 
     // We know the marker boundaries, only after they're drawn!
     // Otherwhise we'd need to do all the marker calculation twice
diff --git a/WebCore/rendering/RenderPath.h b/WebCore/rendering/RenderPath.h
index 2ff179e..67c0a81 100644
--- a/WebCore/rendering/RenderPath.h
+++ b/WebCore/rendering/RenderPath.h
@@ -63,7 +63,7 @@ private:
 
     virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
 
-    FloatRect drawMarkersIfNeeded(GraphicsContext*, const FloatRect&, const Path&) const;
+    FloatRect drawMarkersIfNeeded(PaintInfo&, const Path&) const;
 
 private:
     virtual TransformationMatrix localTransform() const;
diff --git a/WebCore/svg/graphics/SVGResourceMarker.cpp b/WebCore/svg/graphics/SVGResourceMarker.cpp
index 112e4d6..5fdfc7e 100644
--- a/WebCore/svg/graphics/SVGResourceMarker.cpp
+++ b/WebCore/svg/graphics/SVGResourceMarker.cpp
@@ -61,7 +61,7 @@ void SVGResourceMarker::setRef(double refX, double refY)
     m_refY = refY;
 }
 
-void SVGResourceMarker::draw(GraphicsContext* context, const FloatRect& rect, double x, double y, double strokeWidth, double angle)
+void SVGResourceMarker::draw(RenderObject::PaintInfo& paintInfo, double x, double y, double strokeWidth, double angle)
 {
     if (!m_marker)
         return;
@@ -91,16 +91,12 @@ void SVGResourceMarker::draw(GraphicsContext* context, const FloatRect& rect, do
     if (m_useStrokeWidth)
         transform.scaleNonUniform(strokeWidth, strokeWidth);
 
-    // FIXME: PaintInfo should be passed into this method instead of being created here
-    // FIXME: bounding box fractions are lost
-    RenderObject::PaintInfo info(context, enclosingIntRect(rect), PaintPhaseForeground, 0, 0, 0);
-
-    context->save();
-    context->concatCTM(transform);
+    paintInfo.context->save();
+    paintInfo.context->concatCTM(transform);
     m_marker->setDrawsContents(true);
-    m_marker->paint(info, 0, 0);
+    m_marker->paint(paintInfo, 0, 0);
     m_marker->setDrawsContents(false);
-    context->restore();
+    paintInfo.context->restore();
 
     m_cachedBounds = transform.mapRect(m_marker->absoluteClippedOverflowRect());
 
diff --git a/WebCore/svg/graphics/SVGResourceMarker.h b/WebCore/svg/graphics/SVGResourceMarker.h
index bb4039c..5e63f5d 100644
--- a/WebCore/svg/graphics/SVGResourceMarker.h
+++ b/WebCore/svg/graphics/SVGResourceMarker.h
@@ -29,11 +29,11 @@
 #if ENABLE(SVG)
 
 #include "FloatRect.h"
+#include "RenderObject.h"
 #include "SVGResource.h"
 
 namespace WebCore {
 
-    class GraphicsContext;
     class RenderSVGViewportContainer;
 
     class SVGResourceMarker : public SVGResource {
@@ -55,7 +55,7 @@ namespace WebCore {
         bool useStrokeWidth() const { return m_useStrokeWidth; }
 
         FloatRect cachedBounds() const;
-        void draw(GraphicsContext*, const FloatRect&, double x, double y, double strokeWidth = 1, double angle = 0);
+        void draw(RenderObject::PaintInfo&, double x, double y, double strokeWidth = 1, double angle = 0);
         
         virtual SVGResourceType resourceType() const { return MarkerResourceType; }
         virtual TextStream& externalRepresentation(TextStream&) const;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list