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

Unified Diff: chrome/browser/ui/cocoa/fullscreen_low_power_coordinator.mm

Issue 2539863002: Fix partial-screen flashes when first entering low power full screen. (Closed)
Patch Set: Created 4 years, 1 month 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_low_power_coordinator.mm
diff --git a/chrome/browser/ui/cocoa/fullscreen_low_power_coordinator.mm b/chrome/browser/ui/cocoa/fullscreen_low_power_coordinator.mm
index fddcf9073ccf56b67a3438f2138251965eef56c5..b9c2fce0666f29b1d8fe202e0f5be943e395e796 100644
--- a/chrome/browser/ui/cocoa/fullscreen_low_power_coordinator.mm
+++ b/chrome/browser/ui/cocoa/fullscreen_low_power_coordinator.mm
@@ -25,8 +25,13 @@ const uint64_t kWarmUpFramesBeforeEnteringLowPowerMode = 30;
@implementation FullscreenLowPowerWindow
- (id)initWithEventTargetWindow:(NSWindow*)eventTargetWindow
withLayer:(CALayer*)layer {
+ // Resizing an NSWindow can be slow, so try to guess the right size at
+ // creation.
+ NSRect screenFrame = [[eventTargetWindow screen] frame];
+ NSRect initialRect = NSMakeRect(
+ 0, 0, NSWidth(screenFrame), NSHeight(screenFrame));
if (self = [super
- initWithContentRect:NSMakeRect(0, 0, 256, 256)
+ initWithContentRect:initialRect
styleMask:NSTitledWindowMask | NSResizableWindowMask |
NSFullSizeContentViewWindowMask
backing:NSBackingStoreBuffered
@@ -185,6 +190,10 @@ void FullscreenLowPowerCoordinatorCocoa::EnterOrExitLowPowerModeIfNeeded() {
// Ensure that the window's frame and style are set, and order it behind
// the main window, so that it's ready to be moved in front.
state_ = WarmingUp;
+
+ // Changing the size of the Window will also change the size of the
+ // views/layers. Disable implicit animations.
+ ScopedCAActionDisabler disabler;
[low_power_window_ setStyleMask:[low_power_window_ styleMask] |
NSFullScreenWindowMask];
[low_power_window_ setFrame:[content_window_ frame]
« 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