Commit e132a7eb authored by spqchan's avatar spqchan Committed by Commit Bot

[Mac] Fix padding in browser actions container

The horizontal padding around the browser actions
container was incorrectly reduced.

This causes issues where you can't resize the
omnibox (because the extensions now overlap the gripper)
or drag the extensions into the wrench menu

Bug: 825378, 825782
Change-Id: I66061a67546fab679c280a8d816b78dbe19b876e
Reviewed-on: https://chromium-review.googlesource.com/1040914Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Sarah Chan <spqchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555740}
parent f84f1651
......@@ -44,6 +44,10 @@ namespace {
// of the popup 2px below the bottom of the Omnibox.
const CGFloat kBrowserActionBubbleYOffset = 3.0;
// The amount of horizontal padding the browser action container should have on
// each side.
const CGFloat kBrowserActionHorizontalPadding = 2.0;
} // namespace
@interface BrowserActionsController(Private)
......@@ -356,7 +360,9 @@ void ToolbarActionsBarBridge::ShowToolbarActionBubble(
}
- (gfx::Size)preferredSize {
return toolbarActionsBar_->GetFullSize();
gfx::Size size = toolbarActionsBar_->GetFullSize();
size.Enlarge(kBrowserActionHorizontalPadding * 2, 0);
return size;
}
- (NSPoint)popupPointForId:(const std::string&)id {
......@@ -410,7 +416,8 @@ void ToolbarActionsBarBridge::ShowToolbarActionBubble(
}
- (void)updateMaxWidth {
const CGFloat ownMaxWidth = toolbarActionsBar_->GetMaximumWidth();
const CGFloat ownMaxWidth = toolbarActionsBar_->GetMaximumWidth() +
kBrowserActionHorizontalPadding * 2;
containerView_.maxWidth =
(maxWidth_ ? std::min(maxWidth_, ownMaxWidth) : ownMaxWidth);
}
......@@ -538,7 +545,7 @@ void ToolbarActionsBarBridge::ShowToolbarActionBubble(
BOOL animate = !toolbarActionsBar_->suppress_animation() &&
![containerView_ isAnimating] && [[containerView_ window] isVisible];
[self updateContainerVisibility];
[containerView_ resizeToWidth:width
[containerView_ resizeToWidth:width + kBrowserActionHorizontalPadding * 2
animate:animate];
[containerView_ setNeedsDisplay:YES];
......@@ -742,11 +749,15 @@ void ToolbarActionsBarBridge::ShowToolbarActionBubble(
NSRect frame = frameRect.IsEmpty()
? NSMakeRect(-iconWidth - 1, 0, iconWidth, size.height())
: NSRectFromCGRect(frameRect.ToCGRect());
// We need to flip the y coordinate for Cocoa's view system.
frame.origin.y = NSHeight([containerView_ frame]) - NSMaxY(frame);
if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout())
frame.origin.x =
NSWidth([containerView_ frame]) - NSWidth(frame) - NSMinX(frame);
if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) {
frame.origin.x = NSWidth([containerView_ frame]) - NSWidth(frame) -
NSMinX(frame) - kBrowserActionHorizontalPadding;
} else {
frame.origin.x += kBrowserActionHorizontalPadding;
}
return frame;
}
......
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