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

Unified Diff: ui/views/style/platform_style.cc

Issue 1904753002: MenuButton: support Mac look & feel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes :) Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/style/platform_style.cc
diff --git a/ui/views/style/platform_style.cc b/ui/views/style/platform_style.cc
index 9027c6632dd0f0365d3ca45922c63e357c996c3c..4466fff3afc42a055d3c76f021b5b0297003c6cd 100644
--- a/ui/views/style/platform_style.cc
+++ b/ui/views/style/platform_style.cc
@@ -56,6 +56,16 @@ std::unique_ptr<Background> PlatformStyle::CreateComboboxBackground() {
}
// static
+std::unique_ptr<Background> PlatformStyle::CreateMenuButtonBackground() {
+ return nullptr;
+}
+
+// static
+std::unique_ptr<FocusableBorder> PlatformStyle::CreateMenuButtonBorder() {
+ return base::WrapUnique(new FocusableBorder());
+}
+
+// static
std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
Button::ButtonStyle style) {
if (!ui::MaterialDesignController::IsModeMaterial() ||
@@ -70,6 +80,12 @@ std::unique_ptr<LabelButtonBorder> PlatformStyle::CreateLabelButtonBorder(
}
// static
+gfx::ImageSkia PlatformStyle::CreateMenuButtonArrow(bool is_enabled) {
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ return *rb.GetImageSkiaNamed(IDR_MENU_DROPARROW);
+}
+
+// static
std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(bool is_horizontal) {
return base::WrapUnique(new NativeScrollBar(is_horizontal));
}
@@ -83,6 +99,24 @@ SkColor PlatformStyle::TextColorForButton(
#endif // OS_MACOSX
+// This definition is used even on Mac, but Mac has its own
+// CreateComboboxArrow() so it will return something different on Mac.
+// static
+int PlatformStyle::GetComboboxShoulderWidth(Combobox::Style style) {
+ const int kNormalPadding = 7;
+ const int kActionPadding = 11;
+ int padding =
+ style == Combobox::STYLE_NORMAL ? kNormalPadding * 2 : kActionPadding * 2;
+ int image_width = CreateComboboxArrow(true, style).size().width();
tapted 2016/04/22 13:46:52 I don't think the .size() is needed, same below. B
Elly Fong-Jones 2016/04/25 14:30:51 Okay. The reason why it wasn't statically compute
+ return padding + image_width;
+}
+
+// static
+int PlatformStyle::GetMenuButtonShoulderWidth() {
+ const int kPadding = 7;
+ return kPadding * 2 + CreateMenuButtonArrow(true).size().width();
+}
+
#if !defined(DESKTOP_LINUX) && !defined(OS_MACOSX)
// static
void PlatformStyle::ApplyLabelButtonTextStyle(

Powered by Google App Engine
This is Rietveld 408576698