Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: ui/views/controls/textfield/textfield.cc

Issue 302363002: Revert "Fix textfield blur, to prevent resetting the text input client when navigating between text… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "grit/ui_strings.h" 10 #include "grit/ui_strings.h"
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 void Textfield::OnPaint(gfx::Canvas* canvas) { 865 void Textfield::OnPaint(gfx::Canvas* canvas) {
866 OnPaintBackground(canvas); 866 OnPaintBackground(canvas);
867 PaintTextAndCursor(canvas); 867 PaintTextAndCursor(canvas);
868 OnPaintBorder(canvas); 868 OnPaintBorder(canvas);
869 } 869 }
870 870
871 void Textfield::OnFocus() { 871 void Textfield::OnFocus() {
872 GetRenderText()->set_focused(true); 872 GetRenderText()->set_focused(true);
873 cursor_visible_ = true; 873 cursor_visible_ = true;
874 SchedulePaint(); 874 SchedulePaint();
875 GetInputMethod()->OnTextInputTypeChanged(this); 875 GetInputMethod()->OnFocus();
876 OnCaretBoundsChanged(); 876 OnCaretBoundsChanged();
877 877
878 const size_t caret_blink_ms = Textfield::GetCaretBlinkMs(); 878 const size_t caret_blink_ms = Textfield::GetCaretBlinkMs();
879 if (caret_blink_ms != 0) { 879 if (caret_blink_ms != 0) {
880 cursor_repaint_timer_.Start(FROM_HERE, 880 cursor_repaint_timer_.Start(FROM_HERE,
881 base::TimeDelta::FromMilliseconds(caret_blink_ms), this, 881 base::TimeDelta::FromMilliseconds(caret_blink_ms), this,
882 &Textfield::UpdateCursor); 882 &Textfield::UpdateCursor);
883 } 883 }
884 884
885 View::OnFocus(); 885 View::OnFocus();
886 SchedulePaint(); 886 SchedulePaint();
887 } 887 }
888 888
889 void Textfield::OnBlur() { 889 void Textfield::OnBlur() {
890 GetRenderText()->set_focused(false); 890 GetRenderText()->set_focused(false);
891 GetInputMethod()->OnTextInputTypeChanged(this); 891 GetInputMethod()->OnBlur();
892 cursor_repaint_timer_.Stop(); 892 cursor_repaint_timer_.Stop();
893 if (cursor_visible_) { 893 if (cursor_visible_) {
894 cursor_visible_ = false; 894 cursor_visible_ = false;
895 RepaintCursor(); 895 RepaintCursor();
896 } 896 }
897 897
898 DestroyTouchSelection(); 898 DestroyTouchSelection();
899 899
900 // Border typically draws focus indicator. 900 // Border typically draws focus indicator.
901 SchedulePaint(); 901 SchedulePaint();
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 const size_t length = selection_clipboard_text.length(); 1710 const size_t length = selection_clipboard_text.length();
1711 range = gfx::Range(range.start() + length, range.end() + length); 1711 range = gfx::Range(range.start() + length, range.end() + length);
1712 } 1712 }
1713 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); 1713 model_->MoveCursorTo(gfx::SelectionModel(range, affinity));
1714 UpdateAfterChange(true, true); 1714 UpdateAfterChange(true, true);
1715 OnAfterUserAction(); 1715 OnAfterUserAction();
1716 } 1716 }
1717 } 1717 }
1718 1718
1719 } // namespace views 1719 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698