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

Unified Diff: ui/views/controls/menu/menu_item_view.cc

Issue 553233002: Dynamically calculate the number of extension icons to show per row in overflow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « ui/views/controls/menu/menu_item_view.h ('k') | ui/views/controls/menu/menu_item_view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_item_view.cc
diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc
index 8755c024dd3b0c44c82bf110670a1ba7179c6315..a47557f34b8ab0884e9761d2dc5d7c7b2e056696 100644
--- a/ui/views/controls/menu/menu_item_view.cc
+++ b/ui/views/controls/menu/menu_item_view.cc
@@ -410,6 +410,19 @@ gfx::Size MenuItemView::GetPreferredSize() const {
dimensions.height);
}
+int MenuItemView::GetHeightForWidth(int width) const {
+ // If this isn't a container, we can just use the preferred size's height.
+ if (!IsContainer())
+ return GetPreferredSize().height();
+
+ int height = child_at(0)->GetHeightForWidth(width);
+ if (!icon_view_ && GetRootMenuItem()->has_icons())
+ height = std::max(height, GetMenuConfig().check_height);
+ height += GetBottomMargin() + GetTopMargin();
+
+ return height;
+}
+
const MenuItemView::MenuItemDimensions& MenuItemView::GetDimensions() const {
if (!is_dimensions_valid())
dimensions_ = CalculateDimensions();
« no previous file with comments | « ui/views/controls/menu/menu_item_view.h ('k') | ui/views/controls/menu/menu_item_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698