Title: [271503] trunk/Source
Revision
271503
Author
[email protected]
Date
2021-01-14 15:17:20 -0800 (Thu, 14 Jan 2021)

Log Message

Add a quirk to disable "return to element fullscreen from picture-in-picture" for some sites
https://bugs.webkit.org/show_bug.cgi?id=220606

Reviewed by Eric Carlson.

Source/WebCore:

For iPads, we add the support of "return to element fullscreen from picture-in-picture" in r265562.
Unfortunately, some sites do not set element's styles properly when a video returns to fullscreen
from picture-in-picture. This patch adds a quirk to disable the feature for those sites for now.

* page/Quirks.cpp:
(WebCore::Quirks::blocksReturnToFullscreenFromPictureInPictureQuirk const):
* page/Quirks.h:
* platform/ios/VideoFullscreenInterfaceAVKit.h:
* platform/ios/VideoFullscreenInterfaceAVKit.mm:
(VideoFullscreenInterfaceAVKit::setupFullscreen):
(VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(VideoFullscreenControllerContext::setUpFullscreen):

Source/WebKit:

* UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
* UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in:
* UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
* UIProcess/WebFullScreenManagerProxy.cpp:
(WebKit::WebFullScreenManagerProxy::blocksReturnToFullscreenFromPictureInPicture const):
(WebKit::WebFullScreenManagerProxy::enterFullScreen):
* UIProcess/WebFullScreenManagerProxy.h:
* UIProcess/WebFullScreenManagerProxy.messages.in:
* UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController enterFullScreen]):
(-[WKFullScreenWindowController didEnterPictureInPicture]):
* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::enterFullScreenForElement):
* WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp:
(WebKit::InjectedBundlePageFullScreenClient::enterFullScreenForElement):
* WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h:
* WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271502 => 271503)


--- trunk/Source/WebCore/ChangeLog	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebCore/ChangeLog	2021-01-14 23:17:20 UTC (rev 271503)
@@ -1,3 +1,24 @@
+2021-01-14  Peng Liu  <[email protected]>
+
+        Add a quirk to disable "return to element fullscreen from picture-in-picture" for some sites
+        https://bugs.webkit.org/show_bug.cgi?id=220606
+
+        Reviewed by Eric Carlson.
+
+        For iPads, we add the support of "return to element fullscreen from picture-in-picture" in r265562.
+        Unfortunately, some sites do not set element's styles properly when a video returns to fullscreen
+        from picture-in-picture. This patch adds a quirk to disable the feature for those sites for now.
+
+        * page/Quirks.cpp:
+        (WebCore::Quirks::blocksReturnToFullscreenFromPictureInPictureQuirk const):
+        * page/Quirks.h:
+        * platform/ios/VideoFullscreenInterfaceAVKit.h:
+        * platform/ios/VideoFullscreenInterfaceAVKit.mm:
+        (VideoFullscreenInterfaceAVKit::setupFullscreen):
+        (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
+        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+        (VideoFullscreenControllerContext::setUpFullscreen):
+
 2021-01-14  Lauro Moura  <[email protected]>
 
         Unreviewed. Remove unused variable warning.

Modified: trunk/Source/WebCore/page/Quirks.cpp (271502 => 271503)


--- trunk/Source/WebCore/page/Quirks.cpp	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebCore/page/Quirks.cpp	2021-01-14 23:17:20 UTC (rev 271503)
@@ -1273,4 +1273,25 @@
     return *m_requiresUserGestureToPauseInPictureInPicture;
 }
 
+bool Quirks::blocksReturnToFullscreenFromPictureInPictureQuirk() const
+{
+#if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO_PRESENTATION_MODE)
+    // Some sites (e.g., wowhead.com and vimeo.com) do not set element's styles properly when a video
+    // returns to fullscreen from picture-in-picture. This quirk disables the "return to fullscreen
+    // from picture-in-picture" feature for those sites. We should remove the quirk once rdar://problem/73167861
+    // and rdar://problem/73167931 have been fixed.
+    if (!needsQuirks())
+        return false;
+
+    if (!m_blocksReturnToFullscreenFromPictureInPictureQuirk) {
+        auto domain = RegistrableDomain { m_document->topDocument().url() };
+        m_blocksReturnToFullscreenFromPictureInPictureQuirk = domain == "vimeo.com"_s || domain == "wowhead.com"_s;
+    }
+
+    return *m_blocksReturnToFullscreenFromPictureInPictureQuirk;
+#else
+    return false;
+#endif
 }
