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

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

Issue 1819443002: MacViews: draw combobox arrow backgrounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix linux build Created 4 years, 9 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/focusable_rounded_border_mac.h" 5 #include "ui/views/controls/focusable_rounded_border_mac.h"
6 6
7 #include "ui/gfx/canvas.h" 7 #include "ui/gfx/canvas.h"
8 #include "ui/native_theme/native_theme_mac.h"
8 9
9 namespace { 10 namespace {
10 11
11 const int kThickness = 1; 12 const int kThickness = 1;
12 const int kCornerRadius = 5;
13 13
14 } // namespace 14 } // namespace
15 15
16 namespace views { 16 namespace views {
17 17
18 FocusableRoundedBorder::FocusableRoundedBorder() { 18 FocusableRoundedBorder::FocusableRoundedBorder() {
19 // TODO(ellyjones): These insets seem like they shouldn't be big enough, but 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 20 // they are, and insetting by corner_radius_ instead produces gargantuan
21 // padding. Why is that? 21 // padding. Why is that?
22 SetInsets(kThickness, kThickness, kThickness, kThickness); 22 SetInsets(kThickness, kThickness, kThickness, kThickness);
23 } 23 }
24 24
25 FocusableRoundedBorder::~FocusableRoundedBorder() {} 25 FocusableRoundedBorder::~FocusableRoundedBorder() {}
26 26
27 // For now, this is similar to RoundedRectBorder::Paint(), but this method will 27 // For now, this is similar to RoundedRectBorder::Paint(), but this method will
28 // likely diverge in future. 28 // likely diverge in future.
29 // TODO(ellyjones): Diverge it by adding soft focus rings. 29 // TODO(ellyjones): Diverge it by adding soft focus rings.
30 void FocusableRoundedBorder::Paint(const View& view, gfx::Canvas* canvas) { 30 void FocusableRoundedBorder::Paint(const View& view, gfx::Canvas* canvas) {
31 SkPaint paint; 31 SkPaint paint;
32 paint.setStyle(SkPaint::kStroke_Style); 32 paint.setStyle(SkPaint::kStroke_Style);
33 paint.setStrokeWidth(kThickness); 33 paint.setStrokeWidth(kThickness);
34 paint.setColor(GetCurrentColor(view)); 34 paint.setColor(GetCurrentColor(view));
35 paint.setAntiAlias(true); 35 paint.setAntiAlias(true);
36 36
37 float half_thickness = kThickness / 2.0f; 37 float half_thickness = kThickness / 2.0f;
38 gfx::RectF bounds(view.GetLocalBounds()); 38 gfx::RectF bounds(view.GetLocalBounds());
39 bounds.Inset(half_thickness, half_thickness); 39 bounds.Inset(half_thickness, half_thickness);
40 canvas->DrawRoundRect(bounds, kCornerRadius, paint); 40 canvas->DrawRoundRect(bounds, ui::NativeThemeMac::kComboboxCornerRadius,
41 paint);
41 } 42 }
42 43
43 } // namespace views 44 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698