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

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

Issue 2395033002: Harmony - Don't paint focus ring on unless border requests it. (Closed)
Patch Set: Created 4 years, 2 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
« ui/views/border.h ('K') | « ui/views/controls/focusable_border.cc ('k') | no next file » | 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 7c7b03534634c075e20a209397b5897961b0bbcf..4dde2b03a89032a87b0c57a198d7cb0539810b72 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -983,16 +983,19 @@ void Textfield::OnFocus() {
GetRenderText()->set_focused(true);
if (ShouldShowCursor())
GetRenderText()->set_cursor_visible(true);
- SchedulePaint();
if (GetInputMethod())
GetInputMethod()->SetFocusedTextInputClient(this);
OnCaretBoundsChanged();
if (ShouldBlinkCursor())
StartBlinkingCursor();
- View::OnFocus();
- SchedulePaint();
- if (ui::MaterialDesignController::IsSecondaryUiMaterial())
+ // Pre Harmony, the border typically draws focus indicator. If there's no
+ // border, there should be no focus indicator (e.g. in the omnibox).
+ if (ui::MaterialDesignController::IsSecondaryUiMaterial() &&
+ border() && border()->ShouldAddFocusRing()) {
FocusRing::Install(this);
+ }
+ SchedulePaint();
+ View::OnFocus();
}
void Textfield::OnBlur() {
@@ -1008,10 +1011,12 @@ void Textfield::OnBlur() {
DestroyTouchSelection();
- // Border typically draws focus indicator.
- SchedulePaint();
- if (ui::MaterialDesignController::IsSecondaryUiMaterial())
+ if (ui::MaterialDesignController::IsSecondaryUiMaterial() &&
+ border() && border()->ShouldAddFocusRing()) {
FocusRing::Uninstall(this);
+ }
+ SchedulePaint();
+ View::OnBlur();
}
gfx::Point Textfield::GetKeyboardContextMenuLocation() {
« ui/views/border.h ('K') | « ui/views/controls/focusable_border.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698