REGRESSION(r233925): Can't go into PiP twice
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Jul 2018 03:50:46 +0000 (03:50 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Jul 2018 03:50:46 +0000 (03:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=187876
<rdar://problem/42444520>

Reviewed by Jon Lee.

We fail to enter PiP the second time because the video fullscreen interface no longer has a
model, and so gives a contentSize of 0x0. This happens because we disassociate the
interface from the model in didCleanupFullscreen. However, the interface and model can still
be re-used if they're kept alive by another client. We should delay disassociating the model
from the interface until just before the model is destroyed in removeClientForContext.

* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenManagerProxy::removeClientForContext):
(WebKit::VideoFullscreenManagerProxy::didCleanupFullscreen):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234081 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm

index 9e5f11a..4ff9576 100644 (file)
@@ -1,3 +1,21 @@
+2018-07-20  Jer Noble  <jer.noble@apple.com>
+
+        REGRESSION(r233925): Can't go into PiP twice
+        https://bugs.webkit.org/show_bug.cgi?id=187876
+        <rdar://problem/42444520>
+
+        Reviewed by Jon Lee.
+
+        We fail to enter PiP the second time because the video fullscreen interface no longer has a
+        model, and so gives a contentSize of 0x0. This happens because we disassociate the
+        interface from the model in didCleanupFullscreen. However, the interface and model can still
+        be re-used if they're kept alive by another client. We should delay disassociating the model
+        from the interface until just before the model is destroyed in removeClientForContext.
+
+        * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
+        (WebKit::VideoFullscreenManagerProxy::removeClientForContext):
+        (WebKit::VideoFullscreenManagerProxy::didCleanupFullscreen):
+
 2018-07-20  John Wilander  <wilander@apple.com>
 
         Resource Load Statistics: Enable basic functionality in experimental debug mode
index 0e9e9e4..9100afd 100644 (file)
@@ -449,6 +449,7 @@ void VideoFullscreenManagerProxy::removeClientForContext(uint64_t contextId)
     clientCount--;
 
     if (clientCount <= 0) {
+        ensureInterface(contextId).setVideoFullscreenModel(nullptr);
         m_playbackSessionManagerProxy->removeClientForContext(contextId);
         m_clientCounts.remove(contextId);
         m_contextMap.remove(contextId);
@@ -646,7 +647,6 @@ void VideoFullscreenManagerProxy::didCleanupFullscreen(uint64_t contextId)
     m_page->send(Messages::VideoFullscreenManager::DidCleanupFullscreen(contextId), m_page->pageID());
 
     interface->setMode(HTMLMediaElementEnums::VideoFullscreenModeNone);
-    interface->setVideoFullscreenModel(nullptr);
     removeClientForContext(contextId);
 }