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

Unified Diff: ui/views/controls/combobox/combobox.cc

Issue 1819443002: MacViews: draw combobox arrow backgrounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use Background instead of a separate Part 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/combobox/combobox.cc
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc
index 382c6db3ce101d65d28c70c697fb281a6a0fe20c..331ea166744f59b7535d8e7684dcd4547032080f 100644
--- a/ui/views/controls/combobox/combobox.cc
+++ b/ui/views/controls/combobox/combobox.cc
@@ -27,6 +27,7 @@
#include "ui/native_theme/native_theme.h"
#include "ui/native_theme/native_theme_aura.h"
#include "ui/resources/grit/ui_resources.h"
+#include "ui/views/background.h"
#include "ui/views/controls/button/custom_button.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/combobox/combobox_listener.h"
@@ -354,6 +355,9 @@ Combobox::Combobox(ui::ComboboxModel* model)
ModelChanged();
SetFocusable(true);
UpdateBorder();
+ // set_background takes ownership but takes a raw pointer.
tapted 2016/03/22 23:04:32 nit: set_background()
Elly Fong-Jones 2016/03/23 18:07:44 Done.
+ scoped_ptr<Background> b = PlatformStyle::CreateComboboxBackground();
+ set_background(b.release());
// Initialize the button images.
Button::ButtonState button_states[] = {
@@ -713,7 +717,8 @@ void Combobox::PaintText(gfx::Canvas* canvas) {
int y = insets.top();
int text_height = height() - insets.height();
SkColor text_color = GetNativeTheme()->GetSystemColor(
- ui::NativeTheme::kColorId_LabelEnabledColor);
+ enabled() ? ui::NativeTheme::kColorId_LabelEnabledColor :
+ ui::NativeTheme::kColorId_LabelDisabledColor);
DCHECK_GE(selected_index_, 0);
DCHECK_LT(selected_index_, model()->GetItemCount());
@@ -934,4 +939,10 @@ PrefixSelector* Combobox::GetPrefixSelector() {
return selector_.get();
}
+int Combobox::GetArrowButtonWidth() const {
tapted 2016/03/22 23:04:32 nit: move up so it matches declaration order
Elly Fong-Jones 2016/03/23 18:07:44 Done.
+ return GetDisclosureArrowLeftPadding() +
+ ArrowSize().width() +
+ GetDisclosureArrowRightPadding();
+}
+
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698