Commit 466ebdf6 authored by kevers@chromium.org's avatar kevers@chromium.org

Revert "Fix textfield blur, to prevent resetting the text input client when...

Revert "Fix textfield blur, to prevent resetting the text input client when navigating between text fields."

The fix to use OnTextInputTypeChanged in place of OnFocus and OnBlur to resolve focus loss on text field navigation has introduced a number of regressions. As it turns out, the fix is no longer even necessary to address the original bug that it was intended to address (365741).  This patch is a revert of r270818.

BUG=375125,377359,378914

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274374 0039d316-1c4b-4281-b951-d872f2087c98
parent 33677ce5
...@@ -916,7 +916,7 @@ void Textfield::OnFocus() { ...@@ -916,7 +916,7 @@ void Textfield::OnFocus() {
GetRenderText()->set_focused(true); GetRenderText()->set_focused(true);
cursor_visible_ = true; cursor_visible_ = true;
SchedulePaint(); SchedulePaint();
GetInputMethod()->OnTextInputTypeChanged(this); GetInputMethod()->OnFocus();
OnCaretBoundsChanged(); OnCaretBoundsChanged();
const size_t caret_blink_ms = Textfield::GetCaretBlinkMs(); const size_t caret_blink_ms = Textfield::GetCaretBlinkMs();
...@@ -932,7 +932,7 @@ void Textfield::OnFocus() { ...@@ -932,7 +932,7 @@ void Textfield::OnFocus() {
void Textfield::OnBlur() { void Textfield::OnBlur() {
GetRenderText()->set_focused(false); GetRenderText()->set_focused(false);
GetInputMethod()->OnTextInputTypeChanged(this); GetInputMethod()->OnBlur();
cursor_repaint_timer_.Stop(); cursor_repaint_timer_.Stop();
if (cursor_visible_) { if (cursor_visible_) {
cursor_visible_ = false; cursor_visible_ = false;
......
...@@ -644,35 +644,6 @@ TEST_F(TextfieldTest, FocusTraversalTest) { ...@@ -644,35 +644,6 @@ TEST_F(TextfieldTest, FocusTraversalTest) {
EXPECT_EQ(1, GetFocusedView()->id()); EXPECT_EQ(1, GetFocusedView()->id());
} }
// Verify that the text input client properly tracks changing focus between text
// fields. See crbug/365741.
TEST_F(TextfieldTest, TextInputClientFollowsFocusChange) {
InitTextfields(2);
textfield_->RequestFocus();
EXPECT_EQ(textfield_, input_method_->GetTextInputClient());
widget_->GetFocusManager()->AdvanceFocus(false);
Textfield* second = static_cast<Textfield*>(GetFocusedView());
EXPECT_EQ(2, second->id());
EXPECT_EQ(second, input_method_->GetTextInputClient());
ui::MouseEvent click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON);
textfield_->OnMousePressed(click);
EXPECT_EQ(textfield_, input_method_->GetTextInputClient());
input_method_->Clear();
// Verify that blur does not reset text input client if field does not
// have focus.
second->OnBlur();
EXPECT_FALSE(input_method_->text_input_type_changed());
// Verify that blur on the focused text field resets the text input client.
textfield_->OnBlur();
EXPECT_TRUE(input_method_->text_input_type_changed());
}
TEST_F(TextfieldTest, ContextMenuDisplayTest) { TEST_F(TextfieldTest, ContextMenuDisplayTest) {
InitTextfield(); InitTextfield();
EXPECT_TRUE(textfield_->context_menu_controller()); EXPECT_TRUE(textfield_->context_menu_controller());
......
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