Diff
Modified: trunk/LayoutTests/ChangeLog (128308 => 128309)
--- trunk/LayoutTests/ChangeLog 2012-09-12 14:35:03 UTC (rev 128308)
+++ trunk/LayoutTests/ChangeLog 2012-09-12 14:36:26 UTC (rev 128309)
@@ -1,3 +1,13 @@
+2012-09-12 Florin Malita <fmal...@chromium.org>
+
+ getScreenCTM returns different values depending on zoom
+ https://bugs.webkit.org/show_bug.cgi?id=96361
+
+ Reviewed by Dirk Schulze.
+
+ * svg/zoom/page/zoom-get-screen-ctm-expected.txt: Added.
+ * svg/zoom/page/zoom-get-screen-ctm.html: Added.
+
2012-09-12 Allan Sandfeld Jensen <allan.jen...@nokia.com>
Unreviewed gardening. These tests should have been unskipped when fixed.
Added: trunk/LayoutTests/svg/zoom/page/zoom-get-screen-ctm-expected.txt (0 => 128309)
--- trunk/LayoutTests/svg/zoom/page/zoom-get-screen-ctm-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/zoom/page/zoom-get-screen-ctm-expected.txt 2012-09-12 14:36:26 UTC (rev 128309)
@@ -0,0 +1,14 @@
+This test checks getScreenCTM() on zoomed pages.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS CTM1 is "1, 0, 0, 1, 0, 100"
+PASS CTM2 is "1, 0, 0, 1, 100, 200"
+PASS CTM3 is "1, 0, 0, 1, 200, 300"
+PASS CTM4 is "1, 0, 0, 1, 300, 400"
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/svg/zoom/page/zoom-get-screen-ctm.html (0 => 128309)
--- trunk/LayoutTests/svg/zoom/page/zoom-get-screen-ctm.html (rev 0)
+++ trunk/LayoutTests/svg/zoom/page/zoom-get-screen-ctm.html 2012-09-12 14:36:26 UTC (rev 128309)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<body style="margin: 0px; padding: 0px;" _onload_="runRepaintTest()">
+ <div style="width: 100px; height: 100px;"></div>
+ <svg id="svg1" xmlns="http://www.w3.org/2000/svg" width="400" height="400">
+ <rect width="100" height="100" fill="green"/>
+ <svg id="svg2" x="100" y="100" width="300" height="300">
+ <rect width="100" height="100" fill="green"/>
+ <svg id="svg3" x="100" y="100" width="200" height="200">
+ <rect width="100" height="100" fill="green"/>
+ <svg id="svg4" x="100" y="100" width="100" height="100">
+ <rect width="100" height="100" fill="green"/>
+ </svg>
+ </svg>
+ </svg>
+ </svg>
+
+<script>
+ var zoomCount = 2;
+
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ window.postZoomCallback = executeTest;
+ }
+
+ function ctmToString(ctm) {
+ return [ ctm.a, ctm.b, ctm.c, ctm.d, ctm.e, ctm.f ].join(', ');
+ }
+
+ function executeTest() {
+ CTM1 = ctmToString(document.getElementById('svg1').getScreenCTM());
+ CTM2 = ctmToString(document.getElementById('svg2').getScreenCTM());
+ CTM3 = ctmToString(document.getElementById('svg3').getScreenCTM());
+ CTM4 = ctmToString(document.getElementById('svg4').getScreenCTM());
+
+ description("This test checks getScreenCTM() on zoomed pages.");
+
+ shouldBeEqualToString('CTM1', '1, 0, 0, 1, 0, 100');
+ shouldBeEqualToString('CTM2', '1, 0, 0, 1, 100, 200');
+ shouldBeEqualToString('CTM3', '1, 0, 0, 1, 200, 300');
+ shouldBeEqualToString('CTM4', '1, 0, 0, 1, 300, 400');
+ debug('');
+ }
+
+</script>
+<script src=""
+<script src=""
+<script src=""
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (128308 => 128309)
--- trunk/Source/WebCore/ChangeLog 2012-09-12 14:35:03 UTC (rev 128308)
+++ trunk/Source/WebCore/ChangeLog 2012-09-12 14:36:26 UTC (rev 128309)
@@ -1,3 +1,19 @@
+2012-09-12 Florin Malita <fmal...@chromium.org>
+
+ getScreenCTM returns different values depending on zoom
+ https://bugs.webkit.org/show_bug.cgi?id=96361
+
+ Reviewed by Dirk Schulze.
+
+ SVGSVGElement::localCoordinateSpaceTransform() needs to adjust for the
+ zoom level (which is already factored into CSS coordinates) at the
+ SVG/HTML boundary.
+
+ Test: svg/zoom/page/zoom-get-screen-ctm.html
+
+ * svg/SVGSVGElement.cpp:
+ (WebCore::SVGSVGElement::localCoordinateSpaceTransform):
+
2012-09-12 Simon Hausmann <simon.hausm...@nokia.com>
[Qt] Drastically shorten length of commandline needed for JS bindings generator
Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (128308 => 128309)
--- trunk/Source/WebCore/svg/SVGSVGElement.cpp 2012-09-12 14:35:03 UTC (rev 128308)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp 2012-09-12 14:36:26 UTC (rev 128309)
@@ -438,16 +438,21 @@
} else if (mode == SVGLocatable::ScreenScope) {
if (RenderObject* renderer = this->renderer()) {
FloatPoint location;
-
+ float zoomFactor = 1;
+
// At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderBoxTransform
// to map an element from SVG viewport coordinates to CSS box coordinates.
// RenderSVGRoot's localToAbsolute method expects CSS box coordinates.
- if (renderer->isSVGRoot())
+ // We also need to adjust for the zoom level factored into CSS coordinates (bug #96361).
+ if (renderer->isSVGRoot()) {
location = toRenderSVGRoot(renderer)->localToBorderBoxTransform().mapPoint(location);
-
+ zoomFactor = 1 / renderer->style()->effectiveZoom();
+ }
+
// Translate in our CSS parent coordinate space
// FIXME: This doesn't work correctly with CSS transforms.
location = renderer->localToAbsolute(location, false, true);
+ location.scale(zoomFactor, zoomFactor);
// Be careful here! localToBorderBoxTransform() included the x/y offset coming from the viewBoxToViewTransform(),
// so we have to subtract it here (original cause of bug #27183)
@@ -456,6 +461,7 @@
// Respect scroll offset.
if (FrameView* view = document()->view()) {
LayoutSize scrollOffset = view->scrollOffset();
+ scrollOffset.scale(zoomFactor);
transform.translate(-scrollOffset.width(), -scrollOffset.height());
}
}