Chromium Code Reviews| Index: chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.mm |
| diff --git a/chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.mm b/chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.mm |
| index 62f76a83078a3801a09402fe293708cce127fe82..17fa9e64ca70e21bd1cd636e6854ccbfb652efbd 100644 |
| --- a/chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.mm |
| +++ b/chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.mm |
| @@ -6,9 +6,11 @@ |
| #include <Carbon/Carbon.h> |
| +#include "base/mac/mac_util.h" |
| #include "base/macros.h" |
| #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| #import "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_controller.h" |
| +#import "chrome/browser/ui/cocoa/fullscreen/fullscreen_toolbar_visibility_lock_controller.h" |
| #include "ui/base/cocoa/appkit_utils.h" |
| namespace { |
| @@ -136,8 +138,23 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler, |
| else if (progress > menubarFraction_) |
| state_ = FullscreenMenubarState::SHOWING; |
| - menubarFraction_ = progress; |
| + // In 10.12. the toolbar to be janky since the UI doesn't update until the |
| + // menubar finished revealing itself. To smooth things out, animate the |
| + // toolbar in/out by locking/releasing its visibility instead of relying on |
| + // the menubar fraction. |
| + // TODO(spqchan): Figure out why it's not updating and make the toolbar drop |
|
Robert Sesek
2017/04/25 17:33:33
Please file a bug to track this.
spqchan
2017/04/26 17:21:33
Done. I'm using the same bug btw (no intention to
|
| + // down in sync with the menubar. |
| + if (base::mac::IsOS10_12()) { |
| + if (state_ == FullscreenMenubarState::SHOWING) { |
| + [[owner_ visibilityLockController] lockToolbarVisibilityForOwner:self |
| + withAnimation:YES]; |
| + } else if (state_ == FullscreenMenubarState::HIDING) { |
| + [[owner_ visibilityLockController] releaseToolbarVisibilityForOwner:self |
| + withAnimation:YES]; |
| + } |
| + } |
| + menubarFraction_ = progress; |
| [owner_ updateToolbarLayout]; |
| } |
| @@ -149,6 +166,8 @@ OSStatus MenuBarRevealHandler(EventHandlerCallRef handler, |
| - (void)activeSpaceDidChange:(NSNotification*)notification { |
| menubarFraction_ = 0.0; |
| state_ = FullscreenMenubarState::HIDDEN; |
| + [[owner_ visibilityLockController] releaseToolbarVisibilityForOwner:self |
| + withAnimation:NO]; |
| [owner_ updateToolbarLayout]; |
| } |