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

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

Issue 2317033002: views combobox: use MD padding on Mac in MD mode (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698