From 07336da617fa76ee2286bfc78b61d30996402494 Mon Sep 17 00:00:00 2001 From: Stefan Zager Date: Thu, 14 Mar 2024 14:00:57 -0700 Subject: [PATCH 1/5] in progress --- index.bs | 95 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 75 insertions(+), 20 deletions(-) diff --git a/index.bs b/index.bs index 8ab73a9..96f360d 100644 --- a/index.bs +++ b/index.bs @@ -49,6 +49,7 @@ urlPrefix: https://html.spec.whatwg.org/multipage/ type: dfn; text: origin urlPrefix: https://heycam.github.io/webidl/ url: #dfn-simple-exception; type:exception; + text: NotAllowedError text: RangeError text: TypeError text: SyntaxError @@ -56,6 +57,9 @@ urlPrefix: https://heycam.github.io/webidl/ urlPrefix: #idl-; type:interface; text: double urlPrefix: #idl-; type:interface; text: undefined url: #hierarchyrequesterror; type: exception; text: HierarchyRequestError +urlPrefix: https://drafts.csswg.org/css-backgrounds/ + url: #shadow-blur; type:dfn; text: blur + url: #blur-radius; type:dfn; text: blur radius urlPrefix: https://drafts.csswg.org/css-box/ url: #containing-block; type: dfn; text: containing block url: #padding-area; type: dfn; text: padding area @@ -64,12 +68,19 @@ urlPrefix: https://drafts.csswg.org/css-display/ url: #containing-block-chain; type: dfn; text: containing block chain urlPrefix: http://www.w3.org/TR/css-masking-1/ url: #propdef-clip-path; type:dfn; text: clip-path +urlPrefix: https://drafts.csswg.org/css-overflow-3/ + url: #ink-overflow-rectangle; type:dfn; text: ink overflow rectangle + url: #ink-overflow-region; type:dfn; text: ink overflow region + url: #overflow-properties; type:dfn; text: overflow properties +urlPrefix: https://drafts.csswg.org/css-transforms-1/ + url: #transformation-matrix; type:dfn; text: transformation matrix + url: #serialization-of-the-computed-value; type:dfn; text: serialization + url: #identity-transform-function; type:dfn; text: identity transform function + url: #post-multiplied; type:dfn; text: post-multiplied urlPrefix: https://drafts.csswg.org/cssom-view-1/ url: #pinch-zoom; type:dfn; text: pinch zoom urlPrefix: https://drafts.csswg.org/css2/visuren.html url: #viewport; type:dfn; text: viewport -urlPrefix: https://drafts.csswg.org/css-overflow-3/ - url: #overflow-properties; type:dfn; text: overflow properties @@ -513,6 +543,16 @@ dictionary IntersectionObserverInit { by getting the bounding box for target. Note: 0.0 is effectively "any non-zero number of pixels". + : delay + :: + A number specifying the minimum delay in milliseconds + between notifications from the observer for a given target. + : trackVisibility + :: + A boolean indicating whether the observer should track visibility. + Note that tracking visibility is likely to be a more expensive operation + than tracking intersections. It is recommended that this option be used + only when necessary.

@@ -538,23 +578,32 @@ Element

\[[RegisteredIntersectionObservers]] slot, which is initialized to an empty list. This list holds IntersectionObserverRegistration records, -which have an observer property -holding an {{IntersectionObserver}}, a previousThresholdIndex property -holding a number between -1 and the length of the observer's {{IntersectionObserver/thresholds}} property (inclusive), and -a previousIsIntersecting property holding a boolean. +which have: + * an observer property + holding an {{IntersectionObserver}}. + * a previousThresholdIndex property + holding a number between -1 and the length of the observer's {{IntersectionObserver/thresholds}} property (inclusive). + * a previousIsIntersecting property + holding a boolean. + * a lastUpdateTime property + holding a {{DOMHighResTimeStamp}} value. + * a previousIsVisible property + holding a boolean.

IntersectionObserver

-{{IntersectionObserver}} objects have internal -\[[QueuedEntries]] and -\[[ObservationTargets]] slots, -which are initialized to empty lists and an internal -\[[callback]] slot -which is initialized by {{IntersectionObserver(callback, options)}}. -They also have internal \[[rootMargin]] -and \[[scrollMargin]] slots -which are lists of four pixel lengths or percentages. +{{IntersectionObserver}} objects have the following internal slots: + * A \[[QueuedEntries]] slot + initialized to an empty list. + * A \[[ObservationTargets]] slot + initialized to an empty list. + * A \[[callback]] slot + which is initialized by {{IntersectionObserver(callback, options)}}. + * A \[[rootMargin]] slot + which is a list of four pixel lengths or percentages. + * A \[[scrollMargin]] slot + which is a list of four pixel lengths or percentages.

Algorithms

