Title: [219992] trunk/Source/WebCore
Revision
219992
Author
[email protected]
Date
2017-07-27 21:41:14 -0700 (Thu, 27 Jul 2017)

Log Message

Don't override _allowsMediaDocumentInlinePlayback in MediaDocument with playsinlineAttr.
https://bugs.webkit.org/show_bug.cgi?id=174850
rdar://problem/33449903

Patch by Jeremy Jones <[email protected]> on 2017-07-27
Reviewed by Jon Lee.

This change removes playsinlineAttr from MediaDocument so that it doesn't override the setting
from _allowsMediaDocumentInlinePlayback. In its place is an update to requiresFullscreenForVideoPlayback
that implements the details of exactly which media documents are still allowed to play inlne.

Media documents always use a video element; but when there are no video tracks, it has behavior like
an audio element. See media-controller.js isAudio().

This change preserves this behavior with respect to fullscreen requirements for media document by
mirroring the isAudio() check in requiresFullscreenForVideoPlayback.

* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure):
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (219991 => 219992)


--- trunk/Source/WebCore/ChangeLog	2017-07-28 04:20:53 UTC (rev 219991)
+++ trunk/Source/WebCore/ChangeLog	2017-07-28 04:41:14 UTC (rev 219992)
@@ -1,5 +1,28 @@
 2017-07-27  Jeremy Jones  <[email protected]>
 
+        Don't override _allowsMediaDocumentInlinePlayback in MediaDocument with playsinlineAttr.
+        https://bugs.webkit.org/show_bug.cgi?id=174850
+        rdar://problem/33449903
+
+        Reviewed by Jon Lee.
+
+        This change removes playsinlineAttr from MediaDocument so that it doesn't override the setting
+        from _allowsMediaDocumentInlinePlayback. In its place is an update to requiresFullscreenForVideoPlayback
+        that implements the details of exactly which media documents are still allowed to play inlne.
+
+        Media documents always use a video element; but when there are no video tracks, it has behavior like 
+        an audio element. See media-controller.js isAudio().
+
+        This change preserves this behavior with respect to fullscreen requirements for media document by
+        mirroring the isAudio() check in requiresFullscreenForVideoPlayback.
+
+        * html/MediaDocument.cpp:
+        (WebCore::MediaDocumentParser::createDocumentStructure):
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
+
+2017-07-27  Jeremy Jones  <[email protected]>
+
         MediaDocument fullscreen pinch gesture should trigger navigate back.
         https://bugs.webkit.org/show_bug.cgi?id=174914
 

Modified: trunk/Source/WebCore/html/MediaDocument.cpp (219991 => 219992)


--- trunk/Source/WebCore/html/MediaDocument.cpp	2017-07-28 04:20:53 UTC (rev 219991)
+++ trunk/Source/WebCore/html/MediaDocument.cpp	2017-07-28 04:41:14 UTC (rev 219992)
@@ -108,7 +108,6 @@
     m_mediaElement = videoElement.ptr();
     videoElement->setAttributeWithoutSynchronization(controlsAttr, emptyAtom());
     videoElement->setAttributeWithoutSynchronization(autoplayAttr, emptyAtom());
-    videoElement->setAttributeWithoutSynchronization(playsinlineAttr, emptyAtom());
     videoElement->setAttributeWithoutSynchronization(srcAttr, document.url().string());
     if (auto* loader = document.loader())
         videoElement->setAttributeWithoutSynchronization(typeAttr, loader->responseMIMEType());

Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (219991 => 219992)


--- trunk/Source/WebCore/html/MediaElementSession.cpp	2017-07-28 04:20:53 UTC (rev 219991)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp	2017-07-28 04:41:14 UTC (rev 219992)
@@ -560,6 +560,13 @@
     if (is<HTMLAudioElement>(element))
         return false;
 
+    if (element.document().isMediaDocument()) {
+        ASSERT(is<HTMLVideoElement>(element));
+        const HTMLVideoElement& videoElement = *downcast<const HTMLVideoElement>(&element);
+        if (element.readyState() < HTMLVideoElement::HAVE_METADATA || !videoElement.hasEverHadVideo())
+            return false;
+    }
+
     if (element.isTemporarilyAllowingInlinePlaybackAfterFullscreen())
         return false;
 
@@ -575,6 +582,10 @@
     if (dyld_get_program_sdk_version() < DYLD_IOS_VERSION_10_0)
         return !element.hasAttributeWithoutSynchronization(HTMLNames::webkit_playsinlineAttr);
 #endif
+
+    if (element.document().isMediaDocument() && element.document().ownerElement())
+        return false;
+
     return !element.hasAttributeWithoutSynchronization(HTMLNames::playsinlineAttr);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to