+
+}

Modified: trunk/Source/WebCore/page/Quirks.h (271502 => 271503)


--- trunk/Source/WebCore/page/Quirks.h	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebCore/page/Quirks.h	2021-01-14 23:17:20 UTC (rev 271503)
@@ -129,6 +129,8 @@
 
     bool requiresUserGestureToPauseInPictureInPicture() const;
 
+    WEBCORE_EXPORT bool blocksReturnToFullscreenFromPictureInPictureQuirk() const;
+
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
     static bool isMicrosoftTeamsRedirectURL(const URL&);
     static bool hasStorageAccessForAllLoginDomains(const HashSet<RegistrableDomain>&, const RegistrableDomain&);
@@ -170,6 +172,7 @@
     mutable Optional<bool> m_needsHDRPixelDepthQuirk;
     mutable Optional<bool> m_needsBlackFullscreenBackgroundQuirk;
     mutable Optional<bool> m_requiresUserGestureToPauseInPictureInPicture;
+    mutable Optional<bool> m_blocksReturnToFullscreenFromPictureInPictureQuirk;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h (271502 => 271503)


--- trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.h	2021-01-14 23:17:20 UTC (rev 271503)
@@ -79,7 +79,7 @@
     // PlaybackSessionModelClient
     WEBCORE_EXPORT void externalPlaybackChanged(bool enabled, PlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) final;
 
-    WEBCORE_EXPORT void setupFullscreen(UIView& videoView, const IntRect& initialRect, const FloatSize& videoDimensions, UIView* parentView, HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicturePlayback, bool standby);
+    WEBCORE_EXPORT void setupFullscreen(UIView& videoView, const IntRect& initialRect, const FloatSize& videoDimensions, UIView* parentView, HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicturePlayback, bool standby, bool blocksReturnToFullscreenFromPictureInPicture);
     WEBCORE_EXPORT void enterFullscreen();
     WEBCORE_EXPORT bool exitFullscreen(const IntRect& finalRect);
     WEBCORE_EXPORT void cleanupFullscreen();
@@ -192,6 +192,7 @@
     bool m_allowsPictureInPicturePlayback { false };
     bool m_wirelessVideoPlaybackDisabled { true };
     bool m_shouldReturnToFullscreenWhenStoppingPictureInPicture { false };
+    bool m_blocksReturnToFullscreenFromPictureInPicture { false };
     bool m_restoringFullscreenForPictureInPictureStop { false };
     bool m_returningToStandby { false };
 

Modified: trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm (271502 => 271503)


--- trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebCore/platform/ios/VideoFullscreenInterfaceAVKit.mm	2021-01-14 23:17:20 UTC (rev 271503)
@@ -926,7 +926,7 @@
     LOG(Fullscreen, "VideoFullscreenInterfaceAVKit::applicationDidBecomeActive(%p)", this);
 }
 
-void VideoFullscreenInterfaceAVKit::setupFullscreen(UIView& videoView, const IntRect& initialRect, const FloatSize& videoDimensions, UIView* parentView, HTMLMediaElementEnums::VideoFullscreenMode mode, bool allowsPictureInPicturePlayback, bool standby)
+void VideoFullscreenInterfaceAVKit::setupFullscreen(UIView& videoView, const IntRect& initialRect, const FloatSize& videoDimensions, UIView* parentView, HTMLMediaElementEnums::VideoFullscreenMode mode, bool allowsPictureInPicturePlayback, bool standby, bool blocksReturnToFullscreenFromPictureInPicture)
 {
     ASSERT(standby || mode != HTMLMediaElementEnums::VideoFullscreenModeNone);
     LOG(Fullscreen, "VideoFullscreenInterfaceAVKit::setupFullscreen(%p)", this);
@@ -944,6 +944,7 @@
 
     m_targetStandby = standby;
     m_targetMode = mode;
+    m_blocksReturnToFullscreenFromPictureInPicture = blocksReturnToFullscreenFromPictureInPicture;
     setInlineRect(initialRect, true);
     doSetup();
 }
