Title: [98782] trunk
Revision
98782
Author
[email protected]
Date
2011-10-28 16:44:30 -0700 (Fri, 28 Oct 2011)

Log Message

Add support for sending scroll-update events from EventSender.
https://bugs.webkit.org/show_bug.cgi?id=66272

Patch by Sadrul Habib Chowdhury <[email protected]> on 2011-10-28
Reviewed by Adam Barth.

Source/WebKit/chromium:

* public/WebInputEvent.h:
(WebKit::WebGestureEvent::WebGestureEvent):
* src/WebInputEventConversion.cpp:
(WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder):
* src/WebPopupMenuImpl.cpp:
(WebKit::WebPopupMenuImpl::handleInputEvent):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::handleInputEvent):

Tools:

* DumpRenderTree/chromium/EventSender.cpp:
(EventSender::EventSender):
(EventSender::reset):
(EventSender::gestureScrollUpdate):
(EventSender::gestureEvent):
* DumpRenderTree/chromium/EventSender.h:

LayoutTests:

* fast/events/touch/gesture/gesture-scroll-expected.txt: Added.
* fast/events/touch/gesture/gesture-scroll.html: Added.
* platform/chromium/fast/events/touch/gesture/gesture-scroll-expected.txt: Added.
* platform/qt/Skipped:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (98781 => 98782)


--- trunk/LayoutTests/ChangeLog	2011-10-28 23:35:08 UTC (rev 98781)
+++ trunk/LayoutTests/ChangeLog	2011-10-28 23:44:30 UTC (rev 98782)
@@ -1,3 +1,15 @@
+2011-10-28 Sadrul Habib Chowdhury  <[email protected]>
+
+        Add support for sending scroll-update events from EventSender.
+        https://bugs.webkit.org/show_bug.cgi?id=66272
+
+        Reviewed by Adam Barth.
+
+        * fast/events/touch/gesture/gesture-scroll-expected.txt: Added.
+        * fast/events/touch/gesture/gesture-scroll.html: Added.
+        * platform/chromium/fast/events/touch/gesture/gesture-scroll-expected.txt: Added.
+        * platform/qt/Skipped:
+
 2011-10-28  Simon Fraser  <[email protected]>
 
         If visibility changes while an accelerated animation is running, element jumps around

Added: trunk/LayoutTests/fast/events/touch/gesture/gesture-scroll-expected.txt (0 => 98782)


--- trunk/LayoutTests/fast/events/touch/gesture/gesture-scroll-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/gesture-scroll-expected.txt	2011-10-28 23:44:30 UTC (rev 98782)
@@ -0,0 +1,10 @@
+This tests scroll gesture events. Square is (mostly) green on pass
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Gesture events not implemented on this platform or broken
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/touch/gesture/gesture-scroll.html (0 => 98782)


