Title: [143144] trunk
Revision
143144
Author
[email protected]
Date
2013-02-17 21:38:40 -0800 (Sun, 17 Feb 2013)

Log Message

Fix non-root SVG viewport under zoom
https://bugs.webkit.org/show_bug.cgi?id=99453

Reviewed by Dirk Schulze.

Source/WebCore:

The root SVG element handles zoom differently than other SVG nodes because it needs
to translate between CSS (where zoom is applied to all units) and SVG (where zoom is only
applied at the top level). A good description of this difference can be found here:
http://trac.webkit.org/browser/trunk/Source/WebCore/css/StyleResolver.cpp?rev=142855#L2598

SVG elements can appear as children in the SVG tree as well, and in this mode
SVGSVGElement should not consider the current zoom level. This patch fixes a bug
where non-root viewport calculations were removing zoom.

Test: svg/custom/symbol-zoom.html

* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::currentViewportSize):
    This change removes the unnecessary zoom calculation for non-root nodes. This is similar
    to how zoom is handled elsewhere, e.g., SVGSVGElement::localCoordinateSpaceTransform.

LayoutTests:

* svg/custom/symbol-zoom-expected.html: Added.
* svg/custom/symbol-zoom.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (143143 => 143144)


--- trunk/LayoutTests/ChangeLog	2013-02-18 05:30:08 UTC (rev 143143)
+++ trunk/LayoutTests/ChangeLog	2013-02-18 05:38:40 UTC (rev 143144)
@@ -1,3 +1,13 @@
+2013-02-17  Philip Rogers  <[email protected]>
+
+        Fix non-root SVG viewport under zoom
+        https://bugs.webkit.org/show_bug.cgi?id=99453
+
+        Reviewed by Dirk Schulze.
+
+        * svg/custom/symbol-zoom-expected.html: Added.
+        * svg/custom/symbol-zoom.html: Added.
+
 2013-02-17  Chris Fleizach  <[email protected]>
 
         WebSpeech: plumb through a method to generate fake speech jobs for testing

Added: trunk/LayoutTests/svg/custom/symbol-zoom-expected.html (0 => 143144)


--- trunk/LayoutTests/svg/custom/symbol-zoom-expected.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/symbol-zoom-expected.html	2013-02-18 05:38:40 UTC (rev 143144)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+body {
+  zoom: 2;
+}
+</style>
+</head>
+<body>
+<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300">
+  <rect x="0" y="0" width="100" height="100" fill="green" />
+</svg>
+</body>
+</html>

Added: trunk/LayoutTests/svg/custom/symbol-zoom.html (0 => 143144)


--- trunk/LayoutTests/svg/custom/symbol-zoom.html	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/symbol-zoom.html	2013-02-18 05:38:40 UTC (rev 143144)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+body {
+  zoom: 2;
+}
+</style>
+</head>
+<body>
+<!-- Test for WK99453: This test passes if you see a green square and no red. -->
+<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300">
+  <defs>
+    <symbol id="sym" width="100%" height="100%">
+      <rect x="0%" y="0%" width="100%" height="100%" fill="green"/>
+    </symbol>
+  </defs>
+  <!-- This red square should be covered if the test passes. -->
+  <rect x="0" y="0" width="100" height="100" fill="red" />
+  <use xlink:href="" x="0" y="0" width="100" height="100"/>
+</svg>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (143143 => 143144)


--- trunk/Source/WebCore/ChangeLog	2013-02-18 05:30:08 UTC (rev 143143)
+++ trunk/Source/WebCore/ChangeLog	2013-02-18 05:38:40 UTC (rev 143144)
@@ -1,3 +1,26 @@
+2013-02-17  Philip Rogers  <[email protected]>
+
+        Fix non-root SVG viewport under zoom
+        https://bugs.webkit.org/show_bug.cgi?id=99453
+
+        Reviewed by Dirk Schulze.
+
+        The root SVG element handles zoom differently than other SVG nodes because it needs
+        to translate between CSS (where zoom is applied to all units) and SVG (where zoom is only
+        applied at the top level). A good description of this difference can be found here:
+        http://trac.webkit.org/browser/trunk/Source/WebCore/css/StyleResolver.cpp?rev=142855#L2598
+
+        SVG elements can appear as children in the SVG tree as well, and in this mode
+        SVGSVGElement should not consider the current zoom level. This patch fixes a bug
+        where non-root viewport calculations were removing zoom.
+
+        Test: svg/custom/symbol-zoom.html
+
+        * svg/SVGSVGElement.cpp:
+        (WebCore::SVGSVGElement::currentViewportSize):
+            This change removes the unnecessary zoom calculation for non-root nodes. This is similar
+            to how zoom is handled elsewhere, e.g., SVGSVGElement::localCoordinateSpaceTransform.
+
 2013-02-17  Chris Fleizach  <[email protected]>
 
         AX: Upstream iOS Accessibility files

Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (143143 => 143144)


--- trunk/Source/WebCore/svg/SVGSVGElement.cpp	2013-02-18 05:30:08 UTC (rev 143143)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp	2013-02-18 05:38:40 UTC (rev 143144)
@@ -598,7 +598,7 @@
     }
 
     FloatRect viewportRect = toRenderSVGViewportContainer(renderer())->viewport();
-    return FloatSize(viewportRect.width() / renderer()->style()->effectiveZoom(), viewportRect.height() / renderer()->style()->effectiveZoom());
+    return FloatSize(viewportRect.width(), viewportRect.height());
 }
 
 bool SVGSVGElement::widthAttributeEstablishesViewport() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to