@@ -1132,7 +1133,7 @@
             exitFullscreenHandler(success, error);
         }];
     } else {
-        if (m_standby)
+        if (m_standby && !m_blocksReturnToFullscreenFromPictureInPicture)
             m_shouldReturnToFullscreenWhenStoppingPictureInPicture = true;
 
         [m_window setHidden:YES];

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (271502 => 271503)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm	2021-01-14 23:17:20 UTC (rev 271503)
@@ -994,7 +994,7 @@
 
         m_videoFullscreenView = adoptNS([PAL::allocUIViewInstance() init]);
 
-        m_interface->setupFullscreen(*m_videoFullscreenView.get(), videoElementClientRect, videoDimensions, viewRef.get(), mode, allowsPictureInPicture, false);
+        m_interface->setupFullscreen(*m_videoFullscreenView.get(), videoElementClientRect, videoDimensions, viewRef.get(), mode, allowsPictureInPicture, false, false);
     });
 }
 

Modified: trunk/Source/WebKit/ChangeLog (271502 => 271503)


--- trunk/Source/WebKit/ChangeLog	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebKit/ChangeLog	2021-01-14 23:17:20 UTC (rev 271503)
@@ -1,3 +1,30 @@
+2021-01-14  Peng Liu  <[email protected]>
+
+        Add a quirk to disable "return to element fullscreen from picture-in-picture" for some sites
+        https://bugs.webkit.org/show_bug.cgi?id=220606
+
+        Reviewed by Eric Carlson.
+
+        * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
+        * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in:
+        * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
+        (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
+        * UIProcess/WebFullScreenManagerProxy.cpp:
+        (WebKit::WebFullScreenManagerProxy::blocksReturnToFullscreenFromPictureInPicture const):
+        (WebKit::WebFullScreenManagerProxy::enterFullScreen):
+        * UIProcess/WebFullScreenManagerProxy.h:
+        * UIProcess/WebFullScreenManagerProxy.messages.in:
+        * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
+        (-[WKFullScreenWindowController enterFullScreen]):
+        (-[WKFullScreenWindowController didEnterPictureInPicture]):
+        * WebProcess/FullScreen/WebFullScreenManager.cpp:
+        (WebKit::WebFullScreenManager::enterFullScreenForElement):
+        * WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp:
+        (WebKit::InjectedBundlePageFullScreenClient::enterFullScreenForElement):
+        * WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h:
+        * WebProcess/cocoa/VideoFullscreenManager.mm:
+        (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement):
+
 2021-01-14  Chris Dumez  <[email protected]>
 
         Unreviewed, apply post-landing review comments from Darin for r271495.

Modified: trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h (271502 => 271503)


--- trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h	2021-01-14 23:17:20 UTC (rev 271503)
@@ -173,7 +173,7 @@
     void hasVideoInPictureInPictureDidChange(bool);
 
     // Messages from VideoFullscreenManager
-    void setupFullscreenWithID(PlaybackSessionContextIdentifier, WebKit::LayerHostingContextID videoLayerID, const WebCore::IntRect& initialRect, const WebCore::FloatSize& videoDimensions, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicture, bool standby);
+    void setupFullscreenWithID(PlaybackSessionContextIdentifier, WebKit::LayerHostingContextID videoLayerID, const WebCore::IntRect& initialRect, const WebCore::FloatSize& videoDimensions, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicture, bool standby, bool blocksReturnToFullscreenFromPictureInPicture);
     void setInlineRect(PlaybackSessionContextIdentifier, const WebCore::IntRect& inlineRect, bool visible);
     void setHasVideoContentLayer(PlaybackSessionContextIdentifier, bool value);
     void setHasVideo(PlaybackSessionContextIdentifier, bool);

Modified: trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in (271502 => 271503)


--- trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in	2021-01-14 23:17:20 UTC (rev 271503)
@@ -24,7 +24,7 @@
 messages -> VideoFullscreenManagerProxy {
     SetHasVideo(WebKit::PlaybackSessionContextIdentifier contextId, bool hasVideo)
     SetVideoDimensions(WebKit::PlaybackSessionContextIdentifier contextId, WebCore::FloatSize videoDimensions)
-    SetupFullscreenWithID(WebKit::PlaybackSessionContextIdentifier contextId, WebKit::LayerHostingContextID videoLayerID, WebCore::IntRect initialRect, WebCore::FloatSize videoDimensions, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowsPictureInPicture, bool standby)
+    SetupFullscreenWithID(WebKit::PlaybackSessionContextIdentifier contextId, WebKit::LayerHostingContextID videoLayerID, WebCore::IntRect initialRect, WebCore::FloatSize videoDimensions, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowsPictureInPicture, bool standby, bool blocksReturnToFullscreenFromPictureInPicture)
 #if !PLATFORM(IOS_FAMILY)
     EnterFullscreen(WebKit::PlaybackSessionContextIdentifier contextId)
 #endif

Modified: trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm (271502 => 271503)


--- trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm	2021-01-14 23:17:20 UTC (rev 271503)
@@ -508,7 +508,7 @@
 
 #pragma mark Messages from VideoFullscreenManager
 
-void VideoFullscreenManagerProxy::setupFullscreenWithID(PlaybackSessionContextIdentifier contextId, WebKit::LayerHostingContextID videoLayerID, const WebCore::IntRect& initialRect, const WebCore::FloatSize& videoDimensions, float hostingDeviceScaleFactor, HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowsPictureInPicture, bool standby)
+void VideoFullscreenManagerProxy::setupFullscreenWithID(PlaybackSessionContextIdentifier contextId, WebKit::LayerHostingContextID videoLayerID, const WebCore::IntRect& initialRect, const WebCore::FloatSize& videoDimensions, float hostingDeviceScaleFactor, HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowsPictureInPicture, bool standby, bool blocksReturnToFullscreenFromPictureInPicture)
 {
     MESSAGE_CHECK(videoLayerID);
 
@@ -544,9 +544,10 @@
 #if PLATFORM(IOS_FAMILY)
     auto* rootNode = downcast<RemoteLayerTreeDrawingAreaProxy>(*m_page->drawingArea()).remoteLayerTreeHost().rootNode();
     UIView *parentView = rootNode ? rootNode->uiView() : nil;
-    interface->setupFullscreen(*model->layerHostView(), initialRect, videoDimensions, parentView, videoFullscreenMode, allowsPictureInPicture, standby);
+    interface->setupFullscreen(*model->layerHostView(), initialRect, videoDimensions, parentView, videoFullscreenMode, allowsPictureInPicture, standby, blocksReturnToFullscreenFromPictureInPicture);
 #else
     UNUSED_PARAM(videoDimensions);
+    UNUSED_PARAM(blocksReturnToFullscreenFromPictureInPicture);
     IntRect initialWindowRect;
     m_page->rootViewToWindow(initialRect, initialWindowRect);
     interface->setupFullscreen(*model->layerHostView(), initialWindowRect, m_page->platformWindow(), videoFullscreenMode, allowsPictureInPicture);

Modified: trunk/Source/WebKit/UIProcess/WebFullScreenManagerProxy.cpp (271502 => 271503)


--- trunk/Source/WebKit/UIProcess/WebFullScreenManagerProxy.cpp	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebKit/UIProcess/WebFullScreenManagerProxy.cpp	2021-01-14 23:17:20 UTC (rev 271503)
@@ -146,8 +146,14 @@
     return m_client.isFullScreen();
 }
 
-void WebFullScreenManagerProxy::enterFullScreen()
+bool WebFullScreenManagerProxy::blocksReturnToFullscreenFromPictureInPicture() const
 {
+    return m_blocksReturnToFullscreenFromPictureInPicture;
+}
+
+void WebFullScreenManagerProxy::enterFullScreen(bool blocksReturnToFullscreenFromPictureInPicture)
+{
+    m_blocksReturnToFullscreenFromPictureInPicture = blocksReturnToFullscreenFromPictureInPicture;
     m_client.enterFullScreen();
 }
 
@@ -155,7 +161,7 @@
 {
     m_client.exitFullScreen();
 }
-    
+
 void WebFullScreenManagerProxy::beganEnterFullScreen(const IntRect& initialFrame, const IntRect& finalFrame)
 {
     m_client.beganEnterFullScreen(initialFrame, finalFrame);

Modified: trunk/Source/WebKit/UIProcess/WebFullScreenManagerProxy.h (271502 => 271503)


--- trunk/Source/WebKit/UIProcess/WebFullScreenManagerProxy.h	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebKit/UIProcess/WebFullScreenManagerProxy.h	2021-01-14 23:17:20 UTC (rev 271503)
@@ -62,6 +62,7 @@
     virtual ~WebFullScreenManagerProxy();
 
     bool isFullScreen();
+    bool blocksReturnToFullscreenFromPictureInPicture() const;
     void close();
 
     void willEnterFullScreen();
@@ -79,7 +80,7 @@
 
 private:
     void supportsFullScreen(bool withKeyboard, CompletionHandler<void(bool)>&&);
-    void enterFullScreen();
+    void enterFullScreen(bool blocksReturnToFullscreenFromPictureInPicture);
     void exitFullScreen();
     void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame);
     void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame);
@@ -89,6 +90,7 @@
 
     WebPageProxy& m_page;
     WebFullScreenManagerProxyClient& m_client;
+    bool m_blocksReturnToFullscreenFromPictureInPicture { false };
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/WebFullScreenManagerProxy.messages.in (271502 => 271503)


--- trunk/Source/WebKit/UIProcess/WebFullScreenManagerProxy.messages.in	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebKit/UIProcess/WebFullScreenManagerProxy.messages.in	2021-01-14 23:17:20 UTC (rev 271503)
@@ -23,7 +23,7 @@
 #if ENABLE(FULLSCREEN_API)
 messages -> WebFullScreenManagerProxy NotRefCounted {
     SupportsFullScreen(bool withKeyboard) -> (bool supportsFullScreen) Synchronous
-    EnterFullScreen()
+    EnterFullScreen(bool blocksReturnToFullscreenFromPictureInPicture)
     ExitFullScreen()
     BeganEnterFullScreen(WebCore::IntRect initialRect, WebCore::IntRect finalRect)
     BeganExitFullScreen(WebCore::IntRect initialRect, WebCore::IntRect finalRect)

Modified: trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm (271502 => 271503)


--- trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm	2021-01-14 23:17:20 UTC (rev 271503)
@@ -471,6 +471,7 @@
     BOOL _shouldReturnToFullscreenFromPictureInPicture;
     BOOL _enterFullscreenNeedsExitPictureInPicture;
     BOOL _returnToFullscreenFromPictureInPicture;
+    BOOL _blocksReturnToFullscreenFromPictureInPicture;
 
     CGRect _initialFrame;
     CGRect _finalFrame;
@@ -540,6 +541,7 @@
     [self _invalidateEVOrganizationName];
 
     _fullScreenState = WebKit::WaitingToEnterFullScreen;
+    _blocksReturnToFullscreenFromPictureInPicture = manager->blocksReturnToFullscreenFromPictureInPicture();
 
     _window = adoptNS([[UIWindow alloc] initWithWindowScene:[[webView window] windowScene]]);
     [_window setBackgroundColor:[UIColor clearColor]];
@@ -887,7 +889,8 @@
 
 - (void)didEnterPictureInPicture
 {
-    _shouldReturnToFullscreenFromPictureInPicture = YES;
+    _shouldReturnToFullscreenFromPictureInPicture = !_blocksReturnToFullscreenFromPictureInPicture;
+
     if (_fullScreenState == WebKit::InFullScreen)
         [self requestExitFullScreen];
 }

Modified: trunk/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp (271502 => 271503)


--- trunk/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp	2021-01-14 23:17:20 UTC (rev 271503)
@@ -38,6 +38,7 @@
 #include <WebCore/FrameView.h>
 #include <WebCore/FullscreenManager.h>
 #include <WebCore/HTMLVideoElement.h>
+#include <WebCore/Quirks.h>
 #include <WebCore/RenderLayerBacking.h>
 #include <WebCore/RenderView.h>
 #include <WebCore/Settings.h>
@@ -144,7 +145,7 @@
 #endif
 
     m_initialFrame = screenRectOfContents(m_element.get());
-    m_page->injectedBundleFullScreenClient().enterFullScreenForElement(m_page.get(), element);
+    m_page->injectedBundleFullScreenClient().enterFullScreenForElement(m_page.get(), element, m_element->document().quirks().blocksReturnToFullscreenFromPictureInPictureQuirk());
 }
 
 void WebFullScreenManager::exitFullScreenForElement(WebCore::Element* element)

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp (271502 => 271503)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.cpp	2021-01-14 23:17:20 UTC (rev 271503)
@@ -51,13 +51,13 @@
     return supports;
 }
 