@@ -584,7 +633,12 @@ and an {{IntersectionObserverInit}} dictionary |options|, run these steps: 8. If |thresholds| is empty, append 0 to |thresholds|. 9. The {{IntersectionObserver/thresholds}} attribute getter will return this sorted |thresholds| list. -10. Return |this|. +10. If |options|.{{IntersectionObserverInit/trackVisibility}} is true, + and |options|.{{IntersectionObserverInit/delay}} is not specified or is less than 100, + throw a {{NotAllowedError}} exception. +11. Set |this|'s internal {{[[delay]]}} slot to |options|.{{IntersectionObserverInit/delay}}. +12. Set |this|'s internal {{[[trackVisibility]]}} slot to |options|.{{IntersectionObserverInit/trackVisibility}}. +13. Return |this|.

Observe a target Element

@@ -597,7 +651,8 @@ and an {{Element}} |target|, follow these steps: an {{IntersectionObserverRegistration}} record with an {{IntersectionObserverRegistration/observer}} property set to |observer|, a {{IntersectionObserverRegistration/previousThresholdIndex}} property set to -1, - and a {{IntersectionObserverRegistration/previousIsIntersecting}} property set to false. + a {{IntersectionObserverRegistration/previousIsIntersecting}} property set to false, + and a {{IntersectionObserverRegistration/previousIsVisible}} property set to false. 3. Append |intersectionObserverRegistration| to |target|'s internal {{[[RegisteredIntersectionObservers]]}} slot. 4. Add |target| to |observer|'s internal {{[[ObservationTargets]]}} slot. From aea8cdfc8217548750ace9578f5bbb74de22eb2f Mon Sep 17 00:00:00 2001 From: Stefan Zager Date: Wed, 20 Mar 2024 14:12:57 -0700 Subject: [PATCH 2/5] in progress --- index.bs | 100 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 33 deletions(-) diff --git a/index.bs b/index.bs index 96f360d..748a702 100644 --- a/index.bs +++ b/index.bs @@ -57,9 +57,6 @@ urlPrefix: https://heycam.github.io/webidl/ urlPrefix: #idl-; type:interface; text: double urlPrefix: #idl-; type:interface; text: undefined url: #hierarchyrequesterror; type: exception; text: HierarchyRequestError -urlPrefix: https://drafts.csswg.org/css-backgrounds/ - url: #shadow-blur; type:dfn; text: blur - url: #blur-radius; type:dfn; text: blur radius urlPrefix: https://drafts.csswg.org/css-box/ url: #containing-block; type: dfn; text: containing block url: #padding-area; type: dfn; text: padding area @@ -81,6 +78,8 @@ urlPrefix: https://drafts.csswg.org/cssom-view-1/ url: #pinch-zoom; type:dfn; text: pinch zoom urlPrefix: https://drafts.csswg.org/css2/visuren.html url: #viewport; type:dfn; text: viewport +urlPrefix: https://drafts.fxtf.org/filter-effects/ + url: #funcdef-filter-blur; type:dfn; text: blur -This callback will be invoked when there are changes to target's +This callback will be invoked when there are changes to a target's intersection with the intersection root, as per the processing model. @@ -202,7 +202,7 @@ and it can observe any target {{Element}} that {{IntersectionObserver/root}} in the containing block chain. An {{IntersectionObserver}} with a null {{IntersectionObserver/root}} is referred to as an implicit root observer. -Valid targets for an implicit root observer include +Valid targets for an implicit root observer include any {{Element}} in the top-level browsing context, as well as any {{Element}} in any nested browsing context which is in the list of the descendant browsing contexts of the top-level browsing context. @@ -748,19 +748,19 @@ run these steps:

Compute whether a Target is unoccluded, untransformed, unfiltered, and opaque.

-To compute the visibility of a {{IntersectionObserver/target}}, run these steps: +To compute the visibility of a target, run these steps: 1. If the |observer|'s {{IntersectionObserver/trackVisibility}} attribute is false, return true. -2. If the {{IntersectionObserver/target}} has an effective transformation matrix other than a 2D translation or proportional 2D upscaling, return false. -3. If the {{IntersectionObserver/target}}, or any element in its containing block chain, has an effective opacity other than 100%, return false. -4. If the {{IntersectionObserver/target}}, or any element in its containing block chain, has any filters applied, return false. -5. If the implementation cannot guarantee that the {{IntersectionObserver/target}} is completely unoccluded by other page content, return false. +2. If the target has an effective transformation matrix other than a 2D translation or proportional 2D upscaling, return false. +3. If the target, or any element in its containing block chain, has an effective opacity other than 100%, return false. +4. If the target, or any element in its containing block chain, has any filters applied, return false. +5. If the implementation cannot guarantee that the target is completely unoccluded by other page content, return false. -Note: Implementations should use the ink overflow rectangle of page content when determining whether a {{IntersectionObserver/target}} is occluded. For blur effects, which have theoretically infinite extent, the ink overflow rectangle is defined by the finite-area approximation described for the blur filter function. +Note: Implementations should use the ink overflow rectangle of page content when determining whether a target is occluded. For blur effects, which have theoretically infinite extent, the ink overflow rectangle is defined by the finite-area approximation described for the blur filter function. 6. Return true. -

