diff options
author | Grace Kloba <klobag@google.com> | 2009-12-08 09:50:32 -0800 |
---|---|---|
committer | Grace Kloba <klobag@google.com> | 2009-12-09 09:56:11 -0800 |
commit | 3d0d3fdaa1308448b47592c03cda81c7f9e1f789 (patch) | |
tree | 0f7edf54cfb1a5ff64e6b22451e78f847cf35c12 /WebCore/plugins | |
parent | bf16ddc110ef3fde2cfa1ae43ab31d993377981d (diff) | |
download | external_webkit-3d0d3fdaa1308448b47592c03cda81c7f9e1f789.zip external_webkit-3d0d3fdaa1308448b47592c03cda81c7f9e1f789.tar.gz external_webkit-3d0d3fdaa1308448b47592c03cda81c7f9e1f789.tar.bz2 |
Enable longpress and doubletap to WebKit as touch
event if it is requested.
Diffstat (limited to 'WebCore/plugins')
-rw-r--r-- | WebCore/plugins/android/PluginViewAndroid.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/WebCore/plugins/android/PluginViewAndroid.cpp b/WebCore/plugins/android/PluginViewAndroid.cpp index 08ac7c8..4266a9a 100644 --- a/WebCore/plugins/android/PluginViewAndroid.cpp +++ b/WebCore/plugins/android/PluginViewAndroid.cpp @@ -183,6 +183,7 @@ void PluginView::handleTouchEvent(TouchEvent* event) ANPEvent evt; SkANP::InitEvent(&evt, kTouch_ANPEventType); + bool ignoreRet = false; const AtomicString& type = event->type(); if (eventNames().touchstartEvent == type) evt.data.touch.action = kDown_ANPTouchAction; @@ -192,7 +193,13 @@ void PluginView::handleTouchEvent(TouchEvent* event) evt.data.touch.action = kMove_ANPTouchAction; else if (eventNames().touchcancelEvent == type) evt.data.touch.action = kCancel_ANPTouchAction; - else + else if (eventNames().touchlongpressEvent == type) { + evt.data.touch.action = kLongPress_ANPTouchAction; + ignoreRet = true; + } else if (eventNames().touchdoubletapEvent == type) { + evt.data.touch.action = kDoubleTap_ANPTouchAction; + ignoreRet = true; + } else return; evt.data.touch.modifiers = 0; // todo @@ -203,14 +210,22 @@ void PluginView::handleTouchEvent(TouchEvent* event) evt.data.touch.x = event->pageX() - m_npWindow.x; evt.data.touch.y = event->pageY() - m_npWindow.y; - if (m_plugin->pluginFuncs()->event(m_instance, &evt)) { + int16 ret = m_plugin->pluginFuncs()->event(m_instance, &evt); + if (ignoreRet) + return; + if (ret & kHandleTouch_ANPTouchResult) { // The plugin needs focus to receive keyboard events if (evt.data.touch.action == kDown_ANPTouchAction) { if (Page* page = m_parentFrame->page()) page->focusController()->setFocusedFrame(m_parentFrame); m_parentFrame->document()->setFocusedNode(m_element); } - event->setDefaultPrevented(true); + event->preventDefault(); + } else { + if (ret & kHandleLongPress_ANPTouchResult) + event->preventLongPress(); + if (ret & kHandleDoubleTap_ANPTouchResult) + event->preventDoubleTap(); } } |