summaryrefslogtreecommitdiff
path: root/Source/WebKit/chromium/public/WebInputEvent.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/chromium/public/WebInputEvent.h')
-rw-r--r--Source/WebKit/chromium/public/WebInputEvent.h54
1 files changed, 32 insertions, 22 deletions
diff --git a/Source/WebKit/chromium/public/WebInputEvent.h b/Source/WebKit/chromium/public/WebInputEvent.h
index e42e45134..d5d6394f8 100644
--- a/Source/WebKit/chromium/public/WebInputEvent.h
+++ b/Source/WebKit/chromium/public/WebInputEvent.h
@@ -45,16 +45,23 @@ namespace WebKit {
// WARNING! These classes must remain PODs (plain old data). They are
// intended to be "serializable" by copying their raw bytes, so they must
// not contain any non-bit-copyable member variables!
+//
+// Furthermore, the class members need to be packed so they are aligned
+// properly and don't have paddings/gaps, otherwise memory check tools
+// like Valgrind will complain about uninitialized memory usage when
+// transferring these classes over the wire.
+
+#pragma pack(push, 4)
// WebInputEvent --------------------------------------------------------------
class WebInputEvent {
public:
WebInputEvent(unsigned sizeParam = sizeof(WebInputEvent))
- : size(sizeParam)
+ : timeStampSeconds(0.0)
+ , size(sizeParam)
, type(Undefined)
- , modifiers(0)
- , timeStampSeconds(0.0) { }
+ , modifiers(0) { }
// When we use an input method (or an input method editor), we receive
// two events for a keypress. The former event is a keydown, which
@@ -109,6 +116,7 @@ public:
GestureTap,
GestureTapDown,
GestureDoubleTap,
+ GestureLongPress,
GesturePinchBegin,
GesturePinchEnd,
GesturePinchUpdate,
@@ -145,10 +153,10 @@ public:
static const int InputModifiers = ShiftKey | ControlKey | AltKey | MetaKey;
- unsigned size; // The size of this structure, for serialization.
+ double timeStampSeconds; // Seconds since epoch.
+ 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)
@@ -197,6 +205,7 @@ public:
|| type == GestureScrollUpdate
|| type == GestureFlingStart
|| type == GestureFlingCancel
+ || type == GestureTapDown
|| type == GestureTap; // FIXME: Why is GestureTap on this list?
}
};
@@ -225,6 +234,14 @@ public:
// doesn't hurt to have this one around.
int nativeKeyCode;
+ // This identifies whether this event was tagged by the system as being
+ // a "system key" event (see
+ // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for
+ // details). Other platforms don't have this concept, but it's just
+ // easier to leave it always false than ifdef.
+ // See comment at the top of the file for why an int is used here.
+ bool isSystemKey;
+
// |text| is the text generated by this keystroke. |unmodifiedText| is
// |text|, but unmodified by an concurrently-held modifiers (except
// shift). This is useful for working out shortcut keys. Linux and
@@ -237,17 +254,6 @@ public:
// This is a string identifying the key pressed.
char keyIdentifier[keyIdentifierLengthCap];
- // This identifies whether this event was tagged by the system as being
- // a "system key" event (see
- // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for
- // details). Other platforms don't have this concept, but it's just
- // easier to leave it always false than ifdef.
- // int is used instead of bool to ensure the size of this structure is
- // strictly aligned to a factor of 4 bytes, otherwise memory check tools
- // like valgrind may complain about uninitialized memory usage when
- // transfering it over the wire.
- int isSystemKey;
-
WebKeyboardEvent(unsigned sizeParam = sizeof(WebKeyboardEvent))
: WebInputEvent(sizeParam)
, windowsKeyCode(0)
@@ -322,13 +328,11 @@ public:
float wheelTicksX;
float wheelTicksY;
- // int is used instead of bool to ensure the size of this structure is
- // strictly aligned to a factor of 4 bytes, otherwise memory check tools
- // like valgrind may complain about uninitialized memory usage when
- // transfering it over the wire.
+ // See comment at the top of the file for why an int is used here.
int scrollByPage;
- bool hasPreciseScrollingDeltas;
+ // See comment at the top of the file for why an int is used here.
+ int hasPreciseScrollingDeltas;
Phase phase;
Phase momentumPhase;
@@ -355,9 +359,11 @@ public:
int globalX;
int globalY;
- // NOTE: |deltaX| and |deltaY| represents the amount to scroll for Scroll gesture events. For Pinch gesture events, |deltaX| represents the scaling/magnification factor.
+ // NOTE: |deltaX| and |deltaY| represents the amount to scroll for Scroll gesture events. For Pinch gesture events, |deltaX| represents the scaling/magnification factor. For Tap and Press events, |deltaX|,|deltaY| and |gammaX|,|gammaY| correspond to the top left and bottom right corners of the ellipse's enlosing rectangle for tap target fuzzing.
float deltaX;
float deltaY;
+ float gammaX;
+ float gammaY;
WebGestureEvent(unsigned sizeParam = sizeof(WebGestureEvent))
: WebInputEvent(sizeParam)
@@ -367,6 +373,8 @@ public:
, globalY(0)
, deltaX(0.0f)
, deltaY(0.0f)
+ , gammaX(0.0f)
+ , gammaY(0.0f)
{
}
};
@@ -398,6 +406,8 @@ public:
}
};
+#pragma pack(pop)
+
} // namespace WebKit
#endif