Title: [277783] trunk
Revision
277783
Author
[email protected]
Date
2021-05-20 08:33:12 -0700 (Thu, 20 May 2021)

Log Message

<video> rendered inside <template> shows black for webcam stream (Safari 14.0.3 only)
https://bugs.webkit.org/show_bug.cgi?id=222115
<rdar://problem/74546659>

Reviewed by Eric Carlson.

Source/WebCore:

Update element visibility if changing of document. Add internals API to test this.

Test: fast/media/template-hidden.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::didMoveToNewDocument):
* testing/Internals.cpp:
(WebCore::Internals::isMediaElementHidden):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* fast/media/template-hidden-expected.txt: Added.
* fast/media/template-hidden.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (277782 => 277783)


--- trunk/LayoutTests/ChangeLog	2021-05-20 14:45:30 UTC (rev 277782)
+++ trunk/LayoutTests/ChangeLog	2021-05-20 15:33:12 UTC (rev 277783)
@@ -1,3 +1,14 @@
+2021-05-20  Youenn Fablet  <[email protected]>
+
+        <video> rendered inside <template> shows black for webcam stream (Safari 14.0.3 only)
+        https://bugs.webkit.org/show_bug.cgi?id=222115
+        <rdar://problem/74546659>
+
+        Reviewed by Eric Carlson.
+
+        * fast/media/template-hidden-expected.txt: Added.
+        * fast/media/template-hidden.html: Added.
+
 2021-05-20  Alan Bujtas  <[email protected]>
 
         [LFC][TFC] Available space distribution should account for the top and bottom table spacing

Added: trunk/LayoutTests/fast/media/template-hidden-expected.txt (0 => 277783)


--- trunk/LayoutTests/fast/media/template-hidden-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/media/template-hidden-expected.txt	2021-05-20 15:33:12 UTC (rev 277783)
@@ -0,0 +1,4 @@
+
+
+PASS Test templated video visibility
+

Added: trunk/LayoutTests/fast/media/template-hidden.html (0 => 277783)


--- trunk/LayoutTests/fast/media/template-hidden.html	                        (rev 0)
+++ trunk/LayoutTests/fast/media/template-hidden.html	2021-05-20 15:33:12 UTC (rev 277783)
@@ -0,0 +1,35 @@
+<!doctype html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>Testing template video visibility</title>
+    <script src=""
+    <script src=""
+</head>
+<body>
+<template id="aVideoTemplate">
+    <video id="myVideo" playsinline autoplay muted></video>
+</template>
+<div id="myTemplatedVideo"></div>
+<script>
+async function getStream()
+{
+    if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia)
+       return navigator.mediaDevices.getUserMedia({video:true}).then(stream => stream, () => { });
+}
+
+promise_test(async () => {
+    const clone = aVideoTemplate.content.cloneNode(true);
+    myTemplatedVideo.appendChild(clone);
+
+    myVideo.srcObject = await getStream();
+    // Fallback to regular video streaming if getUserMedia is not available.
+    if (!myVideo.srcObject)
+        myVideo.src = ""
+    await myVideo.play();
+    if (window.internals)
+        assert_false(internals.isMediaElementHidden(myVideo));
+}, "Test templated video visibility");
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (277782 => 277783)


--- trunk/Source/WebCore/ChangeLog	2021-05-20 14:45:30 UTC (rev 277782)
+++ trunk/Source/WebCore/ChangeLog	2021-05-20 15:33:12 UTC (rev 277783)
@@ -1,3 +1,22 @@
+2021-05-20  Youenn Fablet  <[email protected]>
+
+        <video> rendered inside <template> shows black for webcam stream (Safari 14.0.3 only)
+        https://bugs.webkit.org/show_bug.cgi?id=222115
+        <rdar://problem/74546659>
+
+        Reviewed by Eric Carlson.
+
+        Update element visibility if changing of document. Add internals API to test this.
+
+        Test: fast/media/template-hidden.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::didMoveToNewDocument):
+        * testing/Internals.cpp:
+        (WebCore::Internals::isMediaElementHidden):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2021-05-20  Alan Bujtas  <[email protected]>
 
         [LFC][TFC] Available space distribution should account for the top and bottom table spacing

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (277782 => 277783)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-05-20 14:45:30 UTC (rev 277782)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-05-20 15:33:12 UTC (rev 277783)
@@ -674,6 +674,7 @@
 
     HTMLElement::didMoveToNewDocument(oldDocument, newDocument);
     updateShouldAutoplay();
+    visibilityStateChanged();
 }
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)

Modified: trunk/Source/WebCore/testing/Internals.cpp (277782 => 277783)


--- trunk/Source/WebCore/testing/Internals.cpp	2021-05-20 14:45:30 UTC (rev 277782)
+++ trunk/Source/WebCore/testing/Internals.cpp	2021-05-20 15:33:12 UTC (rev 277783)
@@ -4967,6 +4967,13 @@
 
 #endif
 
+#if ENABLE(VIDEO)
+bool Internals::isMediaElementHidden(const HTMLMediaElement& media)
+{
+    return media.elementIsHidden();
+}
+#endif
+
 ExceptionOr<void> Internals::setIsPlayingToBluetoothOverride(Optional<bool> isPlaying)
 {
 #if ENABLE(ROUTING_ARBITRATION)

Modified: trunk/Source/WebCore/testing/Internals.h (277782 => 277783)


--- trunk/Source/WebCore/testing/Internals.h	2021-05-20 14:45:30 UTC (rev 277782)
+++ trunk/Source/WebCore/testing/Internals.h	2021-05-20 15:33:12 UTC (rev 277783)
@@ -655,6 +655,8 @@
     String elementBufferingPolicy(HTMLMediaElement&);
     double privatePlayerVolume(const HTMLMediaElement&);
     bool privatePlayerMuted(const HTMLMediaElement&);
+    bool isMediaElementHidden(const HTMLMediaElement&);
+
     ExceptionOr<void> setOverridePreferredDynamicRangeMode(HTMLMediaElement&, const String&);
 #endif
 

Modified: trunk/Source/WebCore/testing/Internals.idl (277782 => 277783)


--- trunk/Source/WebCore/testing/Internals.idl	2021-05-20 14:45:30 UTC (rev 277782)
+++ trunk/Source/WebCore/testing/Internals.idl	2021-05-20 15:33:12 UTC (rev 277783)
@@ -688,6 +688,7 @@
     [Conditional=VIDEO] DOMString elementBufferingPolicy(HTMLMediaElement media);
     [Conditional=VIDEO] double privatePlayerVolume(HTMLMediaElement media);
     [Conditional=VIDEO] boolean privatePlayerMuted(HTMLMediaElement media);
+    [Conditional=VIDEO] boolean isMediaElementHidden(HTMLMediaElement media);
     [Conditional=VIDEO] undefined setOverridePreferredDynamicRangeMode(HTMLMediaElement media, DOMString mode);
 
     undefined setIsPlayingToBluetoothOverride(optional boolean? isPlaying = null);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to