2006-03-10 Rob Buis <buis@kde.org>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Mar 2006 02:26:07 +0000 (02:26 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Mar 2006 02:26:07 +0000 (02:26 +0000)
        Reviewed by darin.  Landed by eseidel.

        Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=7666:
        dasharray on rounded rectangles is broken

        Make sure the rounded rectangle is drawn clockwise, as outlined
        in the specification.

        Test: svg/custom/dashArrayOrigin.svg

        * kcanvas/KCanvasCreator.cpp:
        (WebCore::KCanvasCreator::createRoundedRectangle):

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/W3C-SVG-1.1/shapes-rect-01-t-expected.checksum
LayoutTests/svg/W3C-SVG-1.1/shapes-rect-01-t-expected.png
LayoutTests/svg/W3C-SVG-1.1/shapes-rect-01-t-expected.txt
LayoutTests/svg/custom/dasharrayOrigin-expected.checksum [new file with mode: 0644]
LayoutTests/svg/custom/dasharrayOrigin-expected.png [new file with mode: 0644]
LayoutTests/svg/custom/dasharrayOrigin-expected.txt [new file with mode: 0644]
LayoutTests/svg/custom/dasharrayOrigin.svg [new file with mode: 0644]
LayoutTests/svg/custom/fractional-rects-expected.txt
LayoutTests/svg/custom/rounded-rects-expected.txt
WebCore/ChangeLog
WebCore/kcanvas/KCanvasCreator.cpp

index c633d79053dcc8f72cf76529df5a3c8738ebf9a2..8f32abf9c6f166e2e416a84b897e12994fe1abe7 100644 (file)
@@ -1,3 +1,14 @@
+2006-03-12  Rob Buis  <buis@kde.org>
+
+        Reviewed by darin.  Landed by eseidel.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=7666
+
+        * svg/custom/dasharrayOrigin-expected.checksum: Added.
+        * svg/custom/dasharrayOrigin-expected.png: Added.
+        * svg/custom/dasharrayOrigin-expected.txt: Added.
+        * svg/custom/dasharrayOrigin.svg: Added.
+
 2006-03-12  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Maciej, landed by ap.
index 3f751244f047eec0aab7d402b52e1b179bc6c9bf..0d3b90b7de2a03c356d0b8b27b7e0a046e8ad986 100644 (file)
@@ -1 +1 @@
-392a7945178d151b2b5a2f3d01497ec1
\ No newline at end of file
+24050c9b415ffffa4c32cae97b12cd25
\ No newline at end of file
index 02ab202497479b8e1ab320b30c1318fe9f8da410..bde1c7bb4862977d99df417cb3626d2273f1e04b 100644 (file)
Binary files a/LayoutTests/svg/W3C-SVG-1.1/shapes-rect-01-t-expected.png and b/LayoutTests/svg/W3C-SVG-1.1/shapes-rect-01-t-expected.png differ
index bad840f5d72e260455749edd983e0ba6f46fc16a..fbaf00b9189c3e8c7aa446c0048007f8a2ee132b 100644 (file)
@@ -4,12 +4,12 @@ layer at (0,0) size 480x360
       KCanvasContainer {g} at (26,45.50) size 374x234.50
         KCanvasItem {rect} at (29.50,45.50) size 51x81 [stroke={[type=SOLID] [color=#000000]}] [data="M30.00,46.00L80.00,46.00L80.00,126.00L30.00,126.00"]
         KCanvasItem {rect} at (130,46) size 50x80 [fill={[type=SOLID] [color=#FF0000]}] [data="M130.00,46.00L180.00,46.00L180.00,126.00L130.00,126.00"]
-        KCanvasItem {rect} at (249.50,45.50) size 51x81 [stroke={[type=SOLID] [color=#000000]}] [data="M275.00,46.00C261.20,46.00,250.00,59.44,250.00,76.00L250.00,96.00C250.00,112.56,261.20,126.00,275.00,126.00C288.80,126.00,300.00,112.56,300.00,96.00L300.00,76.00C300.00,59.44,288.80,46.00,275.00,46.00"]
-        KCanvasItem {rect} at (350,46) size 50x80 [fill={[type=SOLID] [color=#FF0000]}] [data="M375.00,46.00C361.20,46.00,350.00,59.44,350.00,76.00L350.00,96.00C350.00,112.56,361.20,126.00,375.00,126.00C388.80,126.00,400.00,112.56,400.00,96.00L400.00,76.00C400.00,59.44,388.80,46.00,375.00,46.00"]
+        KCanvasItem {rect} at (249.50,45.50) size 51x81 [stroke={[type=SOLID] [color=#000000]}] [data="M275.00,46.00C288.80,46.00,300.00,59.44,300.00,76.00L300.00,96.00C300.00,112.56,288.80,126.00,275.00,126.00C261.20,126.00,250.00,112.56,250.00,96.00L250.00,76.00C250.00,59.44,261.20,46.00,275.00,46.00"]
+        KCanvasItem {rect} at (350,46) size 50x80 [fill={[type=SOLID] [color=#FF0000]}] [data="M375.00,46.00C388.80,46.00,400.00,59.44,400.00,76.00L400.00,96.00C400.00,112.56,388.80,126.00,375.00,126.00C361.20,126.00,350.00,112.56,350.00,96.00L350.00,76.00C350.00,59.44,361.20,46.00,375.00,46.00"]
         KCanvasItem {rect} at (26,192) size 58x88 [stroke={[type=SOLID] [color=#0000FF] [stroke width=8.00]}] [data="M30.00,196.00L80.00,196.00L80.00,276.00L30.00,276.00"]
         KCanvasItem {rect} at (126,192) size 58x88 [stroke={[type=SOLID] [color=#0000FF] [stroke width=8.00]}] [fill={[type=SOLID] [color=#00FF00]}] [data="M130.00,196.00L180.00,196.00L180.00,276.00L130.00,276.00"]
-        KCanvasItem {rect} at (246,192) size 58x88 [stroke={[type=SOLID] [color=#0000FF] [stroke width=8.00]}] [data="M275.00,196.00C261.20,196.00,250.00,213.92,250.00,236.00C250.00,258.08,261.20,276.00,275.00,276.00C288.80,276.00,300.00,258.08,300.00,236.00C300.00,213.92,288.80,196.00,275.00,196.00"]
-        KCanvasItem {rect} at (350,196) size 50x80 [fill={[type=SOLID] [color=#00FF00]}] [data="M375.00,196.00C361.20,196.00,350.00,213.92,350.00,236.00C350.00,258.08,361.20,276.00,375.00,276.00C388.80,276.00,400.00,258.08,400.00,236.00C400.00,213.92,388.80,196.00,375.00,196.00"]
+        KCanvasItem {rect} at (246,192) size 58x88 [stroke={[type=SOLID] [color=#0000FF] [stroke width=8.00]}] [data="M275.00,196.00C288.80,196.00,300.00,213.92,300.00,236.00C300.00,258.08,288.80,276.00,275.00,276.00C261.20,276.00,250.00,258.08,250.00,236.00C250.00,213.92,261.20,196.00,275.00,196.00"]
+        KCanvasItem {rect} at (350,196) size 50x80 [fill={[type=SOLID] [color=#00FF00]}] [data="M375.00,196.00C388.80,196.00,400.00,213.92,400.00,236.00C400.00,258.08,388.80,276.00,375.00,276.00C361.20,276.00,350.00,258.08,350.00,236.00C350.00,213.92,361.20,196.00,375.00,196.00"]
       RenderSVGText {text} at (0,0) size 465x46
         RenderText {TEXT} at (0,0) size 264x46
           text run at (0,0) width 264: "$Revision: 1.1 $"
diff --git a/LayoutTests/svg/custom/dasharrayOrigin-expected.checksum b/LayoutTests/svg/custom/dasharrayOrigin-expected.checksum
new file mode 100644 (file)
index 0000000..53b3c39
--- /dev/null
@@ -0,0 +1 @@
+332b5b50b5de2c0354c7b05921fcc092
\ No newline at end of file
diff --git a/LayoutTests/svg/custom/dasharrayOrigin-expected.png b/LayoutTests/svg/custom/dasharrayOrigin-expected.png
new file mode 100644 (file)
index 0000000..20d382f
Binary files /dev/null and b/LayoutTests/svg/custom/dasharrayOrigin-expected.png differ
diff --git a/LayoutTests/svg/custom/dasharrayOrigin-expected.txt b/LayoutTests/svg/custom/dasharrayOrigin-expected.txt
new file mode 100644 (file)
index 0000000..5e89b71
--- /dev/null
@@ -0,0 +1,9 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+    KCanvasContainer {svg} at (27.50,25) size 147.50x147.50
+      KCanvasItem {rect} at (42.50,42.50) size 115x115 [stroke={[type=SOLID] [color=#D3D3D3] [stroke width=15.00]}] [data="M100.00,50.00C127.60,50.00,150.00,72.40,150.00,100.00C150.00,127.60,127.60,150.00,100.00,150.00C72.40,150.00,50.00,127.60,50.00,100.00C50.00,72.40,72.40,50.00,100.00,50.00"]
+      KCanvasItem {rect} at (100,42.50) size 57.50x111.68 [stroke={[type=SOLID] [color=#008000] [stroke width=15.00] [dash array={100.00, 20.00, 20.00, 1000.00}]}] [data="M100.00,50.00C127.60,50.00,150.00,72.40,150.00,100.00C150.00,127.60,127.60,150.00,100.00,150.00C72.40,150.00,50.00,127.60,50.00,100.00C50.00,72.40,72.40,50.00,100.00,50.00"]
+      KCanvasItem {circle} at (47.50,47.50) size 105.00x105.00 [stroke={[type=SOLID] [color=#808080] [stroke width=5.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 (50.55,99.92) size 101.95x52.58 [stroke={[type=SOLID] [color=#FF0000] [stroke width=5.00] [dash array={100.00, 20.00, 20.00, 1000.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 {rect} at (27.50,27.50) size 145x145 [stroke={[type=SOLID] [color=#D3D3D3] [stroke width=5.00]}] [data="M50.00,30.00L150.00,30.00C161.04,30.00,170.00,38.96,170.00,50.00L170.00,150.00C170.00,161.04,161.04,170.00,150.00,170.00L50.00,170.00C38.96,170.00,30.00,161.04,30.00,150.00L30.00,50.00C30.00,38.96,38.96,30.00,50.00,30.00"]
+      KCanvasItem {rect} at (50,25) size 125x33.58 [stroke={[type=SOLID] [color=#0000FF] [stroke width=10.00] [dash array={100.00, 20.00, 20.00, 1000.00}]}] [data="M50.00,30.00L150.00,30.00C161.04,30.00,170.00,38.96,170.00,50.00L170.00,150.00C170.00,161.04,161.04,170.00,150.00,170.00L50.00,170.00C38.96,170.00,30.00,161.04,30.00,150.00L30.00,50.00C30.00,38.96,38.96,30.00,50.00,30.00"]
diff --git a/LayoutTests/svg/custom/dasharrayOrigin.svg b/LayoutTests/svg/custom/dasharrayOrigin.svg
new file mode 100644 (file)
index 0000000..3708b85
--- /dev/null
@@ -0,0 +1,12 @@
+<!-- This test is taken from http://svg-whiz.com/svg/w3c/dasharrayOrigin.svg -->
+<!-- Cross-browser results can be seen here: http://svg-whiz.com/svg/w3c/dasharrayOrigin.png -->
+<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
+ <rect x='50' y='50' width='100' height='100' rx='50' ry='50' fill='none' stroke='lightgray' stroke-width='15'/>
+ <rect x='50' y='50' width='100' height='100' rx='50' ry='50' fill='none' stroke='green' stroke-width='15' stroke-dasharray='100,20,20,1000'/>
+
+ <circle cx='100' cy='100' r='50' fill='none' stroke='gray' stroke-width='5'/>
+ <circle cx='100' cy='100' r='50' fill='none' stroke='red' stroke-width='5' stroke-dasharray='100,20,20,1000' />
+
+ <rect x='30' y='30' width='140' height='140' rx='20' ry='20' fill='none' stroke='lightgray' stroke-width='5'/>
+ <rect x='30' y='30' width='140' height='140' rx='20' ry='20' fill='none' stroke='blue' stroke-width='10' stroke-dasharray='100,20,20,1000'/>
+</svg>
index 7a15671833dddbf38e27891a1584f8a8d8b8a291..55735d0be2c318c62c8e92122438353cfd289396 100644 (file)
@@ -1,5 +1,5 @@
 layer at (0,0) size 800x600
   RenderCanvas at (0,0) size 800x600
     KCanvasContainer {svg} at (50.25,50.33) size 400.40x400.40
-      KCanvasItem {rect} at (50.25,50.33) size 400.40x400.40 [fill={[type=SOLID] [color=#00FF00]}] [data="M100.38,50.33C72.71,50.33,50.25,72.79,50.25,100.46L50.25,400.61C50.25,428.28,72.71,450.73,100.38,450.73L400.53,450.73C428.20,450.73,450.65,428.28,450.65,400.61L450.65,100.46C450.65,72.79,428.20,50.33,400.53,50.33L100.38,50.33"]
-      KCanvasItem {rect} at (150.90,100.33) size 200.35x300.34 [fill={[type=SOLID] [color=#0000FF]}] [data="M186.45,100.33C166.83,100.33,150.90,167.61,150.90,250.50C150.90,333.40,166.83,400.67,186.45,400.67L315.70,400.67C335.32,400.67,351.25,333.40,351.25,250.50C351.25,167.61,335.32,100.33,315.70,100.33L186.45,100.33"]
+      KCanvasItem {rect} at (50.25,50.33) size 400.40x400.40 [fill={[type=SOLID] [color=#00FF00]}] [data="M100.38,50.33L400.53,50.33C428.20,50.33,450.65,72.79,450.65,100.46L450.65,400.61C450.65,428.28,428.20,450.73,400.53,450.73L100.38,450.73C72.71,450.73,50.25,428.28,50.25,400.61L50.25,100.46C50.25,72.79,72.71,50.33,100.38,50.33"]
+      KCanvasItem {rect} at (150.90,100.33) size 200.35x300.34 [fill={[type=SOLID] [color=#0000FF]}] [data="M186.45,100.33L315.70,100.33C335.32,100.33,351.25,167.61,351.25,250.50C351.25,333.40,335.32,400.67,315.70,400.67L186.45,400.67C166.83,400.67,150.90,333.40,150.90,250.50C150.90,167.61,166.83,100.33,186.45,100.33"]
index 47cec653baf0b414d57c664891761ad3af8249ca..f339895eaaaaa2be5d31f237ad161347c8202ae2 100644 (file)
@@ -1,5 +1,5 @@
 layer at (0,0) size 800x600
   RenderCanvas at (0,0) size 800x600
     KCanvasContainer {svg} at (50,50) size 400x400
-      KCanvasItem {rect} at (50,50) size 400x400 [fill={[type=SOLID] [color=#00FF00]}] [data="M100.00,50.00C72.40,50.00,50.00,72.40,50.00,100.00L50.00,400.00C50.00,427.60,72.40,450.00,100.00,450.00L400.00,450.00C427.60,450.00,450.00,427.60,450.00,400.00L450.00,100.00C450.00,72.40,427.60,50.00,400.00,50.00L100.00,50.00"]
-      KCanvasItem {rect} at (150,100) size 200x300 [fill={[type=SOLID] [color=#0000FF]}] [data="M185.00,100.00C165.68,100.00,150.00,167.20,150.00,250.00C150.00,332.80,165.68,400.00,185.00,400.00L315.00,400.00C334.32,400.00,350.00,332.80,350.00,250.00C350.00,167.20,334.32,100.00,315.00,100.00L185.00,100.00"]
+      KCanvasItem {rect} at (50,50) size 400x400 [fill={[type=SOLID] [color=#00FF00]}] [data="M100.00,50.00L400.00,50.00C427.60,50.00,450.00,72.40,450.00,100.00L450.00,400.00C450.00,427.60,427.60,450.00,400.00,450.00L100.00,450.00C72.40,450.00,50.00,427.60,50.00,400.00L50.00,100.00C50.00,72.40,72.40,50.00,100.00,50.00"]
+      KCanvasItem {rect} at (150,100) size 200x300 [fill={[type=SOLID] [color=#0000FF]}] [data="M185.00,100.00L315.00,100.00C334.32,100.00,350.00,167.20,350.00,250.00C350.00,332.80,334.32,400.00,315.00,400.00L185.00,400.00C165.68,400.00,150.00,332.80,150.00,250.00C150.00,167.20,165.68,100.00,185.00,100.00"]
index eeab8a739c5e7aa4830167c531f737925ee4febf..d57763cbf7098d90bd1564cfbd0c79aefb63a011 100644 (file)
@@ -1,3 +1,18 @@
+2006-03-10  Rob Buis  <buis@kde.org>
+
+        Reviewed by darin.  Landed by eseidel.
+
+        Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=7666:
+        dasharray on rounded rectangles is broken
+
+        Make sure the rounded rectangle is drawn clockwise, as outlined
+        in the specification.
+
+        Test: svg/custom/dashArrayOrigin.svg
+
+        * kcanvas/KCanvasCreator.cpp:
+        (WebCore::KCanvasCreator::createRoundedRectangle):
+
 2006-03-12  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Maciej, landed by ap.
index 7ec4dcb3b1a08f3f5129c29f7313480f9142dc79..eeb7e792cdb40af239bd6140471ee3e13144eb62 100644 (file)
@@ -61,34 +61,35 @@ KCanvasPath* KCanvasCreator::createRoundedRectangle(float x, float y, float widt
     double nrx = rx, nry = ry;
     // If rx is greater than half of the width of the rectangle
     // then set rx to half of the width (required in SVG spec)
-    if(nrx > width / 2)
+    if (nrx > width / 2)
         nrx = width / 2;
 
     // If ry is greater than half of the height of the rectangle
     // then set ry to half of the height (required in SVG spec)
-    if(nry > height / 2)
+    if (nry > height / 2)
         nry = height / 2;
 
     path->moveTo(x + nrx, y);
-    path->curveTo(x + nrx * (1 - 0.552), y, x, y + nry * (1 - 0.552), x, y + nry);
 
-    if(nry < height / 2)
-        path->lineTo(x, y + height - nry);
+    if (nrx < width / 2)
+        path->lineTo(x + width - rx, y);
 
-    path->curveTo(x, y + height - nry * (1 - 0.552), x + nrx * (1 - 0.552), y + height, x + nrx, y + height);
+    path->curveTo(x + width - nrx * (1 - 0.552), y, x + width, y + nry * (1 - 0.552), x + width, y + nry);
 
-    if(nrx < width / 2)
-        path->lineTo(x + width - nrx, y + height);
+    if (nry < height / 2)
+        path->lineTo(x + width, y + height - nry);
 
-    path->curveTo(x + width - nrx * (1 - 0.552), y + height, x + width, y + height - nry * (1 - 0.552), x + width, y + height - nry);
+    path->curveTo(x + width, y + height - nry * (1 - 0.552), x + width - nrx * (1 - 0.552), y + height, x + width - nrx, y + height);
 
-    if(nry < height / 2)
-        path->lineTo(x + width, y + nry);
+    if (nrx < width / 2)
+        path->lineTo(x + nrx, y + height);
 
-    path->curveTo(x + width, y + nry * (1 - 0.552), x + width - nrx * (1 - 0.552), y, x + width - nrx, y);
+    path->curveTo(x + nrx * (1 - 0.552), y + height, x, y + height - nry * (1 - 0.552), x, y + height - nry);
 
-    if(nrx < width / 2)
-        path->lineTo(x + nrx, y);
+    if (nry < height / 2)
+        path->lineTo(x, y + nry);
+
+    path->curveTo(x, y + nry * (1 - 0.552), x + nrx * (1 - 0.552), y, x + nrx, y);
 
     path->closeSubpath();
     return path;