Title: [212398] trunk/Source/WebKit2
Revision
212398
Author
jer.no...@apple.com
Date
2017-02-15 14:43:59 -0800 (Wed, 15 Feb 2017)

Log Message

REGRESSION(r183937): Fullscreen Exit animation missing mask
https://bugs.webkit.org/show_bug.cgi?id=168360

Reviewed by Eric Carlson.

In r183937, the fullscreen window's clip layer has it's mask removed when the enter
fullscreen animation completes, allowing low-power video playback mode to be entered. But
this breaks the exit fullscreen animaiton, which assumes a mask is present. Abstract the
mask creation code out into a static helper method, and use it at the beginning of the exit
fullscreen animation to re-create the mask before adding animations to it.

* UIProcess/mac/WKFullScreenWindowController.mm:
(createMask):
(-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
(-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (212397 => 212398)


--- trunk/Source/WebKit2/ChangeLog	2017-02-15 22:43:45 UTC (rev 212397)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-15 22:43:59 UTC (rev 212398)
@@ -1,3 +1,21 @@
+2017-02-15  Jer Noble  <jer.no...@apple.com>
+
+        REGRESSION(r183937): Fullscreen Exit animation missing mask
+        https://bugs.webkit.org/show_bug.cgi?id=168360
+
+        Reviewed by Eric Carlson.
+
+        In r183937, the fullscreen window's clip layer has it's mask removed when the enter
+        fullscreen animation completes, allowing low-power video playback mode to be entered. But
+        this breaks the exit fullscreen animaiton, which assumes a mask is present. Abstract the
+        mask creation code out into a static helper method, and use it at the beginning of the exit
+        fullscreen animation to re-create the mask before adding animations to it.
+
+        * UIProcess/mac/WKFullScreenWindowController.mm:
+        (createMask):
+        (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
+        (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
+
 2017-02-15  Alex Christensen  <achristen...@webkit.org>
 
         Unreviewed, rolling out r212169.

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (212397 => 212398)


--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2017-02-15 22:43:45 UTC (rev 212397)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2017-02-15 22:43:59 UTC (rev 212398)
@@ -556,6 +556,16 @@
     return scaleAnimation;
 }
 
+static CALayer *createMask(const FloatRect& bounds)
+{
+    CALayer *maskLayer = [CALayer layer];
+    maskLayer.anchorPoint = CGPointZero;
+    maskLayer.frame = bounds;
+    maskLayer.backgroundColor = CGColorGetConstantColor(kCGColorBlack);
+    maskLayer.autoresizingMask = (NSViewWidthSizable | NSViewHeightSizable);
+    return maskLayer;
+}
+
 static CAAnimation *maskAnimation(const FloatRect& initialFrame, const FloatRect& finalFrame, const FloatRect& screenFrame, CFTimeInterval duration, AnimationDirection direction)
 {
     CABasicAnimation *boundsAnimation = [CABasicAnimation animationWithKeyPath:@"bounds"];
@@ -601,11 +611,7 @@
     NSView* contentView = [[self window] contentView];
 
     [[_clipView layer] addAnimation:zoomAnimation(_initialFrame, _finalFrame, self.window.screen.frame, duration, AnimateIn) forKey:@"fullscreen"];
-    CALayer *maskLayer = [CALayer layer];
-    maskLayer.anchorPoint = CGPointZero;
-    maskLayer.frame = NSRectToCGRect(contentView.bounds);
-    maskLayer.backgroundColor = CGColorGetConstantColor(kCGColorBlack);
-    maskLayer.autoresizingMask = (NSViewWidthSizable | NSViewHeightSizable);
+    CALayer *maskLayer = createMask(contentView.bounds);
     [maskLayer addAnimation:maskAnimation(_initialFrame, _finalFrame, self.window.screen.frame, duration, AnimateIn) forKey:@"fullscreen"];
     [_clipView layer].mask = maskLayer;
 
@@ -636,9 +642,11 @@
     }
 
     [[_clipView layer] addAnimation:zoomAnimation(_initialFrame, _finalFrame, self.window.screen.frame, duration, AnimateOut) forKey:@"fullscreen"];
-    [[_clipView layer].mask addAnimation:maskAnimation(_initialFrame, _finalFrame, self.window.screen.frame, duration, AnimateOut) forKey:@"fullscreen"];
+    NSView* contentView = [[self window] contentView];
+    CALayer *maskLayer = createMask(contentView.bounds);
+    [maskLayer addAnimation:maskAnimation(_initialFrame, _finalFrame, self.window.screen.frame, duration, AnimateOut) forKey:@"fullscreen"];
+    [_clipView layer].mask = maskLayer;
 
-    NSView* contentView = [[self window] contentView];
     contentView.hidden = NO;
     [_backgroundView.get().layer addAnimation:fadeAnimation(duration, AnimateOut) forKey:@"fullscreen"];
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to