- Revision
- 267724
- Author
- [email protected]
- Date
- 2020-09-28 21:10:11 -0700 (Mon, 28 Sep 2020)
Log Message
webkitfullscreenchange does not fire for shadow DOM elements
https://bugs.webkit.org/show_bug.cgi?id=216607
Patch by Tetsuharu Ohzeki <[email protected]> on 2020-09-28
Reviewed by Ryosuke Niwa.
Source/WebCore:
This bug was caused by the `webkitfullscreenchange` event being fired
but without _composed_ flag set.
This patch fixed the bug by making it composed as defined as
the step 3-2 of https://fullscreen.spec.whatwg.org/#run-the-fullscreen-steps.
so that event listeners outside shadow tree could observe it.
Test: fast/shadow-dom/fullscreen-in-shadow-event-should-propagate.html
* dom/FullscreenManager.cpp:
(WebCore::FullscreenManager::dispatchFullscreenChangeOrErrorEvent):
LayoutTests:
Added a regression test for making an element inside a shadow tree full screen,
and listening to `webkitfullscreenchange` outside the shadow tree.
* fast/shadow-dom/fullscreen-in-shadow-event-should-propagate-expected.txt: Added.
* fast/shadow-dom/fullscreen-in-shadow-event-should-propagate.html: Added.
* platform/ios-wk2/TestExpectations:
Other testcases related to fullscreen API in fast/shadow-dom/ are also
disabled for ios-wk2.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (267723 => 267724)
--- trunk/LayoutTests/ChangeLog 2020-09-29 03:49:32 UTC (rev 267723)
+++ trunk/LayoutTests/ChangeLog 2020-09-29 04:10:11 UTC (rev 267724)
@@ -1,3 +1,19 @@
+2020-09-28 Tetsuharu Ohzeki <[email protected]>
+
+ webkitfullscreenchange does not fire for shadow DOM elements
+ https://bugs.webkit.org/show_bug.cgi?id=216607
+
+ Reviewed by Ryosuke Niwa.
+
+ Added a regression test for making an element inside a shadow tree full screen,
+ and listening to `webkitfullscreenchange` outside the shadow tree.
+
+ * fast/shadow-dom/fullscreen-in-shadow-event-should-propagate-expected.txt: Added.
+ * fast/shadow-dom/fullscreen-in-shadow-event-should-propagate.html: Added.
+ * platform/ios-wk2/TestExpectations:
+ Other testcases related to fullscreen API in fast/shadow-dom/ are also
+ disabled for ios-wk2.
+
2020-09-28 Devin Rousso <[email protected]>
Web Inspector: add checkbox to local override popover to allow it to skip the network
Added: trunk/LayoutTests/fast/shadow-dom/fullscreen-in-shadow-event-should-propagate-expected.txt (0 => 267724)
--- trunk/LayoutTests/fast/shadow-dom/fullscreen-in-shadow-event-should-propagate-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/fullscreen-in-shadow-event-should-propagate-expected.txt 2020-09-29 04:10:11 UTC (rev 267724)
@@ -0,0 +1,13 @@
+Test that webkitfullscreenchange from shadow tree should be propagated to the shadow host.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS () => event.composed is true
+PASS () => event.currentTarget is [object ShadowRoot]
+PASS () => event.composed is true
+PASS () => event.currentTarget is [object HTMLDocument]
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Enter fullscreen
Added: trunk/LayoutTests/fast/shadow-dom/fullscreen-in-shadow-event-should-propagate.html (0 => 267724)
--- trunk/LayoutTests/fast/shadow-dom/fullscreen-in-shadow-event-should-propagate.html (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/fullscreen-in-shadow-event-should-propagate.html 2020-09-29 04:10:11 UTC (rev 267724)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div id="host"></div>
+<button _onclick_="goFullscreen()">Enter fullscreen</button>
+<script src=""
+<script>
+
+description('Test that webkitfullscreenchange from shadow tree should be propagated to the shadow host.');
+
+const shadowHost = document.getElementById('host');
+const shadowRoot = shadowHost.attachShadow({mode: 'closed'});
+shadowRoot.innerHTML = '<span>full screen content</span>';
+
+function logFullScreenChangeEvent(subroot) {
+ return new Promise((resolve, reject) => {
+ subroot.addEventListener('webkitfullscreenchange', event => {
+ shouldBe(() => event.composed, 'true');
+ shouldBe(() => event.currentTarget, () => subroot);
+ resolve();
+ }, {
+ once: true,
+ });
+ });
+}
+
+async function goFullscreen() {
+ shadowRoot.querySelector('span').webkitRequestFullScreen();
+
+ try {
+ await Promise.all([
+ logFullScreenChangeEvent(shadowRoot),
+ logFullScreenChangeEvent(document),
+ ]);
+ } finally {
+ finishJSTest();
+ }
+}
+
+if (window.eventSender) {
+ const button = document.querySelector('button');
+ jsTestIsAsync = true;
+ eventSender.mouseMoveTo(button.offsetLeft + 5, button.offsetTop + 5);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+} else
+ document.write('To test manually, click "Enter Fullscreen" above.');
+
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (267723 => 267724)
--- trunk/LayoutTests/platform/ios-wk2/TestExpectations 2020-09-29 03:49:32 UTC (rev 267723)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations 2020-09-29 04:10:11 UTC (rev 267724)
@@ -1017,6 +1017,7 @@
imported/blink/fast/forms/label/label-contains-other-interactive-content.html [ Skip ]
fast/dom/Window/post-message-user-action.html [ Skip ]
fast/images/image-usemap-parsing.html [ Skip ]
+fast/shadow-dom/fullscreen-in-shadow-event-should-propagate.html [ Skip ]
fast/shadow-dom/fullscreen-in-shadow-full-screen-ancestor.html [ Skip ]
fast/shadow-dom/fullscreen-in-shadow-fullscreenElement.html [ Skip ]
fast/shadow-dom/fullscreen-in-shadow-webkitCurrentFullScreenElement.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (267723 => 267724)
--- trunk/Source/WebCore/ChangeLog 2020-09-29 03:49:32 UTC (rev 267723)
+++ trunk/Source/WebCore/ChangeLog 2020-09-29 04:10:11 UTC (rev 267724)
@@ -1,3 +1,22 @@
+2020-09-28 Tetsuharu Ohzeki <[email protected]>
+
+ webkitfullscreenchange does not fire for shadow DOM elements
+ https://bugs.webkit.org/show_bug.cgi?id=216607
+
+ Reviewed by Ryosuke Niwa.
+
+ This bug was caused by the `webkitfullscreenchange` event being fired
+ but without _composed_ flag set.
+
+ This patch fixed the bug by making it composed as defined as
+ the step 3-2 of https://fullscreen.spec.whatwg.org/#run-the-fullscreen-steps.
+ so that event listeners outside shadow tree could observe it.
+
+ Test: fast/shadow-dom/fullscreen-in-shadow-event-should-propagate.html
+
+ * dom/FullscreenManager.cpp:
+ (WebCore::FullscreenManager::dispatchFullscreenChangeOrErrorEvent):
+
2020-09-28 Eric Carlson <[email protected]>
[GPUP] Out-of-band TextTracks
Modified: trunk/Source/WebCore/dom/FullscreenManager.cpp (267723 => 267724)
--- trunk/Source/WebCore/dom/FullscreenManager.cpp 2020-09-29 03:49:32 UTC (rev 267723)
+++ trunk/Source/WebCore/dom/FullscreenManager.cpp 2020-09-29 04:10:11 UTC (rev 267724)
@@ -482,6 +482,7 @@
void FullscreenManager::dispatchFullscreenChangeOrErrorEvent(Deque<RefPtr<Node>>& queue, const AtomString& eventName, bool shouldNotifyMediaElement)
{
+ // Step 3 of https://fullscreen.spec.whatwg.org/#run-the-fullscreen-steps
while (!queue.isEmpty()) {
RefPtr<Node> node = queue.takeFirst();
if (!node)
@@ -501,7 +502,7 @@
#else
UNUSED_PARAM(shouldNotifyMediaElement);
#endif
- node->dispatchEvent(Event::create(eventName, Event::CanBubble::Yes, Event::IsCancelable::No));
+ node->dispatchEvent(Event::create(eventName, Event::CanBubble::Yes, Event::IsCancelable::No, Event::IsComposed::Yes));
}
}