Commit 53a5165f authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

views: reduce corner radius on context menus

Context menus and combobox menus are both "auxiliary" in the UI sense, so they
have a reduced corner radius to fit better with their parent controls.

Bug: 829347
Change-Id: Ie0ecfcbab5161071d5cf61cc8e7647172122dad5
Reviewed-on: https://chromium-review.googlesource.com/1066470
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560275}
parent debaf4cd
......@@ -58,7 +58,7 @@ MenuConfig::MenuConfig()
check_selected_combobox_item(false),
show_delay(400),
corner_radius(0),
combobox_corner_radius(0),
auxiliary_corner_radius(0),
touchable_corner_radius(8),
touchable_anchor_offset(8),
touchable_menu_height(36),
......@@ -75,8 +75,8 @@ MenuConfig::~MenuConfig() {}
int MenuConfig::CornerRadiusForMenu(const MenuController* controller) const {
if (controller && controller->use_touchable_layout())
return touchable_corner_radius;
if (controller && controller->is_combobox())
return combobox_corner_radius;
if (controller && (controller->is_combobox() || controller->IsContextMenu()))
return auxiliary_corner_radius;
return corner_radius;
}
......
......@@ -168,8 +168,9 @@ struct VIEWS_EXPORT MenuConfig {
// Radius of the rounded corners of the menu border. Must be >= 0.
int corner_radius;
// Radius of combobox rounded corners. Must be >= 0.
int combobox_corner_radius;
// Radius of "auxiliary" rounded corners - comboboxes and context menus.
// Must be >= 0.
int auxiliary_corner_radius;
// Radius of the rounded corners of the touchable menu border
int touchable_corner_radius;
......
......@@ -37,7 +37,7 @@ void InitMaterialMenuConfig(views::MenuConfig* config) {
config->use_outer_border = false;
config->icons_in_label = true;
config->corner_radius = 8;
config->combobox_corner_radius = 4;
config->auxiliary_corner_radius = 4;
}
} // namespace
......
......@@ -549,6 +549,10 @@ void MenuController::AddNestedDelegate(
delegate_ = delegate;
}
bool MenuController::IsContextMenu() const {
return state_.context_menu;
}
bool MenuController::OnMousePressed(SubmenuView* source,
const ui::MouseEvent& event) {
// We should either have no current_mouse_event_target_, or should have a
......
......@@ -143,6 +143,8 @@ class VIEWS_EXPORT MenuController
void set_is_combobox(bool is_combobox) { is_combobox_ = is_combobox; }
bool is_combobox() const { return is_combobox_; }
bool IsContextMenu() const;
// Various events, forwarded from the submenu.
//
// NOTE: the coordinates of the events are in that of the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment