Title: [116996] trunk/Source/WebKit/chromium
Revision
116996
Author
[email protected]
Date
2012-05-14 14:04:10 -0700 (Mon, 14 May 2012)

Log Message

[Chromium] android/WebInputEventFactory should handle wheel events and gesture events
https://bugs.webkit.org/show_bug.cgi?id=86270

Reviewed by Eric Seidel.

* public/android/WebInputEventFactory.h:
* src/android/WebInputEventFactory.cpp:
(WebKit::WebInputEventFactory::keyboardEvent):
(WebKit::WebInputEventFactory::mouseEvent):
(WebKit):
(WebKit::WebInputEventFactory::mouseWheelEvent):
(WebKit::WebInputEventFactory::gestureEvent):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (116995 => 116996)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-14 20:58:39 UTC (rev 116995)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-14 21:04:10 UTC (rev 116996)
@@ -1,3 +1,18 @@
+2012-05-14  Adam Barth  <[email protected]>
+
+        [Chromium] android/WebInputEventFactory should handle wheel events and gesture events
+        https://bugs.webkit.org/show_bug.cgi?id=86270
+
+        Reviewed by Eric Seidel.
+
+        * public/android/WebInputEventFactory.h:
+        * src/android/WebInputEventFactory.cpp:
+        (WebKit::WebInputEventFactory::keyboardEvent):
+        (WebKit::WebInputEventFactory::mouseEvent):
+        (WebKit):
+        (WebKit::WebInputEventFactory::mouseWheelEvent):
+        (WebKit::WebInputEventFactory::gestureEvent):
+
 2012-05-14  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r116983.

Modified: trunk/Source/WebKit/chromium/public/android/WebInputEventFactory.h (116995 => 116996)


--- trunk/Source/WebKit/chromium/public/android/WebInputEventFactory.h	2012-05-14 20:58:39 UTC (rev 116995)
+++ trunk/Source/WebKit/chromium/public/android/WebInputEventFactory.h	2012-05-14 21:04:10 UTC (rev 116996)
@@ -46,6 +46,13 @@
         MouseEventTypeMove,
     };
 
+    enum MouseWheelDirectionType {
+        MouseWheelDirectionTypeUp = 0,
+        MouseWheelDirectionTypeDown,
+        MouseWheelDirectionTypeLeft,
+        MouseWheelDirectionTypeRight,
+    };
+
     WEBKIT_EXPORT static WebKeyboardEvent keyboardEvent(WebInputEvent::Type,
                                                         int modifiers,
                                                         double timeStampSeconds,
@@ -53,15 +60,27 @@
                                                         WebUChar unicodeCharacter,
                                                         bool isSystemKey);
 
-    WEBKIT_EXPORT static WebMouseEvent mouseEvent(int x,
-                                                  int y,
+    WEBKIT_EXPORT static WebMouseEvent mouseEvent(MouseEventType,
+                                                  WebMouseEvent::Button,
+                                                  double timeStampSeconds,
                                                   int windowX,
                                                   int windowY,
-                                                  MouseEventType,
-                                                  double timeStampSeconds,
                                                   int modifiers,
-                                                  int clickCount,
-                                                  WebMouseEvent::Button = WebMouseEvent::ButtonLeft);
+                                                  int clickCount);
+
+    WEBKIT_EXPORT static WebMouseWheelEvent mouseWheelEvent(MouseWheelDirectionType,
+                                                            double timeStampSeconds,
+                                                            int windowX,
+                                                            int windowY);
+
+    WEBKIT_EXPORT static WebGestureEvent gestureEvent(WebInputEvent::Type,
+                                                      double timeStampSeconds,
+                                                      int x,
+                                                      int y,
+                                                      float deltaX,
+                                                      float deltaY,
+                                                      int modifiers);
+
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp (116995 => 116996)


--- trunk/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp	2012-05-14 20:58:39 UTC (rev 116995)
+++ trunk/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp	2012-05-14 21:04:10 UTC (rev 116996)
@@ -66,23 +66,20 @@
     return result;
 }
 
-WebMouseEvent WebInputEventFactory::mouseEvent(int x, int y,
-                                               int windowX, int windowY,
-                                               MouseEventType type,
+WebMouseEvent WebInputEventFactory::mouseEvent(MouseEventType type,
+                                               WebMouseEvent::Button button,
                                                double timeStampSeconds,
+                                               int windowX,
+                                               int windowY,
                                                int modifiers,
-                                               int clickCount,
-                                               WebMouseEvent::Button button)
+                                               int clickCount)
 {
     WebMouseEvent result;
 
-    result.x = x;
-    result.y = y;
+    result.x = windowX;
+    result.y = windowY;
     result.windowX = windowX;
     result.windowY = windowY;
-    // FIXME: We need to decide what to use for the globalX/Y.
-    result.globalX = windowX;
-    result.globalY = windowY;
     result.timeStampSeconds = timeStampSeconds;
     result.clickCount = clickCount;
     result.modifiers = modifiers;
@@ -105,4 +102,69 @@
     return result;
 }
 
+// WebMouseWheelEvent ------------------------------------------------------------
+
+WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(MouseWheelDirectionType direction,
+                                                         double timeStampSeconds,
+                                                         int windowX,
+                                                         int windowY)
+{
+    WebMouseWheelEvent result;
+
+    result.type = WebInputEvent::MouseWheel;
+    result.x = windowX;
+    result.y = windowY;
+    result.windowX = windowX;
+    result.windowY = windowY;
+    result.timeStampSeconds = timeStampSeconds;
+    result.button = WebMouseEvent::ButtonNone;
+
+    // The below choices are matched from GTK.
+    static const float scrollbarPixelsPerTick = 160.0f / 3.0f;
+
+    switch (direction) {
+    case MouseWheelDirectionTypeUp:
+        result.deltaY = scrollbarPixelsPerTick;
+        result.wheelTicksY = 1;
+        break;
+    case MouseWheelDirectionTypeDown:
+        result.deltaY = -scrollbarPixelsPerTick;
+        result.wheelTicksY = -1;
+        break;
+    case MouseWheelDirectionTypeLeft:
+        result.deltaX = scrollbarPixelsPerTick;
+        result.wheelTicksX = 1;
+        break;
+    case MouseWheelDirectionTypeRight:
+        result.deltaX = -scrollbarPixelsPerTick;
+        result.wheelTicksX = -1;
+        break;
+    }
+
+    return result;
+}
+
+// WebGestureEvent ------------------------------------------------------------
+
+WebGestureEvent WebInputEventFactory::gestureEvent(WebInputEvent::Type type,
+                                                   double timeStampSeconds,
+                                                   int x,
+                                                   int y,
+                                                   float deltaX,
+                                                   float deltaY,
+                                                   int modifiers)
+{
+    WebGestureEvent result;
+
+    result.type = type;
+    result.x = x;
+    result.y = y;
+    result.deltaX = deltaX;
+    result.deltaY = deltaY;
+    result.timeStampSeconds = timeStampSeconds;
+    result.modifiers = modifiers;
+
+    return result;
+}
+
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to