Title: [122616] trunk
Revision
122616
Author
[email protected]
Date
2012-07-13 12:08:31 -0700 (Fri, 13 Jul 2012)

Log Message

Remove assert in localCoordinateSpaceTransform()
https://bugs.webkit.org/show_bug.cgi?id=91189

Reviewed by Nikolas Zimmermann.

Source/WebCore:

The assert in localCoordinateSpaceTransform was added to catch subclasses forgetting
to override the method but it is better to simply return the identity matrix.

This scenario can occur when we break the SVG content model, such as asking for
the CTM of a <g> element inside a <tspan>. This is undefined in the spec because
tspan is not a subclass of SVGLocatable but both Firefox and Opera
implement this by returning the identity matrix.

Test: svg/custom/invalid-ctm.svg

* svg/SVGStyledElement.cpp:
(WebCore::SVGStyledElement::localCoordinateSpaceTransform):

LayoutTests:

* svg/custom/invalid-ctm-expected.txt: Added.
* svg/custom/invalid-ctm.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (122615 => 122616)


--- trunk/LayoutTests/ChangeLog	2012-07-13 19:08:27 UTC (rev 122615)
+++ trunk/LayoutTests/ChangeLog	2012-07-13 19:08:31 UTC (rev 122616)
@@ -1,3 +1,13 @@
+2012-07-13  Philip Rogers  <[email protected]>
+
+        Remove assert in localCoordinateSpaceTransform()
+        https://bugs.webkit.org/show_bug.cgi?id=91189
+
+        Reviewed by Nikolas Zimmermann.
+
+        * svg/custom/invalid-ctm-expected.txt: Added.
+        * svg/custom/invalid-ctm.svg: Added.
+
 2012-07-13  David Grogan  <[email protected]>
 
         IndexedDB: Add unexpectedUpgradeNeededCallback to shared.js

Added: trunk/LayoutTests/svg/custom/invalid-ctm-expected.txt (0 => 122616)


--- trunk/LayoutTests/svg/custom/invalid-ctm-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/invalid-ctm-expected.txt	2012-07-13 19:08:31 UTC (rev 122616)
@@ -0,0 +1,3 @@
+Test for WK91189: getCTM() should not assert.
+getCTM() returned: [1,0,0,1,0,0]
+

Added: trunk/LayoutTests/svg/custom/invalid-ctm.svg (0 => 122616)


--- trunk/LayoutTests/svg/custom/invalid-ctm.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/invalid-ctm.svg	2012-07-13 19:08:31 UTC (rev 122616)
@@ -0,0 +1,43 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<body>
+    <svg xmlns="http://www.w3.org/2000/svg" width="500" height="300">
+        <text x="25" y="25">Test for WK91189: getCTM() should not assert.</text>
+        <text x="25" y="50" id="ctm"/>
+
+<a><altGlyph><altGlyphDef><altGlyphItem><circle><clipPath><color-profile>
+<cursor><defs><ellipse><feBlend><feColorMatrix><feComponentTransfer>
+<feComposite><feConvolveMatrix><feDiffuseLighting><feDisplacementMap>
+<feDistantLight><feFlood><feFuncA><feFuncB><feFuncG><feFuncR><feGaussianBlur>
+<feImage><feMerge><feMergeNode><feMorphology><feOffset><fePointLight>
+<feSpecularLighting><feSpotLight><feTile><feTurbulence><filter><font>
+<font-face><font-face-format><font-face-name><font-face-src><font-face-uri>
+<g><glyph><glyphRef><hkern><line><linearGradient><marker><mask><metadata>
+<missing-glyph><mpath><path><pattern><polygon><polyline><radialGradient><rect>
+<set><stop><svg><switch><symbol><text><textPath><tref><tspan><use><view><vkern>
+
+<g id="g">text</g>
+
+</vkern></view></use></tspan></tref></textPath></text></symbol></switch></svg>
+</stop></set></rect></radialGradient></polyline></polygon></pattern></path>
+</mpath></missing-glyph></metadata></mask></marker></linearGradient></line>
+</hkern></glyphRef></glyph></g></font-face-uri></font-face-src>
+</font-face-name></font-face-format></font-face></font></filter>
+</feTurbulence></feTile></feSpotLight></feSpecularLighting></fePointLight>
+</feOffset></feMorphology></feMergeNode></feMerge></feImage></feGaussianBlur>
+</feFuncR></feFuncG></feFuncB></feFuncA></feFlood></feDistantLight>
+</feDisplacementMap></feDiffuseLighting></feConvolveMatrix></feComposite>
+</feComponentTransfer></feColorMatrix></feBlend></ellipse></defs></cursor>
+</color-profile></clipPath></circle></altGlyphItem></altGlyphDef>
+</altGlyph></a>
+    </svg>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+        var ctm = document.getElementById("g").getCTM();
+        document.getElementById("ctm").textContent = "getCTM() returned: [" + 
+                                                     ctm.a + "," + ctm.b + "," + ctm.c + "," + 
+                                                     ctm.d + "," + ctm.e + "," + ctm.f + "]";;
+    </script>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (122615 => 122616)


--- trunk/Source/WebCore/ChangeLog	2012-07-13 19:08:27 UTC (rev 122615)
+++ trunk/Source/WebCore/ChangeLog	2012-07-13 19:08:31 UTC (rev 122616)
@@ -1,3 +1,23 @@
+2012-07-13  Philip Rogers  <[email protected]>
+
+        Remove assert in localCoordinateSpaceTransform()
+        https://bugs.webkit.org/show_bug.cgi?id=91189
+
+        Reviewed by Nikolas Zimmermann.
+
+        The assert in localCoordinateSpaceTransform was added to catch subclasses forgetting
+        to override the method but it is better to simply return the identity matrix.
+
+        This scenario can occur when we break the SVG content model, such as asking for
+        the CTM of a <g> element inside a <tspan>. This is undefined in the spec because
+        tspan is not a subclass of SVGLocatable but both Firefox and Opera
+        implement this by returning the identity matrix.
+
+        Test: svg/custom/invalid-ctm.svg
+
+        * svg/SVGStyledElement.cpp:
+        (WebCore::SVGStyledElement::localCoordinateSpaceTransform):
+
 2012-07-13  Kentaro Hara  <[email protected]>
 
         [V8] String wrappers should be marked Independent

Modified: trunk/Source/WebCore/svg/SVGStyledElement.cpp (122615 => 122616)


--- trunk/Source/WebCore/svg/SVGStyledElement.cpp	2012-07-13 19:08:27 UTC (rev 122615)
+++ trunk/Source/WebCore/svg/SVGStyledElement.cpp	2012-07-13 19:08:31 UTC (rev 122616)
@@ -451,7 +451,6 @@
 AffineTransform SVGStyledElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope) const
 {
     // To be overriden by SVGStyledLocatableElement/SVGStyledTransformableElement (or as special case SVGTextElement and SVGPatternElement)
-    ASSERT_NOT_REACHED();
     return AffineTransform();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to