--- trunk/LayoutTests/fast/events/touch/gesture/gesture-scroll.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/gesture-scroll.html	2011-10-28 23:44:30 UTC (rev 98782)
@@ -0,0 +1,146 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+<style type="text/css">
+#gesturetarget {
+  width: 100px;
+  height: 100px;
+  position: relative;
+  background: white;
+}
+
+#movingbox {
+  width: 100%;
+  height: 100%;
+  position: absolute;
+  word-wrap: break-word;
+  overflow-y: scroll;
+  overflow-x: scroll;
+  display: block;
+}
+
+#greenbox {
+  width: 100px;
+  height: 100px;
+  background: green;
+  padding: 0px;
+  margin: 0px;
+}
+
+#redbox {
+  width: 100px;
+  height: 100px;
+  background: red;
+  padding: 0px;
+  margin: 0px;
+}
+
+td {
+  padding: 0px;
+}
+</style>
+</head>
+<body style="margin:0" _onload_="runTest();">
+<div id="gesturetarget">
+  <div id="movingbox">
+    <table border="0" cellspacing="0px">
+      <tr>
+        <td><div id="redbox"></div></td>
+        <td><div id="greenbox"></div></td>
+      </tr>
+      <tr>
+        <td><div id="greenbox"></div></td>
+        <td><div id="greenbox"></div></td>
+      </tr>
+    </table>
+  </div>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+<script type="text/_javascript_">
+
+var movingdiv;
+var expectedScrollsTotal = 2;
+var scrollsOccurred = 0;
+var scrollAmountX = ['90', '90'];
+var scrollAmountY = ['0', '95'];
+
+function checkScrollOffset()
+{
+    movingdiv = document.getElementById('movingbox');
+    if (window.eventSender) {
+        shouldBe('movingdiv.scrollTop', scrollAmountY[scrollsOccurred]);
+        shouldBe('movingdiv.scrollLeft', scrollAmountX[scrollsOccurred]);
+        scrollsOccurred++;
+    }
+
+    if (scrollsOccurred == expectedScrollsTotal) {
+        // If we've got here, we've passed.
+        successfullyParsed = true;
+        isSuccessfullyParsed();
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    } else {
+        secondGestureScrollSequence();
+    }
+}
+
+function firstGestureScrollSequence()
+{
+    debug("first gesture");
+
+    eventSender.gestureScrollBegin(95, 12);
+    eventSender.gestureScrollUpdate(-90, 0);
+    eventSender.gestureScrollEnd(0, 0);
+
+    // Wait for layout.
+    checkScrollOffset();
+}
+
+function secondGestureScrollSequence()
+{
+    debug("second gesture");
+
+    eventSender.gestureScrollBegin(12, 97);
+    eventSender.gestureScrollUpdate(0, -95);
+    eventSender.gestureScrollEnd(0, 0);
+
+    // Wait for layout.
+    checkScrollOffset();
+}
+
+function exitIfNecessary()
+{
+    debug('Gesture events not implemented on this platform or broken');
+    successfullyParsed = true;
+    isSuccessfullyParsed();
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+function runTest()
+{
+    var movingdiv = document.getElementById('movingbox');
+
+    if (window.eventSender) {
+        description('This tests scroll gesture events. ' +
+            'Square is (mostly) green on pass');
+
+        if (eventSender.clearTouchPoints)
+            firstGestureScrollSequence();
+        else
+            exitIfNecessary();
+    } else {
+        debug("This test requires DumpRenderTree.");
+    }
+}
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/gesture-scroll-expected.txt (0 => 98782)


--- trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/gesture-scroll-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/gesture-scroll-expected.txt	2011-10-28 23:44:30 UTC (rev 98782)
@@ -0,0 +1,15 @@
+This tests scroll gesture events. Square is (mostly) green on pass
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+first gesture
+PASS movingdiv.scrollTop is 0
+PASS movingdiv.scrollLeft is 90
+second gesture
+PASS movingdiv.scrollTop is 95
+PASS movingdiv.scrollLeft is 90
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/LayoutTests/platform/qt/Skipped (98781 => 98782)


--- trunk/LayoutTests/platform/qt/Skipped	2011-10-28 23:35:08 UTC (rev 98781)
+++ trunk/LayoutTests/platform/qt/Skipped	2011-10-28 23:44:30 UTC (rev 98782)
@@ -2222,6 +2222,9 @@
 # [Qt] Add eventSender.gestureTap
 # https://bugs.webkit.org/show_bug.cgi?id=66173
 fast/events/touch/gesture/gesture-click.html
+# New tests introduced in https://bugs.webkit.org/show_bug.cgi?id=66272. Needs
+# Qt implementation.
+fast/events/touch/gesture/gesture-scroll.html
 
 # new test introduced in r88958, but fail on Qt
 # https://bugs.webkit.org/show_bug.cgi?id=62741

Modified: trunk/Source/WebKit/chromium/ChangeLog (98781 => 98782)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-10-28 23:35:08 UTC (rev 98781)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-10-28 23:44:30 UTC (rev 98782)
@@ -1,3 +1,19 @@
+2011-10-28  Sadrul Habib Chowdhury  <[email protected]>
+ 
+        Add support for sending scroll-update events from EventSender.
+        https://bugs.webkit.org/show_bug.cgi?id=66272
+
+        Reviewed by Adam Barth.
+
+        * public/WebInputEvent.h:
+        (WebKit::WebGestureEvent::WebGestureEvent):
+        * src/WebInputEventConversion.cpp:
+        (WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder):
+        * src/WebPopupMenuImpl.cpp:
+        (WebKit::WebPopupMenuImpl::handleInputEvent):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::handleInputEvent):
+
 2011-10-28  James Robinson  <[email protected]>
 
         [chromium] Track wheel event handler registration and pass to input filter

