summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2010-01-25 13:26:14 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-01-25 13:26:14 -0800
commit09cf43c86944667327521b6be03733519a63a6e0 (patch)
treed41d7794832bb49ac11c74b2fd61fb9fc05c19ad
parentf4a88cdf3710d419d2c6cfe988db681089c503ed (diff)
parent562a8a469695e0a2dee4eb1946847553f04ca2a2 (diff)
downloadexternal_webkit-09cf43c86944667327521b6be03733519a63a6e0.zip
external_webkit-09cf43c86944667327521b6be03733519a63a6e0.tar.gz
external_webkit-09cf43c86944667327521b6be03733519a63a6e0.tar.bz2
am 562a8a46: am 53c84f3c: Do not allow the plugin to show or hide the keyboard unless it has focus.
Merge commit '562a8a469695e0a2dee4eb1946847553f04ca2a2' * commit '562a8a469695e0a2dee4eb1946847553f04ca2a2': Do not allow the plugin to show or hide the keyboard unless it has focus.
-rw-r--r--WebKit/android/plugins/ANPWindowInterface.cpp3
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.cpp20
-rw-r--r--WebKit/android/plugins/PluginWidgetAndroid.h6
3 files changed, 22 insertions, 7 deletions
diff --git a/WebKit/android/plugins/ANPWindowInterface.cpp b/WebKit/android/plugins/ANPWindowInterface.cpp
index 06afab1..bb7b9a3 100644
--- a/WebKit/android/plugins/ANPWindowInterface.cpp
+++ b/WebKit/android/plugins/ANPWindowInterface.cpp
@@ -49,7 +49,8 @@ static void anp_clearVisibleRects(NPP instance) {
static void anp_showKeyboard(NPP instance, bool value) {
PluginView* pluginView = pluginViewForInstance(instance);
PluginWidgetAndroid* pluginWidget = pluginView->platformPluginWidget();
- pluginWidget->webViewCore()->requestKeyboard(value, false);
+ if(pluginWidget->hasFocus())
+ pluginWidget->webViewCore()->requestKeyboard(value, false);
}
static void anp_requestFullScreen(NPP instance) {
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.cpp b/WebKit/android/plugins/PluginWidgetAndroid.cpp
index c82f17d..2ea3191 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.cpp
+++ b/WebKit/android/plugins/PluginWidgetAndroid.cpp
@@ -235,12 +235,11 @@ int16 PluginWidgetAndroid::sendEvent(const ANPEvent& evt) {
// "missing" plugins won't have these
if (pkg && instance) {
- // keep track of whether or not the plugin currently has focus
- if (evt.eventType == kLifecycle_ANPEventType) {
- if (evt.data.lifecycle.action == kLoseFocus_ANPLifecycleAction)
- m_hasFocus = false;
- else if (evt.data.lifecycle.action == kGainFocus_ANPLifecycleAction)
- m_hasFocus = true;
+ // if the plugin is gaining focus then update our state now to allow
+ // the plugin's event handler to perform actions that require focus
+ if (evt.eventType == kLifecycle_ANPEventType &&
+ evt.data.lifecycle.action == kGainFocus_ANPLifecycleAction) {
+ m_hasFocus = true;
}
// make a localCopy since the actual plugin may not respect its constness,
@@ -248,6 +247,15 @@ int16 PluginWidgetAndroid::sendEvent(const ANPEvent& evt) {
ANPEvent localCopy = evt;
int16 result = pkg->pluginFuncs()->event(instance, &localCopy);
PLUGIN_LOG_EVENT(instance, &evt, result);
+
+ // if the plugin is losing focus then delay the update of our state
+ // until after we notify the plugin and allow them to perform actions
+ // that may require focus
+ if (evt.eventType == kLifecycle_ANPEventType &&
+ evt.data.lifecycle.action == kLoseFocus_ANPLifecycleAction) {
+ m_hasFocus = false;
+ }
+
return result;
}
return 0;
diff --git a/WebKit/android/plugins/PluginWidgetAndroid.h b/WebKit/android/plugins/PluginWidgetAndroid.h
index 7f306d8..b47a4b3 100644
--- a/WebKit/android/plugins/PluginWidgetAndroid.h
+++ b/WebKit/android/plugins/PluginWidgetAndroid.h
@@ -135,6 +135,12 @@ struct PluginWidgetAndroid {
bool inFullScreen() { return m_isFullScreen; }
+ /** Called to check if a plugin currently has document focus, which is
+ required for certain operations (e.g. show/hide keyboard). It returns
+ true if the plugin currently has focus and false otherwise.
+ */
+ bool hasFocus() const { return m_hasFocus; }
+
private:
void computeVisiblePluginRect();
void scrollToVisiblePluginRect();