From 3b364c5cb50bf2981de3140f98d22079917fd21d Mon Sep 17 00:00:00 2001 From: Traian Captan Date: Thu, 28 Sep 2023 14:02:38 -0700 Subject: [PATCH] Clarify scrollMargin details --- index.bs | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/index.bs b/index.bs index 38c8426..2f8c56f 100644 --- a/index.bs +++ b/index.bs @@ -288,8 +288,6 @@ interface IntersectionObserver { :: Offsets are applied to scrollports on the path from intersection root to target, effectively growing or shrinking the clip rects used to calculate intersections. - These offsets are only applied when handling same-origin-domain targets; - for cross-origin-domain targets they are ignored. On getting, return the result of serializing the elements of {{[[scrollMargin]]}} space-separated, where pixel lengths serialize as the numeric value followed by "px", @@ -341,18 +339,23 @@ If a target {{Element}} is clipped by an ances intersection root, that clipping is unaffected by {{IntersectionObserver/rootMargin}}. -When calculating a scrollport intersection rectangle for -a same-origin-domain target, the rectangle is expanded -according to the offsets in the {{IntersectionObserver}}’s {{[[scrollMargin]]}} slot -in a manner similar to CSS's 'margin' property, -with the four values indicating the amount the top, right, bottom, and left edges, respectively, are offset by, -with positive lengths indicating an outward offset. -Percentages are resolved relative to the width of the undilated rectangle. +To apply scroll margin to a scrollport +:: + When calculating a scrollport intersection rectangle for + a same-origin-domain target, the rectangle is expanded + according to the offsets in the {{IntersectionObserver}}’s {{[[scrollMargin]]}} slot + in a manner similar to CSS's 'margin' property, + with the four values indicating the amount the top, right, bottom, and left edges, respectively, are offset by, + with positive lengths indicating an outward offset. + Percentages are resolved relative to the width of the undilated rectangle. + + These offsets are only applied when handling same-origin-domain targets; + for cross-origin-domain targets they are ignored. -Note: {{IntersectionObserver/scrollMargin}} affects the clipping of target -by all scrollable ancestors up to and including the intersection root. -Both the {{IntersectionObserver/scrollMargin}} and the {{IntersectionObserver/rootMargin}} -are applied to a scrollable intersection root's rectangle. + Note: {{IntersectionObserver/scrollMargin}} affects the clipping of target + by all scrollable ancestors up to and including the intersection root. + Both the {{IntersectionObserver/scrollMargin}} and the {{IntersectionObserver/rootMargin}} + are applied to a scrollable intersection root's rectangle. Note: Root intersection rectangle and scrollport intersection rectangles are not affected by pinch zoom and will report the unadjusted viewport, consistent with the @@ -674,7 +677,7 @@ run these steps: the browsing context container of |container|. 2. Map |intersectionRect| to the coordinate space of |container|. 3. If |container| is a scroll container, apply the {{IntersectionObserver}}’s - {{[[scrollMargin]]}} to the |container|'s clip rect. + {{[[scrollMargin]]}} to the |container|'s clip rect as described in apply scroll margin to a scrollport. 4. If |container| has a content clip or a css clip-path property, update |intersectionRect| by applying |container|'s clip. 5. If |container| is the root element of a browsing context,