diff --git a/index.bs b/index.bs
index f6fd44c..9180fab 100644
--- a/index.bs
+++ b/index.bs
@@ -2,8 +2,9 @@
Title: User Interface Security and the Visibility API
Status: WD
Group: WebAppSec
+TR: https://www.w3.org/TR/UISecurity/
ED: https://w3c.github.io/webappsec-uisecurity/
-Shortname: UI Security
+Shortname: UISecurity
Level: 1
Editor: Brad Hill, Facebook, hillbrad@fb.com
!Author: Dan Kaminsky, White Ops
@@ -12,7 +13,7 @@ Editor: Brad Hill, Facebook, hillbrad@fb.com
Abstract:
UI Security and the Visibility API defines both a
declarative and imperative means for resources
- displayed in an embedded context to protect
+ displayed in an embedded context to protect
themselves against having their content obscured,
moved, or otherwise displayed in a misleading
manner.
@@ -54,9 +55,9 @@ spec:dom; type:interface; text:Document
Introduction
+ Introduction
- This section is not normative.
+ This section is not normative.
Composite or "mash-up" web applications built using iframes
are ubiquitous because they allow users to interact seamlessly and
@@ -73,19 +74,19 @@ spec:dom; type:interface; text:Document
Collectively known as User Interface Redressing, the goal
of such manipulations might be to entice the user to interact
- with embedded content without knowing its context, (e.g. to
+ with embedded content without knowing its context, (e.g. to
send a payment or share content) commonly known as "clickjacking",
or to convince paid content that it is being shown to the user
when it is actually obscured, commonly known in the advertising
business as "display fraud".
- Existing anti-clickjacking measures such as frame-busting
- scripts and headers granting origin-based embedding permissions have
+ Existing anti-clickjacking measures such as frame-busting
+ scripts and headers granting origin-based embedding permissions have
shortcomings which prevent their application to important use-cases.
- Frame-busting scripts, for example, rely on browser behavior that has not been
+ Frame-busting scripts, for example, rely on browser behavior that has not been
engineered to provide a security guarantee and as a consequence,
such scripts may be unreliable if loaded inside a sandbox
- or otherwise disabled. The X-Frame-Options header and the frame-ancestors
+ or otherwise disabled. The X-Frame-Options header and the frame-ancestors
Content Security Policy directive offer an all-or-none approach to
display of embedded content that is not appropriate for content
which may be embedded in arbitrary locations, or known locations
@@ -93,7 +94,7 @@ spec:dom; type:interface; text:Document
This document defines mechanisms to allow resources to
request to be displayed free of interference by their embedding context and
- learn if the user agent was able to satisfy such a request, with
+ learn if the user agent was able to satisfy such a request, with
sufficient granularity to make decisions that can protect both users
and content purveyors from various types of fraud.
@@ -103,15 +104,15 @@ spec:dom; type:interface; text:Document
failure of meeting such guarantees. This API should be suitable
for e.g. paid content such as advertising to receive trustworthy
signals about its viewability from a conforming user agent.
-
+
Secondly, this specification defines a declarative mechanism
(via a Content Security Poicy directive) to request visibility
protection and receive notification, via event properties or
out-of-band reporting, if certain events are delivered to
- a resource while it does not meet its requested visibility
+ a resource while it does not meet its requested visibility
contract.
- The declarative CSP interface does not offer the same fine-granularity control as
+ The declarative CSP interface does not offer the same fine-granularity control as
the JavaScript API. Its goal is to allow protection to be
retrofitted to legacy applications, with no or minimal code changes, as a replacement for
X-Frame-Options, or potentially for use with content that is sandboxed and cannot
@@ -119,7 +120,7 @@ spec:dom; type:interface; text:Document
ISSUE: Do we need to deal with form submission / navigations that aren't JS-event-based?
- ISSUE: how to interact with frame-ancestors and XFO?
+ ISSUE: how to interact with frame-ancestors and XFO?
A notable non-goal is pixel-accurate information about what was
actually displayed beyond its bounding rectangle, as this information
@@ -129,7 +130,7 @@ spec:dom; type:interface; text:Document
Special Conformance Notes
-
- This section is not normative.
-
- UI Redressing attacks rely on fooling the subjective perceptions of
- human actors to induce them to interact with a web application out of
- its intended context. Because of this, the specific mechanisms which
- may be used in attack and defense may vary greatly with the details of
- a user agent implementation. For example, attacks which rely on
- redressing the cursor may not apply in a touch environment, or entire
- classes of attack may be impossible on a text-only browser or screen
- reader.
-
- Similarly, the implementation of the policies specified herein is highly
- dependent on internal architecture and implementation strategies of
- the user agent; such strategies may vary greatly between user agents
- or even across versions or platforms for a single user agent.
-
- This specification provides a normative means by which a resource
- owner can communicate to a user agent its desire for additional
- protective measures, actions to take if violations are detected,
- and tuning hints which may be useful for certain means of
- implementation. A user agent is conformant if it understands
- these directives and makes a best effort to provide the desired
- security properties, which might require no additional implementation
- steps, e.g. in the case of a screen reader that does not support
- embedded resources in a manner that is subject to any of the
- attack classes of concern.
-
- While the indeterminacy of the user agent implementation protects
- applications from needing to constantly update their policies as
- user agents make internal changes, application authors should
- understand that even a conformant user agent cannot make
- perfect security guarantees against UI Redressing.
-
- These directives should be used as part of a comprehensive risk
- mitigation strategy with an appropriate understanding of their
- limitations.
+ Special Conformance Notes
+
+ This section is not normative.
+
+ UI Redressing attacks rely on fooling the subjective perceptions of
+ human actors to induce them to interact with a web application out of
+ its intended context. Because of this, the specific mechanisms which
+ may be used in attack and defense may vary greatly with the details of
+ a user agent implementation. For example, attacks which rely on
+ redressing the cursor may not apply in a touch environment, or entire
+ classes of attack may be impossible on a text-only browser or screen
+ reader.
+
+ Similarly, the implementation of the policies specified herein is highly
+ dependent on internal architecture and implementation strategies of
+ the user agent; such strategies may vary greatly between user agents
+ or even across versions or platforms for a single user agent.
+
+ This specification provides a normative means by which a resource
+ owner can communicate to a user agent its desire for additional
+ protective measures, actions to take if violations are detected,
+ and tuning hints which may be useful for certain means of
+ implementation. A user agent is conformant if it understands
+ these directives and makes a best effort to provide the desired
+ security properties, which might require no additional implementation
+ steps, e.g. in the case of a screen reader that does not support
+ embedded resources in a manner that is subject to any of the
+ attack classes of concern.
+
+ While the indeterminacy of the user agent implementation protects
+ applications from needing to constantly update their policies as
+ user agents make internal changes, application authors should
+ understand that even a conformant user agent cannot make
+ perfect security guarantees against UI Redressing.
+
+ These directives should be used as part of a comprehensive risk
+ mitigation strategy with an appropriate understanding of their
+ limitations.
- dictionary VisibilityObserverInit {
- (double or sequence<double>) areaThreshold = 0;
- (boolean) displacementAware = false;
- (DOMString) visibleMargin = "0px";
- (Element)? observedElement;
- };
+ dictionary VisibilityObserverInit {
+ (double or sequence<double>) areaThreshold = 0;
+ (boolean) displacementAware = false;
+ (DOMString) visibleMargin = "0px";
+ (Element)? observedElement;
+ };
-
- "5px" // all margins set to 5px
- "5px 10px" // top & bottom = 5px, right & left = 10px
- "-10px 5px 8px" // top = -10px, right & left = 5px, bottom = 8px
- "-10px -5px 5px 8px" // top = -10px, right = -5px, bottom = 5px, left = 8px
-
-
+ Same as 'margin', extends the required visibility rectangle
+ behind the protected-element.{{Element/getBoundingClientRect()}}.
+ Can be 1, 2, 3 or 4 components, possibly negative lengths.
+
+ If there is only one component value, it applies to all sides.
+ If there are two values, the top and bottom margins are set to
+ the first value and the right and left margins are set to the
+ second. If there are three values, the top is set to the first
+ value, the left and right are set to the second, and the bottom
+ is set to the third. If there are four values, they apply to the
+ top, right, bottom, and left, respectively.e.g.
+
+
+ "5px" // all margins set to 5px
+ "5px 10px" // top & bottom = 5px, right & left = 10px
+ "-10px 5px 8px" // top = -10px, right & left = 5px, bottom = 8px
+ "-10px -5px 5px 8px" // top = -10px, right = -5px, bottom = 5px, left = 8px
+
+
: observedElement
::
The {{Element}} being observed. If unset, the internal slot will be
initialized to the {{Document}} element.
- directive-name = 'input-protection' @@ -398,21 +399,21 @@ spec:dom; type:interface; text:Document protected area is below this threshold. Threshold values must be in the range [0, 1.0] and represent a - percentage of the area as specified by + percentage of the area as specified by protected-element.{{Element/getBoundingClientRect()}}, adjusted by visible-margin. Unlike the imperative API, only a single value may be specified. protected-element A {{DOMString}} used as the argument to {{NonElementParentNode/getElementById()}} - to resolve the {{Element}} to which the policy applies. + to resolve the {{Element}} to which the policy applies. If unspecified the policy is applied to the resource's {{Document}} node. time-threshold A numeric value in the range [0, 10000] that specifies how long, in milliseconds, the screen area containing the protected-element - must have unmodified viewiability properties when an event is + must have unmodified viewiability properties when an event is delivered to it or one of its ancestors. If not specified, it defaults to 800. If a value outside of the @@ -421,18 +422,18 @@ spec:dom; type:interface; text:Document visible-margin Same as {{VisibilityObserverInit/visibleMargin}}. - + If unspecified, it defaults to "0px".
Copyright © 2016 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and document use rules apply.
+Copyright © 1970 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and document use rules apply.
UI Security and the Visibility API defines both a -declarative and imperative means for resources -displayed in an embedded context to protect -themselves against having their content obscured, -moved, or otherwise displayed in a misleading -manner.
+ declarative and imperative means for resources + displayed in an embedded context to protect + themselves against having their content obscured, + moved, or otherwise displayed in a misleading + manner.This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report - can be found in the W3C technical reports - index at http://www.w3.org/TR/.
-This document was published by the Web Application Security Working Group as a Working Draft. This document is intended to become a W3C Recommendation.
-The (archived) public mailing list public-webappsec@w3.org (see instructions) + can be found in the W3C technical reports + index at https://www.w3.org/TR/.
+This document was published by the Web Application Security Working Group as a Working Draft. This document is intended to become a W3C Recommendation.
+The (archived) public mailing list public-webappsec@w3.org (see instructions) is preferred for discussion of this specification. When sending e-mail, - please put the text “UI Security” in the subject, + please put the text “UISecurity” in the subject, preferably like this: - “[UI Security] …summary of comment…”
+ “[UISecurity] …summary of comment…”Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
-This document was produced by the Web Application Security Working Group.
+This document was produced by the Web Application Security Working Group.
This document was produced by a group operating under - the 5 February 2004 W3C Patent Policy. - W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; + the W3C Patent Policy. + W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. - An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
-This document is governed by the 1 September 2015 W3C Process Document.
+ An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy. +This document is governed by the 15 September 2020 W3C Process Document.
Collectively known as User Interface Redressing, the goal of such manipulations might be to entice the user to interact - with embedded content without knowing its context, (e.g. to + with embedded content without knowing its context, (e.g. to send a payment or share content) commonly known as "clickjacking", or to convince paid content that it is being shown to the user when it is actually obscured, commonly known in the advertising business as "display fraud".
Existing anti-clickjacking measures such as frame-busting - scripts and headers granting origin-based embedding permissions have + scripts and headers granting origin-based embedding permissions have shortcomings which prevent their application to important use-cases. - Frame-busting scripts, for example, rely on browser behavior that has not been + Frame-busting scripts, for example, rely on browser behavior that has not been engineered to provide a security guarantee and as a consequence, such scripts may be unreliable if loaded inside a sandbox - or otherwise disabled. The X-Frame-Options header and the frame-ancestors + or otherwise disabled. The X-Frame-Options header and the frame-ancestors Content Security Policy directive offer an all-or-none approach to display of embedded content that is not appropriate for content which may be embedded in arbitrary locations, or known locations which might still be adversarial.
This document defines mechanisms to allow resources to request to be displayed free of interference by their embedding context and - learn if the user agent was able to satisfy such a request, with + learn if the user agent was able to satisfy such a request, with sufficient granularity to make decisions that can protect both users and content purveyors from various types of fraud.
First, this document defines an imperative API, VisibilityObserver, @@ -378,7 +451,7 @@
The declarative CSP interface does not offer the same fine-granularity control as the JavaScript API. Its goal is to allow protection to be @@ -402,7 +475,7 @@
This section is not normative.
UI Redressing attacks rely on fooling the subjective perceptions of - human actors to induce them to interact with a web application out of - its intended context. Because of this, the specific mechanisms which - may be used in attack and defense may vary greatly with the details of - a user agent implementation. For example, attacks which rely on - redressing the cursor may not apply in a touch environment, or entire - classes of attack may be impossible on a text-only browser or screen - reader.
+ human actors to induce them to interact with a web application out of + its intended context. Because of this, the specific mechanisms which + may be used in attack and defense may vary greatly with the details of + a user agent implementation. For example, attacks which rely on + redressing the cursor may not apply in a touch environment, or entire + classes of attack may be impossible on a text-only browser or screen + reader.Similarly, the implementation of the policies specified herein is highly - dependent on internal architecture and implementation strategies of - the user agent; such strategies may vary greatly between user agents - or even across versions or platforms for a single user agent.
+ dependent on internal architecture and implementation strategies of + the user agent; such strategies may vary greatly between user agents + or even across versions or platforms for a single user agent.This specification provides a normative means by which a resource - owner can communicate to a user agent its desire for additional - protective measures, actions to take if violations are detected, - and tuning hints which may be useful for certain means of - implementation. A user agent is conformant if it understands - these directives and makes a best effort to provide the desired - security properties, which might require no additional implementation - steps, e.g. in the case of a screen reader that does not support - embedded resources in a manner that is subject to any of the - attack classes of concern.
+ owner can communicate to a user agent its desire for additional + protective measures, actions to take if violations are detected, + and tuning hints which may be useful for certain means of + implementation. A user agent is conformant if it understands + these directives and makes a best effort to provide the desired + security properties, which might require no additional implementation + steps, e.g. in the case of a screen reader that does not support + embedded resources in a manner that is subject to any of the + attack classes of concern.While the indeterminacy of the user agent implementation protects - applications from needing to constantly update their policies as - user agents make internal changes, application authors should - understand that even a conformant user agent cannot make - perfect security guarantees against UI Redressing.
+ applications from needing to constantly update their policies as + user agents make internal changes, application authors should + understand that even a conformant user agent cannot make + perfect security guarantees against UI Redressing.These directives should be used as part of a comprehensive risk - mitigation strategy with an appropriate understanding of their - limitations.
+ mitigation strategy with an appropriate understanding of their + limitations.callback VisibilityObserverCallback = void(sequence<VisibilityObserverEntry> entries, VisibilityObserver observer) +callback =VisibilityObserverCallback void (sequence <VisibilityObserverEntry >,entries VisibilityObserver );observer This callback will be invoked when there are changes to the document’s visibility state.
3.2. The VisibilityObserverEntry interface
-[Constructor(VisibilityObserverCallback callback, optional VisibilityObserverEntryInit visibilityObserverEntryInit), Exposed=Window] -interface VisibilityObserverEntry { - readonly attribute DOMRectReadOnly globalVisibleBounds; - readonly attribute DOMRectReadOnly visibleBounds; - readonly attribute DOMHighResTimeStamp time; - }; +[Constructor (VisibilityObserverCallback callback ,optional VisibilityObserverEntryInit visibilityObserverEntryInit ),Exposed =Window ] +interface { +VisibilityObserverEntry readonly attribute DOMRectReadOnly globalVisibleBounds ; +readonly attribute DOMRectReadOnly visibleBounds ; +readonly attribute DOMHighResTimeStamp time ; +}; -dictionary VisibilityObserverEntryInit { - required DOMRectInit globalVisibleBounds; - required DOMRectInit visibleBounds; - required DOMHighResTimeStamp time; +dictionary { +VisibilityObserverEntryInit required DOMRectInit ; +globalVisibleBounds required DOMRectInit ; +visibleBounds required DOMHighResTimeStamp ; };time - globalVisibleBounds TheDOMRectcoresponding to the visible dimensions of the +globalVisibleBoundsTheDOMRectcoresponding to the visible dimensions of the top-level document in the global viewport’s coordinate space. -visibleBounds The
DOMRectcorresponding to the document’s boundingClientRect, +-
visibleBoundsTheDOMRectcorresponding to the document’s boundingClientRect, intersected by each of the document’s ancestor’s clipping rects, - intersected withglobalVisibleBounds. - This value represents the portion of the document actually visible withinglobalVisibleBounds.time A
+DOMHighResTimeStampthat corresponds to the time the visibility + intersected withglobalVisibleBounds. + This value represents the portion of the document actually visible withinglobalVisibleBounds.
timeADOMHighResTimeStampthat corresponds to the time the visibility state was recorded.3.3. The VisibilityObserver Interface
The VisibilityObserver interface can be used to observe changes in the document’s visibility state relative to the global viewport. -[Constructor(VisibilityObserverCallback callback), Exposed=Window] -interface VisibilityObserver { - void observe (); - void unobserve (); - sequence<VisibilityObserverEntry> takeRecords (); +[Constructor (VisibilityObserverCallback callback ),Exposed =Window ] +interface { +VisibilityObserver void observe (); +void unobserve (); +sequence <VisibilityObserverEntry >takeRecords (); };--
-- Let this be a new
VisibilityObserverobject -- Set this’s internal
[[callback]]slot to callback. --
- -
observe()
-- +
new VisibilityObserver(callback, options)+-
-- Add this to the document’s
[[RegisteredVisibilityObservers]]list +- Let this be a new
VisibilityObserverobject +- Set this’s internal
[[callback]]slot to callback.- -
unobserve()
-- +
observe()+-
-- Remove this from the document’s
[[RegisteredVisibilityObservers]]set. +- Add this to the document’s
[[RegisteredVisibilityObservers]]list- -
takeRecords()
-- +
unobserve()+-
+- Let queue be a copy of this’s internal
[[QueuedEntries]]slot. -- Clear this’s internal
[[QueuedEntries]]slot. +- Remove this from the document’s
[[RegisteredVisibilityObservers]]set. +takeRecords()+- +
+
- Let queue be a copy of this’s internal
[[QueuedEntries]]slot. +- Clear this’s internal
[[QueuedEntries]]slot.- Return queue.
3.4. The VisibilityObserverInit dictionary
-dictionary VisibilityObserverInit { - (double or sequence<double>) areaThreshold = 0; - (boolean) displacementAware = false; - (DOMString) visibleMargin = "0px"; - (Element)? observedElement; +dictionary { + (VisibilityObserverInit double or sequence <double >)areaThreshold = 0; + (boolean )displacementAware =false ; + (DOMString )visibleMargin = "0px"; + (Element )?observedElement ; };-
- -
areaThreshold, of type
-(double or sequence<double>), defaulting to0- +
areaThreshold, of type(double or sequence<double>), defaulting to0+List of threshold(s) at which to trigger callback. callback will be invoked when visibleBounds area changes from greater than or equal to any threshold to less than that threshold, and vice versa.
Threshold values must be in the range of [0, 1.0] and represent a -percentage of the area as specified by target.
-getBoundingClientRect().Note: 0.0 is effectively "any non-zero number of pixels".
-- -
displacementAware, of type
-(boolean), defaulting tofalse- +percentage of the area as specified by target.
getBoundingClientRect(). +Note: 0.0 is effectively "any non-zero number of pixels".
+displacementAware, of type(boolean), defaulting tofalse+If true, this observer should trigger the callback -when the position of the
-[[observedElement]]changes relative to the +when the position of the[[observedElement]]changes relative to the global viewport.- -
visibleMargin, of type
-(DOMString), defaulting to"0px"- -
Same as margin, extends the required visibility rectangle - behind the protected-element.
+getBoundingClientRect(). - Can be 1, 2, 3 or 4 components, possibly negative lengths.visibleMargin, of type(DOMString), defaulting to"0px"+- +
Same as margin, extends the required visibility rectangle +behind the protected-element.
getBoundingClientRect(). +Can be 1, 2, 3 or 4 components, possibly negative lengths.If there is only one component value, it applies to all sides. - If there are two values, the top and bottom margins are set to - the first value and the right and left margins are set to the - second. If there are three values, the top is set to the first - value, the left and right are set to the second, and the bottom - is set to the third. If there are four values, they apply to the - top, right, bottom, and left, respectively.e.g.
-+If there are two values, the top and bottom margins are set to +the first value and the right and left margins are set to the +second. If there are three values, the top is set to the first +value, the left and right are set to the second, and the bottom +is set to the third. If there are four values, they apply to the +top, right, bottom, and left, respectively.e.g. +-"5px" // all margins set to 5px "5px 10px" // top & bottom = 5px, right & left = 10px "-10px 5px 8px" // top = -10px, right & left = 5px, bottom = 8px "-10px -5px 5px 8px" // top = -10px, right = -5px, bottom = 5px, left = 8px- -
observedElement, of type
-(Element), nullable- -
The
+Elementbeing observed. If unset, the internal slot will be -initialized to theDocumentelement.observedElement, of type(Element), nullable +- +
The
Elementbeing observed. If unset, the internal slot will be +initialized to theDocumentelement.4. Content Security Policy Interface
This section describes the Content Security Policy - directive introduced in this specification to provide declarative - configuration of protection against input when an element does not meet it’s - visibility requirements.
+ directive introduced in this specification to provide declarative + configuration of protection against input when an element does not meet it’s + visibility requirements.The optional directive-value allows configuration of conditions for which violations - will be triggered.
-4.1. The input-protection Directive
+ will be triggered. +4.1. The input-protection Directive
directive-name = 'input-protection' directive-value = ['area-threshold=' num-val] ['protected-element=' id-selector] @@ -587,23 +648,23 @@
4.1.1. Directive Value
-area-threshold A violation will be triggered if an event is delivered to the +
area-threshold A violation will be triggered if an event is delivered to the protected-element or one of its ancestors if the visibility of the protected area is below this threshold.
Threshold values must be in the range [0, 1.0] and represent a - percentage of the area as specified by protected-element.
-getBoundingClientRect(), - adjusted by visible-margin. Unlike the imperative API, + percentage of the area as specified by protected-element.getBoundingClientRect(), + adjusted by visible-margin. Unlike the imperative API, only a single value may be specified.protected-element A
-DOMStringused as the argument togetElementById()to resolve theElementto which the policy applies.If unspecified the policy is applied to the resource’s
-Documentnode.time-threshold A numeric value in the range [0, 10000] that specifies how long, +
protected-element A
+DOMStringused as the argument togetElementById()to resolve theElementto which the policy applies.If unspecified the policy is applied to the resource’s
+Documentnode.time-threshold A numeric value in the range [0, 10000] that specifies how long, in milliseconds, the screen area containing the protected-element - must have unmodified viewiability properties when an event is + must have unmodified viewiability properties when an event is delivered to it or one of its ancestors.
If not specified, it defaults to 800. If a value outside of the range stated above is given, it defaults ot the nearest value between the lower and higher bounds.
-visible-margin Same as
+visibleMargin.visible-margin Same as
visibleMargin.If unspecified, it defaults to "0px".
@@ -612,84 +673,86 @@ 5.1. Internal Slot Definitions
5.1.1. Browsing Contexts
- Each unit of related similar-origin browsing contexts has an VisibilityObserverTaskQueued flag which + Each unit of related similar-origin browsing contexts has an VisibilityObserverTaskQueued flag which is initialized to false.5.1.2. Element
-Elementobjects have an internal [[InputProtectionObservers]] list, +Elementobjects have an internal[[InputProtectionObservers]]list, which is initially empty.5.1.3. Document
-Documentobjects have an internal [[RegisteredVisibilityObservers]] list, - which is initially empty, and an [[InputProtectionRequested]] flag which is intitially false. +Documentobjects have an internal[[RegisteredVisibilityObservers]]list, + which is initially empty, and an[[InputProtectionRequested]]flag which is intitially false.5.1.4. VisibilityObserver
-VisibilityObserverobjects have the following internal slots: +VisibilityObserverobjects have the following internal slots:-
- As well as internal slots initialized by VisibilityObserver(callback,options): + As well as internal slots initialized by VisibilityObserver(callback,options):- [[QueuedEntries]] which is initialized to an empty list -
- [[previousVisibleRatio]] which is initialized to 0 -
- [[previousGlobalViewportPosition]] +
[[QueuedEntries]]which is initialized to an empty list +[[previousVisibleRatio]]which is initialized to 0 +[[previousGlobalViewportPosition]]-
- The following internal slots will be initialzed to null unless the - object was constructed to represent an input-protection directive. + The following internal slots will be initialzed to null unless the + object was constructed to represent an input-protection directive.- [[callback]] -
- [[areaThreshold]] -
- [[displacementAware]] -
- [[visibleMargin]] -
- [[observedElement]] which is - initialized to the
DocumentElement if not set in theVisibilityObserverInitdictionary +[[callback]]+[[areaThreshold]]+[[displacementAware]]+[[visibleMargin]]+[[observedElement]]which is + initialized to theDocumentElement if not set in theVisibilityObserverInitdictionary-
- [[timeThreshold]] -
- [[associatedContentSecurityPolicy]] +
[[timeThreshold]]+[[associatedContentSecurityPolicy]]5.2. Algorithms
5.2.1. Queue a VisibilityObserver Task
- To queue a visibility observer task for a unit of related similar-origin browsing contexts unit, + To queue a visibility observer task for a unit of related similar-origin browsing contexts unit, run these steps:-
- If unit’s VisibilityObserverTaskQueued flag is set to +
- If unit’s VisibilityObserverTaskQueued flag is set to true, return. -
- Set unit’s VisibilityObserverTaskQueued flag to true. +
- Set unit’s VisibilityObserverTaskQueued flag to true.
- - Post a task to notify visibility observers, or enqueue a - task to notify visibility observers in the list of idle request callbacks with an appropriate timeout. -
Should we define an appropriate timeout?
+ Post a task to notify visibility observers, or enqueue a + task to notify visibility observers in the list of idle request callbacks with an appropriate timeout. +5.2.2. Notify VisibilityObservers
- To notify visibility observers for a unit of related similar-origin browsing contexts unit, + To notify visibility observers for a unit of related similar-origin browsing contexts unit, run these steps:-
- Set unit’s VisibilityObserverTaskQueued flag to false. -
- For each
Documentdocument in unit --
- Let notify list be a copy of document’s
[[RegisteredVisibilityObservers]]list. -- For each
VisibilityObserverobject observer in notify list, run these steps: +- Set unit’s VisibilityObserverTaskQueued flag to false. +
- + For each
Documentdocument in unit-
-- If observer’s internal
[[QueuedEntries]]slot is - empty, continue. -- Let queue be a copy of observer’s internal
[[QueuedEntries]]slot. -- Clear observer’s internal
[[QueuedEntries]]slot. -- Invoke callback with queue as the first argument and observer as the second argument and callback this value. If this throws an exception, report the exception. +
- Let notify list be a copy of document’s
[[RegisteredVisibilityObservers]]list. +- + For each
VisibilityObserverobject observer in notify list, run these steps: ++
- If observer’s internal
[[QueuedEntries]]slot is + empty, continue. +- Let queue be a copy of observer’s internal
[[QueuedEntries]]slot. +- Clear observer’s internal
[[QueuedEntries]]slot. +- Invoke callback with queue as the first argument and observer as the second argument and callback this value. If this throws an exception, report the exception. +
5.2.3. Queue a VisibilityObserverEntry
- To queue a VisibilityObserverEntry for observer, given a unit of related similar-origin browsing contexts unit, VisibilityObserver observer, and VisibilityObserverEntry entry run these steps: + To queue a VisibilityObserverEntry for observer, given a unit of related similar-origin browsing contexts unit, VisibilityObserver observer, and VisibilityObserverEntry entry run these steps:-
- Append entry to observer’s internal
[[QueuedEntries]]slot. -- Queue a visibility observer task for unit. +
- Append entry to observer’s internal
[[QueuedEntries]]slot. +- Queue a visibility observer task for unit.
5.2.4. Promote Observed GraphicsLayers
This section is non-normative.
- NOTE: The full internal details of rendering a document to the pixels - actually displayed to the user is not standardized. UA implementations + NOTE: The full internal details of rendering a document to the pixels + actually displayed to the user is not standardized. UA implementations may vary widely.The implementation strategy detailed in this section is not normative. Any - strategy which produces correct outcomes for the normative algorithms is + strategy which produces correct outcomes for the normative algorithms is conformant and implementers are encouraged to optimize whenever possible.
The possibility of variance among user agent implementations notwithstanding, - the normative algorithms of this specification are designed such that a highly performant + the normative algorithms of this specification are designed such that a highly performant implementation should be possible on the most common internal software and hardware architectures that are state-of-the-art for user agents and consumer computing platforms as of the time of writing.
@@ -698,134 +761,140 @@
Generally, at some point in the rendering of a set of documents in nested browsing contexts into the fully composed graphical representation in the global viewport, - a user agent will arrive at a set of intermediate representations we will designate - as GraphicsLayers, each of which represents a graphical surface to be + a user agent will arrive at a set of intermediate representations we will designate + as GraphicsLayers, each of which represents a graphical surface to be painted / clipped / scrolled.
-A GraphicsLayer representing the contents of a document in an iframe will - be arranged in the layer stack such that at a later phase in the rendering - it is automatically clipped and positioned relative to the series of viewports +
A GraphicsLayer representing the contents of a document in an iframe will + be arranged in the layer stack such that at a later phase in the rendering + it is automatically clipped and positioned relative to the series of viewports above it, and also subject to being drawn over or transformed by the layers above it.
-To prevent potentially malicious composition, the user agent can promote observed graphicsLayers by manipulating them such that - a document with
+[[RegisteredVisibilityObservers]]To prevent potentially malicious composition, the user agent can promote observed graphicsLayers by manipulating them such that + a document with
[[RegisteredVisibilityObservers]]-
-- Is clipped and positioned as-if-unmodified within the set of viewports of its ancestor - browsing contexts. A promoted document should not be able to occupy more - screen real estate than it is given by its embedding contexts. +
- Is clipped and positioned as-if-unmodified within the set of viewports of its ancestor + browsing contexts. A promoted document should not be able to occupy more + screen real estate than it is given by its embedding contexts.
- Responds to hit testing and events as-if-unmodified. Implementation-specific modifications - to internal representations of the document should not change the behavior of the DOM. -
- Is not subject to being drawn over or transformed by any other GraphicsLayers, - except other promoted layers, which should be treated as fully opaque occlusions - when reporting the visibility state of the document. + to internal representations of the document should not change the behavior of the DOM. +
- Is not subject to being drawn over or transformed by any other GraphicsLayers, + except other promoted layers, which should be treated as fully opaque occlusions + when reporting the visibility state of the document.
To promote observed graphicsLayers, given a time now, and an initially empty list promotedLayers, run these steps during the rendering - loop at the stage where the intermediate representation of a set of
+Documents is a set of GraphicsLayers graphicsLayers.To promote observed graphicsLayers, given a time now, and an initially empty list promotedLayers, run these steps during the rendering + loop at the stage where the intermediate representation of a set of
Documents is a set of GraphicsLayers graphicsLayers.
- For each graphicsLayer in graphicsLayers -
- For each
Documentdocument with an intermediate representation in graphicsLayer --
- If document has an empty list of
[[RegisteredVisibilityObservers]], continue. -- If document has a non-empty list of
[[RegisteredVisibilityObservers]]--
-- If document is not the only
Documentrepresented in graphicsLayer, apply - whatever implementation-specific steps are necessary to place it in its own layer. - (e.g. apply translatez(0) to the documentElement) Let graphicsLayer be that - new layer. -- Let rectToRaise be the value of document.
getBoundingClientRect(). -- Intersect rectToRaise with document’s viewport clip rect. -
- For every parent browsing context parent between document and the top-level document, - intersect rectToRaise with parent’s viewport clip rect, - and finally with the global viewport clip rect. -
- Clip graphicsLayer to rectToRaise. (graphicsLayer may have zero width and height - if it is scrolled off screen by an ancestor browsing context) -
- Intersect rectToRaise with any items in the promotedLayers list. -
- Add rectToRaise to the promotedLayers list. -
- Without reordering prior intermediate representations in a manner which would - change event dispatching, hit testing, or the DOM as exposed to JavaScript, reorder - the GraphicsLayers such that rectToRaise is on top of the root GraphicsLayer. - (e.g. by making it a direct child of the root layer) but beneath any layers in promotedLayers that clipped it. -
- Let protectedRect be the value of observer’s
[[observedElement]].getBoundingClientRect(), - adjusted by[[visibleMargin]]. -- Let visibleRatio be the intersection of protectedRect with rectToRaise, divided by protectedRect if protectedRect is non-zero, and 0 otherwise. -
- For each of document’s
[[RegisteredVisibilityObservers]]observer +- + For each
Documentdocument with an intermediate representation in graphicsLayer-
-- Let threshold be the index of the first entry in observer’s internal
[[areaThreshold]]slot whose value - is greater than or equal to visibleRatio. If visibleRatio is equal to 0, let threshold be -1. -- Let oldVisibleRatio be set to observer’s internal
[[previousVisibleRatio]]slot. -- Let oldThreshold be the index of the first entry in observer’s internal
[[areaThreshold]]slot whose value - is greater than or equal to oldVisibleRatio. If oldVisibleRatio is equal to 0, let oldThreshold be -1. -- Let oldPosition be the value of the observer’s internal
[[previousGlobalViewportPosition]]. -- If threshold does not equal oldThreshold, or if observer’s - internal
[[displacementAware]]slot is true and oldPosition is not equal to protectedRect, --
+- queue a VisibilityObserverEntry -
- Assign visibleRatio to observer’s internal
[[previousVisibleRatio]]slot. -- Assign protectedRect to the value of the observer’s internal
[[previousGlobalViewportPosition]]slot. -- If document has an empty list of
[[RegisteredVisibilityObservers]], continue. +- + If document has a non-empty list of
[[RegisteredVisibilityObservers]]++
+- If document is not the only
Documentrepresented in graphicsLayer, apply + whatever implementation-specific steps are necessary to place it in its own layer. + (e.g. apply translatez(0) to the documentElement) Let graphicsLayer be that + new layer. +- Let rectToRaise be the value of document.
getBoundingClientRect(). +- Intersect rectToRaise with document’s viewport clip rect. +
- For every parent browsing context parent between document and the top-level document, + intersect rectToRaise with parent’s viewport clip rect, + and finally with the global viewport clip rect. +
- Clip graphicsLayer to rectToRaise. (graphicsLayer may have zero width and height + if it is scrolled off screen by an ancestor browsing context) +
- Intersect rectToRaise with any items in the promotedLayers list. +
- Add rectToRaise to the promotedLayers list. +
- Without reordering prior intermediate representations in a manner which would + change event dispatching, hit testing, or the DOM as exposed to JavaScript, reorder + the GraphicsLayers such that rectToRaise is on top of the root GraphicsLayer. + (e.g. by making it a direct child of the root layer) but beneath any layers in promotedLayers that clipped it. +
- Let protectedRect be the value of observer’s
[[observedElement]].getBoundingClientRect(), + adjusted by[[visibleMargin]]. +- Let visibleRatio be the intersection of protectedRect with rectToRaise, divided by protectedRect if protectedRect is non-zero, and 0 otherwise. +
- + For each of document’s
[[RegisteredVisibilityObservers]]observer ++
- Let threshold be the index of the first entry in observer’s internal
[[areaThreshold]]slot whose value + is greater than or equal to visibleRatio. If visibleRatio is equal to 0, let threshold be -1. +- Let oldVisibleRatio be set to observer’s internal
[[previousVisibleRatio]]slot. +- Let oldThreshold be the index of the first entry in observer’s internal
[[areaThreshold]]slot whose value + is greater than or equal to oldVisibleRatio. If oldVisibleRatio is equal to 0, let oldThreshold be -1. +- Let oldPosition be the value of the observer’s internal
[[previousGlobalViewportPosition]]. +- + If threshold does not equal oldThreshold, or if observer’s + internal
[[displacementAware]]slot is true and oldPosition is not equal to protectedRect, ++
+- queue a VisibilityObserverEntry +
- Assign visibleRatio to observer’s internal
[[previousVisibleRatio]]slot. +- Assign protectedRect to the value of the observer’s internal
[[previousGlobalViewportPosition]]slot. +find exact terms to make sure that we have viewport definitions minus scrollbars
need to also clip to any other layers that were promoted ahead of us!
-if a parent and child layer both request to be promoted, the parent’s clipping window will have a complex geometry with holes in it that is not accounted for by this algorithm. Likely need to specify that graphics layers be processed by order of depth.
+if a parent and child layer both request to be promoted, the parent’s clipping window will have a complex geometry with holes in it that is not accounted for by this algorithm. Likely need to specify that graphics layers be processed by order of depth.
5.2.5. Enforce An input-protection Directive
- To enforce an input-protection directive for aDocumentdocument, + To enforce an input-protection directive for aDocumentdocument, run the following steps:
- Parse the policy according to [CSP2]. -
- If a value is set for protected-element, let protectedElement be the
Elementreturned by invoking document.getElementById()with - the value as the input, or document if null or unset. -- If document’s
[[InputProtectionRequested]]flag is false, set it - to true. -- Construct a new
VisibilityObserverobserver, with[[areaThreshold]]set to the value of area-threshold,[[visibleMargin]]set to the value of visible-margin,[[observedElement]]set to protectedElement,[[displacementAware]]set to true, - and[[callback]]set to a new function with an empty function body. -- Set the internal
[[timeThreshold]]slot of observer to the value of time-threshold -- Set the internal
[[associatedContentSecurityPolicy]]slot of observer to a reference to the - Content Security Policy which the input-protection directive is associated with. -- When dispatching events, when an
Elementelement will handle anEventevent, - if event is of type Mouse Event, Pointer Event, Drag-and-Drop, or Clipboard Event, (TODO:linkify) - and if element has[[InputProtectionObservers]]observers: --
- If applicable, check the computed style for the cursor. If a cursor is typically displayed but - has been hidden or changed to a non-standard bitmap, handle a violation for event and each observer in observers. -
- Otherwise, for each observer in observers: +
- If a value is set for protected-element, let protectedElement be the
Elementreturned by invoking document.getElementById()with + the value as the input, or document if null or unset. +- If document’s
[[InputProtectionRequested]]flag is false, set it + to true. +- Construct a new
VisibilityObserverobserver, with[[areaThreshold]]set to the value of area-threshold,[[visibleMargin]]set to the value of visible-margin,[[observedElement]]set to protectedElement,[[displacementAware]]set to true, + and[[callback]]set to a new function with an empty function body. +- Set the internal
[[timeThreshold]]slot of observer to the value of time-threshold +- Set the internal
[[associatedContentSecurityPolicy]]slot of observer to a reference to the + Content Security Policy which the input-protection directive is associated with. +- + When dispatching events, when an
Elementelement will handle anEventevent, + if event is of type Mouse Event, Pointer Event, Drag-and-Drop, or Clipboard Event, (TODO:linkify) + and if element has[[InputProtectionObservers]]observers:-
-- If observer’s
[[previousVisibleRatio]]is less than[[areaThreshold]], handle a violation for observer. -- If observer’s
[[previousVisibleRatio]]is greater than[[areaThreshold]], - get the most recentVisibilityObserverEntryentry from observer’s[[QueuedEntries]]. If the difference between entry.timeand now is less than[[timeThreshold]], handle a violation for observer. +- If applicable, check the computed style for the cursor. If a cursor is typically displayed but + has been hidden or changed to a non-standard bitmap, handle a violation for event and each observer in observers. +
- + Otherwise, for each observer in observers: +
+
- If observer’s
[[previousVisibleRatio]]is less than[[areaThreshold]], handle a violation for observer. +- If observer’s
[[previousVisibleRatio]]is greater than[[areaThreshold]], + get the most recentVisibilityObserverEntryentry from observer’s[[QueuedEntries]]. If the difference between entry.timeand now is less than[[timeThreshold]], handle a violation for observer. +5.2.6. Handle a Violation
- To handle a violation of an input-protection directive for observer and event, run the following steps: + To handle a violation of an input-protection directive for observer and event, run the following steps:-
- Follow the steps in [CSP2] to report a violation for observer’s
[[associatedContentSecurityPolicy]]policy. +- Follow the steps in [CSP2] to report a violation for observer’s
[[associatedContentSecurityPolicy]]policy.- Determine if policy is being enforced or monitored. [CSP2] -
- If policy is being enforced, set event’s cancelled flag and stop propagation flag. -
- If policy is being monitored, set event.
isUnsafeto true. +- If policy is being enforced, set event’s cancelled flag and stop propagation flag. +
- If policy is being monitored, set event.
isUnsafeto true.5.3. External Spec Integrations
5.3.1. HTML Processing Model: Event Loop
- As part of substep 10 of the update the rendering event loop in the HTML Processing Model, Promote Observed GraphicsLayers, passing in now as the timestamp. + As part of substep 10 of the update the rendering event loop in the HTML Processing Model, Promote Observed GraphicsLayers, passing in now as the timestamp.5.3.2. DOM: Dispatching Events
As part of dispatching events in the DOM Standard, add a substep to step 5, ("For each object in event path..."), - invoking step 7 of enforce an input-protection directive before proceeding to + invoking step 7 of enforce an input-protection directive before proceeding to "invoke object with event".5.3.3. isUnsafe Attribute
-partial interface Event { - readonly attribute boolean isUnsafe; +partial interface Event { +readonly attribute boolean isUnsafe ; };-
@@ -846,11 +915,11 @@- isUnsafe, of type boolean, readonly +
isUnsafe, of type boolean, readonly- Will be set to true if the event fired when the event did not meet the document’s input-protection requirements.
7. Security Considerations
This section is non-normative.
UI Redressing and Clickjacking attacks rely on violating the contextual and temporal - integrity of embedded content. Because these attacks target the subjective perception - of the user and not well-defined security boundaries, the heuristic protections - afforded by the input-protection directive can never be 100% effective for every - interface. It provides no protection against certain classes of attacks, such as - displaying content around an embedded resource that appears to extend a trusted + integrity of embedded content. Because these attacks target the subjective perception + of the user and not well-defined security boundaries, the heuristic protections + afforded by the input-protection directive can never be 100% effective for every + interface. It provides no protection against certain classes of attacks, such as + displaying content around an embedded resource that appears to extend a trusted dialog but provides misleading information.
When used as a mechanism to report visibility for purposes of monetizing content, operators should be aware that a malicious or modified user agent can always report @@ -884,8 +953,8 @@
Examples in this specification are introduced with the words “for example” or are set apart from the normative text with
class="example", like this: -- +-Informative notes begin with the word “Note” and are set apart from the @@ -910,14 +979,14 @@
areaThreshold, in §3.4
[[associatedContentSecurityPolicy]], in §5.1.4 [[callback]], in §5.1.4 - displacementAware, in §3.4 [[displacementAware]], in §5.1.4 + displacementAware, in §3.4 enforce an input-protection directive, in §5.2.5 globalVisibleBounds -
- dict-member for VisibilityObserverEntryInit, in §3.2
- attribute for VisibilityObserverEntry, in §3.2 +
- dict-member for VisibilityObserverEntryInit, in §3.2
GraphicsLayer, in §5.2.4 handle a violation, in §5.2.6 @@ -927,8 +996,8 @@ isUnsafe, in §5.3.3
notify visibility observers, in §5.2.2 observe(), in §3.3 - observedElement, in §3.4 [[observedElement]], in §5.1.4 + observedElement, in §3.4 [[previousGlobalViewportPosition]], in §5.1.4 [[previousVisibleRatio]], in §5.1.4 promote observed graphicsLayers, in §5.2.4 @@ -941,117 +1010,225 @@ dict-member for VisibilityObserverEntryInit, in §3.2
attribute for VisibilityObserverEntry, in §3.2 + dict-member for VisibilityObserverEntryInit, in §3.2 [[timeThreshold]], in §5.1.4 time-threshold, in §4.1.1 unobserve(), in §3.3 VisibilityObserver, in §3.3 VisibilityObserverCallback, in §3.1 - VisibilityObserver(callback), in §3.3 - VisibilityObserver(callback, options), in §3.3 + VisibilityObserver(callback, options), in §3.3 VisibilityObserverEntry, in §3.2 - VisibilityObserverEntry(callback), in §3.2 - VisibilityObserverEntry(callback, visibilityObserverEntryInit), in §3.2 VisibilityObserverEntryInit, in §3.2 VisibilityObserverInit, in §3.4 VisibilityObserverTaskQueued, in §5.1.1 visibleBounds -
-- dict-member for VisibilityObserverEntryInit, in §3.2
- attribute for VisibilityObserverEntry, in §3.2 +
- dict-member for VisibilityObserverEntryInit, in §3.2
visible-margin, in §4.1.1 [[visibleMargin]], in §5.1.4 + visible-margin, in §4.1.1 visibleMargin, in §3.4 + + + + + + + + + + + + + + + Terms defined by reference
- - [CSS2] defines the following terms: + [css-box-4] defines the following terms:
-
- margin +
- margin
- [cssom-view-1] defines the following terms:
-
- getBoundingClientRect() +
- getBoundingClientRect()
- - [WHATWG-DOM] defines the following terms: + [DOM] defines the following terms:
-
- Document -
- Element -
- Event -
- getElementById(elementId) -
- stop propagation flag +
- Document +
- Element +
- Event +
- getElementById(elementId) +
- stop propagation flag
- [geometry-1] defines the following terms:
-
- DOMRect -
- DOMRectInit -
- DOMRectReadOnly +
- DOMRect +
- DOMRectInit +
- DOMRectReadOnly
- - [WebIDL-1] defines the following terms: + [WebIDL] defines the following terms:
References
Normative References
- [CSP2] -
- Mike West; Adam Barth; Daniel Veditz. Content Security Policy Level 2. 21 July 2015. CR. URL: http://www.w3.org/TR/CSP2/ -
- [CSS2] -
- Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 7 June 2011. REC. URL: http://www.w3.org/TR/CSS2 +
- Mike West; Adam Barth; Daniel Veditz. Content Security Policy Level 2. 15 December 2016. REC. URL: https://www.w3.org/TR/CSP2/ +
- [CSS-BOX-4] +
- Elika Etemad. CSS Box Model Module Level 4. 21 April 2020. WD. URL: https://www.w3.org/TR/css-box-4/
- [CSSOM-VIEW-1] -
- Simon Pieters. CSSOM View Module. 17 March 2016. WD. URL: http://www.w3.org/TR/cssom-view-1/ +
- Simon Pieters. CSSOM View Module. 17 March 2016. WD. URL: https://www.w3.org/TR/cssom-view-1/ +
- [DOM] +
- Anne van Kesteren. DOM Standard. Living Standard. URL: https://dom.spec.whatwg.org/
- [GEOMETRY-1] -
- Simon Pieters; Dirk Schulze; Rik Cabanier. Geometry Interfaces Module Level 1. 25 November 2014. CR. URL: http://www.w3.org/TR/geometry-1/ +
- Simon Pieters; Chris Harrelson. Geometry Interfaces Module Level 1. 4 December 2018. CR. URL: https://www.w3.org/TR/geometry-1/
- [RFC2119]
- S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119 -
- [WebIDL-1] -
- Cameron McCormack; Boris Zbarsky. WebIDL Level 1. 8 March 2016. CR. URL: http://www.w3.org/TR/WebIDL-1/ -
- [WHATWG-DOM] -
- Anne van Kesteren. DOM Standard. Living Standard. URL: https://dom.spec.whatwg.org/ +
- [WebIDL] +
- Boris Zbarsky. Web IDL. 15 December 2016. ED. URL: https://heycam.github.io/webidl/
IDL Index
-callback VisibilityObserverCallback = void(sequence<VisibilityObserverEntry> entries, VisibilityObserver observer) +@@ -1059,353 +1236,352 @@callback =VisibilityObserverCallback void (sequence <VisibilityObserverEntry >,entries VisibilityObserver ); -[Constructor(VisibilityObserverCallback callback, optional VisibilityObserverEntryInit visibilityObserverEntryInit), Exposed=Window] -interface VisibilityObserverEntry { - readonly attribute DOMRectReadOnly globalVisibleBounds; - readonly attribute DOMRectReadOnly visibleBounds; - readonly attribute DOMHighResTimeStamp time; - }; +[observer Constructor (VisibilityObserverCallback callback ,optional VisibilityObserverEntryInit visibilityObserverEntryInit ),Exposed =Window ] +interface { +VisibilityObserverEntry readonly attribute DOMRectReadOnly globalVisibleBounds ; +readonly attribute DOMRectReadOnly visibleBounds ; +readonly attribute DOMHighResTimeStamp time ; +}; -dictionary VisibilityObserverEntryInit { - required DOMRectInit globalVisibleBounds; - required DOMRectInit visibleBounds; - required DOMHighResTimeStamp time; +dictionary { +VisibilityObserverEntryInit required DOMRectInit ; +globalVisibleBounds required DOMRectInit ; +visibleBounds required DOMHighResTimeStamp ; }; -[Constructor(VisibilityObserverCallback callback), Exposed=Window] -interface VisibilityObserver { - void observe (); - void unobserve (); - sequence<VisibilityObserverEntry> takeRecords (); +[time Constructor (VisibilityObserverCallback callback ),Exposed =Window ] +interface { +VisibilityObserver void observe (); +void unobserve (); +sequence <VisibilityObserverEntry >takeRecords (); }; -dictionary VisibilityObserverInit { - (double or sequence<double>) areaThreshold = 0; - (boolean) displacementAware = false; - (DOMString) visibleMargin = "0px"; - (Element)? observedElement; +dictionary { + (VisibilityObserverInit double or sequence <double >)areaThreshold = 0; + (boolean )displacementAware =false ; + (DOMString )visibleMargin = "0px"; + (Element )?observedElement ; }; -partial interface Event { - readonly attribute boolean isUnsafe; +partial interface Event { +readonly attribute boolean isUnsafe ; };
Do we need to deal with form submission / navigations that aren’t JS-event-based? ↵how to interact with frame-ancestors and XFO? ↵-Should we define an appropriate timeout? ↵+Should we define an appropriate timeout? ↵find exact terms to make sure that we have viewport definitions minus scrollbars ↵need to also clip to any other layers that were promoted ahead of us! ↵-if a parent and child layer both request to be promoted, the parent’s clipping window will have a complex geometry with holes in it that is not accounted for by this algorithm. Likely need to specify that graphics layers be processed by order of depth. ↵+if a parent and child layer both request to be promoted, the parent’s clipping window will have a complex geometry with holes in it that is not accounted for by this algorithm. Likely need to specify that graphics layers be processed by order of depth. ↵