Title: [116188] trunk
Revision
116188
Author
jer.no...@apple.com
Date
2012-05-04 16:31:14 -0700 (Fri, 04 May 2012)

Log Message

Flash of white when exiting full screen HTML5 video
https://bugs.webkit.org/show_bug.cgi?id=85438

.:

Reviewed by Sam Weinig.

* ManualTests/fullscreen/full-screen-flash.html: Added.

Source/WebKit2:

Reviewed by Maciej Stachowiak.

Force a repaint before displaying the newly exited WebView window.  This gives the window
a chance to seamlessly repaint before enabling screen updates.

Also, send the WebProcess the didExitFullScreen and setAnimatingFullScreen(false) messages
after swapping the WebView back into its original window. Doing otherwise seems to cause
forceRepaint to paint a white frame.

* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
(-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
(completeFinishExitFullScreenAnimationAfterRepaint):

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (116187 => 116188)


--- trunk/ChangeLog	2012-05-04 23:11:06 UTC (rev 116187)
+++ trunk/ChangeLog	2012-05-04 23:31:14 UTC (rev 116188)
@@ -1,5 +1,14 @@
 2012-05-04  Jer Noble  <jer.no...@apple.com>
 
+        Flash of white when exiting full screen HTML5 video
+        https://bugs.webkit.org/show_bug.cgi?id=85438
+
+        Reviewed by Sam Weinig.
+
+        * ManualTests/fullscreen/full-screen-flash.html: Added.
+
+2012-05-04  Jer Noble  <jer.no...@apple.com>
+
         Taking a visibility:hidden element full screen causes full screen window to disappear.
         https://bugs.webkit.org/show_bug.cgi?id=85432
 

Added: trunk/ManualTests/fullscreen/full-screen-flash.html (0 => 116188)


--- trunk/ManualTests/fullscreen/full-screen-flash.html	                        (rev 0)
+++ trunk/ManualTests/fullscreen/full-screen-flash.html	2012-05-04 23:31:14 UTC (rev 116188)
@@ -0,0 +1,28 @@
+<style>
+    body { background: green; color: white; }
+    document:-webkit-full-screen-document > body { background: red;  }
+    span { text-decoration: underline; cursor: hand; }
+    div {
+        background: blue;
+        width: 200px;
+        height: 100px;
+    }
+    div:-webkit-full-screen {
+        width: 100%;
+        height: 100%;
+    }
+</style>
+<script>
+function toggleFullScreen() {
+    if (document.webkitIsFullScreen)
+        document.webkitCancelFullScreen();
+    else
+        document.getElementsByTagName('div')[0].webkitRequestFullscreen();
+}
+</script>
+<body>
+    This tests that the page does not have a visible "flash" when finishing the exit full screen animation.
+    <span _onclick_="toggleFullScreen()">Click to toggle full screen.</span>
+    <div>
+    </div>
+</body>
\ No newline at end of file

Modified: trunk/Source/WebKit2/ChangeLog (116187 => 116188)


--- trunk/Source/WebKit2/ChangeLog	2012-05-04 23:11:06 UTC (rev 116187)
+++ trunk/Source/WebKit2/ChangeLog	2012-05-04 23:31:14 UTC (rev 116188)
@@ -1,3 +1,22 @@
+2012-05-02  Jer Noble  <jer.no...@apple.com>
+
+        Flash of white when exiting full screen HTML5 video
+        https://bugs.webkit.org/show_bug.cgi?id=85438
+
+        Reviewed by Maciej Stachowiak.
+
+        Force a repaint before displaying the newly exited WebView window.  This gives the window
+        a chance to seamlessly repaint before enabling screen updates.
+
+        Also, send the WebProcess the didExitFullScreen and setAnimatingFullScreen(false) messages
+        after swapping the WebView back into its original window. Doing otherwise seems to cause
+        forceRepaint to paint a white frame.
+
+        * UIProcess/mac/WKFullScreenWindowController.mm:
+        (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
+        (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
+        (completeFinishExitFullScreenAnimationAfterRepaint):
+
 2012-05-04  Anders Carlsson  <ander...@apple.com>
 
         Set the right device scale factor when creating the web page

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (116187 => 116188)


--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2012-05-04 23:11:06 UTC (rev 116187)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm	2012-05-04 23:31:14 UTC (rev 116188)
@@ -338,6 +338,8 @@
     [self _startExitFullScreenAnimationWithDuration:defaultAnimationDuration];
 }
 
+static void completeFinishExitFullScreenAnimationAfterRepaint(WKErrorRef, void*);
+
 - (void)finishedExitFullScreenAnimation:(bool)completed
 {
     if (!_isExitingFullScreen)
@@ -346,12 +348,10 @@
 
     [self _updateMenuAndDockForFullScreen];
 
-    // Screen updates to be re-enabled ta the end of the current function.
+    // Screen updates to be re-enabled in completeFinishExitFullScreenAnimationAfterRepaint.
     NSDisableScreenUpdates();
+    [[_webViewPlaceholder.get() window] setAutodisplay:NO];
 
-    [self _manager]->didExitFullScreen();
-    [self _manager]->setAnimatingFullScreen(false);
-
     NSResponder *firstResponder = [[self window] firstResponder];
     [self _swapView:_webViewPlaceholder.get() with:_webView];
     [[_webView window] makeResponder:firstResponder firstResponderIfDescendantOfView:_webView];
@@ -372,9 +372,24 @@
 
     [[_webView window] makeKeyAndOrderFront:self];
 
+    // These messages must be sent after the swap or flashing will occur during forceRepaint:
+    [self _manager]->didExitFullScreen();
+    [self _manager]->setAnimatingFullScreen(false);
+
+    [self _page]->forceRepaint(VoidCallback::create(self, completeFinishExitFullScreenAnimationAfterRepaint));
+}
+
+- (void)completeFinishExitFullScreenAnimationAfterRepaint
+{
+    [[_webView window] setAutodisplay:YES];
     NSEnableScreenUpdates();
 }
 
+static void completeFinishExitFullScreenAnimationAfterRepaint(WKErrorRef, void* _self)
+{
+    [(WKFullScreenWindowController*)_self completeFinishExitFullScreenAnimationAfterRepaint];
+}
+
 - (void)close
 {
     // We are being asked to close rapidly, most likely because the page 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to