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

Side by Side Diff: ui/native_theme/native_theme_base.cc

Issue 1817613002: MacViews: draw Mac combobox arrows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move drawing to PlatformStyle/Combobox 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/native_theme/native_theme_base.h" 5 #include "ui/native_theme/native_theme_base.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return color_utils::HSLToSkColor(adjusted, alpha); 90 return color_utils::HSLToSkColor(adjusted, alpha);
91 } 91 }
92 92
93 } // namespace 93 } // namespace
94 94
95 namespace ui { 95 namespace ui {
96 96
97 gfx::Size NativeThemeBase::GetPartSize(Part part, 97 gfx::Size NativeThemeBase::GetPartSize(Part part,
98 State state, 98 State state,
99 const ExtraParams& extra) const { 99 const ExtraParams& extra) const {
100 gfx::Size size = CommonThemeGetPartSize(part, state, extra);
101 if (!size.IsEmpty())
102 return size;
103
104 switch (part) { 100 switch (part) {
105 // Please keep these in the order of NativeTheme::Part. 101 // Please keep these in the order of NativeTheme::Part.
106 case kCheckbox: 102 case kCheckbox:
107 return gfx::Size(kCheckboxAndRadioWidth, kCheckboxAndRadioHeight); 103 return gfx::Size(kCheckboxAndRadioWidth, kCheckboxAndRadioHeight);
108 case kInnerSpinButton: 104 case kInnerSpinButton:
109 return gfx::Size(scrollbar_width_, 0); 105 return gfx::Size(scrollbar_width_, 0);
110 case kMenuList: 106 case kMenuList:
111 return gfx::Size(); // No default size. 107 return gfx::Size(); // No default size.
112 case kMenuPopupBackground: 108 case kMenuPopupBackground:
113 return gfx::Size(); // No default size. 109 return gfx::Size(); // No default size.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 const gfx::Rect& rect, 186 const gfx::Rect& rect,
191 const ExtraParams& extra) const { 187 const ExtraParams& extra) const {
192 if (rect.IsEmpty()) 188 if (rect.IsEmpty())
193 return; 189 return;
194 190
195 canvas->save(); 191 canvas->save();
196 canvas->clipRect(gfx::RectToSkRect(rect)); 192 canvas->clipRect(gfx::RectToSkRect(rect));
197 193
198 switch (part) { 194 switch (part) {
199 // Please keep these in the order of NativeTheme::Part. 195 // Please keep these in the order of NativeTheme::Part.
200 case kComboboxArrow:
201 CommonThemePaintComboboxArrow(canvas, rect);
202 break;
203 case kCheckbox: 196 case kCheckbox:
204 PaintCheckbox(canvas, state, rect, extra.button); 197 PaintCheckbox(canvas, state, rect, extra.button);
205 break; 198 break;
206 case kInnerSpinButton: 199 case kInnerSpinButton:
207 PaintInnerSpinButton(canvas, state, rect, extra.inner_spin); 200 PaintInnerSpinButton(canvas, state, rect, extra.inner_spin);
208 break; 201 break;
209 case kMenuList: 202 case kMenuList:
210 PaintMenuList(canvas, state, rect, extra.menu_list); 203 PaintMenuList(canvas, state, rect, extra.menu_list);
211 break; 204 break;
212 case kMenuPopupBackground: 205 case kMenuPopupBackground:
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); 1026 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f);
1034 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); 1027 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f);
1035 1028
1036 if (hsv1[2] + hsv2[2] > 1.0) 1029 if (hsv1[2] + hsv2[2] > 1.0)
1037 diff = -diff; 1030 diff = -diff;
1038 1031
1039 return SaturateAndBrighten(hsv2, -0.2f, diff); 1032 return SaturateAndBrighten(hsv2, -0.2f, diff);
1040 } 1033 }
1041 1034
1042 } // namespace ui 1035 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698