| Index: chrome/browser/ui/cocoa/extensions/browser_action_button.mm
|
| diff --git a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm
|
| index 9a97f24db7ed8563343c15c0307f2b4d68c8c3f6..371eef8d027992359d62805cabaf4ad68bbbe8ee 100644
|
| --- a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm
|
| +++ b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm
|
| @@ -220,14 +220,22 @@ void ToolbarActionViewDelegateBridge::SetContextMenuController(
|
| NSRect buttonFrame = [self frame];
|
| // The desired x is the current mouse point, minus the original offset of the
|
| // mouse into the button.
|
| - CGFloat desiredX = [[self superview] convertPoint:eventPoint fromView:nil].x -
|
| - dragStartPoint_.x;
|
| + NSPoint localPoint = [[self superview] convertPoint:eventPoint fromView:nil];
|
| + CGFloat desiredX = localPoint.x - dragStartPoint_.x;
|
| // Clamp the button to be within its superview along the X-axis.
|
| NSRect containerBounds = [[self superview] bounds];
|
| desiredX = std::min(std::max(NSMinX(containerBounds), desiredX),
|
| NSMaxX(containerBounds) - NSWidth(buttonFrame));
|
| -
|
| buttonFrame.origin.x = desiredX;
|
| +
|
| + // If the button is in the overflow menu, it could move along the y-axis, too.
|
| + if ([browserActionsController_ isOverflow]) {
|
| + CGFloat desiredY = localPoint.y - dragStartPoint_.y;
|
| + desiredY = std::min(std::max(NSMinY(containerBounds), desiredY),
|
| + NSMaxY(containerBounds) - NSHeight(buttonFrame));
|
| + buttonFrame.origin.y = desiredY;
|
| + }
|
| +
|
| [self setFrame:buttonFrame];
|
| [self setNeedsDisplay:YES];
|
| [[NSNotificationCenter defaultCenter]
|
|
|