Title: [106464] trunk
Revision
106464
Author
[email protected]
Date
2012-02-01 05:31:11 -0800 (Wed, 01 Feb 2012)

Log Message

getIntersectionList causes transforms to be recalculated in SVG
https://bugs.webkit.org/show_bug.cgi?id=77179

Reviewed by Nikolas Zimmermann.

Introduce a local variable to store the element's local-to-parent
transformation matrix in, removing the need for the const_cast and
stopping us from modifying any matrices elsewhere.

Source/WebCore:

Test: svg/custom/intersection-list-transforms.svg

* rendering/svg/RenderSVGModelObject.cpp:
(WebCore::getElementCTM):

LayoutTests:

* svg/custom/intersection-list-transforms-expected.png: Added.
* svg/custom/intersection-list-transforms-expected.txt: Added.
* svg/custom/intersection-list-transforms.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (106463 => 106464)


--- trunk/LayoutTests/ChangeLog	2012-02-01 12:02:47 UTC (rev 106463)
+++ trunk/LayoutTests/ChangeLog	2012-02-01 13:31:11 UTC (rev 106464)
@@ -1,3 +1,18 @@
+2012-02-01  Peter Beverloo  <[email protected]>
+
+        getIntersectionList causes transforms to be recalculated in SVG
+        https://bugs.webkit.org/show_bug.cgi?id=77179
+
+        Reviewed by Nikolas Zimmermann.
+
+        Introduce a local variable to store the element's local-to-parent
+        transformation matrix in, removing the need for the const_cast and
+        stopping us from modifying any matrices elsewhere.
+
+        * svg/custom/intersection-list-transforms-expected.png: Added.
+        * svg/custom/intersection-list-transforms-expected.txt: Added.
+        * svg/custom/intersection-list-transforms.svg: Added.
+
 2012-02-01  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: [InspectorIndexedDB] Add tests for database names and database structure requests.

Added: trunk/LayoutTests/svg/custom/intersection-list-transforms-expected.png (0 => 106464)


--- trunk/LayoutTests/svg/custom/intersection-list-transforms-expected.png	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/intersection-list-transforms-expected.png	2012-02-01 13:31:11 UTC (rev 106464)
@@ -0,0 +1,8 @@
+\x89PNG
+
+
+IHDR X')tEXtchecksum088f986b3560ec0de1111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C4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4a\xBA
+\xA9\xBB\xD7\xACIEND\xAEB`\x82
\ No newline at end of file

Added: trunk/LayoutTests/svg/custom/intersection-list-transforms-expected.txt (0 => 106464)


--- trunk/LayoutTests/svg/custom/intersection-list-transforms-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/intersection-list-transforms-expected.txt	2012-02-01 13:31:11 UTC (rev 106464)
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 500x500
+  RenderSVGRoot {svg} at (0,0) size 149x149
+    RenderSVGContainer {g} at (0,0) size 149x149 [transform={m=((-0.71,0.71)(-0.71,-0.71)) t=(100.00,100.00)}]
+      RenderSVGRect {rect} at (0,0) size 149x149 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(0.00,0.00)}] [fill={[type=SOLID] [color=#008000]}] [x=1.00] [y=1.00] [width=100.00] [height=100.00]
+    RenderSVGText {text}

Added: trunk/LayoutTests/svg/custom/intersection-list-transforms.svg (0 => 106464)


--- trunk/LayoutTests/svg/custom/intersection-list-transforms.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/intersection-list-transforms.svg	2012-02-01 13:31:11 UTC (rev 106464)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- getIntersectionList causes transforms to be recalculated in SVG
+     https://bugs.webkit.org/show_bug.cgi?id=77179 -->
+<svg id="root" width="500" height="500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+  <script>
+    function runTest() {
+        var root = document.documentElement;
+        root.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "text"));
+        root.getIntersectionList(root.createSVGRect(), null);
+    }
+    window.addEventListener('load', runTest, false);
+  </script>
+  <!-- This test passes if there is a green non-rotated square visible on the top-left corner of the page. -->
+  <g transform="translate(100, 100) rotate(135)">
+    <rect x="1" y="1" width="100" height="100" fill="green" transform="rotate(45)" />
+  </g>
+</svg>
+

Modified: trunk/Source/WebCore/ChangeLog (106463 => 106464)


--- trunk/Source/WebCore/ChangeLog	2012-02-01 12:02:47 UTC (rev 106463)
+++ trunk/Source/WebCore/ChangeLog	2012-02-01 13:31:11 UTC (rev 106464)
@@ -1,3 +1,19 @@
+2012-02-01  Peter Beverloo  <[email protected]>
+
+        getIntersectionList causes transforms to be recalculated in SVG
+        https://bugs.webkit.org/show_bug.cgi?id=77179
+
+        Reviewed by Nikolas Zimmermann.
+
+        Introduce a local variable to store the element's local-to-parent
+        transformation matrix in, removing the need for the const_cast and
+        stopping us from modifying any matrices elsewhere.
+
+        Test: svg/custom/intersection-list-transforms.svg
+
+        * rendering/svg/RenderSVGModelObject.cpp:
+        (WebCore::getElementCTM):
+
 2012-02-01  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: [InspectorIndexedDB] Add tests for database names and database structure requests.

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp (106463 => 106464)


--- trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp	2012-02-01 12:02:47 UTC (rev 106463)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp	2012-02-01 13:31:11 UTC (rev 106464)
@@ -125,12 +125,15 @@
     SVGElement* stopAtElement = SVGLocatable::nearestViewportElement(element);
     ASSERT(stopAtElement);
 
+    AffineTransform localTransform;
     Node* current = element;
+
     while (current && current->isSVGElement()) {
         SVGElement* currentElement = static_cast<SVGElement*>(current);
-        if (currentElement->isStyled())
-            transform = const_cast<AffineTransform&>(currentElement->renderer()->localToParentTransform()).multiply(transform);
-
+        if (currentElement->isStyled()) {
+            localTransform = currentElement->renderer()->localToParentTransform();
+            transform = localTransform.multiply(transform);
+        }
         // For getCTM() computation, stop at the nearest viewport element
         if (currentElement == stopAtElement)
             break;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to