[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf

krit at webkit.org krit at webkit.org
Tue Jan 5 23:42:39 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 0f13219b9ef0060d265ad064797a9e303899a91d
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 4 20:19:50 2009 +0000

    2009-12-04  Dirk Schulze  <krit at webkit.org>
    
            Reviewed by Nikolas Zimmermann.
    
            Gradient SVG animation demonstrates tearing at animation extremes
            https://bugs.webkit.org/show_bug.cgi?id=11929
    
            The focalPoint of a radial gradient is temporarly substracted by
            the centralPoint, if the focalPoint is not in the radius of the
            gradient. This is needed to calculate a new postion of the focalPoint
            according to the specification. But the new focalPoint needs to be
            moved by the centralPoint after this calculation, which is not the case
            at the moment. This patch fixes this issue. It was also introduced a
            deviation of maximal 0.2% for Cairo to get around the fixed point numbers
            in Cairo.
    
            W3C-SVG-1.1/pservers-grad-13-b needed an update. The missing adjustment
            of the new focalPoint caused wrong results for the last three tests.
    
            Test: svg/custom/radial-gradient-with-outstanding-focalPoint.svg
    
            * svg/SVGRadialGradientElement.cpp:
            (WebCore::SVGRadialGradientElement::buildGradient):
    
            Gradient SVG animation demonstrates tearing at animation extremes
            https://bugs.webkit.org/show_bug.cgi?id=11929
    
            In SVG a focalPoint must be inside the radius of a radial gradient.
            It this isn't the case, we have to move the focalPoint into the radius.
            This checks the correct behavior of WebKit on false values for fx, fy.
    
            * platform/mac/svg/W3C-SVG-1.1/pservers-grad-13-b-expected.checksum:
            * platform/mac/svg/W3C-SVG-1.1/pservers-grad-13-b-expected.png:
            * platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.checksum: Added.
            * platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.png: Added.
            * platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.txt: Added.
            * svg/custom/radial-gradient-with-outstanding-focalPoint.svg: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51708 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c1e2c82..3794407 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2009-12-04  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        Gradient SVG animation demonstrates tearing at animation extremes
+        https://bugs.webkit.org/show_bug.cgi?id=11929
+
+        In SVG a focalPoint must be inside the radius of a radial gradient.
+        It this isn't the case, we have to move the focalPoint into the radius.
+        This checks the correct behavior of WebKit on false values for fx, fy.
+
+        * platform/mac/svg/W3C-SVG-1.1/pservers-grad-13-b-expected.checksum:
+        * platform/mac/svg/W3C-SVG-1.1/pservers-grad-13-b-expected.png:
+        * platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.checksum: Added.
+        * platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.png: Added.
+        * platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.txt: Added.
+        * svg/custom/radial-gradient-with-outstanding-focalPoint.svg: Added.
+
 2009-12-04  Chris Fleizach  <cfleizach at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-13-b-expected.checksum b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-13-b-expected.checksum
index b2c834c..d8f81cc 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-13-b-expected.checksum
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-13-b-expected.checksum
@@ -1 +1 @@
-1057e5426ca845b73d4597e53eb4e6bf
\ No newline at end of file
+f7609cc7980e789d33a009b729585da2
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-13-b-expected.png b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-13-b-expected.png
index 02c7df2..5cee77e 100644
Binary files a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-13-b-expected.png and b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-13-b-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.checksum b/LayoutTests/platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.checksum
new file mode 100644
index 0000000..c1f89bd
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.checksum
@@ -0,0 +1 @@
+fd20552b05d94c5d9cad2f5a8861c981
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.png b/LayoutTests/platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.png
new file mode 100644
index 0000000..adb6a27
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.txt b/LayoutTests/platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.txt
new file mode 100644
index 0000000..e845b72
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/radial-gradient-with-outstanding-focalPoint-expected.txt
@@ -0,0 +1,25 @@
+KRenderingPaintServer {id="rad11" [type=RADIAL-GRADIENT] [stops=[(0.00,#FFFFFF), (1.00,#0000FF)]] [bounding box mode=0] [center=(50,50)] [focal=(100,100)] [radius=30.00]}
+KRenderingPaintServer {id="rad12" [type=RADIAL-GRADIENT] [stops=[(0.00,#FFFFFF), (1.00,#0000FF)]] [bounding box mode=0] [center=(170,50)] [focal=(120,0)] [radius=30.00]}
+KRenderingPaintServer {id="rad21" [type=RADIAL-GRADIENT] [stops=[(0.00,#FFFFFF), (1.00,#0000FF)]] [center=(0.50,0.50)] [focal=(1,1)] [radius=0.30]}
+KRenderingPaintServer {id="rad22" [type=RADIAL-GRADIENT] [stops=[(0.00,#FFFFFF), (1.00,#0000FF)]] [center=(0.50,0.50)] [focal=(0,0)] [radius=0.30]}
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (0,0) size 220x220
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGHiddenContainer {radialGradient} at (0,0) size 0x0
+        RenderSVGGradientStop {stop} at (0,0) size 0x0
+        RenderSVGGradientStop {stop} at (0,0) size 0x0
+      RenderSVGHiddenContainer {radialGradient} at (0,0) size 0x0
+        RenderSVGGradientStop {stop} at (0,0) size 0x0
+        RenderSVGGradientStop {stop} at (0,0) size 0x0
+      RenderSVGHiddenContainer {radialGradient} at (0,0) size 0x0
+        RenderSVGGradientStop {stop} at (0,0) size 0x0
+        RenderSVGGradientStop {stop} at (0,0) size 0x0
+      RenderSVGHiddenContainer {radialGradient} at (0,0) size 0x0
+        RenderSVGGradientStop {stop} at (0,0) size 0x0
+        RenderSVGGradientStop {stop} at (0,0) size 0x0
+    RenderPath {rect} at (0,0) size 100x100 [fill={[type=RADIAL-GRADIENT] [stops=[(0.00,#FFFFFF), (1.00,#0000FF)]] [bounding box mode=0] [center=(50,50)] [focal=(100,100)] [radius=30.00]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
+    RenderPath {rect} at (120,0) size 100x100 [fill={[type=RADIAL-GRADIENT] [stops=[(0.00,#FFFFFF), (1.00,#0000FF)]] [bounding box mode=0] [center=(170,50)] [focal=(120,0)] [radius=30.00]}] [data="M120.00,0.00 L220.00,0.00 L220.00,100.00 L120.00,100.00 Z"]
+    RenderPath {rect} at (0,120) size 100x100 [fill={[type=RADIAL-GRADIENT] [stops=[(0.00,#FFFFFF), (1.00,#0000FF)]] [center=(0.50,0.50)] [focal=(1,1)] [radius=0.30]}] [data="M0.00,120.00 L100.00,120.00 L100.00,220.00 L0.00,220.00 Z"]
+    RenderPath {rect} at (120,120) size 100x100 [fill={[type=RADIAL-GRADIENT] [stops=[(0.00,#FFFFFF), (1.00,#0000FF)]] [center=(0.50,0.50)] [focal=(0,0)] [radius=0.30]}] [data="M120.00,120.00 L220.00,120.00 L220.00,220.00 L120.00,220.00 Z"]
diff --git a/LayoutTests/svg/custom/radial-gradient-with-outstanding-focalPoint.svg b/LayoutTests/svg/custom/radial-gradient-with-outstanding-focalPoint.svg
new file mode 100644
index 0000000..7333ca8
--- /dev/null
+++ b/LayoutTests/svg/custom/radial-gradient-with-outstanding-focalPoint.svg
@@ -0,0 +1,27 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+<defs>
+<!-- userSpaceOnUse -->
+  <radialGradient id="rad11" cx="50" cy="50" r="30" fx="100" fy="100" gradientUnits="userSpaceOnUse">
+    <stop stop-color="white" offset="0" />
+    <stop stop-color="blue" offset="1" />
+  </radialGradient>
+  <radialGradient id="rad12" cx="170" cy="50" r="30" fx="120" fy="0" gradientUnits="userSpaceOnUse">
+    <stop stop-color="white" offset="0" />
+    <stop stop-color="blue" offset="1" />
+  </radialGradient>
+
+<!-- objectBoundingBox -->
+  <radialGradient id="rad21" cx="50%" cy="50%" r="30%" fx="100%" fy="100%">
+    <stop stop-color="white" offset="0" />
+    <stop stop-color="blue" offset="1" />
+  </radialGradient>
+  <radialGradient id="rad22" cx="50%" cy="50%" r="30%" fx="0%" fy="0%">
+    <stop stop-color="white" offset="0" />
+    <stop stop-color="blue" offset="1" />
+  </radialGradient>
+</defs>
+<rect width="100" height="100" fill="url(#rad11)" />
+<rect x="120" width="100" height="100" fill="url(#rad12)" />
+<rect y="120" width="100" height="100" fill="url(#rad21)" />
+<rect x="120" y="120" width="100" height="100" fill="url(#rad22)" />
+</svg>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3d33182..6887b3d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2009-12-04  Dirk Schulze  <krit at webkit.org>
+
+        Reviewed by Nikolas Zimmermann.
+
+        Gradient SVG animation demonstrates tearing at animation extremes
+        https://bugs.webkit.org/show_bug.cgi?id=11929
+
+        The focalPoint of a radial gradient is temporarly substracted by
+        the centralPoint, if the focalPoint is not in the radius of the
+        gradient. This is needed to calculate a new postion of the focalPoint
+        according to the specification. But the new focalPoint needs to be
+        moved by the centralPoint after this calculation, which is not the case
+        at the moment. This patch fixes this issue. It was also introduced a
+        deviation of maximal 0.2% for Cairo to get around the fixed point numbers
+        in Cairo.
+
+        W3C-SVG-1.1/pservers-grad-13-b needed an update. The missing adjustment
+        of the new focalPoint caused wrong results for the last three tests.
+
+        Test: svg/custom/radial-gradient-with-outstanding-focalPoint.svg
+
+        * svg/SVGRadialGradientElement.cpp:
+        (WebCore::SVGRadialGradientElement::buildGradient):
+
 2009-12-04  Anton Muhin  <antonm at chromium.org>
 
         Reviewed by Dmitry Titov.
diff --git a/WebCore/svg/SVGRadialGradientElement.cpp b/WebCore/svg/SVGRadialGradientElement.cpp
index a9b5cff..270de6f 100644
--- a/WebCore/svg/SVGRadialGradientElement.cpp
+++ b/WebCore/svg/SVGRadialGradientElement.cpp
@@ -105,23 +105,37 @@ void SVGRadialGradientElement::buildGradient() const
         radius = attributes.r().value(this);
     }
 
-    float adjustedFocusX = focalPoint.x();
-    float adjustedFocusY = focalPoint.y();
-
-    float fdx = focalPoint.x() - centerPoint.x();
-    float fdy = focalPoint.y() - centerPoint.y();
+    FloatPoint adjustedFocalPoint = focalPoint;
+    float dfx = focalPoint.x() - centerPoint.x();
+    float dfy = focalPoint.y() - centerPoint.y();
 
     // Spec: If (fx, fy) lies outside the circle defined by (cx, cy) and
     // r, set (fx, fy) to the point of intersection of the line through
     // (fx, fy) and the circle.
-    if (sqrt(fdx * fdx + fdy * fdy) > radius) {
-        float angle = atan2f(focalPoint.y() * 100.0f, focalPoint.x() * 100.0f);
-        adjustedFocusX = cosf(angle) * radius;
-        adjustedFocusY = sinf(angle) * radius;
+    if (sqrt(dfx * dfx + dfy * dfy) >= radius) {
+        float angle = atan2f(dfx, dfy);
+
+        // The maximum deviation of 0.2% is needed on Cairo, since Cairo
+        // is working with fixed point numbers.
+#if PLATFORM(CAIRO)
+        if (focalPoint.x() < centerPoint.x())
+            dfx = cosf(angle) * radius + 0.002f;
+        else
+            dfx = cosf(angle) * radius - 0.002f;
+        if (focalPoint.y() < centerPoint.y())
+            dfy = sinf(angle) * radius + 0.002f;
+        else
+            dfy = sinf(angle) * radius - 0.002f;
+#else
+        dfx = cosf(angle) * radius;
+        dfy = sinf(angle) * radius;
+#endif
+
+        adjustedFocalPoint = FloatPoint(dfx + centerPoint.x(), dfy + centerPoint.y());
     }
 
     RefPtr<Gradient> gradient = Gradient::create(
-        FloatPoint(adjustedFocusX, adjustedFocusY),
+        adjustedFocalPoint,
         0.f, // SVG does not support a "focus radius"
         centerPoint,
         radius);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list