summaryrefslogtreecommitdiff
path: root/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-18 14:03:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-18 14:03:11 +0200
commit8d473cf9743f1d30a16a27114e93bd5af5648d23 (patch)
treecdca40d0353886b3ca52f33a2d7b8f1c0011aafc /Source/WebKit/chromium/src/android/WebInputEventFactory.cpp
parent1b914638db989aaa98631a1c1e02c7b2d44805d8 (diff)
downloadqtwebkit-8d473cf9743f1d30a16a27114e93bd5af5648d23.tar.gz
Imported WebKit commit 1350e72f7345ced9da2bd9980deeeb5a8d62fab4 (http://svn.webkit.org/repository/webkit/trunk@117578)
Weekly snapshot
Diffstat (limited to 'Source/WebKit/chromium/src/android/WebInputEventFactory.cpp')
-rw-r--r--Source/WebKit/chromium/src/android/WebInputEventFactory.cpp82
1 files changed, 72 insertions, 10 deletions
diff --git a/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp
index 13166f344..fb723223b 100644
--- a/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp
+++ b/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp
@@ -66,23 +66,20 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(WebInputEvent::Type type,
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 @@ WebMouseEvent WebInputEventFactory::mouseEvent(int x, int y,
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