Title: [134127] trunk
Revision
134127
Author
commit-qu...@webkit.org
Date
2012-11-09 15:54:39 -0800 (Fri, 09 Nov 2012)

Log Message

Correct scroll adjustment for touchEvent.clientX/clientY
https://bugs.webkit.org/show_bug.cgi?id=101800

Patch by Tien-Ren Chen <trc...@chromium.org> on 2012-11-09
Reviewed by Adam Barth.

FrameView::scrollX/scrollY returns scroll offset in (scaled) frame coordinate.
Convert to document coordinate before passing to _javascript_.

Source/WebCore:

Test: fast/events/touch/touch-scaled-scrolled.html

* dom/Touch.cpp:
(WebCore::contentsX):
(WebCore::contentsY):

LayoutTests:

* fast/events/touch/touch-scaled-scrolled-expected.txt: Added.
* fast/events/touch/touch-scaled-scrolled.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (134126 => 134127)


--- trunk/LayoutTests/ChangeLog	2012-11-09 23:52:11 UTC (rev 134126)
+++ trunk/LayoutTests/ChangeLog	2012-11-09 23:54:39 UTC (rev 134127)
@@ -1,3 +1,16 @@
+2012-11-09  Tien-Ren Chen  <trc...@chromium.org>
+
+        Correct scroll adjustment for touchEvent.clientX/clientY
+        https://bugs.webkit.org/show_bug.cgi?id=101800
+
+        Reviewed by Adam Barth.
+
+        FrameView::scrollX/scrollY returns scroll offset in (scaled) frame coordinate.
+        Convert to document coordinate before passing to _javascript_.
+
+        * fast/events/touch/touch-scaled-scrolled-expected.txt: Added.
+        * fast/events/touch/touch-scaled-scrolled.html: Added.
+
 2012-11-09  Alexandru Chiculita  <ach...@adobe.com>
 
         [Texmap][CSS Shaders] Enable CSS Shaders in TextureMapperGL

Added: trunk/LayoutTests/fast/events/touch/touch-scaled-scrolled-expected.txt (0 => 134127)


--- trunk/LayoutTests/fast/events/touch/touch-scaled-scrolled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/touch-scaled-scrolled-expected.txt	2012-11-09 23:54:39 UTC (rev 134127)
@@ -0,0 +1,2 @@
+This test is successful if event.clientX/Y are consistent with the generated input.
+15, 35

Added: trunk/LayoutTests/fast/events/touch/touch-scaled-scrolled.html (0 => 134127)


--- trunk/LayoutTests/fast/events/touch/touch-scaled-scrolled.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/touch-scaled-scrolled.html	2012-11-09 23:54:39 UTC (rev 134127)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body _onload_="runTest();" style="width:2000px;height:2000px;">
+<div>This test is successful if event.clientX/Y are consistent with the generated input.</div>
+<div id="result"></div>
+<script>
+function touched(e) {
+    document.getElementById("result").innerText = e.targetTouches[0].clientX + ', ' + e.targetTouches[0].clientY;
+    if (window.testRunner)
+        window.testRunner.notifyDone()
+}
+
+function runTest() {
+    if (window.internals)
+        window.internals.settings.setPageScaleFactor(2, 0, 0);
+    window.scrollTo(100,100);
+
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    document.addEventListener("touchstart", touched, false);
+    if (window.eventSender) {
+        eventSender.clearTouchPoints();
+        eventSender.addTouchPoint(30, 70);
+        eventSender.touchStart();
+    } else
+        debug("This test requires DumpRenderTree.");
+}
+</script>
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (134126 => 134127)


--- trunk/Source/WebCore/ChangeLog	2012-11-09 23:52:11 UTC (rev 134126)
+++ trunk/Source/WebCore/ChangeLog	2012-11-09 23:54:39 UTC (rev 134127)
@@ -1,3 +1,19 @@
+2012-11-09  Tien-Ren Chen  <trc...@chromium.org>
+
+        Correct scroll adjustment for touchEvent.clientX/clientY
+        https://bugs.webkit.org/show_bug.cgi?id=101800
+
+        Reviewed by Adam Barth.
+
+        FrameView::scrollX/scrollY returns scroll offset in (scaled) frame coordinate.
+        Convert to document coordinate before passing to _javascript_.
+
+        Test: fast/events/touch/touch-scaled-scrolled.html
+
+        * dom/Touch.cpp:
+        (WebCore::contentsX):
+        (WebCore::contentsY):
+
 2012-11-09  Alexandru Chiculita  <ach...@adobe.com>
 
         [Texmap][CSS Shaders] Enable CSS Shaders in TextureMapperGL

Modified: trunk/Source/WebCore/dom/Touch.cpp (134126 => 134127)


--- trunk/Source/WebCore/dom/Touch.cpp	2012-11-09 23:52:11 UTC (rev 134126)
+++ trunk/Source/WebCore/dom/Touch.cpp	2012-11-09 23:54:39 UTC (rev 134127)
@@ -42,7 +42,7 @@
     FrameView* frameView = frame->view();
     if (!frameView)
         return 0;
-    return frameView->scrollX() / frame->pageZoomFactor();
+    return frameView->scrollX() / frame->pageZoomFactor() / frame->frameScaleFactor();
 }
 
 static int contentsY(Frame* frame)
@@ -52,7 +52,7 @@
     FrameView* frameView = frame->view();
     if (!frameView)
         return 0;
-    return frameView->scrollY() / frame->pageZoomFactor();
+    return frameView->scrollY() / frame->pageZoomFactor() / frame->frameScaleFactor();
 }
 
 Touch::Touch(Frame* frame, EventTarget* target, unsigned identifier, int screenX, int screenY, int pageX, int pageY, int radiusX, int radiusY, float rotationAngle, float force)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to