Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / platform / PlatformMouseEvent.h
index 7c8e036..488bd0c 100644 (file)
 #include "platform/PlatformEvent.h"
 #include "platform/geometry/IntPoint.h"
 
-namespace WebCore {
+namespace blink {
 
 // These button numbers match the ones used in the DOM API, 0 through 2, except for NoButton which isn't specified.
 enum MouseButton { NoButton = -1, LeftButton, MiddleButton, RightButton };
 
 class PlatformMouseEvent : public PlatformEvent {
 public:
+    enum SyntheticEventType {
+        // Real mouse input events or synthetic events that behave just like real events
+        RealOrIndistinguishable,
+        // Mouse events derived from touch input
+        FromTouch,
+    };
+
     PlatformMouseEvent()
         : PlatformEvent(PlatformEvent::MouseMoved)
         , m_button(NoButton)
         , m_clickCount(0)
+        , m_synthesized(RealOrIndistinguishable)
+        , m_modifierFlags(0)
+    {
+    }
+
+    PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifiers, double timestamp)
+        : PlatformEvent(type, modifiers, timestamp)
+        , m_position(position)
+        , m_globalPosition(globalPosition)
+        , m_button(button)
+        , m_clickCount(clickCount)
+        , m_synthesized(RealOrIndistinguishable)
+        , m_modifierFlags(0)
+    {
+    }
+
+    PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifiers, SyntheticEventType synthesized, double timestamp)
+        : PlatformEvent(type, modifiers, timestamp)
+        , m_position(position)
+        , m_globalPosition(globalPosition)
+        , m_button(button)
+        , m_clickCount(clickCount)
+        , m_synthesized(synthesized)
         , m_modifierFlags(0)
     {
     }
 
-    PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp)
+    PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, SyntheticEventType synthesized, double timestamp)
         : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
         , m_position(position)
         , m_globalPosition(globalPosition)
         , m_button(button)
         , m_clickCount(clickCount)
+        , m_synthesized(synthesized)
         , m_modifierFlags(0)
     {
     }
@@ -61,6 +92,8 @@ public:
     MouseButton button() const { return m_button; }
     int clickCount() const { return m_clickCount; }
     unsigned modifierFlags() const { return m_modifierFlags; }
+    bool fromTouch() const { return m_synthesized == FromTouch; }
+    SyntheticEventType syntheticEventType() const { return m_synthesized; }
 
 protected:
     IntPoint m_position;
@@ -68,9 +101,10 @@ protected:
     IntPoint m_movementDelta;
     MouseButton m_button;
     int m_clickCount;
+    SyntheticEventType m_synthesized;
     unsigned m_modifierFlags;
 };
 
-} // namespace WebCore
+} // namespace blink
 
 #endif // PlatformMouseEvent_h