Removes the redundant IMB::OnFocus call in DNWA::HandleNativeFocus().
commit4719aba37c66ae6f677977107819119494d70748
authorshuchen <shuchen@chromium.org>
Wed, 20 May 2015 07:11:17 +0000 (20 00:11 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 20 May 2015 07:11:09 +0000 (20 07:11 +0000)
treef43cf55f9a4567c7ccaea59bf60fb40151b7e149
parentee86aac35b1736f39977c92eaec2abb435924520
Removes the redundant IMB::OnFocus call in DNWA::HandleNativeFocus().

Currently HWNDMessageHandler::OnSetFocus happens before WM_ACTIVATE is handled in HWNDMessageHandler::OnWndProc().
Root cause: when WM_ACTIVATE comes, in HWNDMessageHandler::OnWndProc(), it will call DefWindowProc() first, which may result in generating WM_SETFOCUS message and call OnWndProc() recursively and therefore OnSetFocus() is called.
After the recursive OnWndProc() returns, PostProcessActivateMessage() is called to handle WM_ACTIVATE.

So DWTHW::HandleNativeFocus() happens before DNWA::HandleActivationChanged().
Therefore, IMB::OnFocus() will get NULL for host_->GetTextInputClient(), which will result in the IMB instance set to the host InputMethod as the focused TextInputClient (which should be the RWHVA).

It would be risky to fix that order in HWNDMessageHandler.
Instead, we can remove the IMB::OnFocus call in DWTHW::HandleNativeFocus() which seems to be redundant, because DNWA::OnWindowFocused() can do the thing, which happens after the top window is activated.

TBR=ananta@chromium.org,sky@chromium.org
BUG=486604
TEST=Verified on local win build.

Review URL: https://codereview.chromium.org/1139623003

Cr-Commit-Position: refs/heads/master@{#330707}
ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc