Commit 17a7a0c8 authored by kinaba's avatar kinaba Committed by Commit bot

arc: Stop piggybacking "text input started" and "show virtual keyboard" events.

It is not only useless in the latest version, but is even harmful
for some advanced apps that take the liberty of splitting these
two events.

This change itself should not change any observable behavior yet,
but will be necessary to enable coming Android-side change to
make this split effective.

BUG=640816
BUG=b/31001453
TEST=ArcImeServiceTest
TEST=Tested manually with some ARC apps (Settings, PlayStore)

Review-Url: https://codereview.chromium.org/2280503002
Cr-Commit-Position: refs/heads/master@{#414283}
parent ef5c4148
......@@ -140,15 +140,8 @@ void ArcImeService::OnTextInputTypeChanged(ui::TextInputType type) {
ime_type_ = type;
ui::InputMethod* const input_method = GetInputMethod();
if (input_method) {
if (input_method)
input_method->OnTextInputTypeChanged(this);
// TODO(crbug.com/581282): Remove this piggyback call when
// ImeInstance::ShowImeIfNeeded is wired to ARC.
if (input_method->GetTextInputClient() == this &&
ime_type_ != ui::TEXT_INPUT_TYPE_NONE) {
input_method->ShowImeIfNeeded();
}
}
}
void ArcImeService::OnCursorRectChanged(const gfx::Rect& rect) {
......
......@@ -142,19 +142,12 @@ TEST_F(ArcImeServiceTest, ShowImeIfNeeded) {
instance_->OnTextInputTypeChanged(ui::TEXT_INPUT_TYPE_NONE);
ASSERT_EQ(0, fake_input_method_->count_show_ime_if_needed());
// Text input type change does not imply the show ime request.
instance_->OnTextInputTypeChanged(ui::TEXT_INPUT_TYPE_TEXT);
EXPECT_EQ(1, fake_input_method_->count_show_ime_if_needed());
EXPECT_EQ(0, fake_input_method_->count_show_ime_if_needed());
// The type is not changing, hence no call.
instance_->OnTextInputTypeChanged(ui::TEXT_INPUT_TYPE_TEXT);
instance_->ShowImeIfNeeded();
EXPECT_EQ(1, fake_input_method_->count_show_ime_if_needed());
instance_->OnTextInputTypeChanged(ui::TEXT_INPUT_TYPE_SEARCH);
EXPECT_EQ(2, fake_input_method_->count_show_ime_if_needed());
// Change to NONE should not trigger the showing event.
instance_->OnTextInputTypeChanged(ui::TEXT_INPUT_TYPE_NONE);
EXPECT_EQ(2, fake_input_method_->count_show_ime_if_needed());
}
TEST_F(ArcImeServiceTest, CancelComposition) {
......
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