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 983a8077e9d600bf041a8cf351ce53fe477cdc5b..becceb5ba03d010d8c62f4a329cd8a10e34cefed 100644 |
| --- a/ui/views/controls/combobox/combobox.cc |
| +++ b/ui/views/controls/combobox/combobox.cc |
| @@ -407,9 +407,11 @@ Combobox::Combobox(ui::ComboboxModel* model, Style style) |
| UpdateBorder(); |
| // set_background() takes ownership but takes a raw pointer. |
| - std::unique_ptr<Background> b = |
| - PlatformStyle::CreateComboboxBackground(GetArrowContainerWidth()); |
| - set_background(b.release()); |
| + if (!UseMd()) { |
| + std::unique_ptr<Background> b = |
| + PlatformStyle::CreateComboboxBackground(GetArrowContainerWidth()); |
| + set_background(b.release()); |
| + } |
| // Initialize the button images. |
| Button::ButtonState button_states[] = { |
| @@ -788,6 +790,12 @@ void Combobox::PaintText(gfx::Canvas* canvas) { |
| gfx::Rect text_bounds(x, y, text_width, text_height); |
| AdjustBoundsForRTLUI(&text_bounds); |
| + // TODO(ellyjones): This doesn't seem right. There's no particular reason why |
| + // the text should need the rectangle underneath it filled first while none of |
| + // the other drawn things need that. Also, drawing over with |
| + // SK_ColorTRANSPARENT doesn't seem to suffice. Why? |
| + if (UseMd()) |
| + canvas->FillRect(text_bounds, SK_ColorWHITE); |
| canvas->DrawStringRect(text, font_list, text_color, text_bounds); |
| gfx::Rect arrow_bounds(disclosure_arrow_offset, 0, GetArrowContainerWidth(), |
| @@ -968,8 +976,11 @@ PrefixSelector* Combobox::GetPrefixSelector() { |
| } |
| int Combobox::GetArrowContainerWidth() const { |
| + const int kMdPaddingWidth = 8; |
|
Evan Stade
2016/09/07 17:24:43
this change seems fine
|
| + int arrow_pad = UseMd() ? kMdPaddingWidth |
| + : PlatformStyle::kComboboxNormalArrowPadding; |
| int padding = style_ == STYLE_NORMAL |
| - ? PlatformStyle::kComboboxNormalArrowPadding * 2 |
| + ? arrow_pad * 2 |
| : kActionLeftPadding + kActionRightPadding; |
| return ArrowSize().width() + padding; |
| } |