From 951520f516ec45cab6d0f34a46483a84e0533ea6 Mon Sep 17 00:00:00 2001
From: Florian Rivoal
- A display mode represents how the web application is being
+ A [=display mode=], as defined in [[MEDIAQUERIES-5]],
+ represents how the web application is being
presented within the context of an OS (e.g., in fullscreen, etc.).
Display modes correspond to user interface (UI) metaphors and
- functionality in use on a given platform. The UI conventions of the
- display modes are purely advisory and implementers are free to
- interpret them how they best see fit.
-
- This specification defines the following [=display modes=]:
-
- The [=display mode/fullscreen=] display mode is orthogonal to,
- and works independently of, the [[[FULLSCREEN]]]. The [=display
- mode/fullscreen=] display mode affects the fullscreen state of
- the browser window, while the [[FULLSCREEN]] API operates on an element
- contained within the viewport. As such, a web application can have its
- display mode set to [=display mode/fullscreen=], while
- `document.fullScreenElement` returns `null`, and `fullscreenEnabled`
- returns `false`.
+ functionality in use on a given platform.
Once a user agent [=applies=] a particular display mode to an
@@ -2518,130 +2465,17 @@
- Display modes
+ Choosing a display mode
-
-
mode/fullscreen=]", "[=display mode/standalone=]", "[=display
mode/minimal-ui=]", "[=display mode/browser=]" ».
- Name: - | -- display-mode - | -
---|---|
- For: - | -- @media - | -
- Value: - | -- [=display mode/fullscreen=] | [=display mode/standalone=] | - [=display mode/minimal-ui=] | [=display mode/browser=] - | -
- Type: - | -- discrete - | -
- The `display-mode` media feature represents, via a CSS media query - [[MEDIAQ]], the display mode of the web application. This - media feature applies to the top-level browsing context and any child - browsing contexts. Child browsing contexts reflect the display - mode of the top-level browsing context. -
-- A user agent MUST expose the '`display-mode`' media feature - irrespective of whether a manifest is being applied to a browsing - context. For example, if the end-user puts the whole user agent into - fullscreen, then the user agent would reflect this change to CSS and - scripts via the '`display-mode`' media feature. -
- -- A user agent MUST reflect the applied display mode of the web - application via a CSS media query [[MEDIAQ]]. -
-- An example in CSS: -
-- @media all and (display-mode: minimal-ui) { - /* ... */ - } - @media all and (display-mode: standalone) { - /* ... */ - } --
- Accessing the display-mode media feature in ECMAScript through - `matchMedia()` of [[CSSOM-VIEW]]: -
-- const standalone = matchMedia( '(display-mode: standalone)' ); - - standalone.onchange = (e) => { - /* handle changes to display mode */ - } - - if (standalone.matches) { - /* do standalone things */ - } --
+ A user agent MUST reflect the applied display mode of the web + application in the '`display-mode`' media feature [[MEDIAQUERIES-5]]. +
++ A user agent will expose the '`display-mode`' media feature + irrespective of whether a manifest is being applied to a browsing + context. For example, if the end-user puts the application into + fullscreen, then the user agent would reflect this change to CSS and + scripts via the '`display-mode`' media feature. +
- The `'display-mode'` media feature allows an origin access to aspects - of a user’s local computing environment and, together with the - `display` member, allows an origin some measure of control over a user - agent’s native UI: Through a CSS media query, a script can know the - display mode of a web application. An attacker could, in such a case, - exploit the fact that an application is being displayed in fullscreen + The `display` member allows an origin some measure of control over a user + agent’s native UI. After taking over the full screen, it could attempt to mimic the user interface of another application. + This is also facilitated by the `'display-mode'` media feature [[MEDIAQUERIES-5]], + through which a script can know the display mode of a web application.