You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -580,30 +579,30 @@ which is initialized to an empty list.
580
579
This list holds <dfn interface>IntersectionObserverRegistration</dfn> records,
581
580
which have:
582
581
* an <dfn attribute for=IntersectionObserverRegistration>observer</dfn> property
583
-
holding an {{IntersectionObserver}}.
582
+
holding an {{IntersectionObserver}}.
584
583
* a <dfn attribute for=IntersectionObserverRegistration>previousThresholdIndex</dfn> property
585
-
holding a number between -1 and the length of the observer's {{IntersectionObserver/thresholds}} property (inclusive).
584
+
holding a number between -1 and the length of the observer's {{IntersectionObserver/thresholds}} property (inclusive).
586
585
* a <dfn attribute for=IntersectionObserverRegistration>previousIsIntersecting</dfn> property
587
-
holding a boolean.
586
+
holding a boolean.
588
587
* a <dfn attribute for=IntersectionObserverRegistration>lastUpdateTime</dfn> property
589
-
holding a {{DOMHighResTimeStamp}} value.
588
+
holding a {{DOMHighResTimeStamp}} value.
590
589
* a <dfn attribute for=IntersectionObserverRegistration>previousIsVisible</dfn> property
591
-
holding a boolean.
590
+
holding a boolean.
592
591
593
592
<h4 id='intersection-observer-private-slots'>
594
593
IntersectionObserver</h4>
595
594
596
595
{{IntersectionObserver}} objects have the following internal slots:
597
596
* A <dfn attribute for=IntersectionObserver>\[[QueuedEntries]]</dfn> slot
598
-
initialized to an empty list.
597
+
initialized to an empty list.
599
598
* A <dfn attribute for=IntersectionObserver>\[[ObservationTargets]]</dfn> slot
600
-
initialized to an empty list.
599
+
initialized to an empty list.
601
600
* A <dfn attribute for=IntersectionObserver>\[[callback]]</dfn> slot
602
-
which is initialized by {{IntersectionObserver(callback, options)}}.
601
+
which is initialized by {{IntersectionObserver(callback, options)}}.
603
602
* A <dfn attribute for=IntersectionObserver>\[[rootMargin]]</dfn> slot
604
-
which is a list of four pixel lengths or percentages.
603
+
which is a list of four pixel lengths or percentages.
605
604
* A <dfn attribute for=IntersectionObserver>\[[scrollMargin]]</dfn> slot
606
-
which is a list of four pixel lengths or percentages.
605
+
which is a list of four pixel lengths or percentages.
607
606
608
607
<h3 id='algorithms'>
609
608
Algorithms</h2>
@@ -746,6 +745,32 @@ run these steps:
746
745
6. Map |intersectionRect| to the coordinate space of the <a>viewport</a> of the {{document}} containing |target|.
747
746
7. Return |intersectionRect|.
748
747
748
+
<h4 id='calculate-visibility-algo'>
749
+
Compute whether a Target is unoccluded, untransformed, unfiltered, and opaque.</h4>
750
+
751
+
To compute the <dfn>visibility</dfn> of a <a>target</a>, run these steps:
752
+
1. If the |observer|'s {{IntersectionObserver/trackVisibility}} attribute is false, return true.
753
+
2. If the <a>target</a> has an <a>effective transformation matrix</a> other than a 2D translation or proportional 2D upscaling, return false.
754
+
3. If the <a>target</a>, or any element in its <a>containing block chain</a>, has an effective opacity other than 100%, return false.
755
+
4. If the <a>target</a>, or any element in its <a>containing block chain</a>, has any filters applied, return false.
756
+
5. If the implementation cannot guarantee that the <a>target</a> is completely unoccluded by other page content, return false.
757
+
758
+
Note: Implementations should use the <a>ink overflow rectangle</a> of page content when determining whether a <a>target</a> is occluded. For blur effects, which have theoretically infinite extent, the <a>ink overflow rectangle</a> is defined by the finite-area approximation described for the <a>blur</a> filter function.
759
+
760
+
6. Return true.
761
+
762
+
<h4 id='calculate-effective-transformation-matrix'>Calculate a <a>target</a>'s Effective Transformation Matrix</h4>
763
+
To compute the <dfn>effective transformation matrix</dfn> of a <a>target</a>, run these steps:
764
+
1. Let |matrix| be the <a>serialization</a> of the <a>identity transform function</a>.
765
+
2. Let |container| be the target.
766
+
3. While |container| is not the <a>intersection root</a>:
767
+
1. Set |t| to |container|'s <a>transformation matrix</a>.
768
+
2. Set |matrix| to |t| <a>post-multiplied</a> by |matrix|.
769
+
3. If |container| is the root element of a <a>nested browsing context</a>,
770
+
update |container| to be the <a>browsing context container</a> of |container|. Otherwise, update |container| to be the <a>containing block</a> of |container|.
771
+
4. Return |matrix|.
772
+
773
+
749
774
<h4 id='update-intersection-observations-algo'>
750
775
Run the Update Intersection Observations Steps</h4>
751
776
@@ -758,45 +783,54 @@ To <dfn export>run the update intersection observations steps</dfn> for a
758
783
2. For each |observer| in |observer list|:
759
784
1. Let |rootBounds| be |observer|'s <a>root intersection rectangle</a>.
760
785
2. For each |target| in |observer|'s internal {{[[ObservationTargets]]}} slot, processed in the same order that {{observe()}} was called on each |target|:
761
-
1. Let:
786
+
1. Let |registration| be the {{IntersectionObserverRegistration}} record
787
+
in |target|'s internal {{[[RegisteredIntersectionObservers]]}} slot
788
+
whose {{IntersectionObserverRegistration/observer}} property is equal to |observer|.
789
+
2. If <code>(|time| - |registration|.{{IntersectionObserverRegistration/lastUpdateTime}} < |observer|.{{IntersectionObserver/delay}})</code>, skip further processing for |target|.
790
+
3. Set |registration|.{{IntersectionObserverRegistration/lastUpdateTime}} to |time|.
791
+
4. Let:
762
792
- |thresholdIndex| be 0.
763
793
- |isIntersecting| be false.
764
794
- |targetRect| be a {{DOMRectReadOnly}} with |x|, |y|, |width|, and |height| set to 0.
765
795
- |intersectionRect| be a {{DOMRectReadOnly}} with |x|, |y|, |width|, and |height| set to 0.
766
-
2. If the <a>intersection root</a> is not the <a>implicit root</a>,
796
+
5. If the <a>intersection root</a> is not the <a>implicit root</a>,
767
797
and |target| is not in the same {{document}} as the <a>intersection root</a>,
768
798
skip to step 11.
769
-
3. If the <a>intersection root</a> is an {{Element}},
799
+
6. If the <a>intersection root</a> is an {{Element}},
770
800
and |target| is not a descendant of the <a>intersection root</a>
771
801
in the <a>containing block chain</a>, skip to step 11.
772
-
4. Set |targetRect| to the {{DOMRectReadOnly}} obtained by <a>getting the bounding box</a> for
802
+
7. Set |targetRect| to the {{DOMRectReadOnly}} obtained by <a>getting the bounding box</a> for
773
803
|target|.
774
-
4. Let |intersectionRect| be the result of running the <a>compute the intersection</a>
804
+
8. Let |intersectionRect| be the result of running the <a>compute the intersection</a>
775
805
algorithm on |target| and |observer|'s <a>intersection root</a>.
776
-
5. Let |targetArea| be |targetRect|'s area.
777
-
6. Let |intersectionArea| be |intersectionRect|'s area.
778
-
7. Let |isIntersecting| be true if |targetRect| and |rootBounds| intersect or are edge-adjacent,
806
+
9. Let |targetArea| be |targetRect|'s area.
807
+
10. Let |intersectionArea| be |intersectionRect|'s area.
808
+
11. Let |isIntersecting| be true if |targetRect| and |rootBounds| intersect or are edge-adjacent,
779
809
even if the intersection has zero area (because |rootBounds| or |targetRect| have
780
810
zero area).
781
-
9. If |targetArea| is non-zero, let |intersectionRatio| be |intersectionArea| divided by |targetArea|.<br>
811
+
12. If |targetArea| is non-zero, let |intersectionRatio| be |intersectionArea| divided by |targetArea|.<br>
782
812
Otherwise, let |intersectionRatio| be <code>1</code> if |isIntersecting| is true, or <code>0</code> if |isIntersecting| is false.
783
-
10. Set |thresholdIndex| to the index of the first entry in |observer|.{{thresholds}} whose value is greater than |intersectionRatio|, or the length of |observer|.{{thresholds}} if |intersectionRatio| is greater than or equal to the last entry in |observer|.{{thresholds}}.
784
-
11. Let |intersectionObserverRegistration| be the {{IntersectionObserverRegistration}} record
785
-
in |target|'s internal {{[[RegisteredIntersectionObservers]]}} slot
786
-
whose {{IntersectionObserverRegistration/observer}} property is equal to |observer|.
787
-
12. Let |previousThresholdIndex| be the |intersectionObserverRegistration|'s
813
+
13. Set |thresholdIndex| to the index of the first entry in |observer|.{{thresholds}} whose value is greater than |intersectionRatio|, or the length of |observer|.{{thresholds}} if |intersectionRatio| is greater than or equal to the last entry in |observer|.{{thresholds}}.
814
+
14. Let |isVisible| be the result of running the <a>visibility</a> algorithm on |target|.
815
+
15. Let |previousThresholdIndex| be the |registration|'s
0 commit comments