Skip to content
Browse files
Return from PiP to Element Fullscreen Animation breaks sometimes

Reviewed by Eric Carlson.

When entering picture-in-picture from "element" fullscreen (as opposed to "video" i.e. "AVKit" fullscreen) tapping the "return" button in the PiP window will re-enter fullscreen. But because this operation may take a while (re-layout of a heavy page like can take upwards of 500ms), WebKit performs a four-part transition: 1, enter AVKit fullscreen mode with blank content; 2, exit PiP into the AVKit fullscreen presentation; 3, enter "element" fullscreen mode behind AVKit's fullscreen presentation; 4, exit AKit fullscreen _into_ the "element" fullscreen presentation.

When this bug occurs, it appears that in step 3, the "element" fullscreen presentation happens _on top_ of the AVKit fullscreen presentation rather than below.

To mitigate this animation issue, disable the "element" fullscreen presentation animation when transitining to fullcreen from PiP mode.

* Source/WebKit/UIProcess/ios/fullscreen/
(-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):

Canonical link:
  • Loading branch information
jernoble committed Sep 30, 2022
1 parent d32479a commit f235928df8cfd0ed6f1d0a6eef8bda1a83914516
Showing 1 changed file with 6 additions and 1 deletion.
@@ -680,7 +680,12 @@ - (void)beganEnterFullScreenWithInitialFrame:(CGRect)initialFrame finalFrame:(CG

[CATransaction commit];

[_rootViewController presentViewController:_fullscreenViewController.get() animated:YES completion:^{
// NOTE: In this state, there is already a AVKit fullscreen presentation; we want to
// animate into position under the AVKit fullscreen, then after that presentation
// completes, exit AVKit fullscreen.
BOOL shouldAnimateEnterFullscreenTransition = !_returnToFullscreenFromPictureInPicture;

[_rootViewController presentViewController:_fullscreenViewController.get() animated:shouldAnimateEnterFullscreenTransition completion:^{
_fullScreenState = WebKit::InFullScreen;

if (_exitRequested) {

0 comments on commit f235928

Please sign in to comment.