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

Issue 1904753002: MenuButton: support Mac look & feel (Closed)

Created:
4 years, 8 months ago by Elly Fong-Jones
Modified:
4 years, 3 months ago
Reviewers:
tapted, sky
CC:
chromium-reviews, tfarina
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MenuButton: support Mac look & feel This change: * Factors arrow width calculation out of Combobox * Generalizes ComboboxBackgroundMac so it can be used on any control * Refactor MenuButton to use PlatformStyle for background and arrow The ability to set the arrow image on MenuButton is removed; MenuButton will now always use the appropriate PlatformStyle image. To test this change, build views_examples_with_content_exe and choose Menu from the combobox. BUG=605161

Patch Set 1 #

Patch Set 2 : fix RTL support #

Total comments: 30

Patch Set 3 : fixes :) #

Total comments: 17

Patch Set 4 : cache arrow images #

Total comments: 34

Patch Set 5 : only cache one arrow image #

Total comments: 16

Patch Set 6 : Fix arrow position with no border #

Patch Set 7 : don't call virtual from constructor #

Total comments: 10

Patch Set 8 : WIP #

Patch Set 9 : Add basic tests #

Total comments: 13
Unified diffs Side-by-side diffs Delta from patch set Stats (+363 lines, -191 lines) Patch
M chrome/browser/ui/views/translate/translate_bubble_view.cc View 1 2 3 1 chunk +2 lines, -2 lines 1 comment Download
M ui/gfx/BUILD.gn View 1 2 3 4 2 chunks +5 lines, -1 line 0 comments Download
M ui/gfx/gfx.gyp View 1 2 3 4 1 chunk +1 line, -0 lines 1 comment Download
M ui/gfx/scoped_canvas.h View 1 2 3 4 5 2 chunks +18 lines, -1 line 0 comments Download
A ui/gfx/scoped_canvas.cc View 1 2 3 1 chunk +21 lines, -0 lines 0 comments Download
A + ui/gfx/vector_icons/menu_button_arrow_mac.icon View 1 2 1 chunk +3 lines, -2 lines 0 comments Download
M ui/views/controls/button/menu_button.h View 1 2 3 4 5 6 7 4 chunks +12 lines, -12 lines 1 comment Download
M ui/views/controls/button/menu_button.cc View 1 2 3 4 5 6 7 6 chunks +41 lines, -23 lines 3 comments Download
M ui/views/controls/button/menu_button_unittest.cc View 1 2 3 4 5 6 7 8 5 chunks +42 lines, -7 lines 6 comments Download
M ui/views/controls/combobox/combobox.h View 1 2 3 4 5 6 chunks +10 lines, -8 lines 0 comments Download
M ui/views/controls/combobox/combobox.cc View 1 2 3 4 5 12 chunks +29 lines, -72 lines 0 comments Download
M ui/views/controls/combobox/combobox_unittest.cc View 1 2 3 4 28 chunks +75 lines, -42 lines 0 comments Download
M ui/views/examples/combobox_example.cc View 1 2 3 1 chunk +2 lines, -3 lines 0 comments Download
M ui/views/examples/menu_example.cc View 1 2 3 4 5 6 7 6 chunks +36 lines, -6 lines 0 comments Download
M ui/views/style/mac/combobox_background_mac.h View 1 2 3 1 chunk +6 lines, -1 line 1 comment Download
M ui/views/style/mac/combobox_background_mac.cc View 1 2 3 1 chunk +7 lines, -7 lines 0 comments Download
M ui/views/style/platform_style.h View 1 2 3 4 1 chunk +12 lines, -1 line 0 comments Download
M ui/views/style/platform_style.cc View 1 2 3 4 2 chunks +19 lines, -1 line 0 comments Download
M ui/views/style/platform_style_mac.mm View 1 2 3 4 1 chunk +22 lines, -2 lines 0 comments Download

Messages

