From 823024a704caeaeeb05c1fc3cf8bd6a095081d5d Mon Sep 17 00:00:00 2001 From: Tim Nguyen Date: Thu, 8 Dec 2022 01:57:00 -0800 Subject: [PATCH] Make requestFullscreen() consume user activation https://bugs.webkit.org/show_bug.cgi?id=247920 rdar://102355401 Reviewed by Youenn Fablet. Matches Chrome & Firefox implementations, we should reset the activation timestamps when requesting fullscreen. This disallows double non-user initiated requestFullscreen calls. Spec PR: https://github.com/whatwg/fullscreen/pull/153 WPT upstream revision: https://github.com/web-platform-tests/wpt/commit/897b406f2925a22025d62001a5f7e97096e3f5a0 * LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-consume-user-activation-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-consume-user-activation.html: Added. * LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element.html: Added. * LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/w3c-import.log: * LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element-expected.txt: Added. * Source/WebCore/dom/FullscreenManager.cpp: (WebCore::FullscreenManager::requestFullscreenForElement): Canonical link: https://commits.webkit.org/257554@main --- ...creen-consume-user-activation-expected.txt | 3 +++ ...st-fullscreen-consume-user-activation.html | 25 +++++++++++++++++ ...quest-fullscreen-same-element-expected.txt | 3 +++ ...ement-request-fullscreen-same-element.html | 27 +++++++++++++++++++ .../fullscreen/api/w3c-import.log | 2 ++ ...quest-fullscreen-same-element-expected.txt | 5 ++++ Source/WebCore/dom/FullscreenManager.cpp | 2 +- 7 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-consume-user-activation-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-consume-user-activation.html create mode 100644 LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element.html create mode 100644 LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element-expected.txt diff --git a/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-consume-user-activation-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-consume-user-activation-expected.txt new file mode 100644 index 0000000000000..27fe4054891bb --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-consume-user-activation-expected.txt @@ -0,0 +1,3 @@ + +PASS Element#requestFullscreen() consumes user activation + diff --git a/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-consume-user-activation.html b/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-consume-user-activation.html new file mode 100644 index 0000000000000..cc4806711dab9 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-consume-user-activation.html @@ -0,0 +1,25 @@ + +Element#requestFullscreen() consumes user activation + + + + +
+ diff --git a/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element-expected.txt new file mode 100644 index 0000000000000..097bbdef82ffc --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element-expected.txt @@ -0,0 +1,3 @@ + +PASS Element#requestFullscreen() on the current fullscreen element + diff --git a/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element.html b/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element.html new file mode 100644 index 0000000000000..a2b04dd173989 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element.html @@ -0,0 +1,27 @@ + +Element#requestFullscreen() on the current fullscreen element + + + + +
+ diff --git a/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/w3c-import.log index d9616bdc21acf..2caeac112bcca 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/w3c-import.log +++ b/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/w3c-import.log @@ -24,10 +24,12 @@ List of files: /LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/document-fullscreen-enabled.html /LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/document-onfullscreenerror.html /LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-active-document.html +/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-consume-user-activation.html /LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-dialog.html /LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-not-allowed.html /LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-options.html /LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-options.tentative.html +/LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element.html /LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen.html /LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/fullscreen-display-contents-expected.html /LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/fullscreen-display-contents-ref.html diff --git a/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element-expected.txt b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element-expected.txt new file mode 100644 index 0000000000000..6895855123692 --- /dev/null +++ b/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-same-element-expected.txt @@ -0,0 +1,5 @@ + +FAIL Element#requestFullscreen() on the current fullscreen element assert_equals: fullscreen element after first request expected Element node
+