diff options
author | Grace Kloba <klobag@google.com> | 2010-03-31 12:07:39 -0700 |
---|---|---|
committer | Grace Kloba <klobag@google.com> | 2010-03-31 12:35:38 -0700 |
commit | a622a48d6cc2bea33d2467de9d31feb1b03b03eb (patch) | |
tree | e777f23d61d2cea75ca142ab20c3d92a7bf459f3 | |
parent | 5a3decdc84314db679df0dc60edb9aa4fb215147 (diff) | |
download | external_webkit-a622a48d6cc2bea33d2467de9d31feb1b03b03eb.zip external_webkit-a622a48d6cc2bea33d2467de9d31feb1b03b03eb.tar.gz external_webkit-a622a48d6cc2bea33d2467de9d31feb1b03b03eb.tar.bz2 |
Make sure html plugin element supports focus so that
plugin can call focus() on it.
By default, only nodes can be tabbed through supports
focus. We make plugin element like frame element where
it always supports focus. In Android, plugin has a
focused mode, so it requires this change.
Fix http://b/issue?id=2539608
-rw-r--r-- | WebCore/html/HTMLPlugInElement.cpp | 7 | ||||
-rw-r--r-- | WebCore/html/HTMLPlugInElement.h | 6 | ||||
-rw-r--r-- | WebCore/plugins/android/PluginViewAndroid.cpp | 8 |
3 files changed, 16 insertions, 5 deletions
diff --git a/WebCore/html/HTMLPlugInElement.cpp b/WebCore/html/HTMLPlugInElement.cpp index dafa8fb..9319034 100644 --- a/WebCore/html/HTMLPlugInElement.cpp +++ b/WebCore/html/HTMLPlugInElement.cpp @@ -177,4 +177,11 @@ void HTMLPlugInElement::updateWidgetCallback(Node* n) static_cast<HTMLPlugInElement*>(n)->updateWidget(); } +#if PLATFORM(ANDROID) +bool HTMLPlugInElement::supportsFocus() const +{ + return true; +} +#endif + } diff --git a/WebCore/html/HTMLPlugInElement.h b/WebCore/html/HTMLPlugInElement.h index 9d3dc6d..cf18e27 100644 --- a/WebCore/html/HTMLPlugInElement.h +++ b/WebCore/html/HTMLPlugInElement.h @@ -60,6 +60,12 @@ protected: virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; virtual void parseMappedAttribute(MappedAttribute*); +#if PLATFORM(ANDROID) + // in Android, plugin has a focused mode where it accepts all the touch events. + // so need to claim that plugin element supports focus instead of using the default. + virtual bool supportsFocus() const; +#endif + private: virtual void defaultEventHandler(Event*); diff --git a/WebCore/plugins/android/PluginViewAndroid.cpp b/WebCore/plugins/android/PluginViewAndroid.cpp index ee39687..682268a 100644 --- a/WebCore/plugins/android/PluginViewAndroid.cpp +++ b/WebCore/plugins/android/PluginViewAndroid.cpp @@ -247,11 +247,9 @@ void PluginView::handleMouseEvent(MouseEvent* event) evt.data.mouse.y = localPos.y(); if (isDown) { - // The plugin needs focus to receive keyboard events - if (Page* page = m_parentFrame->page()) { - page->focusController()->setFocusedNode(m_element, m_parentFrame); - event->setDefaultHandled(); - } + // The plugin needs focus to receive keyboard and touch events + m_element->focus(); + event->setDefaultHandled(); } } else { |