Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Unified Diff: chrome/browser/ui/cocoa/fullscreen/fullscreen_menubar_tracker.mm

Issue 2827383004: [Mac] Fullscreen Toolbar Janky Animation Fix (Closed)
Patch Set: Added crbug to TODO Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b9c1486aaee2d39354f63d46c0b2479666157bc5 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
+ // down in sync with the menubar. See crbug.com/672254.
+ 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];
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698