LayoutTests:
authorddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Jun 2006 21:55:46 +0000 (21:55 +0000)
committerddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Jun 2006 21:55:46 +0000 (21:55 +0000)
        Reviewed by Darin. Patch by Rob Buis.

        Test cases for
        <http://bugzilla.opendarwin.org/show_bug.cgi?id=9352>
        Webkit doesn't respect stroke-width in SVG for smaller <circle>s

        * svg/custom/gradient-stroke-width-expected.checksum: Added.
        * svg/custom/gradient-stroke-width-expected.png: Added.
        * svg/custom/gradient-stroke-width-expected.txt: Added.
        * svg/custom/gradient-stroke-width.svg: Added.

WebCore:

        Reviewed by Darin. Patch by Rob Buis.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=9352
        Webkit doesn't respect stroke-width in SVG for smaller <circle>s

        Make sure the stroke path is set before applying gradient transforms.

        * kcanvas/device/quartz/KRenderingPaintServerGradientQuartz.mm:
        (WebCore::KRenderingPaintServerGradientQuartz::setup):
        (WebCore::KRenderingPaintServerGradientQuartz::renderPath):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15021 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/svg/custom/gradient-stroke-width-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/gradient-stroke-width-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/gradient-stroke-width-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/gradient-stroke-width.svg [new file with mode: 0644]
WebCore/ChangeLog
WebCore/kcanvas/device/quartz/KRenderingPaintServerGradientQuartz.mm

index a7048bb3da6c243dffab616118cf14e70f7a266e..b9375f7a2443ad91a7236d8437761534b990d1ef 100644 (file)
@@ -1,3 +1,16 @@
+2006-06-24  Rob Buis  <buis@kde.org>
+
+        Reviewed by Darin.
+
+        Test cases for
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=9352>
+        Webkit doesn't respect stroke-width in SVG for smaller <circle>s
+
+        * svg/custom/gradient-stroke-width-expected.checksum: Added.
+        * svg/custom/gradient-stroke-width-expected.png: Added.
+        * svg/custom/gradient-stroke-width-expected.txt: Added.
+        * svg/custom/gradient-stroke-width.svg: Added.
+
 2006-06-24  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Darin, landed by ap.
