Commit 5af4e86a authored by Anupam Snigdha's avatar Anupam Snigdha Committed by Commit Bot

Remove ::SetFocus API call in RWHVEH::SetKeyboardFocus

Text service framework(TSF) on Windows platform already triggers a
focus call to the top level HWND that should receive keyboard focus.
This happens in |TSFBridgeImpl::OnTextInputTypeChanged| and
|TSFBridgeImpl::UpdateAssociateFocus| where the thread input manager
sets focus on the HWND by calling |SetFocus| and |AssociateFocus|
respectively. |RenderWidgetHostViewEventHandler::SetKeyboardFocus|
explicitly calls |::SetFocus| on the HWND that leads to side-effects
when narrator is active as it intermittently switches focus to the
legacy HWND that results in VK dismissal and also puts the state
machine of the VK in a weird state. Calling |::SetFocus| also has perf
implications as TSF listens to this API call and does a reentrant call
to Chromium to fetch document states. I tested both hardware and
virtual keyboard with this change and I don't see any obvious issues.
Removing this call also fixed the accessibility issue where the VK was
getting dismissed after first keystroke.

Bug: 1106556

Change-Id: If8146d2b97a36799a8ade1c514fb238c67e76b36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2314980Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Anupam Snigdha <snianu@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#791634}
parent fd3c7ca2
......@@ -923,16 +923,6 @@ bool RenderWidgetHostViewEventHandler::MatchesSynthesizedMovePosition(
}
void RenderWidgetHostViewEventHandler::SetKeyboardFocus() {
#if defined(OS_WIN)
if (window_ && window_->delegate()->CanFocus()) {
aura::WindowTreeHost* host = window_->GetHost();
if (host) {
gfx::AcceleratedWidget hwnd = host->GetAcceleratedWidget();
if (!(::GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_NOACTIVATE))
::SetFocus(hwnd);
}
}
#endif
// TODO(wjmaclean): can host_ ever be null?
if (host_ && set_focus_on_mouse_down_or_key_event_) {
set_focus_on_mouse_down_or_key_event_ = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment