Skip to content

Commit

Permalink
Add initial implementation of the unprefixed fullscreen API
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=246103

Reviewed by Tim Nguyen.

Add initial implementation of the unprefixed fullscreen API:
- https://fullscreen.spec.whatwg.org/#api

The feature is behind an experimental feature flag, off by default.

This is needed to unblock the WPT testing of the screen orientation API since
screen orientation locking requires being in fullscreen.

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/html/capability-delegation/delegate-fullscreen-request-popup-same-origin.https.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/capability-delegation/delegate-fullscreen-request-subframe-same-origin.https.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/active-lock-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/event-before-promise-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/lock-basic-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/lock-sandboxed-iframe-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/lock-unlock-check-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/onchange-event-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/onchange-event-subframe-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/screen-orientation/orientation-reading-expected.txt:
* Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml:
* Source/WebCore/dom/Element+Fullscreen.idl:
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::requestFullscreen):
* Source/WebCore/dom/Element.h:
* Source/WebCore/dom/EventNames.h:
* Source/WebCore/dom/FullscreenManager.cpp:
(WebCore::FullscreenManager::dispatchFullscreenChangeEvents):
* Source/WebCore/html/HTMLAttributeNames.in:

Canonical link: https://commits.webkit.org/255317@main
  • Loading branch information
cdumez committed Oct 8, 2022
1 parent c946458 commit 6331c0f
Show file tree
Hide file tree
Showing 77 changed files with 645 additions and 189 deletions.
3 changes: 2 additions & 1 deletion LayoutTests/TestExpectations
Expand Up @@ -448,6 +448,7 @@ imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-
imported/w3c/web-platform-tests/html/browsers/sandboxing/sandbox-disallow-popups.html [ DumpJSConsoleLogInStdErr ]
imported/w3c/web-platform-tests/html/browsers/windows/clear-window-name.https.html [ DumpJSConsoleLogInStdErr ]
imported/w3c/web-platform-tests/html/cross-origin-embedder-policy/blob.https.html [ DumpJSConsoleLogInStdErr ]
imported/w3c/web-platform-tests/html/capability-delegation/delegate-fullscreen-request-popup-same-origin.https.tentative.html [ DumpJSConsoleLogInStdErr ]
imported/w3c/web-platform-tests/html/cross-origin-embedder-policy/multi-globals/workers-coep-report.https.html [ DumpJSConsoleLogInStdErr ]
imported/w3c/web-platform-tests/html/cross-origin-embedder-policy/reporting-navigation.https.html [ DumpJSConsoleLogInStdErr ]
imported/w3c/web-platform-tests/html/cross-origin-embedder-policy/reporting-subresource-corp.https.html [ DumpJSConsoleLogInStdErr ]
Expand Down Expand Up @@ -612,6 +613,7 @@ imported/w3c/web-platform-tests/feature-policy/picture-in-picture-allowed-by-fea
imported/w3c/web-platform-tests/feature-policy/picture-in-picture-default-feature-policy.https.sub.html [ Skip ]
imported/w3c/web-platform-tests/feature-policy/picture-in-picture-disabled-by-feature-policy.https.sub.html [ Skip ]
imported/w3c/web-platform-tests/feature-policy/policy-extends-to-sandbox.html [ Skip ]
imported/w3c/web-platform-tests/feature-policy/reporting/fullscreen-reporting.html [ Skip ]
imported/w3c/web-platform-tests/feature-policy/reporting/geolocation-reporting.https.html [ Skip ]
imported/w3c/web-platform-tests/feature-policy/reporting/screen-wake-lock-reporting.https.html [ Skip ]
imported/w3c/web-platform-tests/fullscreen/api/fullscreen-display-contents.html [ Skip ]
Expand Down Expand Up @@ -715,7 +717,6 @@ imported/w3c/web-platform-tests/html/rendering/replaced-elements/svg-inline-sizi
imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_navigate_ancestor-1.sub.html [ Skip ]
imported/w3c/web-platform-tests/html/semantics/forms/historical-search-event.html [ Skip ]
imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-summary-element/anchor-with-inline-element.html [ Skip ]
imported/w3c/web-platform-tests/screen-orientation/lock-sandboxed-iframe.html [ Skip ]
imported/w3c/web-platform-tests/service-workers/service-worker/same-site-cookies.https.html [ Skip ]
imported/w3c/web-platform-tests/workers/interfaces/WorkerGlobalScope/onerror/message-module-Error.html [ Skip ]
[ Debug ] imported/w3c/web-platform-tests/css/css-backgrounds/background-size/background-size-near-zero-svg.html [ Skip ]
Expand Down
Expand Up @@ -342,7 +342,7 @@ PASS Document interface object length
PASS Document interface object name
PASS Document interface: existence and properties of interface prototype object
PASS Document interface: existence and properties of interface prototype object's "constructor" property
PASS Document interface: existence and properties of interface prototype object's @@unscopables property
FAIL Document interface: existence and properties of interface prototype object's @@unscopables property assert_not_equals: Document.prototype[Symbol.unscopables] has unexpected property "fullscreen" got disallowed value -1
PASS Document interface: attribute implementation
PASS Document interface: attribute URL
PASS Document interface: attribute documentURI
Expand Down
@@ -1,3 +1,5 @@

FAIL Fullscreen Report Format document.getElementById('fs').requestFullscreen is not a function. (In 'document.getElementById('fs').requestFullscreen()', 'document.getElementById('fs').requestFullscreen' is undefined)
Harness Error (TIMEOUT), message = null

TIMEOUT Fullscreen Report Format Test timed out

@@ -1,3 +1,3 @@

FAIL Document#exitFullscreen() when the document is not the active document documentBeforeNav.exitFullscreen is not a function. (In 'documentBeforeNav.exitFullscreen()', 'documentBeforeNav.exitFullscreen' is undefined)
PASS Document#exitFullscreen() when the document is not the active document

@@ -1,11 +1,17 @@
CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: outer.requestFullscreen is not a function. (In 'outer.requestFullscreen()', 'outer.requestFullscreen' is undefined)
CONSOLE MESSAGE: Unhandled Promise Rejection: Error: assert_equals: expected Element node <div id="outer">
<slot></slot>
</div> but got null
fullscreen

Harness Error (FAIL), message = Unhandled rejection: outer.requestFullscreen is not a function. (In 'outer.requestFullscreen()', 'outer.requestFullscreen' is undefined)
Harness Error (FAIL), message = Unhandled rejection: assert_equals: expected Element node <div id="outer">
<slot></slot>
</div> but got null

TIMEOUT Exiting fullscreen from a nested shadow root works correctly. Test timed out

Harness Error (FAIL), message = Unhandled rejection: outer.requestFullscreen is not a function. (In 'outer.requestFullscreen()', 'outer.requestFullscreen' is undefined)
Harness Error (FAIL), message = Unhandled rejection: assert_equals: expected Element node <div id="outer">
<slot></slot>
</div> but got null

TIMEOUT Exiting fullscreen from a nested shadow root works correctly. Test timed out

@@ -1,3 +1,3 @@

FAIL Document#fullscreenEnabled when the document is not the active document assert_false: expected false got undefined
PASS Document#fullscreenEnabled when the document is not the active document

Expand Up @@ -3,8 +3,8 @@ Blocked access to external URL http://www1.localhost:8800/fullscreen/api/resourc

Harness Error (TIMEOUT), message = null

FAIL Fullscreen enabled test: same-origin-default assert_equals: same-origin-default frame fullscreenEnabled expected (boolean) true but got (undefined) undefined
FAIL Fullscreen enabled test: same-origin-allow assert_equals: same-origin-allow frame fullscreenEnabled expected (boolean) true but got (undefined) undefined
PASS Fullscreen enabled test: same-origin-default
PASS Fullscreen enabled test: same-origin-allow
NOTRUN Fullscreen enabled test: cross-origin-default
NOTRUN Fullscreen enabled test: cross-origin-allow

@@ -1,3 +1,3 @@

FAIL Document#fullscreenEnabled assert_true: top-level document expected true got undefined
PASS Document#fullscreenEnabled

@@ -1,3 +1,3 @@

FAIL Document#onfullscreenerror assert_equals: initial onfullscreenerror expected (object) null but got (undefined) undefined
PASS Document#onfullscreenerror

@@ -1,3 +1,3 @@

FAIL Element#requestFullscreen() when the document is not the active document documentBeforeNav.documentElement.requestFullscreen is not a function. (In 'documentBeforeNav.documentElement.requestFullscreen()', 'documentBeforeNav.documentElement.requestFullscreen' is undefined)
PASS Element#requestFullscreen() when the document is not the active document

@@ -1,10 +1,3 @@
CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: dialog.requestFullscreen is not a function. (In 'dialog.requestFullscreen()', 'dialog.requestFullscreen' is undefined)

Harness Error (FAIL), message = Unhandled rejection: dialog.requestFullscreen is not a function. (In 'dialog.requestFullscreen()', 'dialog.requestFullscreen' is undefined)

TIMEOUT Element#requestFullscreen() for dialog element Test timed out

Harness Error (FAIL), message = Unhandled rejection: dialog.requestFullscreen is not a function. (In 'dialog.requestFullscreen()', 'dialog.requestFullscreen' is undefined)

TIMEOUT Element#requestFullscreen() for dialog element Test timed out
FAIL Element#requestFullscreen() for dialog element assert_unreached: fullscreenchange event Reached unreachable code

@@ -1,5 +1,3 @@

Harness Error (FAIL), message = Test named 'Element#requestFullscreen()' specified 1 'cleanup' function, and 1 failed.

FAIL Element#requestFullscreen() assert_unreached: TypeError: div.requestFullscreen is not a function. (In 'div.requestFullscreen()', 'div.requestFullscreen' is undefined) Reached unreachable code
PASS Element#requestFullscreen()

@@ -1,3 +1,3 @@

FAIL Element#requestFullscreen() when not allowed to request fullscreen div.requestFullscreen is not a function. (In 'div.requestFullscreen()', 'div.requestFullscreen' is undefined)
PASS Element#requestFullscreen() when not allowed to request fullscreen

@@ -1,5 +1,3 @@

FAIL Element#requestFullscreen({ navigationUI }) support document.body.requestFullscreen is not a function. (In 'document.body.requestFullscreen({
get navigationUI() { invoked = true; return "irrelevant-value"; }
})', 'document.body.requestFullscreen' is undefined)
PASS Element#requestFullscreen({ navigationUI }) support

@@ -1,4 +1,4 @@

FAIL Promises#reject e.requestFullscreen is not a function. (In 'e.requestFullscreen()', 'e.requestFullscreen' is undefined)
FAIL Promises#reject 1 document.exitFullscreen is not a function. (In 'document.exitFullscreen()', 'document.exitFullscreen' is undefined)
PASS Promises#reject
PASS Promises#reject 1

Expand Up @@ -22,24 +22,24 @@ PASS Element includes Slottable: member names are unique
PASS Document includes XPathEvaluatorBase: member names are unique
PASS Document includes GlobalEventHandlers: member names are unique
PASS Document includes DocumentAndElementEventHandlers: member names are unique
FAIL Document interface: attribute fullscreenEnabled assert_true: The prototype object must have a property "fullscreenEnabled" expected true got false
FAIL Document interface: attribute fullscreen assert_equals: Document.prototype[Symbol.unscopables].fullscreen must exist expected "object" but got "undefined"
FAIL Document interface: operation exitFullscreen() assert_own_property: interface prototype object missing non-static operation expected property "exitFullscreen" missing
FAIL Document interface: attribute onfullscreenchange assert_true: The prototype object must have a property "onfullscreenchange" expected true got false
FAIL Document interface: attribute onfullscreenerror assert_true: The prototype object must have a property "onfullscreenerror" expected true got false
FAIL Document interface: attribute fullscreenElement assert_true: The prototype object must have a property "fullscreenElement" expected true got false
FAIL Document interface: new Document must inherit property "fullscreenEnabled" with the proper type assert_inherits: property "fullscreenEnabled" not found in prototype chain
FAIL Document interface: new Document must inherit property "fullscreen" with the proper type assert_inherits: property "fullscreen" not found in prototype chain
FAIL Document interface: new Document must inherit property "exitFullscreen()" with the proper type assert_inherits: property "exitFullscreen" not found in prototype chain
FAIL Document interface: new Document must inherit property "onfullscreenchange" with the proper type assert_inherits: property "onfullscreenchange" not found in prototype chain
FAIL Document interface: new Document must inherit property "onfullscreenerror" with the proper type assert_inherits: property "onfullscreenerror" not found in prototype chain
FAIL Document interface: new Document must inherit property "fullscreenElement" with the proper type assert_inherits: property "fullscreenElement" not found in prototype chain
FAIL ShadowRoot interface: attribute fullscreenElement assert_true: The prototype object must have a property "fullscreenElement" expected true got false
FAIL Element interface: operation requestFullscreen(optional FullscreenOptions) assert_own_property: interface prototype object missing non-static operation expected property "requestFullscreen" missing
FAIL Element interface: attribute onfullscreenchange assert_true: The prototype object must have a property "onfullscreenchange" expected true got false
FAIL Element interface: attribute onfullscreenerror assert_true: The prototype object must have a property "onfullscreenerror" expected true got false
FAIL Element interface: document.createElementNS(null, "test") must inherit property "requestFullscreen(optional FullscreenOptions)" with the proper type assert_inherits: property "requestFullscreen" not found in prototype chain
FAIL Element interface: calling requestFullscreen(optional FullscreenOptions) on document.createElementNS(null, "test") with too few arguments must throw TypeError assert_inherits: property "requestFullscreen" not found in prototype chain
FAIL Element interface: document.createElementNS(null, "test") must inherit property "onfullscreenchange" with the proper type assert_inherits: property "onfullscreenchange" not found in prototype chain
FAIL Element interface: document.createElementNS(null, "test") must inherit property "onfullscreenerror" with the proper type assert_inherits: property "onfullscreenerror" not found in prototype chain
FAIL Document interface: attribute fullscreenEnabled assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
FAIL Document interface: attribute fullscreen assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
PASS Document interface: operation exitFullscreen()
PASS Document interface: attribute onfullscreenchange
PASS Document interface: attribute onfullscreenerror
FAIL Document interface: attribute fullscreenElement assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
PASS Document interface: new Document must inherit property "fullscreenEnabled" with the proper type
PASS Document interface: new Document must inherit property "fullscreen" with the proper type
PASS Document interface: new Document must inherit property "exitFullscreen()" with the proper type
PASS Document interface: new Document must inherit property "onfullscreenchange" with the proper type
PASS Document interface: new Document must inherit property "onfullscreenerror" with the proper type
PASS Document interface: new Document must inherit property "fullscreenElement" with the proper type
FAIL ShadowRoot interface: attribute fullscreenElement assert_equals: setter must be function for PutForwards, Replaceable, or non-readonly attributes expected "function" but got "undefined"
PASS Element interface: operation requestFullscreen(optional FullscreenOptions)
PASS Element interface: attribute onfullscreenchange
PASS Element interface: attribute onfullscreenerror
PASS Element interface: document.createElementNS(null, "test") must inherit property "requestFullscreen(optional FullscreenOptions)" with the proper type
PASS Element interface: calling requestFullscreen(optional FullscreenOptions) on document.createElementNS(null, "test") with too few arguments must throw TypeError
PASS Element interface: document.createElementNS(null, "test") must inherit property "onfullscreenchange" with the proper type
PASS Element interface: document.createElementNS(null, "test") must inherit property "onfullscreenerror" with the proper type

@@ -1,4 +1,4 @@
Should be green

FAIL Invalidate :fullscreen based style document.documentElement.requestFullscreen is not a function. (In 'document.documentElement.requestFullscreen()', 'document.documentElement.requestFullscreen' is undefined)
FAIL Invalidate :fullscreen based style assert_equals: Green when :root is fullscreened. expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"

@@ -1,4 +1,4 @@
Should be green

FAIL Transitions should not be stopped by going fullscreen trans.requestFullscreen is not a function. (In 'trans.requestFullscreen()', 'trans.requestFullscreen' is undefined)
PASS Transitions should not be stopped by going fullscreen

@@ -1,9 +1,6 @@
CONSOLE MESSAGE: TypeError: document.body.requestFullscreen is not a function. (In 'document.body.requestFullscreen()', 'document.body.requestFullscreen' is undefined)
Verifies that element.requestFullscreen() calls from a same-origin popup without user activation work if and only if the opener has user activation and it delegates the capability. https://wicg.github.io/capability-delegation/spec.html

Harness Error (TIMEOUT), message = null

TIMEOUT Fullscreen requests from a same-origin popup fails without delegation from an opener with no user activation Test timed out
NOTRUN Fullscreen requests from a same-origin popup fails without delegation from an opener with user activation
NOTRUN Fullscreen requests from a same-origin popup succeeds with delegation from an opener with user activation
PASS Fullscreen requests from a same-origin popup fails without delegation from an opener with no user activation
PASS Fullscreen requests from a same-origin popup fails without delegation from an opener with user activation
FAIL Fullscreen requests from a same-origin popup succeeds with delegation from an opener with user activation assert_equals: expected "success" but got "failure"

@@ -1,10 +1,8 @@
CONSOLE MESSAGE: TypeError: document.body.requestFullscreen is not a function. (In 'document.body.requestFullscreen()', 'document.body.requestFullscreen' is undefined)
CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Type error
Verifies that element.requestFullscreen() calls from a same-origin subframe without user activation work if and only if the top frame has user activation, regardless of whether it delegates the capability or not. https://wicg.github.io/capability-delegation/spec.html See wpt/html/user-activation/propagation*.html for frame tree user activation visibility tests.


Harness Error (TIMEOUT), message = null

TIMEOUT Fullscreen requests from a same-origin subframe fails without delegation from an opener with no user activation Test timed out
NOTRUN Fullscreen requests from a same-origin subframe succeeds without delegation from an opener with user activation
NOTRUN Fullscreen requests from a same-origin subframe succeeds with delegation from an opener with user activation
PASS Fullscreen requests from a same-origin subframe fails without delegation from an opener with no user activation
PASS Fullscreen requests from a same-origin subframe succeeds without delegation from an opener with user activation
PASS Fullscreen requests from a same-origin subframe succeeds with delegation from an opener with user activation

@@ -1,3 +1,4 @@
CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'null' and allow attribute ''.

FAIL iframe-cross-origin-allow assert_false: Document inside cross-origin iframe without allow attribute should not have feature enabled expected false got undefined
FAIL iframe-cross-origin-allow assert_false: Feature should be denied when correct allow attribute is added, before reload expected false got true

@@ -1,6 +1,7 @@
CONSOLE MESSAGE: Feature policy 'Fullscreen' check failed for iframe with origin 'null' and allow attribute ''.

FAIL iframe-same-origin-allowfullscreen assert_true: Top level document has fullscreen enabled flag set expected true got undefined
FAIL iframe-cross-origin-allowfullscreen assert_false: Document inside cross-origin iframe without allowfullscreen attribute should not have fullscreen enabled flag set expected false got undefined
FAIL iframe-noload-noallowfullscreen assert_true: Fullscreen should still be enabled in same-origin document without allowfullscreen attribute expected true got undefined
FAIL iframe-noload-allowfullscreen assert_true: Fullscreen should be enabled with allowfullscreen attribute expected true got undefined
PASS iframe-same-origin-allowfullscreen
FAIL iframe-cross-origin-allowfullscreen assert_false: Fullscreen should be denied when allowfullscreen attribute is added, before reload expected false got true
PASS iframe-noload-noallowfullscreen
PASS iframe-noload-allowfullscreen

Expand Up @@ -4,5 +4,5 @@ Tests user activation from a mouse right-click.

Right-click anywhere in the document.

FAIL Activation through right-click mouse event assert_true: mousedown event should result in activation expected true got false
FAIL Activation through right-click mouse event assert_false: mouseup should have no activation after mousedown consumption expected false got true

0 comments on commit 6331c0f

Please sign in to comment.