Modified: trunk/Source/WebKit/chromium/public/WebInputEvent.h (98781 => 98782)


--- trunk/Source/WebKit/chromium/public/WebInputEvent.h	2011-10-28 23:35:08 UTC (rev 98781)
+++ trunk/Source/WebKit/chromium/public/WebInputEvent.h	2011-10-28 23:44:30 UTC (rev 98782)
@@ -103,6 +103,7 @@
         // WebGestureEvent
         GestureScrollBegin,
         GestureScrollEnd,
+        GestureScrollUpdate,
         GestureTap,
 
         // WebTouchEvent
@@ -334,12 +335,16 @@
     int y;
     int globalX;
     int globalY;
+    float deltaX;
+    float deltaY;
 
     WebGestureEvent(unsigned sizeParam = sizeof(WebGestureEvent))
         : x(0)
         , y(0)
         , globalX(0)
         , globalY(0)
+        , deltaX(0.0f)
+        , deltaY(0.0f)
     {
     }
 };

Modified: trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp (98781 => 98782)


--- trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp	2011-10-28 23:35:08 UTC (rev 98781)
+++ trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp	2011-10-28 23:44:30 UTC (rev 98782)
@@ -124,6 +124,9 @@
     case WebInputEvent::GestureScrollEnd:
         m_type = PlatformGestureEvent::ScrollEndType;
         break;
+    case WebInputEvent::GestureScrollUpdate:
+        m_type = PlatformGestureEvent::ScrollUpdateType;
+        break;
     case WebInputEvent::GestureTap:
         m_type = PlatformGestureEvent::TapType;
         break;
@@ -132,6 +135,8 @@
     }
     m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y));
     m_globalPosition = IntPoint(e.globalX, e.globalY);
+    m_deltaX = e.deltaX;
+    m_deltaY = e.deltaY;
     m_timestamp = e.timeStampSeconds;
     m_shiftKey = (e.modifiers & WebInputEvent::ShiftKey);
     m_ctrlKey = (e.modifiers & WebInputEvent::ControlKey);

Modified: trunk/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp (98781 => 98782)


--- trunk/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp	2011-10-28 23:35:08 UTC (rev 98781)
+++ trunk/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp	2011-10-28 23:44:30 UTC (rev 98782)
@@ -274,6 +274,7 @@
 
     case WebInputEvent::GestureScrollBegin:
     case WebInputEvent::GestureScrollEnd:
+    case WebInputEvent::GestureScrollUpdate:
     case WebInputEvent::GestureTap:
         return GestureEvent(*static_cast<const WebGestureEvent*>(&inputEvent));
 

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (98781 => 98782)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-10-28 23:35:08 UTC (rev 98781)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-10-28 23:44:30 UTC (rev 98782)
@@ -1281,6 +1281,7 @@
 #if ENABLE(GESTURE_EVENTS)
     case WebInputEvent::GestureScrollBegin:
     case WebInputEvent::GestureScrollEnd:
+    case WebInputEvent::GestureScrollUpdate:
     case WebInputEvent::GestureTap:
         handled = gestureEvent(*static_cast<const WebGestureEvent*>(&inputEvent));
         break;

Modified: trunk/Tools/ChangeLog (98781 => 98782)


--- trunk/Tools/ChangeLog	2011-10-28 23:35:08 UTC (rev 98781)
+++ trunk/Tools/ChangeLog	2011-10-28 23:44:30 UTC (rev 98782)
@@ -1,3 +1,17 @@
+2011-10-28  Sadrul Habib Chowdhury  <[email protected]>
+
+        Add support for sending scroll-update events from EventSender.
+        https://bugs.webkit.org/show_bug.cgi?id=66272
+
+        Reviewed by Adam Barth.
+
+        * DumpRenderTree/chromium/EventSender.cpp:
+        (EventSender::EventSender):
+        (EventSender::reset):
+        (EventSender::gestureScrollUpdate):
+        (EventSender::gestureEvent):
+        * DumpRenderTree/chromium/EventSender.h:
+
 2011-10-28  Eric Seidel  <[email protected]>
 
         new-run-webkit-tests: MASTER BUG: Switch all webkit.org bots over

