summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 16:38:23 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 16:38:23 +0000
commit6837cf8e48f577f215bee763f080cb737c2fdf2f (patch)
treedcc2584d7825a32e1509cc6c77bd4c79c8991596 /webkit/glue/plugins
parenta513227838d8b0b8b6d6d4289f2e9d35c7630266 (diff)
downloadchromium_src-6837cf8e48f577f215bee763f080cb737c2fdf2f.zip
chromium_src-6837cf8e48f577f215bee763f080cb737c2fdf2f.tar.gz
chromium_src-6837cf8e48f577f215bee763f080cb737c2fdf2f.tar.bz2
One more attempt at fixing the keyboard focus issue when the windowless Flash plugin puts up a context
menu and we click on the browser window. The Flash plugin at times sets focus to its hidden popup window with class name SWFlash_PlaceholderX in the context of the TrackPopupMenu call. This causes the browser ui thread to receive a WM_ACTIVATEAPP message indicating that another top level window has become active, which causes this issue. This also happens in Firefox at times. However in Firefox the popup lives on the ui thread and hence the sideeffect is that no window has keyboard focus. Our workaround/fix for this scenario is to identify when this occurs and send over a raw mousedown/mouseup event via SendInput to the last focus window. Fixes http://code.google.com/p/chromium/issues/detail?id=8988 Bug=8988 Review URL: http://codereview.chromium.org/119049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17636 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins')
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc
index eba09ec..325c294 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl.cc
@@ -1269,11 +1269,31 @@ BOOL WINAPI WebPluginDelegateImpl::TrackPopupMenuPatch(
::SetFocus(g_current_plugin_instance->dummy_window_for_activation_);
}
}
-
+
BOOL result = TrackPopupMenu(menu, flags, x, y, reserved, window, rect);
if (IsWindow(last_focus_window)) {
- ::SetFocus(last_focus_window);
+ // The Flash plugin at times sets focus to its hidden top level window
+ // with class name SWFlash_PlaceholderX. This causes the chrome browser
+ // window to receive a WM_ACTIVATEAPP message as a top level window from
+ // another thread is now active. We end up in a state where the chrome
+ // browser window is not active even though the user clicked on it.
+ // Our workaround for this is to send over a raw
+ // WM_LBUTTONDOWN/WM_LBUTTONUP combination to the last focus window, which
+ // does the trick.
+ if (g_current_plugin_instance->dummy_window_for_activation_ !=
+ ::GetFocus()) {
+ INPUT input_info = {0};
+ input_info.type = INPUT_MOUSE;
+ input_info.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
+ ::SendInput(1, &input_info, sizeof(INPUT));
+
+ input_info.type = INPUT_MOUSE;
+ input_info.mi.dwFlags = MOUSEEVENTF_LEFTUP;
+ ::SendInput(1, &input_info, sizeof(INPUT));
+ } else {
+ ::SetFocus(last_focus_window);
+ }
}
return result;