Skip to content

Commit

Permalink
Flash of white when exiting full screen HTML5 video
Browse files Browse the repository at this point in the history
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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@116188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
[email protected] committed May 4, 2012
1 parent b7604d1 commit 72b0f5f
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 4 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2012-05-04 Jer Noble <[email protected]>

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 <[email protected]>

Taking a visibility:hidden element full screen causes full screen window to disappear.
Expand Down
28 changes: 28 additions & 0 deletions ManualTests/fullscreen/full-screen-flash.html
Original file line number Diff line number Diff line change
@@ -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>
19 changes: 19 additions & 0 deletions Source/WebKit2/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
2012-05-02 Jer Noble <[email protected]>

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 <[email protected]>

Set the right device scale factor when creating the web page
Expand Down
23 changes: 19 additions & 4 deletions Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ - (void)beganExitFullScreenWithInitialFrame:(const WebCore::IntRect&)initialFram
[self _startExitFullScreenAnimationWithDuration:defaultAnimationDuration];
}

static void completeFinishExitFullScreenAnimationAfterRepaint(WKErrorRef, void*);

- (void)finishedExitFullScreenAnimation:(bool)completed
{
if (!_isExitingFullScreen)
Expand All @@ -346,11 +348,9 @@ - (void)finishedExitFullScreenAnimation:(bool)completed

[self _updateMenuAndDockForFullScreen];

// Screen updates to be re-enabled ta the end of the current function.
// Screen updates to be re-enabled in completeFinishExitFullScreenAnimationAfterRepaint.
NSDisableScreenUpdates();

[self _manager]->didExitFullScreen();
[self _manager]->setAnimatingFullScreen(false);
[[_webViewPlaceholder.get() window] setAutodisplay:NO];

NSResponder *firstResponder = [[self window] firstResponder];
[self _swapView:_webViewPlaceholder.get() with:_webView];
Expand All @@ -372,9 +372,24 @@ - (void)finishedExitFullScreenAnimation:(bool)completed

[[_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
Expand Down

0 comments on commit 72b0f5f

Please sign in to comment.