Skip to content

Commit 12a3efc

Browse files
authoredApr 1, 2022
Merge pull request #355 from yoavweiss/compute_intersection_return
Add a return value to compute the intersection
2 parents 6093f7d + de2ee35 commit 12a3efc

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed
 

‎index.bs

+11-11
Original file line numberDiff line numberDiff line change
@@ -620,12 +620,12 @@ run these steps:
620620
<h4 id='calculate-intersection-rect-algo'>
621621
Compute the Intersection of a Target Element and the Root</h4>
622622

623-
To <dfn>compute the intersection</dfn> between a <a>target</a> and the observer's <a>intersection root</a>,
623+
To <dfn>compute the intersection</dfn> between a <a>target</a> |target| and an <a>intersection root</a> |root|,
624624
run these steps:
625625

626-
1. Let |intersectionRect| be the result of running the {{Element/getBoundingClientRect()}} algorithm on the <a>target</a>.
627-
2. Let |container| be the <a>containing block</a> of the <a>target</a>.
628-
3. While |container| is not the <a>intersection root</a>:
626+
1. Let |intersectionRect| be the result of running the {{Element/getBoundingClientRect()}} algorithm on |target|.
627+
2. Let |container| be the <a>containing block</a> of |target|.
628+
3. While |container| is not |root|:
629629
1. If |container| is the {{document}} of a <a>nested browsing context</a>,
630630
update |intersectionRect| by clipping to the <a>viewport</a>
631631
of the {{document}}, and update |container| to be
@@ -637,9 +637,9 @@ run these steps:
637637
update |container| to be the <a>browsing context</a>'s {{document}};
638638
otherwise, update |container| to be the <a>containing block</a>
639639
of |container|.
640-
4. Map |intersectionRect| to the coordinate space of the <a>intersection root</a>.
640+
4. Map |intersectionRect| to the coordinate space of |root|.
641641
5. Update |intersectionRect| by intersecting it with the <a>root intersection rectangle</a>.
642-
6. Map |intersectionRect| to the coordinate space of the <a>viewport</a> of the {{document}} containing the <a>target</a>.
642+
6. Map |intersectionRect| to the coordinate space of the <a>viewport</a> of the {{document}} containing |target|.
643643
7. Return |intersectionRect|.
644644

645645
<h4 id='update-intersection-observations-algo'>
@@ -667,11 +667,11 @@ To <dfn>run the update intersection observations steps</dfn> for a
667667
in the <a>containing block chain</a>, skip to step 11.
668668
4. Set |targetRect| to the {{DOMRectReadOnly}} obtained
669669
by running the {{Element/getBoundingClientRect()}} algorithm on |target|.
670-
5. Set |intersectionRect| to the result of running the <a>compute the intersection</a>
671-
algorithm on |target|.
672-
6. Let |targetArea| be |targetRect|'s area.
673-
7. Let |intersectionArea| be |intersectionRect|'s area.
674-
8. Set |isIntersecting| to true if |targetRect| and |rootBounds| intersect or are edge-adjacent,
670+
4. Let |intersectionRect| be the result of running the <a>compute the intersection</a>
671+
algorithm on |target| and |observer|'s <a>intersection root</a>.
672+
5. Let |targetArea| be |targetRect|'s area.
673+
6. Let |intersectionArea| be |intersectionRect|'s area.
674+
7. Let |isIntersecting| be true if |targetRect| and |rootBounds| intersect or are edge-adjacent,
675675
even if the intersection has zero area (because |rootBounds| or |targetRect| have
676676
zero area).
677677
9. If |targetArea| is non-zero, let |intersectionRatio| be |intersectionArea| divided by |targetArea|.<br>

0 commit comments

Comments
 (0)
Please sign in to comment.