summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-02-02 20:36:35 +0000
committerBen Murdoch <benm@google.com>2010-02-19 11:46:26 +0000
commitff38e49a48fa4d5f7810ce815794d262dabf5183 (patch)
tree3d47f09135a686e00285309ce6b556cbad3ee993 /WebCore/platform
parent74d23f79f073f0f0c3d925d9cf2749cef827130c (diff)
downloadexternal_webkit-ff38e49a48fa4d5f7810ce815794d262dabf5183.zip
external_webkit-ff38e49a48fa4d5f7810ce815794d262dabf5183.tar.gz
external_webkit-ff38e49a48fa4d5f7810ce815794d262dabf5183.tar.bz2
Add support for setting key states with touch events on Android.
Properly guard non-upstreamed common code. Change-Id: I109dbe97d8c96efe3660ce3893a4e730927e90ef
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/PlatformTouchEvent.h8
-rw-r--r--WebCore/platform/android/PlatformTouchEventAndroid.cpp20
2 files changed, 21 insertions, 7 deletions
diff --git a/WebCore/platform/PlatformTouchEvent.h b/WebCore/platform/PlatformTouchEvent.h
index 854db3c..56d1020 100644
--- a/WebCore/platform/PlatformTouchEvent.h
+++ b/WebCore/platform/PlatformTouchEvent.h
@@ -60,8 +60,8 @@ public:
#if PLATFORM(QT)
PlatformTouchEvent(QTouchEvent*);
#elif PLATFORM(ANDROID)
- // TODO (benm): eventTime is new and needs to be upstream
- PlatformTouchEvent(const IntPoint& windowPos, TouchEventType, PlatformTouchPoint::State, long eventTime);
+ // TODO (benm): eventTime and metaState are new and need to be upstreamed.
+ PlatformTouchEvent(const IntPoint& windowPos, TouchEventType, PlatformTouchPoint::State, long eventTime, int metaState);
#endif
TouchEventType type() const { return m_type; }
@@ -72,7 +72,9 @@ public:
bool shiftKey() const { return m_shiftKey; }
bool metaKey() const { return m_metaKey; }
+#if PLATFORM(ANDROID)
long eventTime() const { return m_eventTime; }
+#endif
private:
TouchEventType m_type;
@@ -81,7 +83,9 @@ private:
bool m_altKey;
bool m_shiftKey;
bool m_metaKey;
+#if PLATFORM(ANDROID)
long m_eventTime;
+#endif
};
}
diff --git a/WebCore/platform/android/PlatformTouchEventAndroid.cpp b/WebCore/platform/android/PlatformTouchEventAndroid.cpp
index d2fcebb..085eb0a 100644
--- a/WebCore/platform/android/PlatformTouchEventAndroid.cpp
+++ b/WebCore/platform/android/PlatformTouchEventAndroid.cpp
@@ -30,16 +30,26 @@
namespace WebCore {
-// TODO (benm): eventTime is new and needs to be upstream
-PlatformTouchEvent::PlatformTouchEvent(const IntPoint& windowPos, TouchEventType type, PlatformTouchPoint::State state, long eventTime)
+// TODO(benm): This enum needs upstreaming.
+// These values should be kept in sync with those defined in the android.view.KeyEvent class from the Android SDK.
+enum AndroidMetaKeyState {
+ META_SHIFT_ON = 0x01,
+ META_ALT_ON = 0x02,
+ META_SYM_ON = 0x04
+};
+
+// TODO (benm): eventTime and metaState are new and needs to be upstreamed.
+PlatformTouchEvent::PlatformTouchEvent(const IntPoint& windowPos, TouchEventType type, PlatformTouchPoint::State state, long eventTime, int metaState)
: m_type(type)
- , m_ctrlKey(false)
- , m_altKey(false)
- , m_shiftKey(false)
, m_metaKey(false)
, m_eventTime(eventTime)
{
m_touchPoints.append(PlatformTouchPoint(windowPos, state));
+
+ // TODO(benm): metaState needs upstreaming.
+ m_altKey = metaState & META_ALT_ON;
+ m_shiftKey = metaState & META_SHIFT_ON;
+ m_ctrlKey = metaState & META_SYM_ON;
}
}