diff options
Diffstat (limited to 'WebCore/plugins')
-rw-r--r-- | WebCore/plugins/PluginView.cpp | 4 | ||||
-rw-r--r-- | WebCore/plugins/PluginView.h | 1 | ||||
-rw-r--r-- | WebCore/plugins/android/PluginViewAndroid.cpp | 18 |
3 files changed, 22 insertions, 1 deletions
diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp index 811f6be..13d8511 100644 --- a/WebCore/plugins/PluginView.cpp +++ b/WebCore/plugins/PluginView.cpp @@ -165,6 +165,10 @@ void PluginView::handleEvent(Event* event) #if defined(ANDROID_PLUGINS) else if (event->isTouchEvent()) handleTouchEvent(static_cast<TouchEvent*>(event)); + else if (event->type() == eventNames().DOMFocusOutEvent) + handleFocusEvent(false); + else if (event->type() == eventNames().DOMFocusInEvent) + handleFocusEvent(true); #endif #if defined(Q_WS_X11) else if (event->type() == eventNames().DOMFocusOutEvent) diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h index 0fd0d4f..b385d41 100644 --- a/WebCore/plugins/PluginView.h +++ b/WebCore/plugins/PluginView.h @@ -289,6 +289,7 @@ namespace WebCore { #endif #ifdef ANDROID_PLUGINS + void handleFocusEvent(bool hasFocus); void handleTouchEvent(TouchEvent*); // called at the end of the base constructor void platformInit(); diff --git a/WebCore/plugins/android/PluginViewAndroid.cpp b/WebCore/plugins/android/PluginViewAndroid.cpp index 0c69cfd..529458b 100644 --- a/WebCore/plugins/android/PluginViewAndroid.cpp +++ b/WebCore/plugins/android/PluginViewAndroid.cpp @@ -258,6 +258,20 @@ static ANPKeyModifier make_modifiers(bool shift, bool alt) { return mod; } +void PluginView::handleFocusEvent(bool hasFocus) +{ + ANPEvent evt; + SkANP::InitEvent(&evt, kLifecycle_ANPEventType); + evt.data.lifecycle.action = hasFocus ? kGainFocus_ANPLifecycleAction : + kLoseFocus_ANPLifecycleAction; + m_window->sendEvent(evt); + + // redraw the plugin which subsequently invalidates the nav cache + IntRect rect = IntRect(m_npWindow.x, m_npWindow.y, + m_npWindow.width, m_npWindow.height); + m_window->webViewCore()->contentInvalidate(rect); +} + void PluginView::handleKeyboardEvent(KeyboardEvent* event) { if (!m_window->isAcceptingEvent(kKey_ANPEventFlag)) @@ -319,6 +333,9 @@ void PluginView::handleKeyboardEvent(KeyboardEvent* event) if (m_plugin->pluginFuncs()->event(m_instance, &evt)) { event->setDefaultHandled(); + } else { + // remove the plugin from the document's focus + m_parentFrame->document()->focusedNodeRemoved(); } } @@ -498,7 +515,6 @@ void PluginView::invalidateRect(NPRect* rect) } m_window->inval(r, true); -// android::WebViewCore::getWebViewCore(parent())->contentInvalidate(r); } void PluginView::invalidateRegion(NPRegion region) |