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

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

Issue 2920463002: views: remove FocusableRoundedBorderMac (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « ui/views/controls/focusable_rounded_border_mac.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/views/controls/focusable_rounded_border_mac.h"
6
7 #include "ui/gfx/canvas.h"
8 #include "ui/native_theme/native_theme_mac.h"
9
10 namespace {
11
12 const int kThickness = 1;
13
14 } // namespace
15
16 namespace views {
17
18 FocusableRoundedBorder::FocusableRoundedBorder() {
19 // TODO(ellyjones): These insets seem like they shouldn't be big enough, but
20 // they are, and insetting by corner_radius_ instead produces gargantuan
21 // padding. Why is that?
22 SetInsets(kThickness, kThickness, kThickness, kThickness);
23 }
24
25 FocusableRoundedBorder::~FocusableRoundedBorder() {}
26
27 // For now, this is similar to RoundedRectBorder::Paint(), but this method will
28 // likely diverge in future.
29 // TODO(ellyjones): Diverge it by adding soft focus rings.
30 void FocusableRoundedBorder::Paint(const View& view, gfx::Canvas* canvas) {
31 cc::PaintFlags flags;
32 flags.setStyle(cc::PaintFlags::kStroke_Style);
33 flags.setStrokeWidth(kThickness);
34 flags.setColor(GetCurrentColor(view));
35 flags.setAntiAlias(true);
36
37 float half_thickness = kThickness / 2.0f;
38 gfx::RectF bounds(view.GetLocalBounds());
39 bounds.Inset(half_thickness, half_thickness);
40 canvas->DrawRoundRect(bounds, ui::NativeThemeMac::kButtonCornerRadius, flags);
41 }
42
43 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/focusable_rounded_border_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698