diff --git a/LayoutTests/svg/custom/gradient-stroke-width-expected.checksum b/LayoutTests/svg/custom/gradient-stroke-width-expected.checksum
new file mode 100644 (file)
index 0000000..cd34b5f
--- /dev/null
@@ -0,0 +1,2 @@
+d399e6d6c22709ffa0ea8aba9ff44421
+\ No newline at end of file
diff --git a/LayoutTests/svg/custom/gradient-stroke-width-expected.png b/LayoutTests/svg/custom/gradient-stroke-width-expected.png
new file mode 100644 (file)
index 0000000..094bee5
Binary files /dev/null and b/LayoutTests/svg/custom/gradient-stroke-width-expected.png differ
diff --git a/LayoutTests/svg/custom/gradient-stroke-width-expected.txt b/LayoutTests/svg/custom/gradient-stroke-width-expected.txt
new file mode 100644 (file)
index 0000000..fd86d6e
--- /dev/null
@@ -0,0 +1,9 @@
+KRenderingPaintServer {id="black2white" [type=LINEAR-GRADIENT] [stops=[(0.00,#000000), (1.00,#0000004C)]] [start=(0,0)] [end=(100,0)]}
+KRenderingPaintServer {id="red-grad" [type=LINEAR-GRADIENT] [stops=[(0.00,#D7433C), (1.00,#BD1F1844)]] [start=(0,0)] [end=(100,0)]}
+KRenderingPaintServer {id="red-radial-grad" [type=RADIAL-GRADIENT] [stops=[(0.00,#D7433C), (1.00,#BD1F1844)]] [center=(50,50)] [focal=(50,50)] [radius=50.00]}
+KRenderingPaintServer {id="border-grad" [type=LINEAR-GRADIENT] [stops=[(0.00,#000000), (1.00,#0000004C)]] [start=(5,95)] [end=(95,5)]}
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+    KCanvasContainer {svg} at (32.00,32.00) size 123.00x123.00
+      KCanvasItem {circle} at (45.00,45.00) size 110.00x110.00 [stroke={[type=LINEAR-GRADIENT] [stops=[(0.00,#000000), (1.00,#0000004C)]] [start=(5,95)] [end=(95,5)] [stroke width=10.00]}] [fill={[type=RADIAL-GRADIENT] [stops=[(0.00,#D7433C), (1.00,#BD1F1844)]] [center=(50,50)] [focal=(50,50)] [radius=50.00]}] [data="M150.00,100.00L149.90,103.14L149.61,106.27L149.11,109.37L148.43,112.43L147.55,115.45L146.49,118.41L145.24,121.29L143.82,124.09L142.22,126.79L140.45,129.39L138.53,131.87L136.45,134.23L134.23,136.45L131.87,138.53L129.39,140.45L126.79,142.22L124.09,143.82L121.29,145.24L118.41,146.49L115.45,147.55L112.43,148.43L109.37,149.11L106.27,149.61L103.14,149.90L100.00,150.00L96.86,149.90L93.73,149.61L90.63,149.11L87.57,148.43L84.55,147.55L81.59,146.49L78.71,145.24L75.91,143.82L73.21,142.22L70.61,140.45L68.13,138.53L65.77,136.45L63.55,134.23L61.47,131.87L59.55,129.39L57.78,126.79L56.18,124.09L54.76,121.29L53.51,118.41L52.45,115.45L51.57,112.43L50.89,109.37L50.39,106.27L50.10,103.14L50.00,100.00L50.10,96.86L50.39,93.73L50.89,90.63L51.57,87.57L52.45,84.55L53.51,81.59L54.76,78.71L56.18,75.91L57.78,73.21L59.55,70.61L61.47,68.13L63.55,65.77L65.77,63.55L68.13,61.47L70.61,59.55L73.21,57.78L75.91,56.18L78.71,54.76L81.59,53.51L84.55,52.45L87.57,51.57L90.63,50.89L93.73,50.39L96.86,50.10L100.00,50.00L103.14,50.10L106.27,50.39L109.37,50.89L112.43,51.57L115.45,52.45L118.41,53.51L121.29,54.76L124.09,56.18L126.79,57.78L129.39,59.55L131.87,61.47L134.23,63.55L136.45,65.77L138.53,68.13L140.45,70.61L142.22,73.21L143.82,75.91L145.24,78.71L146.49,81.59L147.55,84.55L148.43,87.57L149.11,90.63L149.61,93.73L149.90,96.86"]
+      KCanvasItem {circle} at (32.00,32.00) size 30.00x30.00 [stroke={[type=LINEAR-GRADIENT] [stops=[(0.00,#000000), (1.00,#0000004C)]] [start=(5,95)] [end=(95,5)] [stroke width=10.00]}] [fill={[type=RADIAL-GRADIENT] [stops=[(0.00,#D7433C), (1.00,#BD1F1844)]] [center=(50,50)] [focal=(50,50)] [radius=50.00]}] [data="M57.00,47.00L56.98,47.63L56.92,48.25L56.82,48.87L56.69,49.49L56.51,50.09L56.30,50.68L56.05,51.26L55.76,51.82L55.44,52.36L55.09,52.88L54.71,53.37L54.29,53.85L53.85,54.29L53.37,54.71L52.88,55.09L52.36,55.44L51.82,55.76L51.26,56.05L50.68,56.30L50.09,56.51L49.49,56.69L48.87,56.82L48.25,56.92L47.63,56.98L47.00,57.00L46.37,56.98L45.75,56.92L45.13,56.82L44.51,56.69L43.91,56.51L43.32,56.30L42.74,56.05L42.18,55.76L41.64,55.44L41.12,55.09L40.63,54.71L40.15,54.29L39.71,53.85L39.29,53.37L38.91,52.88L38.56,52.36L38.24,51.82L37.95,51.26L37.70,50.68L37.49,50.09L37.31,49.49L37.18,48.87L37.08,48.25L37.02,47.63L37.00,47.00L37.02,46.37L37.08,45.75L37.18,45.13L37.31,44.51L37.49,43.91L37.70,43.32L37.95,42.74L38.24,42.18L38.56,41.64L38.91,41.12L39.29,40.63L39.71,40.15L40.15,39.71L40.63,39.29L41.12,38.91L41.64,38.56L42.18,38.24L42.74,37.95L43.32,37.70L43.91,37.49L44.51,37.31L45.13,37.18L45.75,37.08L46.37,37.02L47.00,37.00L47.63,37.02L48.25,37.08L48.87,37.18L49.49,37.31L50.09,37.49L50.68,37.70L51.26,37.95L51.82,38.24L52.36,38.56L52.88,38.91L53.37,39.29L53.85,39.71L54.29,40.15L54.71,40.63L55.09,41.12L55.44,41.64L55.76,42.18L56.05,42.74L56.30,43.32L56.51,43.91L56.69,44.51L56.82,45.13L56.92,45.75L56.98,46.37"]
diff --git a/LayoutTests/svg/custom/gradient-stroke-width.svg b/LayoutTests/svg/custom/gradient-stroke-width.svg
new file mode 100644 (file)
index 0000000..cb6883c
--- /dev/null
@@ -0,0 +1,58 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="svgel" width="200px" height="200px">
+       <style type="text/css"><![CDATA[
+       svg {
+               background-color: #ccc;
+               height: 500px;
+       }
+       #background {
+               fill: white;
+       }
+       stop.black {
+               stop-color: #000;
+               stop-opacity: 1;
+       }
+       stop.white {
+               stop-color: #000;
+               stop-opacity: 0.3;
+       }
+       stop.darkred {
+               stop-color: #d7433c;
+               stop-opacity: 1;
+       }
+       stop.lightred {
+               stop-color: #bd1f18;
+               stop-opacity: 0.27;
+       }
+       stop.darkblue {
+               stop-color: #3c43d7;
+               stop-opacity: 1;
+       }
+       stop.lightblue {
+                stop-color: #181fbd;
+                stop-opacity: 0.27;
+       }
+       .line {
+               stroke: #000;
+       }
+       .circle {
+               fill: black;
+       }
+       .piece {
+               stroke-width:10px;
+       }
+       ]]></style>
+       <defs>
+               <linearGradient id="black2white">
+                       <stop class="black" offset="0"/>
+                       <stop class="white" offset="1"/>
+               </linearGradient>
+               <linearGradient id="red-grad">
+                       <stop class="darkred" offset="0"/>
+                       <stop class="lightred" offset="1"/>
+               </linearGradient>
+               <radialGradient r="50%" id="red-radial-grad" xlink:href="#red-grad"/>
+               <linearGradient x1="5%" y1="95%" x2="95%" y2="5%" id="border-grad" xlink:href="#black2white" />
+       </defs>
+       <circle id="circle" cx="100px" cy="100px" r="50px" style="fill:url(#red-radial-grad);stroke:url(#border-grad);" class="piece"/>
+       <circle cx="47px" cy="47px" r="10px" class="piece" style="fill:url(#red-radial-grad);stroke:url(#border-grad);"/>
+</svg>
index 493dfa30516c32cebe3b8a2cfb7df3b979c5c6ae..cc17ca166dee7a3397cbd5fed456ea5e37d3bc7a 100644 (file)
@@ -1,3 +1,16 @@
+2006-06-24  Rob Buis  <buis@kde.org>
+
+        Reviewed by Darin.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=9352
+        Webkit doesn't respect stroke-width in SVG for smaller <circle>s
+
+        Make sure the stroke path is set before applying gradient transforms.
+
+        * kcanvas/device/quartz/KRenderingPaintServerGradientQuartz.mm:
+        (WebCore::KRenderingPaintServerGradientQuartz::setup):
+        (WebCore::KRenderingPaintServerGradientQuartz::renderPath):
+
 2006-06-24  Alexey Proskuryakov  <ap@nypop.com>
 
         Rubber-stamped by Eric.
index e95395e8b744898477ab14ae49f1b12bb11cb23a..0de5f09d9d88b154641de1f5aa343bc9bd43800c 100644 (file)
@@ -238,20 +238,6 @@ bool KRenderingPaintServerGradientQuartz::setup(const KRenderingPaintServerGradi
     ASSERT(context != NULL);
     
     CGContextSaveGState(context);
-    // make the gradient fit in the bbox if necessary.
-    if (server->boundingBoxMode() && renderObject->isRenderPath()) { // no support for bounding boxes around text yet!
-        // get the object bbox
-        CGRect objectBBox = CGContextGetPathBoundingBox(context);
-        CGRect gradientBBox = CGRectMake(0,0,100,100); // FIXME - this is arbitrary no?
-        // generate a transform to map between the two.
-        CGAffineTransform gradientIntoObjectBBox = CGAffineTransformMakeMapBetweenRects(gradientBBox, objectBBox);
-        CGContextConcatCTM(context, gradientIntoObjectBBox);
-    }
-    
-    // apply the gradient's own transform
-    CGAffineTransform gradientTransform = CGAffineTransform(server->gradientTransform().qmatrix());
-    CGContextConcatCTM(context, gradientTransform);
-    
     CGContextSetAlpha(context, renderStyle->opacity());
     
     if ((type & APPLY_TO_FILL) && KSVGPainterFactory::isFilled(renderStyle)) {
@@ -286,10 +272,25 @@ void KRenderingPaintServerGradientQuartz::renderPath(const KRenderingPaintServer
     RenderStyle* renderStyle = path->style();
     ASSERT(context != NULL);
     
+    CGRect objectBBox;
+    if (server->boundingBoxMode())
+        objectBBox = CGContextGetPathBoundingBox(context);
     if ((type & APPLY_TO_FILL) && KSVGPainterFactory::isFilled(renderStyle))
         KRenderingPaintServerQuartzHelper::clipToFillPath(context, path);
     if ((type & APPLY_TO_STROKE) && KSVGPainterFactory::isStroked(renderStyle))
         KRenderingPaintServerQuartzHelper::clipToStrokePath(context, path);
+    // make the gradient fit in the bbox if necessary.
+    if (server->boundingBoxMode()) { // no support for bounding boxes around text yet!
+        // get the object bbox
+        CGRect gradientBBox = CGRectMake(0,0,100,100); // FIXME - this is arbitrary no?
+        // generate a transform to map between the two.
+        CGAffineTransform gradientIntoObjectBBox = CGAffineTransformMakeMapBetweenRects(gradientBBox, objectBBox);
+        CGContextConcatCTM(context, gradientIntoObjectBBox);
+    }
+    
+    // apply the gradient's own transform
+    CGAffineTransform gradientTransform = CGAffineTransform(server->gradientTransform().qmatrix());
+    CGContextConcatCTM(context, gradientTransform);
 }
 
 void KRenderingPaintServerGradientQuartz::teardown(const KRenderingPaintServerGradient *server, KRenderingDeviceContext* renderingContext, const RenderObject* renderObject, KCPaintTargetType type) const