diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 14:52:14 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 14:52:14 +0000 |
commit | 31a9900b29bd851e8551d8f980ee34f56247f8b9 (patch) | |
tree | a8b7789b3440d257659f51858e600133dd768db6 /webkit | |
parent | 6c07b61f401a32d41884a6ce0722a2a8cf4294f7 (diff) | |
download | chromium_src-31a9900b29bd851e8551d8f980ee34f56247f8b9.zip chromium_src-31a9900b29bd851e8551d8f980ee34f56247f8b9.tar.gz chromium_src-31a9900b29bd851e8551d8f980ee34f56247f8b9.tar.bz2 |
[Mac] Call setIsActive() when changing focus in layout test mode.
This change effectively reverts http://src.chromium.org/viewvc/chrome?view=rev&revision=25491 and fixes http://crbug.com/16018 in a different way.
BUG=http://crbug.com/16018
BUG=http://crbug.com/21738
TEST=layout tests should still pass
Review URL: http://codereview.chromium.org/258035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29644 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webview_impl.cc | 9 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 6 |
2 files changed, 8 insertions, 7 deletions
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 5fdf0e3..9e68cae 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -1098,12 +1098,11 @@ void WebViewImpl::mouseCaptureLost() { } void WebViewImpl::setFocus(bool enable) { + page_->focusController()->setFocused(enable); if (enable) { - // Note that we call setActive and setFocued in opposite order in focus vs - // blur. This is done so that setActive does not dispatch any events since - // the event will be dispatched in setFocused. + // Note that we don't call setActive() when disabled as this cause extra + // focus/blur events to be dispatched. page_->focusController()->setActive(true); - page_->focusController()->setFocused(true); ime_accept_events_ = true; } else { HideAutoCompletePopup(); @@ -1124,8 +1123,6 @@ void WebViewImpl::setFocus(bool enable) { editor->confirmComposition(); ime_accept_events_ = false; } - page_->focusController()->setFocused(false); - page_->focusController()->setActive(false); } } diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index e208eaf..5c28287 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -621,16 +621,20 @@ void TestShell::SetFocus(WebWidgetHost* host, bool enable) { if (!layout_test_mode_) { InteractiveSetFocus(host, enable); } else { + // Simulate the effects of InteractiveSetFocus(), which includes calling + // both setFocus() and setIsActive(). if (enable) { if (m_focusedWidgetHost != host) { if (m_focusedWidgetHost) - m_focusedWidgetHost->webwidget()->setFocus(false); + m_focusedWidgetHost->webwidget()->setFocus(false); + webView()->setIsActive(enable); host->webwidget()->setFocus(enable); m_focusedWidgetHost = host; } } else { if (m_focusedWidgetHost == host) { host->webwidget()->setFocus(enable); + webView()->setIsActive(enable); m_focusedWidgetHost = NULL; } } |