Title: [149102] trunk
Revision
149102
Author
[email protected]
Date
2013-04-25 05:56:20 -0700 (Thu, 25 Apr 2013)

Log Message

SVG: Fix viewBox animations on shapes with non-scaling-stroke.
<http://webkit.org/b/115173>

Source/WebCore:

>From Blink r149058 by <[email protected]>:

Previously hasAttribute() to determine if a viewBox was set in the transform
code for non-scaling-strokes. hasAttribute() should not be used in this case,
as it will return false if the attribute is not set but the value is animating.

This patch switches to checking if the viewBox is empty instead of checking for
the presence of the attribute.

Test: svg/stroke/animated-non-scaling-stroke.html

* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::localCoordinateSpaceTransform):
* svg/SVGSVGElement.h:
(WebCore::SVGSVGElement::hasEmptyViewBox):

LayoutTests:

>From Blink r149058 by <[email protected]>.

* svg/stroke/animated-non-scaling-stroke-expected.html: Added.
* svg/stroke/animated-non-scaling-stroke.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (149101 => 149102)


--- trunk/LayoutTests/ChangeLog	2013-04-25 12:32:49 UTC (rev 149101)
+++ trunk/LayoutTests/ChangeLog	2013-04-25 12:56:20 UTC (rev 149102)
@@ -1,3 +1,13 @@
+2013-04-25  Andreas Kling  <[email protected]>
+
+        SVG: Fix viewBox animations on shapes with non-scaling-stroke.
+        <http://webkit.org/b/115173>
+
+        From Blink r149058 by <[email protected]>.
+
+        * svg/stroke/animated-non-scaling-stroke-expected.html: Added.
+        * svg/stroke/animated-non-scaling-stroke.html: Added.
+
 2013-04-25  Ádám Kallai  <[email protected]>
 
         [Qt] Unreviewed gardening. Unskip now passing tests.

Added: trunk/LayoutTests/svg/stroke/animated-non-scaling-stroke-expected.html (0 => 149102)


--- trunk/LayoutTests/svg/stroke/animated-non-scaling-stroke-expected.html	                        (rev 0)
+++ trunk/LayoutTests/svg/stroke/animated-non-scaling-stroke-expected.html	2013-04-25 12:56:20 UTC (rev 149102)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<body>
+  Test for crbug.com/232890: this test passes if there is a green square with a small blue border.<br/>
+  <svg id="actual" width="300" height="300" viewBox="0 0 25 25">
+    <rect x="2" y="2" width="2" height="2" vector-effect="non-scaling-stroke" stroke-width="2" stroke="blue" fill="green"/>
+  </svg>
+</body>
+</html>
+

Added: trunk/LayoutTests/svg/stroke/animated-non-scaling-stroke.html (0 => 149102)


--- trunk/LayoutTests/svg/stroke/animated-non-scaling-stroke.html	                        (rev 0)
+++ trunk/LayoutTests/svg/stroke/animated-non-scaling-stroke.html	2013-04-25 12:56:20 UTC (rev 149102)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<body>
+  Test for crbug.com/232890: this test passes if there is a green square with a small blue border.<br/>
+  <svg id="actual" width="300" height="300">
+    <rect x="2" y="2" width="2" height="2" vector-effect="non-scaling-stroke" stroke-width="2" stroke="blue" fill="green"/>
+    <set attributeName="viewBox" to="0 0 25 25" begin="0s" fill="freeze"/>
+  </svg>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (149101 => 149102)


--- trunk/Source/WebCore/ChangeLog	2013-04-25 12:32:49 UTC (rev 149101)
+++ trunk/Source/WebCore/ChangeLog	2013-04-25 12:56:20 UTC (rev 149102)
@@ -1,5 +1,26 @@
 2013-04-25  Andreas Kling  <[email protected]>
 
+        SVG: Fix viewBox animations on shapes with non-scaling-stroke.
+        <http://webkit.org/b/115173>
+
+        From Blink r149058 by <[email protected]>:
+
+        Previously hasAttribute() to determine if a viewBox was set in the transform
+        code for non-scaling-strokes. hasAttribute() should not be used in this case,
+        as it will return false if the attribute is not set but the value is animating.
+
+        This patch switches to checking if the viewBox is empty instead of checking for
+        the presence of the attribute.
+
+        Test: svg/stroke/animated-non-scaling-stroke.html
+
+        * svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::localCoordinateSpaceTransform):
+        * svg/SVGSVGElement.h:
+        (WebCore::SVGSVGElement::hasEmptyViewBox):
+
+2013-04-25  Andreas Kling  <[email protected]>
+
         Remove isPluginElement hack in Document::setFocusedNode()
         <http://webkit.org/b/115171>
 

Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (149101 => 149102)


--- trunk/Source/WebCore/svg/SVGSVGElement.cpp	2013-04-25 12:32:49 UTC (rev 149101)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp	2013-04-25 12:56:20 UTC (rev 149102)
@@ -437,7 +437,7 @@
 AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const
 {
     AffineTransform viewBoxTransform;
-    if (hasAttribute(SVGNames::viewBoxAttr)) {
+    if (!hasEmptyViewBox()) {
         FloatSize size = currentViewportSize();
         viewBoxTransform = viewBoxToViewTransform(size.width(), size.height());
     }

Modified: trunk/Source/WebCore/svg/SVGSVGElement.h (149101 => 149102)


--- trunk/Source/WebCore/svg/SVGSVGElement.h	2013-04-25 12:32:49 UTC (rev 149101)
+++ trunk/Source/WebCore/svg/SVGSVGElement.h	2013-04-25 12:56:20 UTC (rev 149102)
@@ -135,7 +135,7 @@
     SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; }
     void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); }
 
-    bool hasEmptyViewBox() { return hasAttribute(SVGNames::viewBoxAttr) && viewBoxIsValid() && viewBox().isEmpty(); }
+    bool hasEmptyViewBox() const { return viewBoxIsValid() && viewBox().isEmpty(); }
 
 protected:
     virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to