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

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

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: Refactor 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/compositor/layer_type.h"
7 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas.h"
8 #include "ui/native_theme/native_theme.h" 9 #include "ui/native_theme/native_theme.h"
9 #include "ui/views/controls/focusable_border.h" 10 #include "ui/views/controls/focusable_border.h"
10 11
11 namespace views { 12 namespace views {
12 13
13 namespace { 14 namespace {
14 15
15 // The stroke width of the focus border in dp. 16 // The stroke width of the focus border in dp.
16 constexpr float kFocusHaloThicknessDp = 2.f; 17 constexpr float kFocusHaloThicknessDp = 2.f;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 paint.setStyle(SkPaint::kStroke_Style); 81 paint.setStyle(SkPaint::kStroke_Style);
81 paint.setStrokeWidth(kFocusHaloThicknessDp); 82 paint.setStrokeWidth(kFocusHaloThicknessDp);
82 gfx::RectF rect(GetLocalBounds()); 83 gfx::RectF rect(GetLocalBounds());
83 rect.Inset(gfx::InsetsF(kFocusHaloThicknessDp / 2.f)); 84 rect.Inset(gfx::InsetsF(kFocusHaloThicknessDp / 2.f));
84 canvas->DrawRoundRect(rect, kFocusHaloCornerRadiusDp, paint); 85 canvas->DrawRoundRect(rect, kFocusHaloCornerRadiusDp, paint);
85 } 86 }
86 87
87 FocusRing::FocusRing() 88 FocusRing::FocusRing()
88 : override_color_id_(ui::NativeTheme::kColorId_NumColors) { 89 : override_color_id_(ui::NativeTheme::kColorId_NumColors) {
89 // A layer is necessary to paint beyond the parent's bounds. 90 // A layer is necessary to paint beyond the parent's bounds.
90 SetPaintToLayer(true); 91 SetPaintToLayer(ui::LAYER_TEXTURED);
91 layer()->SetFillsBoundsOpaquely(false); 92 layer()->SetFillsBoundsOpaquely(false);
92 } 93 }
93 94
94 FocusRing::~FocusRing() {} 95 FocusRing::~FocusRing() {}
95 96
96 } // namespace views 97 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698