Title: [221709] trunk/Source/WebCore
Revision
221709
Author
[email protected]
Date
2017-09-06 17:02:27 -0700 (Wed, 06 Sep 2017)

Log Message

Support new autoplay quirk for arbitrary user gestures.
https://bugs.webkit.org/show_bug.cgi?id=176402

Reviewed by Eric Carlson.

This quirk allows any user gesture to allow autoplay in a document.

No new tests because this specifically targets one host.

* html/MediaElementSession.cpp:
(WebCore::needsArbitraryUserGestureAutoplayQuirk):
(WebCore::MediaElementSession::playbackPermitted const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (221708 => 221709)


--- trunk/Source/WebCore/ChangeLog	2017-09-06 23:33:21 UTC (rev 221708)
+++ trunk/Source/WebCore/ChangeLog	2017-09-07 00:02:27 UTC (rev 221709)
@@ -1,3 +1,18 @@
+2017-09-05  Matt Rajca  <[email protected]>
+
+        Support new autoplay quirk for arbitrary user gestures.
+        https://bugs.webkit.org/show_bug.cgi?id=176402
+
+        Reviewed by Eric Carlson.
+
+        This quirk allows any user gesture to allow autoplay in a document.
+
+        No new tests because this specifically targets one host.
+
+        * html/MediaElementSession.cpp:
+        (WebCore::needsArbitraryUserGestureAutoplayQuirk):
+        (WebCore::MediaElementSession::playbackPermitted const):
+
 2017-09-06  Youenn Fablet  <[email protected]>
 
         Support caching of Response with a ReadableStream body

Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (221708 => 221709)


--- trunk/Source/WebCore/html/MediaElementSession.cpp	2017-09-06 23:33:21 UTC (rev 221708)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp	2017-09-07 00:02:27 UTC (rev 221709)
@@ -148,6 +148,17 @@
     m_restrictions &= ~restriction;
 }
 
+#if PLATFORM(MAC)
+static bool needsArbitraryUserGestureAutoplayQuirk(const Document& document)
+{
+    if (!document.settings().needsSiteSpecificQuirks())
+        return false;
+
+    auto host = document.url().host();
+    return equalLettersIgnoringASCIICase(host, "washingtonpost.com") || host.endsWithIgnoringASCIICase(".washingtonpost.com");
+}
+#endif // PLATFORM(MAC)
+
 SuccessOr<MediaPlaybackDenialReason> MediaElementSession::playbackPermitted(const HTMLMediaElement& element) const
 {
     if (element.document().isMediaDocument() && !element.document().ownerElement())
@@ -178,6 +189,9 @@
     const auto& topDocument = element.document().topDocument();
     if (topDocument.mediaState() & MediaProducer::HasUserInteractedWithMediaElement && topDocument.settings().needsSiteSpecificQuirks())
         return { };
+
+    if (element.document().hasHadUserInteraction() && needsArbitraryUserGestureAutoplayQuirk(element.document()))
+        return { };
 #endif
 
     if (m_restrictions & RequireUserGestureForVideoRateChange && element.isVideo() && !element.document().processingUserGestureForMedia()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to