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

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

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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
« no previous file with comments | « ui/views/controls/combobox/combobox.cc ('k') | ui/views/controls/focusable_border.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 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 void FocusRing::Layout() { 64 void FocusRing::Layout() {
65 // The focus ring handles its own sizing, which is simply to fill the parent 65 // The focus ring handles its own sizing, which is simply to fill the parent
66 // and extend a little beyond its borders. 66 // and extend a little beyond its borders.
67 gfx::Rect focus_bounds = parent()->GetLocalBounds(); 67 gfx::Rect focus_bounds = parent()->GetLocalBounds();
68 focus_bounds.Inset(gfx::Insets(-kFocusHaloThicknessDp)); 68 focus_bounds.Inset(gfx::Insets(-kFocusHaloThicknessDp));
69 SetBoundsRect(focus_bounds); 69 SetBoundsRect(focus_bounds);
70 } 70 }
71 71
72 void FocusRing::OnPaint(gfx::Canvas* canvas) { 72 void FocusRing::OnPaint(gfx::Canvas* canvas) {
73 SkPaint paint; 73 CdlPaint paint;
74 paint.setAntiAlias(true); 74 paint.setAntiAlias(true);
75 paint.setColor( 75 paint.setColor(
76 SkColorSetA(GetNativeTheme()->GetSystemColor( 76 SkColorSetA(GetNativeTheme()->GetSystemColor(
77 override_color_id_ != ui::NativeTheme::kColorId_NumColors 77 override_color_id_ != ui::NativeTheme::kColorId_NumColors
78 ? override_color_id_ 78 ? override_color_id_
79 : ui::NativeTheme::kColorId_FocusedBorderColor), 79 : ui::NativeTheme::kColorId_FocusedBorderColor),
80 0x66)); 80 0x66));
81 paint.setStyle(SkPaint::kStroke_Style); 81 paint.setStyle(CdlPaint::kStroke_Style);
82 paint.setStrokeWidth(kFocusHaloThicknessDp); 82 paint.setStrokeWidth(kFocusHaloThicknessDp);
83 gfx::RectF rect(GetLocalBounds()); 83 gfx::RectF rect(GetLocalBounds());
84 rect.Inset(gfx::InsetsF(kFocusHaloThicknessDp / 2.f)); 84 rect.Inset(gfx::InsetsF(kFocusHaloThicknessDp / 2.f));
85 canvas->DrawRoundRect(rect, kFocusHaloCornerRadiusDp, paint); 85 canvas->DrawRoundRect(rect, kFocusHaloCornerRadiusDp, paint);
86 } 86 }
87 87
88 FocusRing::FocusRing() 88 FocusRing::FocusRing()
89 : override_color_id_(ui::NativeTheme::kColorId_NumColors) { 89 : override_color_id_(ui::NativeTheme::kColorId_NumColors) {
90 // A layer is necessary to paint beyond the parent's bounds. 90 // A layer is necessary to paint beyond the parent's bounds.
91 SetPaintToLayer(true); 91 SetPaintToLayer(true);
92 layer()->SetFillsBoundsOpaquely(false); 92 layer()->SetFillsBoundsOpaquely(false);
93 } 93 }
94 94
95 FocusRing::~FocusRing() {} 95 FocusRing::~FocusRing() {}
96 96
97 } // namespace views 97 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/combobox/combobox.cc ('k') | ui/views/controls/focusable_border.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698