summaryrefslogtreecommitdiffstats
path: root/WebCore/plugins/android
diff options
context:
space:
mode:
authorGrace Kloba <klobag@google.com>2009-09-23 17:31:16 -0700
committerGrace Kloba <klobag@google.com>2009-09-23 17:37:58 -0700
commit2c02e355bf0631c0bec3496fab67f45710c5cd21 (patch)
tree01d7fd37b5f51a6bbec35621c0451628c8deb9c9 /WebCore/plugins/android
parentda2757a9cf762906063af0b8901ada0f72ecddbe (diff)
downloadexternal_webkit-2c02e355bf0631c0bec3496fab67f45710c5cd21.zip
external_webkit-2c02e355bf0631c0bec3496fab67f45710c5cd21.tar.gz
external_webkit-2c02e355bf0631c0bec3496fab67f45710c5cd21.tar.bz2
When mouse down or plugin handles touch down, set the plugin
to be the focus of the document so that it can receive key events. This has the same logic as in PluginViewMac.cpp's handleMouseEvent().
Diffstat (limited to 'WebCore/plugins/android')
-rw-r--r--WebCore/plugins/android/PluginViewAndroid.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/WebCore/plugins/android/PluginViewAndroid.cpp b/WebCore/plugins/android/PluginViewAndroid.cpp
index d98ccef..7d10993 100644
--- a/WebCore/plugins/android/PluginViewAndroid.cpp
+++ b/WebCore/plugins/android/PluginViewAndroid.cpp
@@ -31,6 +31,7 @@
#include "Document.h"
#include "Element.h"
#include "EventNames.h"
+#include "FocusController.h"
#include "FrameLoader.h"
#include "FrameLoadRequest.h"
#include "FrameTree.h"
@@ -243,6 +244,12 @@ void PluginView::handleTouchEvent(TouchEvent* event)
evt.data.touch.y = event->pageY() - m_npWindow.y;
if (m_plugin->pluginFuncs()->event(m_instance, &evt)) {
+ // 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);
}
}
@@ -264,6 +271,12 @@ void PluginView::handleMouseEvent(MouseEvent* event)
// coordinates despite their misleading name.
evt.data.mouse.x = event->pageX() - m_npWindow.x;
evt.data.mouse.y = event->pageY() - m_npWindow.y;
+ if (isDown) {
+ // The plugin needs focus to receive keyboard events
+ if (Page* page = m_parentFrame->page())
+ page->focusController()->setFocusedFrame(m_parentFrame);
+ m_parentFrame->document()->setFocusedNode(m_element);
+ }
}
else {
return;