Commit 36d9092c authored by Siye Liu's avatar Siye Liu Committed by Chromium LUCI CQ

Reset focus before re-using TSF document.

Due to the fact that we reuse TSF document for text fields with same
input type, we should property reset the state by clearing focus before
re-using the document.

Bug: 1162974
Change-Id: Ia92187705e93cc064e992e28c8638d5647e06ea9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2610147Reviewed-by: default avatarYohei Yukawa <yukawa@chromium.org>
Reviewed-by: default avatarSiye Liu <siliu@microsoft.com>
Commit-Queue: Siye Liu <siliu@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#840322}
parent 9ce74c14
...@@ -233,6 +233,13 @@ void TSFBridgeImpl::OnTextInputTypeChanged(const TextInputClient* client) { ...@@ -233,6 +233,13 @@ void TSFBridgeImpl::OnTextInputTypeChanged(const TextInputClient* client) {
return; return;
} }
// Since we reuse TSF document for same text input type, there is a case where
// focus is switched between two text fields with same input type. We should
// prepare the TSF document for reuse by clearing focus first.
if (input_type_ != TEXT_INPUT_TYPE_NONE &&
input_type_ == client_->GetTextInputType()) {
thread_manager_->SetFocus(nullptr);
}
input_type_ = client_->GetTextInputType(); input_type_ = client_->GetTextInputType();
TSFDocument* document = GetAssociatedDocument(); TSFDocument* document = GetAssociatedDocument();
if (!document) if (!document)
......
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