-void InjectedBundlePageFullScreenClient::enterFullScreenForElement(WebPage *page, WebCore::Element *element)
+void InjectedBundlePageFullScreenClient::enterFullScreenForElement(WebPage *page, WebCore::Element *element, bool blocksReturnToFullscreenFromPictureInPicture)
 {
     if (m_client.enterFullScreenForElement) {
         RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(element);
         m_client.enterFullScreenForElement(toAPI(page), toAPI(nodeHandle.get()));
     } else
-        page->send(Messages::WebFullScreenManagerProxy::EnterFullScreen());
+        page->send(Messages::WebFullScreenManagerProxy::EnterFullScreen(blocksReturnToFullscreenFromPictureInPicture));
 }
 
 void InjectedBundlePageFullScreenClient::exitFullScreenForElement(WebPage *page, WebCore::Element *element)
@@ -69,7 +69,6 @@
         page->send(Messages::WebFullScreenManagerProxy::ExitFullScreen());
 }
 
-
 void InjectedBundlePageFullScreenClient::beganEnterFullScreen(WebPage *page, IntRect& initialFrame, IntRect& finalFrame)
 {
     if (m_client.beganEnterFullScreen)
@@ -78,7 +77,6 @@
         page->send(Messages::WebFullScreenManagerProxy::BeganEnterFullScreen(initialFrame, finalFrame));
 }
 
