Chromium Code Reviews| 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..62a3fe67d9d3a7a7e106dca463882064bc28af95 100644 |
| --- a/ui/views/controls/combobox/combobox.cc |
| +++ b/ui/views/controls/combobox/combobox.cc |
| @@ -625,6 +625,9 @@ void Combobox::OnPaint(gfx::Canvas* canvas) { |
| switch (style_) { |
| case STYLE_NORMAL: { |
| OnPaintBackground(canvas); |
| + // Painting the arrow background needs to happen before PaintText applies |
| + // a clip rect to |canvas| so the background can touch the border. |
| + PaintArrowBackground(canvas); |
| PaintText(canvas); |
| OnPaintBorder(canvas); |
| break; |
| @@ -713,7 +716,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()); |
| @@ -813,6 +817,29 @@ void Combobox::PaintButtons(gfx::Canvas* canvas) { |
| } |
| } |
| +void Combobox::PaintArrowBackground(gfx::Canvas* canvas) { |
| + gfx::ScopedCanvas scoped_canvas(canvas); |
|
tapted
2016/03/22 11:20:26
This is a lot of code for something Mac-specific -
Elly Fong-Jones
2016/03/22 22:05:10
Done.
|
| + |
| + if (base::i18n::IsRTL()) { |
| + canvas->Translate(gfx::Vector2d(width(), 0)); |
| + canvas->Scale(-1, 1); |
| + } |
| + |
| + gfx::Rect bounds = GetLocalBounds(); |
| + gfx::Size arrow_size = ArrowSize(); |
| + int disclosure_arrow_offset = width() - arrow_size.width() - |
| + GetDisclosureArrowLeftPadding() - GetDisclosureArrowRightPadding(); |
| + bounds.Inset(disclosure_arrow_offset, 0, 0, 0); |
| + |
| + ui::NativeTheme::State state = |
| + HasFocus() ? ui::NativeTheme::kHovered : ui::NativeTheme::kNormal; |
| + GetNativeTheme()->Paint(canvas->sk_canvas(), |
| + ui::NativeTheme::kComboboxArrowBackground, |
| + state, |
| + bounds, |
| + ui::NativeTheme::ExtraParams()); |
| +} |
| + |
| void Combobox::ShowDropDownMenu(ui::MenuSourceType source_type) { |
| gfx::Rect lb = GetLocalBounds(); |
| gfx::Point menu_position(lb.origin()); |