Title: [201405] trunk/Source/WebKit2
Revision
201405
Author
[email protected]
Date
2016-05-25 15:07:17 -0700 (Wed, 25 May 2016)

Log Message

Flashiness and jumpiness when entering fullscreen
https://bugs.webkit.org/show_bug.cgi?id=158087

Reviewed by Beth Dakin.

Multiple independant sources of jumpiness and flashiness are addressed here:

- Setting the top content inset on the WKView cause a vertical jump during fullscreen
transition. Instead of setting the content inset to 0, take the existing inset into account
when placing the WKView in the NSWindow.

- The enter fullscreen transition causes a white flash due to the NSWindow needing
display before ordering onscreen. Ensure the window has a backing by calling -displayIfNeeded
before entering fullscreen mode.

- The exit fullscreen transition causes a white background color flash for an unknown
reason, but is solved by not making the window's content view layer-backed. Rather than
directly animating the contentView's background color, create a specific background view
and animate it's background color instead.

* UIProcess/mac/WKFullScreenWindowController.h:
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController initWithWindow:webView:page:]):
(-[WKFullScreenWindowController enterFullScreen:]):
(-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
(-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
(-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
(-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::saveScrollPosition): Deleted.
(WebKit::WebFullScreenManager::restoreScrollPosition): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (201404 => 201405)


--- trunk/Source/WebKit2/ChangeLog	2016-05-25 21:58:08 UTC (rev 201404)
+++ trunk/Source/WebKit2/ChangeLog	2016-05-25 22:07:17 UTC (rev 201405)
@@ -1,3 +1,37 @@
+2016-05-25  Jer Noble  <[email protected]>
+
+        Flashiness and jumpiness when entering fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=158087
+
+        Reviewed by Beth Dakin.
+
+        Multiple independant sources of jumpiness and flashiness are addressed here:
+
+        - Setting the top content inset on the WKView cause a vertical jump during fullscreen
+        transition. Instead of setting the content inset to 0, take the existing inset into account
+        when placing the WKView in the NSWindow.
+
+        - The enter fullscreen transition causes a white flash due to the NSWindow needing
+        display before ordering onscreen. Ensure the window has a backing by calling -displayIfNeeded
+        before entering fullscreen mode.
+
+        - The exit fullscreen transition causes a white background color flash for an unknown
+        reason, but is solved by not making the window's content view layer-backed. Rather than
+        directly animating the contentView's background color, create a specific background view
+        and animate it's background color instead.
+
+        * UIProcess/mac/WKFullScreenWindowController.h:
+        * UIProcess/mac/WKFullScreenWindowController.mm:
+        (-[WKFullScreenWindowController initWithWindow:webView:page:]):
+        (-[WKFullScreenWindowController enterFullScreen:]):
+        (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
+        (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
+        (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
+        (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
+        * WebProcess/FullScreen/WebFullScreenManager.cpp:
+        (WebKit::WebFullScreenManager::saveScrollPosition): Deleted.
+        (WebKit::WebFullScreenManager::restoreScrollPosition): Deleted.
+
 2016-05-25  Alex Christensen  <[email protected]>
 
         Fix CMake build.

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h (201404 => 201405)


--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h	2016-05-25 21:58:08 UTC (rev 201404)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h	2016-05-25 22:07:17 UTC (rev 201405)
@@ -49,6 +49,7 @@
     WebKit::WebPageProxy* _page;
     RetainPtr<WebCoreFullScreenPlaceholderView> _webViewPlaceholder;
     RetainPtr<NSView> _clipView;
+    RetainPtr<NSView> _backgroundView;
     NSRect _initialFrame;
     NSRect _finalFrame;
     RetainPtr<NSTimer> _watchdogTimer;

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (201404 => 201405)


--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2016-05-25 21:58:08 UTC (rev 201404)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2016-05-25 22:07:17 UTC (rev 201405)
@@ -94,16 +94,22 @@
     [window setCollectionBehavior:([window collectionBehavior] | NSWindowCollectionBehaviorFullScreenPrimary)];
 
     NSView *contentView = [window contentView];
-    contentView.wantsLayer = YES;
-    contentView.layer.hidden = YES;
+    contentView.hidden = YES;
     contentView.autoresizesSubviews = YES;
 
+    _backgroundView = adoptNS([[NSView alloc] initWithFrame:contentView.bounds]);
+    _backgroundView.get().layer = [CALayer layer];
+    _backgroundView.get().wantsLayer = YES;
+    _backgroundView.get().autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
+    [contentView addSubview:_backgroundView.get()];
+
     _clipView = adoptNS([[NSView alloc] initWithFrame:contentView.bounds]);
     [_clipView setWantsLayer:YES];
     [_clipView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
-    [contentView addSubview:_clipView.get()];
+    [_backgroundView addSubview:_clipView.get()];
 
     [self windowDidLoad];
+    [window displayIfNeeded];
     _webView = webView;
     _page = &page;
     
@@ -234,7 +240,7 @@
     // Then insert the WebView into the full screen window
     NSView *contentView = [[self window] contentView];
     [_clipView addSubview:_webView positioned:NSWindowBelow relativeTo:nil];
-    [_webView setFrame:[contentView bounds]];
+    _webView.frame = NSInsetRect(contentView.bounds, 0, -_page->topContentInset());
 
     makeResponderFirstResponderIfDescendantOfView(self.window, webWindowFirstResponder, _webView);
 
@@ -272,8 +278,7 @@
         [self _manager]->didEnterFullScreen();
         [self _manager]->setAnimatingFullScreen(false);
 
-        NSView *contentView = [[self window] contentView];
-        [contentView.layer removeAllAnimations];
+        [_backgroundView.get().layer removeAllAnimations];
         [[_clipView layer] removeAllAnimations];
         [[_clipView layer] setMask:nil];
 
@@ -369,7 +374,8 @@
     _page->setSuppressVisibilityUpdates(true);
     [[self window] orderOut:self];
     NSView *contentView = [[self window] contentView];
-    contentView.layer.hidden = YES;
+    contentView.hidden = YES;
+    [_backgroundView.get().layer removeAllAnimations];
     [[_webViewPlaceholder window] setAutodisplay:NO];
 
     NSResponder *firstResponder = [[self window] firstResponder];
@@ -576,8 +582,8 @@
     [maskLayer addAnimation:maskAnimation(_initialFrame, _finalFrame, self.window.screen.frame, duration, AnimateIn) forKey:@"fullscreen"];
     [_clipView layer].mask = maskLayer;
 
-    contentView.layer.hidden = NO;
-    [contentView.layer addAnimation:fadeAnimation(duration, AnimateIn) forKey:@"fullscreen"];
+    contentView.hidden = NO;
+    [_backgroundView.get().layer addAnimation:fadeAnimation(duration, AnimateIn) forKey:@"fullscreen"];
 
     NSWindow* window = [self window];
     NSWindowCollectionBehavior behavior = [window collectionBehavior];
@@ -605,8 +611,8 @@
     [[_clipView layer].mask addAnimation:maskAnimation(_initialFrame, _finalFrame, self.window.screen.frame, duration, AnimateOut) forKey:@"fullscreen"];
 
     NSView* contentView = [[self window] contentView];
-    contentView.layer.hidden = NO;
-    [contentView.layer addAnimation:fadeAnimation(duration, AnimateOut) forKey:@"fullscreen"];
+    contentView.hidden = NO;
+    [_backgroundView.get().layer addAnimation:fadeAnimation(duration, AnimateOut) forKey:@"fullscreen"];
 
     _page->setSuppressVisibilityUpdates(false);
     [[self window] setAutodisplay:YES];

Modified: trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp (201404 => 201405)


--- trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp	2016-05-25 21:58:08 UTC (rev 201404)
+++ trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp	2016-05-25 22:07:17 UTC (rev 201405)
@@ -157,13 +157,10 @@
 void WebFullScreenManager::saveScrollPosition()
 {
     m_scrollPosition = m_page->corePage()->mainFrame().view()->scrollPosition();
-    m_topContentInset = m_page->corePage()->topContentInset();
-    m_page->corePage()->setTopContentInset(0);
 }
 
 void WebFullScreenManager::restoreScrollPosition()
 {
-    m_page->corePage()->setTopContentInset(m_topContentInset);
     m_page->corePage()->mainFrame().view()->setScrollPosition(m_scrollPosition);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to