Chromium Code Reviews| Index: chrome/browser/ui/panels/panel_window_controller_cocoa.mm |
| diff --git a/chrome/browser/ui/panels/panel_window_controller_cocoa.mm b/chrome/browser/ui/panels/panel_window_controller_cocoa.mm |
| index cd187277deb16de06f822791158dc1438b73beb6..13c46eeefede28a572328649f54693bbe37d33c9 100644 |
| --- a/chrome/browser/ui/panels/panel_window_controller_cocoa.mm |
| +++ b/chrome/browser/ui/panels/panel_window_controller_cocoa.mm |
| @@ -40,7 +40,8 @@ |
| #include "ui/gfx/mac/nsimage_cache.h" |
| const int kMinimumWindowSize = 1; |
| -const double kBoundsChangeAnimationDuration = 0.18; // Seconds. |
| +const double kBoundsChangeAnimationSpeed = 1000; // Pixels per second. |
|
jennb
2011/11/17 23:45:40
Prefer units in var name. kBoundsAnimationPixelsPe
Dmitry Titov
2011/11/18 00:15:11
Done.
|
| +const double kBoundsChangeAnimationMaxDuration = 0.18; // Seconds. |
| // Replicate specific 10.6 SDK declarations for building with prior SDKs. |
| #if !defined(MAC_OS_X_VERSION_10_6) || \ |
| @@ -111,12 +112,7 @@ enum { |
| DCHECK(titlebar_view_); |
| DCHECK_EQ(self, [window delegate]); |
| - // Using NSModalPanelWindowLevel (8) rather then NSStatusWindowLevel (25) |
| - // ensures notification balloons on top of regular windows, but below |
| - // popup menus which are at NSPopUpMenuWindowLevel (101) and Spotlight |
| - // drop-out, which is at NSStatusWindowLevel-2 (23) for OSX 10.6/7. |
| - // See http://crbug.com/59878. |
| - [window setLevel:NSModalPanelWindowLevel]; |
| + [window setLevel:NSStatusWindowLevel]; |
|
jennb
2011/11/17 23:45:40
I'm assuming the comment no longer applies because
Dmitry Titov
2011/11/18 00:15:11
It never actually applied because it was a copy-pa
|
| if (base::mac::IsOSSnowLeopardOrLater()) { |
| [window setCollectionBehavior: |
| @@ -443,7 +439,22 @@ enum { |
| [boundsAnimation_ setDelegate:self]; |
| [boundsAnimation_ setAnimationBlockingMode: NSAnimationNonblocking]; |
| - [boundsAnimation_ setDuration: kBoundsChangeAnimationDuration]; |
| + |
| + NSRect currentFrame = [[self window] frame]; |
| + // Compute duration. We use constant speed of animation, however if the change |
| + // is too large, we clip the duration (effectively increasing speed) to |
| + // limit total duration of animation. This helps to make 'big changes' take |
| + // specific well-percieved time, while making smaller updates quicker, which |
|
jennb
2011/11/17 23:45:40
perceived
jennb
2011/11/17 23:45:40
Did you mean slower instead of quicker? (I admit t
Dmitry Titov
2011/11/18 00:15:11
Done.
Dmitry Titov
2011/11/18 00:15:11
Re-worded, made shorter.
Dmitry Titov
2011/11/18 00:15:11
Done.
|
| + // is intuitively 'correct'. |
| + // 'distance' is the max travel between 4 potentially traveling corners. |
|
jennb
2011/11/17 23:45:40
extra space in line
Dmitry Titov
2011/11/18 00:15:11
Done.
|
| + double distanceX = std::max(abs(NSMinX(currentFrame) - NSMinX(frame)), |
| + abs(NSMaxX(currentFrame) - NSMaxX(frame))); |
| + double distanceY = std::max(abs(NSMinY(currentFrame) - NSMinY(frame)), |
| + abs(NSMaxY(currentFrame) - NSMaxY(frame))); |
| + double distance = std::max(distanceX, distanceY); |
| + double duration = std::min(distance / kBoundsChangeAnimationSpeed, |
| + kBoundsChangeAnimationMaxDuration); |
| + [boundsAnimation_ setDuration: duration]; |
| [boundsAnimation_ startAnimation]; |
| } |