Total messages: 17 (4 generated)
Elly Fong-Jones
tapted: ptal? :)
4 years, 8 months ago (2016-04-20 17:23:02 UTC) #4
tapted
There's some quirky stuff in mac_views_browser -- see http://crbug.com/605161#c3 - there might be an easy ...
4 years, 8 months ago (2016-04-21 06:06:46 UTC) #5
Elly Fong-Jones
tapted: ptal? :) https://codereview.chromium.org/1904753002/diff/20001/ui/gfx/BUILD.gn File ui/gfx/BUILD.gn (right): https://codereview.chromium.org/1904753002/diff/20001/ui/gfx/BUILD.gn#newcode585 ui/gfx/BUILD.gn:585: "vector_icons/menu_button_arrow_mac.icon", On 2016/04/21 06:06:45, tapted wrote: ...
4 years, 8 months ago (2016-04-21 15:30:27 UTC) #6
tapted
ran out of time to try this out today. Main question is about how the ...
4 years, 8 months ago (2016-04-22 13:46:52 UTC) #7
Elly Fong-Jones
tapted: ptal? should be last round I think https://codereview.chromium.org/1904753002/diff/40001/ui/gfx/BUILD.gn File ui/gfx/BUILD.gn (right): https://codereview.chromium.org/1904753002/diff/40001/ui/gfx/BUILD.gn#newcode165 ui/gfx/BUILD.gn:165: "scoped_canvas.h", ...
4 years, 8 months ago (2016-04-25 14:30:51 UTC) #8
tapted
https://codereview.chromium.org/1904753002/diff/40001/ui/views/controls/button/menu_button.cc File ui/views/controls/button/menu_button.cc (right): https://codereview.chromium.org/1904753002/diff/40001/ui/views/controls/button/menu_button.cc#newcode84 ui/views/controls/button/menu_button.cc:84: SetBorder(PlatformStyle::CreateMenuButtonBorder()); On 2016/04/25 14:30:50, Elly Jones wrote: > On ...
4 years, 8 months ago (2016-04-26 05:05:58 UTC) #9
Elly Fong-Jones
tapted, sky: ptal? :) https://codereview.chromium.org/1904753002/diff/60001/ui/gfx/scoped_canvas.h File ui/gfx/scoped_canvas.h (right): https://codereview.chromium.org/1904753002/diff/60001/ui/gfx/scoped_canvas.h#newcode36 ui/gfx/scoped_canvas.h:36: class ScopedRTLFlipCanvas { On 2016/04/26 ...
4 years, 8 months ago (2016-04-26 17:41:26 UTC) #11
tapted
https://codereview.chromium.org/1904753002/diff/60001/ui/gfx/scoped_canvas.h File ui/gfx/scoped_canvas.h (right): https://codereview.chromium.org/1904753002/diff/60001/ui/gfx/scoped_canvas.h#newcode36 ui/gfx/scoped_canvas.h:36: class ScopedRTLFlipCanvas { On 2016/04/26 17:41:25, Elly Jones wrote: ...
4 years, 8 months ago (2016-04-27 03:25:11 UTC) #12
Elly Fong-Jones
tapted: ptal? https://codereview.chromium.org/1904753002/diff/80001/ui/gfx/scoped_canvas.h File ui/gfx/scoped_canvas.h (right): https://codereview.chromium.org/1904753002/diff/80001/ui/gfx/scoped_canvas.h#newcode9 ui/gfx/scoped_canvas.h:9: On 2016/04/27 03:25:11, tapted wrote: > nit: ...
4 years, 7 months ago (2016-04-28 17:03:12 UTC) #13
tapted
https://codereview.chromium.org/1904753002/diff/120001/ui/views/controls/button/menu_button.cc File ui/views/controls/button/menu_button.cc (right): https://codereview.chromium.org/1904753002/diff/120001/ui/views/controls/button/menu_button.cc#newcode84 ui/views/controls/button/menu_button.cc:84: set_background(PlatformStyle::CreateMenuButtonBackground(GetShoulderWidth()) The background will need similar treatment to the ...
4 years, 7 months ago (2016-04-29 06:53:18 UTC) #14
Elly Fong-Jones
tapted: ptal? not sure where else to go with the tests. https://codereview.chromium.org/1904753002/diff/120001/ui/views/controls/button/menu_button.cc File ui/views/controls/button/menu_button.cc (right): ...
4 years, 7 months ago (2016-05-06 21:30:45 UTC) #15
tapted
LabelButton seems to be where all tricky stuff is -- how about we split off ...
4 years, 7 months ago (2016-05-09 08:01:36 UTC) #16
tapted
4 years, 7 months ago (2016-05-10 08:03:23 UTC) #17
https://codereview.chromium.org/1904753002/diff/120001/ui/views/controls/butt...
File ui/views/controls/button/menu_button.cc (right):

https://codereview.chromium.org/1904753002/diff/120001/ui/views/controls/butt...
ui/views/controls/button/menu_button.cc:330:
arrow_bounds.ClampToCenteredSize(menu_marker_.size());
On 2016/05/09 08:01:35, tapted wrote:
> On 2016/05/06 21:30:45, Elly Jones wrote:
> > On 2016/04/29 06:53:18, tapted wrote:
> > > With kMenuMarkerPaddingLeft/Right gone, won't this change the position on
> > > linux/win/chromeos?
> > 
> > I *think* that I accounted for that in GetShoulderWidth()? I don't have
Linux
> or
> > Windows machines handy to test against.
> 
> GetShoulderWidth() is the sum though. It might work for combobox, but
MenuButton
> is less evenly weighted. I'll try this on Windows. my last attempt at a build
> ran out of disk space though :|

Added Windows screenshots to http://crbug.com/605161#c6 for this. The layout
changes quite a bit (and of course we need to ensure Windows doesn't change at
all).

Powered by Google App Engine
This is Rietveld 408576698