Title: [271542] trunk/Source/WebCore
Revision
271542
Author
[email protected]
Date
2021-01-15 15:47:13 -0800 (Fri, 15 Jan 2021)

Log Message

(REGRESSION) Playback pauses upon entering PiP via media controls on trailers.apple.com
https://bugs.webkit.org/show_bug.cgi?id=220669

Reviewed by Jer Noble.

Add a quirk to disable the "webkitendfullscreen" event when a video enters picture-in-picture
from fullscreen for the sites which cannot handle the event properly.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::enterFullscreen):
* page/Quirks.cpp:
(WebCore::Quirks::shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk const):
* page/Quirks.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271541 => 271542)


--- trunk/Source/WebCore/ChangeLog	2021-01-15 23:35:58 UTC (rev 271541)
+++ trunk/Source/WebCore/ChangeLog	2021-01-15 23:47:13 UTC (rev 271542)
@@ -1,3 +1,19 @@
+2021-01-15  Peng Liu  <[email protected]>
+
+        (REGRESSION) Playback pauses upon entering PiP via media controls on trailers.apple.com
+        https://bugs.webkit.org/show_bug.cgi?id=220669
+
+        Reviewed by Jer Noble.
+
+        Add a quirk to disable the "webkitendfullscreen" event when a video enters picture-in-picture
+        from fullscreen for the sites which cannot handle the event properly.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::enterFullscreen):
+        * page/Quirks.cpp:
+        (WebCore::Quirks::shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk const):
+        * page/Quirks.h:
+
 2021-01-15  Chris Fleizach  <[email protected]>
 
         AX: increment/decrement synthetic arrow events don't work in ARIA slider examples

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (271541 => 271542)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-01-15 23:35:58 UTC (rev 271541)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-01-15 23:47:13 UTC (rev 271542)
@@ -5964,7 +5964,7 @@
 
                 if (mode == VideoFullscreenModeStandard)
                     scheduleEvent(eventNames().webkitbeginfullscreenEvent);
-                else if (oldMode == VideoFullscreenModeStandard)
+                else if (oldMode == VideoFullscreenModeStandard && !document().quirks().shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk())
                     scheduleEvent(eventNames().webkitendfullscreenEvent);
 
                 return;

Modified: trunk/Source/WebCore/page/Quirks.cpp (271541 => 271542)


--- trunk/Source/WebCore/page/Quirks.cpp	2021-01-15 23:35:58 UTC (rev 271541)
+++ trunk/Source/WebCore/page/Quirks.cpp	2021-01-15 23:47:13 UTC (rev 271542)
@@ -1294,4 +1294,24 @@
 #endif
 }
 
+bool Quirks::shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk() const
+{
+#if ENABLE(VIDEO_PRESENTATION_MODE)
+    // This quirk disables the "webkitendfullscreen" event when a video enters picture-in-picture
+    // from fullscreen for the sites which cannot handle the event properly in that case.
+    // We should remove the quirk once rdar://problem/73261957 has been fixed.
+    if (!needsQuirks())
+        return false;
+
+    if (!m_shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk) {
+        auto host = m_document->topDocument().url().host();
+        m_shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk = equalLettersIgnoringASCIICase(host, "trailers.apple.com");
+    }
+
+    return *m_shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk;
+#else
+    return false;
+#endif
 }
+
+}

Modified: trunk/Source/WebCore/page/Quirks.h (271541 => 271542)


--- trunk/Source/WebCore/page/Quirks.h	2021-01-15 23:35:58 UTC (rev 271541)
+++ trunk/Source/WebCore/page/Quirks.h	2021-01-15 23:47:13 UTC (rev 271542)
@@ -130,6 +130,7 @@
     bool requiresUserGestureToPauseInPictureInPicture() const;
 
     WEBCORE_EXPORT bool blocksReturnToFullscreenFromPictureInPictureQuirk() const;
+    bool shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk() const;
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
     static bool isMicrosoftTeamsRedirectURL(const URL&);
@@ -173,6 +174,7 @@
     mutable Optional<bool> m_needsBlackFullscreenBackgroundQuirk;
     mutable Optional<bool> m_requiresUserGestureToPauseInPictureInPicture;
     mutable Optional<bool> m_blocksReturnToFullscreenFromPictureInPictureQuirk;
+    mutable Optional<bool> m_shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to