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

Unified Diff: chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm

Issue 1330423003: [Extensions Toolbar] Protect against crazy bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final nits Created 5 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
Index: chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm
diff --git a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm
index a3a29b61cd9200c68a9e5e8f825cb01f14a23834..ff4f2c808dedf81f4c5d29fbdb46f7a58a089603 100644
--- a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm
+++ b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm
@@ -38,6 +38,13 @@ namespace {
// actions overflow container).
const int kLeftPadding = 16;
const int kRightPadding = 10;
+
+// In *very* extreme cases, it's possible that there are so many overflowed
+// actions, we won't be able to show them all. Cap the height so that the
+// overflow won't make the menu larger than the height of the screen.
+// Note: With this height, we can show 104 actions. Less than 0.0002% of our
+// users will be affected.
+const int kMaxOverflowContainerHeight = 416;
}
namespace wrench_menu_controller {
@@ -278,7 +285,9 @@ class ZoomLevelObserver {
// and size of each for it display properly.
// The parent views each have a size of the full width of the menu, so we can
// properly position the container.
- NSSize parentSize = NSMakeSize(menuWidth, preferredContainerSize.height());
+ NSSize parentSize = NSMakeSize(menuWidth,
+ std::min(preferredContainerSize.height(),
+ kMaxOverflowContainerHeight));
[view setFrameSize:parentSize];
[[containerView superview] setFrameSize:parentSize];
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm ('k') | chrome/browser/ui/toolbar/toolbar_actions_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698