Calculate a {{IntersectionObserver/target}}'s Effective Transformation Matrix

-To compute the effective transformation matrix of a {{IntersectionObserver/target}}, run these steps: +

Calculate a target's Effective Transformation Matrix

+To compute the effective transformation matrix of a target, run these steps: 1. Let |matrix| be the serialization of the identity transform function. 2. Let |container| be the target. 3. While |container| is not the intersection root: From 885a800ebd52305e751b6888d2df946d9abfc502 Mon Sep 17 00:00:00 2001 From: Stefan Zager Date: Mon, 20 May 2024 16:36:15 -0700 Subject: [PATCH 5/5] review nits --- index.bs | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/index.bs b/index.bs index 5570f43..67c6865 100644 --- a/index.bs +++ b/index.bs @@ -49,7 +49,6 @@ urlPrefix: https://html.spec.whatwg.org/multipage/ type: dfn; text: origin urlPrefix: https://heycam.github.io/webidl/ url: #dfn-simple-exception; type:exception; - text: NotAllowedError text: RangeError text: TypeError text: SyntaxError @@ -464,9 +463,8 @@ dictionary IntersectionObserverEntryInit { has zero area). : isVisible :: - True if {{IntersectionObserver/trackVisibility}} is true - and the visibility algorithm, - when run on {{IntersectionObserverEntry/target}}, returns true. + Contains the result of running the visibility algorithm + on {{IntersectionObserverEntry/target}}. : intersectionRatio :: If the {{IntersectionObserverEntry/boundingClientRect}} has non-zero area, @@ -603,6 +601,12 @@ IntersectionObserver which is a list of four pixel lengths or percentages. * A \[[scrollMargin]] slot which is a list of four pixel lengths or percentages. + * A \[[thresholds]] slot + which is initialized by {{IntersectionObserver(callback, options)}}. + * A \[[delay]] slot + which is initialized by {{IntersectionObserver(callback, options)}}. + * A \[[trackVisibility]] slot + which is initialized by {{IntersectionObserver(callback, options)}}.

Algorithms

@@ -632,10 +636,10 @@ and an {{IntersectionObserverInit}} dictionary |options|, run these steps: 8. If |thresholds| is empty, append 0 to |thresholds|. 9. The {{IntersectionObserver/thresholds}} attribute getter will return this sorted |thresholds| list. -10. If |options|.{{IntersectionObserverInit/trackVisibility}} is true, - and |options|.{{IntersectionObserverInit/delay}} is not specified or is less than 100, - throw a {{NotAllowedError}} exception. -11. Set |this|'s internal {{[[delay]]}} slot to |options|.{{IntersectionObserverInit/delay}}. +10. Let |delay| be the value of |options|.{{IntersectionObserverInit/delay}}. +11. If |options|.{{IntersectionObserverInit/trackVisibility}} is true + and |delay| is less than 100, set |delay| to 100. +11. Set |this|'s internal {{[[delay]]}} slot to |options|.{{IntersectionObserverInit/delay}} to |delay|. 12. Set |this|'s internal {{[[trackVisibility]]}} slot to |options|.{{IntersectionObserverInit/trackVisibility}}. 13. Return |this|. @@ -650,8 +654,8 @@ and an {{Element}} |target|, follow these steps: an {{IntersectionObserverRegistration}} record with an {{IntersectionObserverRegistration/observer}} property set to |observer|, a {{IntersectionObserverRegistration/previousThresholdIndex}} property set to -1, - a {{IntersectionObserverRegistration/previousIsIntersecting}} property set to false, - and a {{IntersectionObserverRegistration/previousIsVisible}} property set to false. + a {{IntersectionObserverRegistration/previousIsIntersecting}} property set to false, + and a {{IntersectionObserverRegistration/previousIsVisible}} property set to false. 3. Append |intersectionObserverRegistration| to |target|'s internal {{[[RegisteredIntersectionObservers]]}} slot. 4. Add |target| to |observer|'s internal {{[[ObservationTargets]]}} slot. @@ -749,7 +753,7 @@ run these steps: Compute whether a Target is unoccluded, untransformed, unfiltered, and opaque. To compute the visibility of a target, run these steps: -1. If the |observer|'s {{IntersectionObserver/trackVisibility}} attribute is false, return true. +1. If the |observer|'s {{IntersectionObserver/trackVisibility}} attribute is false, return false. 2. If the target has an effective transformation matrix other than a 2D translation or proportional 2D upscaling, return false. 3. If the target, or any element in its containing block chain, has an effective opacity other than 100%, return false. 4. If the target, or any element in its containing block chain, has any filters applied, return false.