Commit e3f1197b authored by erikchen's avatar erikchen Committed by Commit bot

Fix partial-screen flashes when first entering low power full screen.

NSWindow resizing is slow, so try to guess the right size when first creating
the window. Furthermore, resizing the window will create implicit animations for
the Window's views and layers. Disable those implicit animations.

BUG=667511

Review-Url: https://codereview.chromium.org/2539863002
Cr-Commit-Position: refs/heads/master@{#435062}
parent 131e0dc9
...@@ -25,8 +25,13 @@ const uint64_t kWarmUpFramesBeforeEnteringLowPowerMode = 30; ...@@ -25,8 +25,13 @@ const uint64_t kWarmUpFramesBeforeEnteringLowPowerMode = 30;
@implementation FullscreenLowPowerWindow @implementation FullscreenLowPowerWindow
- (id)initWithEventTargetWindow:(NSWindow*)eventTargetWindow - (id)initWithEventTargetWindow:(NSWindow*)eventTargetWindow
withLayer:(CALayer*)layer { 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 if (self = [super
initWithContentRect:NSMakeRect(0, 0, 256, 256) initWithContentRect:initialRect
styleMask:NSTitledWindowMask | NSResizableWindowMask | styleMask:NSTitledWindowMask | NSResizableWindowMask |
NSFullSizeContentViewWindowMask NSFullSizeContentViewWindowMask
backing:NSBackingStoreBuffered backing:NSBackingStoreBuffered
...@@ -186,6 +191,10 @@ void FullscreenLowPowerCoordinatorCocoa::EnterOrExitLowPowerModeIfNeeded() { ...@@ -186,6 +191,10 @@ void FullscreenLowPowerCoordinatorCocoa::EnterOrExitLowPowerModeIfNeeded() {
// Ensure that the window's frame and style are set, and order it behind // 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. // the main window, so that it's ready to be moved in front.
state_ = WarmingUp; 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] | [low_power_window_ setStyleMask:[low_power_window_ styleMask] |
NSFullScreenWindowMask]; NSFullScreenWindowMask];
[low_power_window_ setFrame:[content_window_ frame] [low_power_window_ setFrame:[content_window_ frame]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment