Title: [265437] trunk/Source/WebCore
Revision
265437
Author
[email protected]
Date
2020-08-10 10:49:01 -0700 (Mon, 10 Aug 2020)

Log Message

r262456 broke sites that expect webkitDisplayingFullscreen to be true almost immediately
https://bugs.webkit.org/show_bug.cgi?id=215240
<rdar://problem/66284042>

Reviewed by Darin Adler.

Add a quirk for sites that use the Akamai Media Player, which begins polling
`webkitDisplayingFullscreen` every 100ms immediately after entering video fullscreen
mode and exits fullscreen as soon as it returns false. r262456 changed the HTMLMediaPlayer
state machine so `webkitDisplayingFullscreen` doesn't return `true` until the fullscreen
window has been opened in the UI process. This was done to fix bugs triggered by
rapidly entering and exiting fullscreen and PiP and make our own fullscreen/PiP tests
less flakey, so instead of reverting the change universally do it as a quirk for sites
using the Akamai Media Player.

* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::webkitDisplayingFullscreen):
* page/Quirks.cpp:
(WebCore::Quirks::needsAkamaiMediaPlayerQuirk const):
* page/Quirks.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (265436 => 265437)


--- trunk/Source/WebCore/ChangeLog	2020-08-10 17:25:34 UTC (rev 265436)
+++ trunk/Source/WebCore/ChangeLog	2020-08-10 17:49:01 UTC (rev 265437)
@@ -1,3 +1,26 @@
+2020-08-10  Eric Carlson  <[email protected]>
+
+        r262456 broke sites that expect webkitDisplayingFullscreen to be true almost immediately
+        https://bugs.webkit.org/show_bug.cgi?id=215240
+        <rdar://problem/66284042>
+
+        Reviewed by Darin Adler.
+
+        Add a quirk for sites that use the Akamai Media Player, which begins polling
+        `webkitDisplayingFullscreen` every 100ms immediately after entering video fullscreen
+        mode and exits fullscreen as soon as it returns false. r262456 changed the HTMLMediaPlayer
+        state machine so `webkitDisplayingFullscreen` doesn't return `true` until the fullscreen
+        window has been opened in the UI process. This was done to fix bugs triggered by
+        rapidly entering and exiting fullscreen and PiP and make our own fullscreen/PiP tests
+        less flakey, so instead of reverting the change universally do it as a quirk for sites
+        using the Akamai Media Player.
+
+        * html/HTMLVideoElement.cpp:
+        (WebCore::HTMLVideoElement::webkitDisplayingFullscreen):
+        * page/Quirks.cpp:
+        (WebCore::Quirks::needsAkamaiMediaPlayerQuirk const):
+        * page/Quirks.h:
+
 2020-08-10  Antti Koivisto  <[email protected]>
 
         Return values of FontDatabase::collectionForFamily are not thread safe

Modified: trunk/Source/WebCore/html/HTMLVideoElement.cpp (265436 => 265437)


--- trunk/Source/WebCore/html/HTMLVideoElement.cpp	2020-08-10 17:25:34 UTC (rev 265436)
+++ trunk/Source/WebCore/html/HTMLVideoElement.cpp	2020-08-10 17:49:01 UTC (rev 265437)
@@ -352,6 +352,9 @@
 
 bool HTMLVideoElement::webkitDisplayingFullscreen()
 {
+    if (document().quirks().needsAkamaiMediaPlayerQuirk(*this))
+        return isFullscreen() || m_isChangingPresentationMode;
+
     // This function starts to return true after the video element has entered
     // fullscreen/picture-in-picture until it has exited fullscreen/picture-in-picture
     return (isFullscreen() && !waitingToEnterFullscreen()) || (!isFullscreen() && m_isChangingPresentationMode);

Modified: trunk/Source/WebCore/page/Quirks.cpp (265436 => 265437)


--- trunk/Source/WebCore/page/Quirks.cpp	2020-08-10 17:25:34 UTC (rev 265436)
+++ trunk/Source/WebCore/page/Quirks.cpp	2020-08-10 17:49:01 UTC (rev 265437)
@@ -38,6 +38,7 @@
 #include "HTMLDivElement.h"
 #include "HTMLMetaElement.h"
 #include "HTMLObjectElement.h"
+#include "HTMLVideoElement.h"
 #include "JSEventListener.h"
 #include "LayoutUnit.h"
 #include "NamedNodeMap.h"
@@ -983,5 +984,30 @@
     return *m_needsHDRPixelDepthQuirk;
 }
 
+// FIXME: remove this once rdar://66739450 has been fixed.
+bool Quirks::needsAkamaiMediaPlayerQuirk(const HTMLVideoElement& element) const
+{
+#if PLATFORM(IOS_FAMILY)
+    // Akamai Media Player begins polling `webkitDisplayingFullscreen` every 100ms immediately after calling
+    // `webkitEnterFullscreen` and exits fullscreen as soon as it returns false. r262456 changed the HTMLMediaPlayer state
+    // machine so `webkitDisplayingFullscreen` doesn't return true until the fullscreen window has been opened in the
+    // UI process, which causes Akamai Media Player to frequently exit fullscreen mode immediately.
 
+    static NeverDestroyed<const AtomString> akamaiHTML5(MAKE_STATIC_STRING_IMPL("akamai-html5"));
+    static NeverDestroyed<const AtomString> akamaiMediaElement(MAKE_STATIC_STRING_IMPL("akamai-media-element"));
+
+    if (!needsQuirks())
+        return false;
+
+    if (!element.hasClass())
+        return false;
+
+    auto& classNames = element.classNames();
+    return classNames.contains(akamaiHTML5) && classNames.contains(akamaiMediaElement);
+#else
+    UNUSED_PARAM(element);
+    return false;
+#endif
 }
+
+}

Modified: trunk/Source/WebCore/page/Quirks.h (265436 => 265437)


--- trunk/Source/WebCore/page/Quirks.h	2020-08-10 17:25:34 UTC (rev 265436)
+++ trunk/Source/WebCore/page/Quirks.h	2020-08-10 17:49:01 UTC (rev 265437)
@@ -110,6 +110,8 @@
 
     bool needsVP9FullRangeFlagQuirk() const;
     bool needsHDRPixelDepthQuirk() const;
+    
+    bool needsAkamaiMediaPlayerQuirk(const HTMLVideoElement&) const;
 
 private:
     bool needsQuirks() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to