Index: trunk/src/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm |
=================================================================== |
--- trunk/src/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm (revision 240945) |
+++ trunk/src/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm (working copy) |
@@ -340,17 +340,20 @@ |
windowOrigin.y -= NSHeight(frame) - offsets.height; |
frame.origin = windowOrigin; |
- // In case the window is animating already, change its size by creating a |
- // new animation setting the opacity and new frame value. Otherwise, a |
- // preexisting animation would continue after the frame is set, reverting |
- // the frame to what it was when the animation started. |
+ // Is the window still animating in? If so, then cancel that and create a new |
+ // animation setting the opacity and new frame value. Otherwise the current |
+ // animation will continue after this frame is set, reverting the frame to |
+ // what it was when the animation started. |
NSWindow* window = [self window]; |
- id animator = [window animator]; |
- [NSAnimationContext beginGrouping]; |
- [[NSAnimationContext currentContext] setDuration:kAnimationDuration]; |
- [animator setAlphaValue:1.0]; |
- [animator setFrame:frame display:YES]; |
- [NSAnimationContext endGrouping]; |
+ if ([window isVisible] && [[window animator] alphaValue] < 1.0) { |
+ [NSAnimationContext beginGrouping]; |
+ [[NSAnimationContext currentContext] setDuration:kAnimationDuration]; |
+ [[window animator] setAlphaValue:1.0]; |
+ [[window animator] setFrame:frame display:YES]; |
+ [NSAnimationContext endGrouping]; |
+ } else { |
+ [window setFrame:frame display:YES]; |
+ } |
// A NSViewFrameDidChangeNotification won't be sent until the extension view |
// content is loaded. The window is hidden on init, so show it the first time |