DescriptionUse a ui::MenuModel in views::Combobox
views::Combobox currently does its own menu-building rather than using a
ui::MenuModel. However, the only thing missing from MenuModel is the
ability to set a minimum menu width. (Combobox currently does this by
adding an invisible SubmenuView with a given width.)
Moving the menu building out of Combobox allows Mac to build a native
menu instead, which gives a much nicer menu experience there. In
particular, Comboboxes on Mac center the menu over the button vertically,
and have fancy scrolling/repositioning mechanisms when the menu is shown
near the edge of the screen.
This CL adds an Adapter class that adapts a ui::ComboboxModel to the
ui::MenuModel interface, allowing views:Comboxbox to be simplified
elsewhere. MenuRunnerImplCocoa will be extended to support comboboxes in
a follow-up. For the minimum width, MenuController::CalculateMenuBounds()
can just use the width of the anchor rectangle for the same effect.
Note that TranslateBubbleView is the only user of
Combobox::STYLE_ACTION. TranslateBubbleView puts a separator after the
first item which Combobox always removes. MenuModel::IsVisibleAt() isn't
checked for separators, so simply don't add the separator to keep things
simple.
BUG=522365
Committed: https://crrev.com/e989104781ae77c9bdb31d24b96830bf27a2c717
Cr-Commit-Position: refs/heads/master@{#347867}
Patch Set 1 #Patch Set 2 : more obsolete code #Patch Set 3 : It works! \o/ Just .. offset is wrong #Patch Set 4 : Update tests. To fix: ComboboxTest.ContentWidth #Patch Set 5 : Audit headers #Patch Set 6 : Fix test / extend coverage. Vertical whitespace. #Patch Set 7 : Fonts are slow: keep the content_size cache #Patch Set 8 : Clearer IsVisibleAt #Patch Set 9 : Fix the translate bubble #Patch Set 10 : Split out Cocoa changes to http://crrev.com/1321023005 #
Total comments: 13
Patch Set 11 : respond to comments #Patch Set 12 : Maintain the current selection #
Total comments: 2
Patch Set 13 : +curlies #
Messages
Total messages: 13 (3 generated)
|