summaryrefslogtreecommitdiffstats
path: root/WebKit/chromium/public/WebInputEvent.h
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/chromium/public/WebInputEvent.h')
-rw-r--r--WebKit/chromium/public/WebInputEvent.h54
1 files changed, 53 insertions, 1 deletions
diff --git a/WebKit/chromium/public/WebInputEvent.h b/WebKit/chromium/public/WebInputEvent.h
index 983aa2a..581e76c 100644
--- a/WebKit/chromium/public/WebInputEvent.h
+++ b/WebKit/chromium/public/WebInputEvent.h
@@ -32,6 +32,7 @@
#define WebInputEvent_h
#include "WebCommon.h"
+#include "WebTouchPoint.h"
#include <string.h>
@@ -88,6 +89,7 @@ public:
MouseMove,
MouseEnter,
MouseLeave,
+ ContextMenu,
// WebMouseWheelEvent
MouseWheel,
@@ -96,7 +98,13 @@ public:
RawKeyDown,
KeyDown,
KeyUp,
- Char
+ Char,
+
+ // WebTouchEvent
+ TouchStart,
+ TouchMove,
+ TouchEnd,
+ TouchCancel,
};
enum Modifiers {
@@ -114,13 +122,32 @@ public:
LeftButtonDown = 1 << 6,
MiddleButtonDown = 1 << 7,
RightButtonDown = 1 << 8,
+
+ // Toggle modifiers for all events. Danger: these are not reflected
+ // into WebCore, so round-tripping from WebInputEvent to a WebCore
+ // event and back will not preserve these flags.
+ CapsLockOn = 1 << 9,
+ NumLockOn = 1 << 10,
};
+ static const int InputModifiers = ShiftKey | ControlKey | AltKey | MetaKey;
+
unsigned size; // The size of this structure, for serialization.
Type type;
int modifiers;
double timeStampSeconds; // Seconds since epoch.
+ // Returns true if the WebInputEvent |type| is a mouse event.
+ static bool isMouseEventType(int type)
+ {
+ return type == MouseDown
+ || type == MouseUp
+ || type == MouseMove
+ || type == MouseEnter
+ || type == MouseLeave
+ || type == ContextMenu;
+ }
+
// Returns true if the WebInputEvent |type| is a keyboard event.
static bool isKeyboardEventType(int type)
{
@@ -129,6 +156,15 @@ public:
|| type == KeyUp
|| type == Char;
}
+
+ // Returns true if the WebInputEvent |type| is a touch event.
+ static bool isTouchEventType(int type)
+ {
+ return type == TouchStart
+ || type == TouchMove
+ || type == TouchEnd
+ || type == TouchCancel;
+ }
};
// WebKeyboardEvent -----------------------------------------------------------
@@ -255,6 +291,22 @@ public:
}
};
+// WebTouchEvent --------------------------------------------------------------
+
+class WebTouchEvent : public WebInputEvent {
+public:
+ static const int touchPointsLengthCap = 4;
+
+ int touchPointsLength;
+ WebTouchPoint touchPoints[touchPointsLengthCap];
+
+ WebTouchEvent(unsigned sizeParam = sizeof(WebTouchEvent))
+ : WebInputEvent(sizeParam)
+ , touchPointsLength(0)
+ {
+ }
+};
+
} // namespace WebKit
#endif