Index: chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm |
diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm |
index 74311fa77fa820f195578eb3e8253bf769834f25..4e2cea83df9a627bd54026728c670f0b2c576113 100644 |
--- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm |
+++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm |
@@ -583,10 +583,8 @@ void ToolbarActionsBarBridge::ShowExtensionMessageBubble( |
} |
[self showChevronIfNecessaryInFrame:[containerView_ frame]]; |
- NSUInteger minIndex = isOverflow_ ? |
- [buttons_ count] - toolbarActionsBar_->GetIconCount() : 0; |
- NSUInteger maxIndex = isOverflow_ ? |
- [buttons_ count] : toolbarActionsBar_->GetIconCount(); |
+ NSUInteger startIndex = toolbarActionsBar_->GetStartIndexInBounds(); |
+ NSUInteger endIndex = toolbarActionsBar_->GetEndIndexInBounds(); |
for (NSUInteger i = 0; i < [buttons_ count]; ++i) { |
BrowserActionButton* button = [buttons_ objectAtIndex:i]; |
if ([button isBeingDragged]) |
@@ -594,7 +592,7 @@ void ToolbarActionsBarBridge::ShowExtensionMessageBubble( |
[self moveButton:[buttons_ objectAtIndex:i] toIndex:i]; |
- if (i >= minIndex && i < maxIndex) { |
+ if (i >= startIndex && i < endIndex) { |
// Make sure the button is within the visible container. |
if ([button superview] != containerView_) { |
// We add the subview under the sibling views so that when it |
@@ -669,16 +667,23 @@ void ToolbarActionsBarBridge::ShowExtensionMessageBubble( |
- (void)updateButtonOpacity { |
for (BrowserActionButton* button in buttons_.get()) { |
NSRect buttonFrame = [button frame]; |
+ // Button is fully in the container view, and should get full opacity. |
Avi (use Gerrit)
2015/09/10 20:58:56
*The* button?
Devlin
2015/09/11 16:46:15
Done.
|
if (NSContainsRect([containerView_ bounds], buttonFrame)) { |
if ([button alphaValue] != 1.0) |
[button setAlphaValue:1.0]; |
continue; |
} |
- CGFloat intersectionWidth = |
- NSWidth(NSIntersectionRect([containerView_ bounds], buttonFrame)); |
- CGFloat alpha = std::max(static_cast<CGFloat>(0.0), |
- intersectionWidth / NSWidth(buttonFrame)); |
+ // Button is only partially in the container view. If the user is resizing |
Avi (use Gerrit)
2015/09/10 20:58:56
*The* button?
Devlin
2015/09/11 16:46:15
Done.
|
+ // the container, we have partial alpha so the icon fades in as space is |
+ // made. Otherwise, hide the icon fully. |
+ CGFloat alpha = 0.0; |
+ if ([containerView_ userIsResizing]) { |
+ CGFloat intersectionWidth = |
+ NSWidth(NSIntersectionRect([containerView_ bounds], buttonFrame)); |
+ alpha = std::max(static_cast<CGFloat>(0.0), |
+ intersectionWidth / NSWidth(buttonFrame)); |
+ } |
[button setAlphaValue:alpha]; |
[button setNeedsDisplay:YES]; |
} |