summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorojan@google.com <ojan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-13 19:31:21 +0000
committerojan@google.com <ojan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-13 19:31:21 +0000
commit46057f746c812d94747985e4210dec9f1fb1ee1d (patch)
tree8fafe2c371dc370a7b965a61c7f55f2485f3c5ae /webkit
parent15123f1788581598067683b3c1d6d88533e0a9bf (diff)
downloadchromium_src-46057f746c812d94747985e4210dec9f1fb1ee1d.zip
chromium_src-46057f746c812d94747985e4210dec9f1fb1ee1d.tar.gz
chromium_src-46057f746c812d94747985e4210dec9f1fb1ee1d.tar.bz2
Make the focus handling in test_shell a bit closer to how
Chrome handles focus. Fixes a few issues where the page would not correctly get focus (e.g. a page that alerts on a keydown handler would never get focus again). Review URL: http://codereview.chromium.org/18009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7952 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/tools/test_shell/test_shell_win.cc4
-rw-r--r--webkit/tools/test_shell/webwidget_host_win.cc8
2 files changed, 9 insertions, 3 deletions
diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc
index 3701c5f..d0dc942 100644
--- a/webkit/tools/test_shell/test_shell_win.cc
+++ b/webkit/tools/test_shell/test_shell_win.cc
@@ -485,9 +485,7 @@ void TestShell::WaitTestFinished() {
}
void TestShell::InteractiveSetFocus(WebWidgetHost* host, bool enable) {
- if (enable)
- ::SetFocus(host->view_handle());
- else if (::GetFocus() == host->view_handle())
+ if (!enable && ::GetFocus() == host->view_handle())
::SetFocus(NULL);
}
diff --git a/webkit/tools/test_shell/webwidget_host_win.cc b/webkit/tools/test_shell/webwidget_host_win.cc
index 3f56002..c282699 100644
--- a/webkit/tools/test_shell/webwidget_host_win.cc
+++ b/webkit/tools/test_shell/webwidget_host_win.cc
@@ -285,6 +285,14 @@ void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) {
break;
}
webwidget_->HandleInputEvent(&event);
+
+ if (event.type == WebInputEvent::MOUSE_DOWN) {
+ // This mimics a temporary workaround in RenderWidgetHostViewWin
+ // for bug 765011 to get focus when the mouse is clicked. This
+ // happens after the mouse down event is sent to the renderer
+ // because normally Windows does a WM_SETFOCUS after WM_LBUTTONDOWN.
+ ::SetFocus(view_);
+ }
}
void WebWidgetHost::WheelEvent(WPARAM wparam, LPARAM lparam) {