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

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

Issue 2604303002: (Mac)Views: Widgets focus first View in traversal order if initial focus fails. (Closed)
Patch Set: Use views:: everywhere for consistency (?) Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/focus_ring.h" 5 #include "ui/views/controls/focus_ring.h"
6 6
7 #include "ui/gfx/canvas.h" 7 #include "ui/gfx/canvas.h"
8 #include "ui/native_theme/native_theme.h" 8 #include "ui/native_theme/native_theme.h"
9 #include "ui/views/controls/focusable_border.h" 9 #include "ui/views/controls/focusable_border.h"
10 10
(...skipping 18 matching lines...) Expand all
29 return nullptr; 29 return nullptr;
30 } 30 }
31 31
32 } // namespace 32 } // namespace
33 33
34 const char FocusRing::kViewClassName[] = "FocusRing"; 34 const char FocusRing::kViewClassName[] = "FocusRing";
35 35
36 // static 36 // static
37 views::View* FocusRing::Install(views::View* parent, 37 views::View* FocusRing::Install(views::View* parent,
38 ui::NativeTheme::ColorId override_color_id) { 38 ui::NativeTheme::ColorId override_color_id) {
39 DCHECK(parent->HasFocus());
karandeepb 2016/12/30 21:16:04 If it's ok, can you send a separate CL for this, s
Patti Lor 2017/01/03 03:48:26 No worries, see https://codereview.chromium.org/26
40 FocusRing* ring = GetFocusRing(parent); 39 FocusRing* ring = GetFocusRing(parent);
41 if (!ring) { 40 if (!ring) {
42 ring = new FocusRing(); 41 ring = new FocusRing();
43 parent->AddChildView(ring); 42 parent->AddChildView(ring);
44 } 43 }
45 ring->override_color_id_ = override_color_id; 44 ring->override_color_id_ = override_color_id;
46 ring->Layout(); 45 ring->Layout();
47 ring->SchedulePaint(); 46 ring->SchedulePaint();
48 return ring; 47 return ring;
49 } 48 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 FocusRing::FocusRing() 87 FocusRing::FocusRing()
89 : override_color_id_(ui::NativeTheme::kColorId_NumColors) { 88 : override_color_id_(ui::NativeTheme::kColorId_NumColors) {
90 // A layer is necessary to paint beyond the parent's bounds. 89 // A layer is necessary to paint beyond the parent's bounds.
91 SetPaintToLayer(true); 90 SetPaintToLayer(true);
92 layer()->SetFillsBoundsOpaquely(false); 91 layer()->SetFillsBoundsOpaquely(false);
93 } 92 }
94 93
95 FocusRing::~FocusRing() {} 94 FocusRing::~FocusRing() {}
96 95
97 } // namespace views 96 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698