-
 void InjectedBundlePageFullScreenClient::beganExitFullScreen(WebPage *page, IntRect& initialFrame, IntRect& finalFrame)
 {
     if (m_client.beganExitFullScreen)

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h (271502 => 271503)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageFullScreenClient.h	2021-01-14 23:17:20 UTC (rev 271503)
@@ -50,7 +50,7 @@
 class InjectedBundlePageFullScreenClient : public API::Client<WKBundlePageFullScreenClientBase> {
 public:
     bool supportsFullScreen(WebPage*, bool withKeyboard);
-    void enterFullScreenForElement(WebPage*, WebCore::Element*);
+    void enterFullScreenForElement(WebPage*, WebCore::Element*, bool blocksReturnToFullscreenFromPictureInPicture);
     void exitFullScreenForElement(WebPage*, WebCore::Element*);
     void beganEnterFullScreen(WebPage*, WebCore::IntRect& initialFrame, WebCore::IntRect& finalFrame);
     void beganExitFullScreen(WebPage*, WebCore::IntRect& initialFrame, WebCore::IntRect& finalFrame);

Modified: trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm (271502 => 271503)


--- trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm	2021-01-14 23:07:39 UTC (rev 271502)
+++ trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm	2021-01-14 23:17:20 UTC (rev 271503)
@@ -45,6 +45,7 @@
 #import <WebCore/HTMLVideoElement.h>
 #import <WebCore/PictureInPictureSupport.h>
 #import <WebCore/PlatformCALayer.h>
+#import <WebCore/Quirks.h>
 #import <WebCore/RenderLayer.h>
 #import <WebCore/RenderLayerBacking.h>
 #import <WebCore/RenderVideo.h>
@@ -291,7 +292,7 @@
         interface->layerHostingContext()->setRootLayer(videoLayer.get());
     }
 
-    m_page->send(Messages::VideoFullscreenManagerProxy::SetupFullscreenWithID(contextId, interface->layerHostingContext()->contextID(), videoRect, FloatSize(videoElement.videoWidth(), videoElement.videoHeight()), m_page->deviceScaleFactor(), interface->fullscreenMode(), allowsPictureInPicture, standby));
+    m_page->send(Messages::VideoFullscreenManagerProxy::SetupFullscreenWithID(contextId, interface->layerHostingContext()->contextID(), videoRect, FloatSize(videoElement.videoWidth(), videoElement.videoHeight()), m_page->deviceScaleFactor(), interface->fullscreenMode(), allowsPictureInPicture, standby, videoElement.document().quirks().blocksReturnToFullscreenFromPictureInPictureQuirk()));
 }
 
 void VideoFullscreenManager::exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement& videoElement, CompletionHandler<void(bool)>&& completionHandler)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to