Title: [94114] trunk
- Revision
- 94114
- Author
- [email protected]
- Date
- 2011-08-30 15:02:52 -0700 (Tue, 30 Aug 2011)
Log Message
SVG panning y-axis is flipped in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=65800
<rdar://problem/9908012>
Reviewed by Darin Adler.
We previously were not transforming the pointer coordinates passed
to SVGDocument's panning implementation into the coordinate space of
the contents, so on different platforms, the drag direction was different.
Test: svg/custom/pan-direction.svg
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (94113 => 94114)
--- trunk/LayoutTests/ChangeLog 2011-08-30 21:37:12 UTC (rev 94113)
+++ trunk/LayoutTests/ChangeLog 2011-08-30 22:02:52 UTC (rev 94114)
@@ -1,3 +1,18 @@
+2011-08-30 Tim Horton <[email protected]>
+
+ SVG panning y-axis is flipped in WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=65800
+ <rdar://problem/9908012>
+
+ Reviewed by Darin Adler.
+
+ Add a test which attempts to pan an SVG using eventSender.
+
+ * platform/chromium-linux/svg/custom/pan-direction-expected.png: Added.
+ * platform/mac/svg/custom/pan-direction-expected.png: Added.
+ * svg/custom/pan-direction-expected.txt: Added.
+ * svg/custom/pan-direction.svg: Added.
+
2011-08-30 Cary Clark <[email protected]>
LayoutTest expected results for Skia on Mac (animations and canvas directories only)
Added: trunk/LayoutTests/platform/chromium-linux/svg/custom/pan-direction-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/chromium-linux/svg/custom/pan-direction-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/svg/custom/pan-direction-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/svg/custom/pan-direction-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/svg/custom/pan-direction-expected.txt (0 => 94114)
--- trunk/LayoutTests/svg/custom/pan-direction-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/custom/pan-direction-expected.txt 2011-08-30 22:02:52 UTC (rev 94114)
@@ -0,0 +1,6 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderSVGRoot {svg} at (0,0) size 800x600
+ RenderSVGPath {rect} at (0,0) size 800x600 [fill={[type=SOLID] [color=#FF0000]}] [x=-1000.00] [y=-1000.00] [width=5000.00] [height=5000.00]
+ RenderSVGPath {rect} at (50,20) size 20x20 [fill={[type=SOLID] [color=#008000]}] [x=50.00] [y=50.00] [width=20.00] [height=20.00]
Added: trunk/LayoutTests/svg/custom/pan-direction.svg (0 => 94114)
--- trunk/LayoutTests/svg/custom/pan-direction.svg (rev 0)
+++ trunk/LayoutTests/svg/custom/pan-direction.svg 2011-08-30 22:02:52 UTC (rev 94114)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">
+<svg version="1.1" baseProfile="basic" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg-root" width="100%" height="100%" _onload_="runTest()">
+ <script type="text/ecmascript"><![CDATA[
+ function testPanUp(y) {
+ eventSender.mouseMoveTo(50, 50);
+ eventSender.mouseDown(0, ['shiftKey']);
+ eventSender.mouseMoveTo(50, 50 - y);
+ eventSender.mouseUp();
+ }
+ function runTest() {
+ if (window.eventSender) {
+ testPanUp(30);
+ } else {
+ // in manual mode
+ alert("Please use run-webkit-tests.");
+ }
+ }
+ ]]></script>
+ <rect x="-1000" y="-1000" width="5000" height="5000" fill="red" />
+ <rect x="50" y="50" width="20" height="20" fill="green" />
+</svg>
Modified: trunk/Source/WebCore/ChangeLog (94113 => 94114)
--- trunk/Source/WebCore/ChangeLog 2011-08-30 21:37:12 UTC (rev 94113)
+++ trunk/Source/WebCore/ChangeLog 2011-08-30 22:02:52 UTC (rev 94114)
@@ -1,3 +1,25 @@
+2011-08-30 Tim Horton <[email protected]>
+
+ SVG panning y-axis is flipped in WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=65800
+ <rdar://problem/9908012>
+
+ Reviewed by Darin Adler.
+
+ We previously were not transforming the pointer coordinates passed
+ to SVGDocument's panning implementation into the coordinate space of
+ the contents, so on different platforms, the drag direction was different.
+
+ Test: svg/custom/pan-direction.svg
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleMousePressEvent):
+ (WebCore::EventHandler::handleMouseMoveEvent):
+ (WebCore::EventHandler::handleMouseReleaseEvent):
+ * svg/SVGDocument.cpp:
+ (WebCore::SVGDocument::startPan):
+ (WebCore::SVGDocument::updatePan):
+
2011-08-30 Adam Barth <[email protected]>
Flaky crash with _javascript_ URLs
Modified: trunk/Source/WebCore/page/EventHandler.cpp (94113 => 94114)
--- trunk/Source/WebCore/page/EventHandler.cpp 2011-08-30 21:37:12 UTC (rev 94113)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2011-08-30 22:02:52 UTC (rev 94114)
@@ -473,7 +473,7 @@
&& static_cast<SVGDocument*>(m_frame->document())->zoomAndPanEnabled()) {
if (event.event().shiftKey() && singleClick) {
m_svgPan = true;
- static_cast<SVGDocument*>(m_frame->document())->startPan(event.event().pos());
+ static_cast<SVGDocument*>(m_frame->document())->startPan(m_frame->view()->windowToContents(event.event().pos()));
return true;
}
}
@@ -1561,7 +1561,7 @@
#if ENABLE(SVG)
if (m_svgPan) {
- static_cast<SVGDocument*>(m_frame->document())->updatePan(m_currentMousePosition);
+ static_cast<SVGDocument*>(m_frame->document())->updatePan(m_frame->view()->windowToContents(m_currentMousePosition));
return true;
}
#endif
@@ -1682,7 +1682,7 @@
#if ENABLE(SVG)
if (m_svgPan) {
m_svgPan = false;
- static_cast<SVGDocument*>(m_frame->document())->updatePan(m_currentMousePosition);
+ static_cast<SVGDocument*>(m_frame->document())->updatePan(m_frame->view()->windowToContents(m_currentMousePosition));
return true;
}
#endif
Modified: trunk/Source/WebCore/svg/SVGDocument.cpp (94113 => 94114)
--- trunk/Source/WebCore/svg/SVGDocument.cpp 2011-08-30 21:37:12 UTC (rev 94113)
+++ trunk/Source/WebCore/svg/SVGDocument.cpp 2011-08-30 22:02:52 UTC (rev 94114)
@@ -83,13 +83,13 @@
void SVGDocument::startPan(const FloatPoint& start)
{
if (rootElement())
- m_translate = FloatPoint(start.x() - rootElement()->currentTranslate().x(), rootElement()->currentTranslate().y() + start.y());
+ m_translate = FloatPoint(start.x() - rootElement()->currentTranslate().x(), start.y() - rootElement()->currentTranslate().y());
}
void SVGDocument::updatePan(const FloatPoint& pos) const
{
if (rootElement()) {
- rootElement()->setCurrentTranslate(FloatPoint(pos.x() - m_translate.x(), m_translate.y() - pos.y()));
+ rootElement()->setCurrentTranslate(FloatPoint(pos.x() - m_translate.x(), pos.y() - m_translate.y()));
if (renderer())
renderer()->repaint();
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes