summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/PlatformMouseEvent.h
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2016-08-25 19:20:41 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-02-02 12:30:55 +0000
commit6882a04fb36642862b11efe514251d32070c3d65 (patch)
treeb7959826000b061fd5ccc7512035c7478742f7b0 /Source/WebCore/platform/PlatformMouseEvent.h
parentab6df191029eeeb0b0f16f127d553265659f739e (diff)
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore/platform/PlatformMouseEvent.h')
-rw-r--r--Source/WebCore/platform/PlatformMouseEvent.h48
1 files changed, 30 insertions, 18 deletions
diff --git a/Source/WebCore/platform/PlatformMouseEvent.h b/Source/WebCore/platform/PlatformMouseEvent.h
index 037b5b158..fd25b0bd5 100644
--- a/Source/WebCore/platform/PlatformMouseEvent.h
+++ b/Source/WebCore/platform/PlatformMouseEvent.h
@@ -10,10 +10,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -28,9 +28,7 @@
#include "IntPoint.h"
#include "PlatformEvent.h"
-#if OS(WINDOWS)
-#include "WindowsExtras.h"
-#endif
+#include <wtf/WindowsExtras.h>
#if PLATFORM(GTK)
typedef struct _GdkEventButton GdkEventButton;
@@ -44,14 +42,13 @@ typedef struct _Evas_Event_Mouse_Move Evas_Event_Mouse_Move;
#endif
namespace WebCore {
-
+
+const double ForceAtClick = 1;
+const double ForceAtForceClick = 2;
+
// 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 };
+ enum MouseButton : int8_t { NoButton = -1, LeftButton, MiddleButton, RightButton };
-#if PLATFORM(BLACKBERRY)
- enum MouseInputMethod { PointingDevice, TouchScreen };
-#endif
-
class PlatformMouseEvent : public PlatformEvent {
public:
PlatformMouseEvent()
@@ -61,6 +58,7 @@ namespace WebCore {
, m_modifierFlags(0)
#if PLATFORM(MAC)
, m_eventNumber(0)
+ , m_menuTypeForEvent(0)
#elif PLATFORM(WIN)
, m_didActivateWebView(false)
#endif
@@ -68,15 +66,17 @@ namespace WebCore {
}
PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type,
- int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp)
+ int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp, double force)
: PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
, m_position(position)
, m_globalPosition(globalPosition)
, m_button(button)
, m_clickCount(clickCount)
, m_modifierFlags(0)
+ , m_force(force)
#if PLATFORM(MAC)
, m_eventNumber(0)
+ , m_menuTypeForEvent(0)
#elif PLATFORM(WIN)
, m_didActivateWebView(false)
#endif
@@ -92,6 +92,7 @@ namespace WebCore {
MouseButton button() const { return m_button; }
int clickCount() const { return m_clickCount; }
unsigned modifierFlags() const { return m_modifierFlags; }
+ double force() const { return m_force; }
#if PLATFORM(GTK)
@@ -109,6 +110,7 @@ namespace WebCore {
#if PLATFORM(MAC)
int eventNumber() const { return m_eventNumber; }
+ int menuTypeForEvent() const { return m_menuTypeForEvent; }
#endif
#if PLATFORM(WIN)
@@ -117,10 +119,6 @@ namespace WebCore {
bool didActivateWebView() const { return m_didActivateWebView; }
#endif
-#if PLATFORM(BLACKBERRY)
- PlatformMouseEvent(const IntPoint& eventPosition, const IntPoint& globalPosition, const PlatformEvent::Type, int clickCount, MouseButton, bool shiftKey, bool ctrlKey, bool altKey, MouseInputMethod = PointingDevice);
- MouseInputMethod inputMethod() const { return m_inputMethod; }
-#endif
protected:
IntPoint m_position;
IntPoint m_globalPosition;
@@ -130,16 +128,30 @@ namespace WebCore {
MouseButton m_button;
int m_clickCount;
unsigned m_modifierFlags;
+ double m_force { 0 };
#if PLATFORM(MAC)
int m_eventNumber;
+ int m_menuTypeForEvent;
#elif PLATFORM(WIN)
bool m_didActivateWebView;
-#elif PLATFORM(BLACKBERRY)
- MouseInputMethod m_inputMethod;
#endif
};
+#if COMPILER(MSVC)
+ // These functions are necessary to work around the fact that MSVC will not find a most-specific
+ // operator== to use after implicitly converting MouseButton to an unsigned short.
+ inline bool operator==(unsigned short a, MouseButton b)
+ {
+ return a == static_cast<unsigned short>(b);
+ }
+
+ inline bool operator!=(unsigned short a, MouseButton b)
+ {
+ return a != static_cast<unsigned short>(b);
+ }
+#endif
+
} // namespace WebCore
#endif // PlatformMouseEvent_h