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

Unified Diff: ui/views/controls/textfield/textfield.cc

Issue 2728433002: Unnecessarily cursor appears in omnibox after clicking inside the 'Search box' (Closed)
Patch Set: nits Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield_test_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/textfield/textfield.cc
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index 01a666be628b77420bc5d76c902de3877e681d9f..01ca7439765f3ff74908349e1dcbb233ca56f7a6 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -979,10 +979,11 @@ void Textfield::OnPaint(gfx::Canvas* canvas) {
}
void Textfield::OnFocus() {
- GetRenderText()->set_focused(true);
+ gfx::RenderText* render_text = GetRenderText();
+ render_text->set_focused(true);
if (ShouldShowCursor()) {
sadrul 2017/03/01 20:51:24 Can you look at whether ShouldShowCursor() should
yiyix 2017/03/01 22:18:58 ShouldShowCursor() does not check render_text->cur
UpdateCursorView();
- cursor_view_.SetVisible(true);
+ cursor_view_.SetVisible(render_text->cursor_enabled());
}
if (GetInputMethod())
GetInputMethod()->SetFocusedTextInputClient(this);
@@ -1909,8 +1910,9 @@ void Textfield::UpdateAfterChange(bool text_changed, bool cursor_changed) {
NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true);
}
if (cursor_changed) {
- cursor_view_.SetVisible(ShouldShowCursor());
UpdateCursorView();
+ cursor_view_.SetVisible(GetRenderText()->cursor_enabled() &&
+ ShouldShowCursor());
if (ShouldBlinkCursor())
StartBlinkingCursor();
else
@@ -2087,7 +2089,8 @@ void Textfield::StopBlinkingCursor() {
void Textfield::OnCursorBlinkTimerFired() {
DCHECK(ShouldBlinkCursor());
- cursor_view_.SetVisible(!cursor_view_.visible());
+ cursor_view_.SetVisible(GetRenderText()->cursor_enabled() &&
+ !cursor_view_.visible());
sadrul 2017/03/01 20:51:24 If cursor is disabled in RenderText, is there a re
yiyix 2017/03/01 22:18:58 After the modification, this function is only call
UpdateCursorView();
}
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698