diff options
-rw-r--r-- | WebCore/platform/PlatformTouchEvent.h | 8 | ||||
-rw-r--r-- | WebCore/platform/android/PlatformTouchEventAndroid.cpp | 20 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 10 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 2 |
4 files changed, 27 insertions, 13 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; } } diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 0c37380..a68ada8 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1929,7 +1929,7 @@ void WebViewCore::click(WebCore::Frame* frame, WebCore::Node* node) { } } -int WebViewCore::handleTouchEvent(int action, int x, int y, long time) +int WebViewCore::handleTouchEvent(int action, int x, int y, long time, int metaState) { int preventDefault = 0; @@ -1984,7 +1984,7 @@ int WebViewCore::handleTouchEvent(int action, int x, int y, long time) m_lastTouchPoint = pt; - WebCore::PlatformTouchEvent te(pt, type, touchState, time); + WebCore::PlatformTouchEvent te(pt, type, touchState, time, metaState); preventDefault = m_mainFrame->eventHandler()->handleTouchEvent(te); #endif @@ -2677,14 +2677,14 @@ static jstring FindAddress(JNIEnv *env, jobject obj, jstring addr, return ret; } -static jint HandleTouchEvent(JNIEnv *env, jobject obj, jint action, jint x, jint y, jlong time) +static jint HandleTouchEvent(JNIEnv *env, jobject obj, jint action, jint x, jint y, jlong time, jint metaState) { #ifdef ANDROID_INSTRUMENT TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); #endif WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); - return viewImpl->handleTouchEvent(action, x, y, time); + return viewImpl->handleTouchEvent(action, x, y, time, metaState); } static void TouchUp(JNIEnv *env, jobject obj, jint touchGeneration, @@ -3087,7 +3087,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) SaveDocumentState }, { "nativeFindAddress", "(Ljava/lang/String;Z)Ljava/lang/String;", (void*) FindAddress }, - { "nativeHandleTouchEvent", "(IIIJ)I", + { "nativeHandleTouchEvent", "(IIIJI)I", (void*) HandleTouchEvent }, { "nativeTouchUp", "(IIIII)V", (void*) TouchUp }, diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index fc5ffc7..c6c3dee 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -282,7 +282,7 @@ namespace android { /** * Handle touch event */ - int handleTouchEvent(int action, int x, int y, long time); + int handleTouchEvent(int action, int x, int y, long time, int metaState); /** * Handle motionUp event from the UI thread (called touchUp in the |