Modified: trunk/Tools/DumpRenderTree/chromium/EventSender.cpp (98781 => 98782)


--- trunk/Tools/DumpRenderTree/chromium/EventSender.cpp	2011-10-28 23:35:08 UTC (rev 98781)
+++ trunk/Tools/DumpRenderTree/chromium/EventSender.cpp	2011-10-28 23:44:30 UTC (rev 98782)
@@ -280,6 +280,7 @@
     bindMethod("updateTouchPoint", &EventSender::updateTouchPoint);
     bindMethod("gestureScrollBegin", &EventSender::gestureScrollBegin);
     bindMethod("gestureScrollEnd", &EventSender::gestureScrollEnd);
+    bindMethod("gestureScrollUpdate", &EventSender::gestureScrollUpdate);
     bindMethod("gestureTap", &EventSender::gestureTap);
     bindMethod("zoomPageIn", &EventSender::zoomPageIn);
     bindMethod("zoomPageOut", &EventSender::zoomPageOut);
@@ -328,6 +329,7 @@
     touchModifiers = 0;
     touchPoints.clear();
     m_taskList.revokeAll();
+    m_gestureStartLocation = WebPoint(0, 0);
 }
 
 WebView* EventSender::webview()
@@ -1037,6 +1039,12 @@
     gestureEvent(WebInputEvent::GestureScrollEnd, arguments);
 }
 
+void EventSender::gestureScrollUpdate(const CppArgumentList& arguments, CppVariant* result)
+{
+    result->setNull();
+    gestureEvent(WebInputEvent::GestureScrollUpdate, arguments);
+}
+
 void EventSender::gestureTap(const CppArgumentList& arguments, CppVariant* result)
 {
     result->setNull();
@@ -1052,10 +1060,29 @@
 
     WebGestureEvent event;
     event.type = type;
-    event.x = point.x;
-    event.y = point.y;
-    event.globalX = point.x;
-    event.globalY = point.y;
+
+    switch (type) {
+    case WebInputEvent::GestureScrollUpdate:
+        event.deltaX = static_cast<float>(arguments[0].toDouble());
+        event.deltaY = static_cast<float>(arguments[1].toDouble());
+        event.x = m_gestureStartLocation.x + event.deltaX;
+        event.y = m_gestureStartLocation.y + event.deltaY;
+        break;
+
+    case WebInputEvent::GestureScrollBegin:
+        m_gestureStartLocation = WebPoint(point.x, point.y);
+        // Fallthrough
+    case WebInputEvent::GestureScrollEnd:
+    case WebInputEvent::GestureTap:
+        event.x = point.x;
+        event.y = point.y;
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+
+    event.globalX = event.x;
+    event.globalY = event.y;
     event.timeStampSeconds = getCurrentEventTimeSec();
     webview()->handleInputEvent(event);
 }

Modified: trunk/Tools/DumpRenderTree/chromium/EventSender.h (98781 => 98782)


--- trunk/Tools/DumpRenderTree/chromium/EventSender.h	2011-10-28 23:35:08 UTC (rev 98781)
+++ trunk/Tools/DumpRenderTree/chromium/EventSender.h	2011-10-28 23:44:30 UTC (rev 98782)
@@ -98,6 +98,7 @@
 
     void gestureScrollBegin(const CppArgumentList&, CppVariant*);
     void gestureScrollEnd(const CppArgumentList&, CppVariant*);
+    void gestureScrollUpdate(const CppArgumentList&, CppVariant*);
     void gestureTap(const CppArgumentList&, CppVariant*);
     void gestureEvent(WebKit::WebInputEvent::Type, const CppArgumentList&);
 
@@ -159,6 +160,9 @@
     // Non-owning pointer. The EventSender is owned by the TestShell.
     TestShell* m_shell;
 
+    // Location of the touch point that initiated a gesture.
+    WebKit::WebPoint m_gestureStartLocation;
+
     // Location of last mouseMoveTo event.
     static WebKit::WebPoint lastMousePos;
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to