Title: [193762] trunk/Source/WebCore
Revision
193762
Author
jer.no...@apple.com
Date
2015-12-08 11:29:39 -0800 (Tue, 08 Dec 2015)

Log Message

[iOS] Do not exit fullscreen mode during auto-PiP.
https://bugs.webkit.org/show_bug.cgi?id=151889

Reviewed by Darin Adler.

When auto-PiPing, do not exit fullscreen mode, as that causes a two-step animation upon returing from auto-PiP.

* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(WebVideoFullscreenInterfaceAVKit::applicationDidBecomeActive): Handle the case where we open Safari after an
    auto-PiP by clicking on a link; if so, hide the fullscreen window.
(WebVideoFullscreenInterfaceAVKit::didStartPictureInPicture): Do not exit fullscreen during auto-PiP.
(WebVideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (193761 => 193762)


--- trunk/Source/WebCore/ChangeLog	2015-12-08 19:20:52 UTC (rev 193761)
+++ trunk/Source/WebCore/ChangeLog	2015-12-08 19:29:39 UTC (rev 193762)
@@ -1,3 +1,18 @@
+2015-12-08  Jer Noble  <jer.no...@apple.com>
+
+        [iOS] Do not exit fullscreen mode during auto-PiP.
+        https://bugs.webkit.org/show_bug.cgi?id=151889
+
+        Reviewed by Darin Adler.
+
+        When auto-PiPing, do not exit fullscreen mode, as that causes a two-step animation upon returing from auto-PiP.
+
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+        (WebVideoFullscreenInterfaceAVKit::applicationDidBecomeActive): Handle the case where we open Safari after an
+            auto-PiP by clicking on a link; if so, hide the fullscreen window.
+        (WebVideoFullscreenInterfaceAVKit::didStartPictureInPicture): Do not exit fullscreen during auto-PiP.
+        (WebVideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason): Ditto.
+
 2015-12-08  Per Arne Vollan  <pe...@outlook.com>
 
         [WinCairo] Remove unneeded function.

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (193761 => 193762)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2015-12-08 19:20:52 UTC (rev 193761)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2015-12-08 19:29:39 UTC (rev 193762)
@@ -1079,8 +1079,20 @@
 void WebVideoFullscreenInterfaceAVKit::applicationDidBecomeActive()
 {
     LOG(Fullscreen, "WebVideoFullscreenInterfaceAVKit::applicationDidBecomeActive(%p)", this);
-    if (m_shouldReturnToFullscreenAfterEnteringForeground && m_videoFullscreenModel && m_videoFullscreenModel->isVisible())
+    if (m_shouldReturnToFullscreenAfterEnteringForeground && m_videoFullscreenModel && m_videoFullscreenModel->isVisible()) {
         [m_playerViewController stopPictureInPicture];
+        return;
+    }
+
+    // If we are both in PiP and in Fullscreen (i.e., via auto-PiP), and we did not stop fullscreen upon returning, it must be
+    // because the originating view is not visible, so hide the fullscreen window.
+    if (isMode(HTMLMediaElementEnums::VideoFullscreenModeStandard | HTMLMediaElementEnums::VideoFullscreenModePictureInPicture)) {
+        RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
+        [m_playerViewController exitFullScreenAnimated:NO completionHandler:[strongThis, this] (BOOL, NSError*) {
+            [m_window setHidden:YES];
+            [[m_playerViewController view] setHidden:YES];
+        }];
+    }
 }
 
 @interface UIWindow ()
@@ -1376,11 +1388,13 @@
     [m_playerViewController setShowsPlaybackControls:YES];
 
     if (m_mode & HTMLMediaElementEnums::VideoFullscreenModeStandard) {
-        RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
-        [m_playerViewController exitFullScreenAnimated:YES completionHandler:[strongThis, this] (BOOL, NSError*) {
-            [m_window setHidden:YES];
-            [[m_playerViewController view] setHidden:YES];
-        }];
+        if (![m_playerViewController pictureInPictureWasStartedWhenEnteringBackground]) {
+            RefPtr<WebVideoFullscreenInterfaceAVKit> strongThis(this);
+            [m_playerViewController exitFullScreenAnimated:YES completionHandler:[strongThis, this] (BOOL, NSError*) {
+                [m_window setHidden:YES];
+                [[m_playerViewController view] setHidden:YES];
+            }];
+        }
     } else {
         [m_window setHidden:YES];
         [[m_playerViewController view] setHidden:YES];
@@ -1479,6 +1493,9 @@
         return true;
 
     if (reason == ExitFullScreenReason::PictureInPictureStarted) {
+        if ([m_playerViewController pictureInPictureWasStartedWhenEnteringBackground])
+            return false;
+
         m_shouldReturnToFullscreenWhenStoppingPiP = hasMode(HTMLMediaElementEnums::VideoFullscreenModeStandard);
         clearMode(HTMLMediaElementEnums::VideoFullscreenModeStandard);
         return true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to