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

Side by Side Diff: ui/views/style/mac/combobox_background_mac.cc

Issue 2261593002: Use ScopedRTLFlipCanvas more pervasively for RTL flipping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix namespace Created 4 years, 4 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/combobox/combobox.cc ('k') | ui/views/view.h » ('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/style/mac/combobox_background_mac.h" 5 #include "ui/views/style/mac/combobox_background_mac.h"
6 6
7 #include "third_party/skia/include/core/SkPath.h" 7 #include "third_party/skia/include/core/SkPath.h"
8 #include "third_party/skia/include/core/SkRRect.h" 8 #include "third_party/skia/include/core/SkRRect.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/scoped_canvas.h" 10 #include "ui/gfx/scoped_canvas.h"
11 #include "ui/native_theme/native_theme_mac.h" 11 #include "ui/native_theme/native_theme_mac.h"
12 #include "ui/views/view.h" 12 #include "ui/views/view.h"
13 13
14 using ui::NativeThemeMac; 14 using ui::NativeThemeMac;
15 15
16 namespace views { 16 namespace views {
17 17
18 ComboboxBackgroundMac::ComboboxBackgroundMac(int container_width) 18 ComboboxBackgroundMac::ComboboxBackgroundMac(int container_width)
19 : container_width_(container_width) {} 19 : container_width_(container_width) {}
20 20
21 ComboboxBackgroundMac::~ComboboxBackgroundMac() {} 21 ComboboxBackgroundMac::~ComboboxBackgroundMac() {}
22 22
23 void ComboboxBackgroundMac::Paint(gfx::Canvas* canvas, View* view) const { 23 void ComboboxBackgroundMac::Paint(gfx::Canvas* canvas, View* view) const {
24 gfx::RectF bounds(view->GetLocalBounds()); 24 gfx::RectF bounds(view->GetLocalBounds());
25 gfx::ScopedRTLFlipCanvas scoped_canvas(canvas, view->bounds()); 25 gfx::ScopedRTLFlipCanvas scoped_canvas(canvas, view->width());
26 26
27 // Inset the left side far enough to draw only the arrow button, and inset the 27 // Inset the left side far enough to draw only the arrow button, and inset the
28 // other three sides by half a pixel so the edge of the background doesn't 28 // other three sides by half a pixel so the edge of the background doesn't
29 // paint outside the border. 29 // paint outside the border.
30 // Disabled comboboxes do not have a separate color for the arrow container; 30 // Disabled comboboxes do not have a separate color for the arrow container;
31 // instead, the entire combobox is drawn with the disabled background shader. 31 // instead, the entire combobox is drawn with the disabled background shader.
32 if (view->enabled()) { 32 if (view->enabled()) {
33 bounds.Inset(bounds.width() - container_width_, 0.5, 0.5, 0.5); 33 bounds.Inset(bounds.width() - container_width_, 0.5, 0.5, 0.5);
34 } else { 34 } else {
35 bounds.Inset(0.5, 0.5); 35 bounds.Inset(0.5, 0.5);
(...skipping 25 matching lines...) Expand all
61 else 61 else
62 fill_rect.setRectXY(gfx::RectFToSkRect(bounds), curve.fX, curve.fY); 62 fill_rect.setRectXY(gfx::RectFToSkRect(bounds), curve.fX, curve.fY);
63 63
64 SkPath path; 64 SkPath path;
65 path.addRRect(fill_rect); 65 path.addRRect(fill_rect);
66 66
67 canvas->DrawPath(path, paint); 67 canvas->DrawPath(path, paint);
68 } 68 }
69 69
70 } // namespace views 70 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/combobox/combobox.cc ('k') | ui/views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698