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
Copy file name to clipboardExpand all lines: cssom-view-1/Overview.bs
+65-39Lines changed: 65 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -441,22 +441,26 @@ an associated element or [=pseudo-element=] <var>element</var> and optionally a
441
441
(which is "<code>auto</code>" if omitted),
442
442
the following steps must be run:
443
443
444
-
<ol>
445
-
<li><a lt="smooth scroll aborted">Abort</a> any ongoing <a>smooth scroll</a> for <var>box</var>.
446
-
<li>If the user agent honors the 'scroll-behavior' property and one of the following are true:
444
+
1. <a lt="smooth scroll aborted">Abort</a> any ongoing <a>smooth scroll</a> for <var>box</var>.
445
+
1. Resolve all pending scroll {{Promise}}s whose scroll container is <var>box</var>.
446
+
1. Let <var>scrollPromise</var> be a new {{Promise}}.
447
+
1. Return <var>scrollPromise</var>, and run the remaining steps <a>in parallel</a>.
448
+
1. If the user agent honors the 'scroll-behavior' property and one of the following is true:
447
449
<ul>
448
450
<li><var>behavior</var> is "<code>auto</code>" and <var>element</var> is not null and its computed value of the
449
-
'scroll-behavior' property is ''scroll-behavior/smooth''
451
+
'scroll-behavior' property is ''scroll-behavior/smooth'', or
450
452
<li><var>behavior</var> is <code>smooth</code>
451
453
</ul>
452
-
...then perform a <a>smooth scroll</a> of <var>box</var> to <var>position</var>. Once the position has finished updating, emit the <a event>scrollend</a> event.
453
-
Otherwise, perform an <a>instant scroll</a> of <var>box</var> to <var>position</var>. After an <a>instant scroll</a> emit the <a event>scrollend</a> event.
454
+
then perform a <a>smooth scroll</a> of <var>box</var> to <var>position</var>;
455
+
otherwise, perform an <a>instant scroll</a> of <var>box</var> to <var>position</var>.
456
+
1. Wait until either the position has finished updating, or <var>scrollPromise</var> has been resolved.
457
+
1. If <var>scrollPromise</var> is still in the pending state:
458
+
1. If the scroll position changed as a result of this call, emit the <a event>scrollend</a> event.
459
+
1. Resolve <var>scrollPromise</var>.
454
460
455
461
Note: <code>behavior: "instant"</code> always performs an <a>instant scroll</a> by this algorithm.
456
462
457
463
Note: If the scroll position did not change as a result of the user interaction or programmatic invocation, where no translations were applied as a result, then no <a event>scrollend</a> event fires because no scrolling occurred.
458
-
</ol>
459
-
460
464
</div>
461
465
462
466
<div algorithm="perform a scroll of a viewport">
@@ -481,8 +485,13 @@ When a user agent is to <dfn for="viewport" export>perform a scroll</dfn> of a <
481
485
1. Let <var>element</var> be <var>doc</var>'s root element if there is one, null otherwise.
482
486
1. <a for="/">Perform a scroll</a> of the <a>viewport</a>'s <a>scrolling box</a> to its current scroll position + (<var>layout dx</var>, <var>layout dy</var>) with <var>element</var> as the
483
487
associated element, and <var>behavior</var> as the scroll behavior.
488
+
Let <var>scrollPromise1</var> be the {{Promise}} returned from this step.
484
489
1. <a for="/">Perform a scroll</a> of <var>vv</var>'s <a>scrolling box</a> to its current scroll position + (<var>visual dx</var>, <var>visual dy</var>) with <var>element</var> as the associated
485
490
element, and <var>behavior</var> as the scroll behavior.
491
+
Let <var>scrollPromise2</var> be the {{Promise}} returned from this step.
492
+
1. Let <var>scrollPromise</var> be a new {{Promise}}.
493
+
1. Return <var>scrollPromise</var>, and run the remaining steps <a>in parallel</a>.
494
+
1. Resolve <var>scrollPromise</var> when both <var>scrollPromise1</var> and <var>scrollPromise2</var> have settled.
486
495
487
496
Note: Conceptually, the visual viewport is scrolled until it "bumps up" against the layout viewport
488
497
edge and then "pushes" the layout viewport by applying the scroll delta to the layout viewport.
Issue: Should the scroll methods above return a result object and if so what information should they provide? #12495
1343
+
1329
1344
Note: The {{CheckVisibilityOptions/checkOpacity}} and {{CheckVisibilityOptions/checkVisibilityCSS}} properties are historical names.
1330
1345
These properties have aliases that match the new naming scheme,
1331
1346
namely {{CheckVisibilityOptions/opacityProperty}} and {{CheckVisibilityOptions/visibilityProperty}}.
@@ -1462,10 +1477,12 @@ The <dfn method for=Element caniuse=scrollintoview>scrollIntoView(<var>arg</var>
1462
1477
1. Otherwise, if <var>arg</var> is false, then set <var>block</var> to "<code>end</code>".
1463
1478
1. If the element does not have any associated [=CSS/box=],
1464
1479
or is not available to user-agent features,
1465
-
then return.
1480
+
then return a resolved {{Promise}} and abort the remaining steps.
1466
1481
1. <a lt='scroll a target into view'>Scroll the element into view</a>
1467
1482
with <var>behavior</var>, <var>block</var>, <var>inline</var>, and <var>container</var>.
1483
+
Let <var>scrollPromise</var> be the {{Promise}} returned from this step
1468
1484
1. Optionally perform some other action that brings the element to the user's attention.
1485
+
1. Return <var>scrollPromise</var>.
1469
1486
1470
1487
<div class='example'>
1471
1488
A component can use scrollIntoView to scroll content of interest into the specified alignment:
@@ -1553,23 +1570,24 @@ The <dfn method for=Element lt="scroll(options)|scroll(x, y)">scroll()</dfn> met
1553
1570
1. Let the {{ScrollToOptions/left}} dictionary member of <var>options</var> have the value <var>x</var>.
1554
1571
1. Let the {{ScrollToOptions/top}} dictionary member of <var>options</var> have the value <var>y</var>.
1555
1572
1. Let <var>document</var> be the element's <a>node document</a>.
1556
-
1. If <var>document</var> is not the <a>active document</a>, terminate these steps.
1573
+
1. If <var>document</var> is not the <a>active document</a>, return a resolved {{Promise}} and abort the remaining steps.
1557
1574
1. Let <var>window</var> be the value of <var>document</var>'s {{Document/defaultView}} attribute.
1558
-
1. If <var>window</var> is null, terminate these steps.
1559
-
1. If the element is the [=root element=] and <var>document</var> is in <a>quirks mode</a>, terminate these steps.
1560
-
1. If the element is the [=root element=] invoke {{Window/scroll()}}on <var>window</var> with {{Window/scrollX}} on <var>window</var>as first argument and <var>y</var> as second argument,
1561
-
and terminate these steps.
1575
+
1. If <var>window</var> is null, return a resolved {{Promise}} and abort the remaining steps.
1576
+
1. If the element is the [=root element=] and <var>document</var> is in <a>quirks mode</a>, return a resolved {{Promise}} and abort the remaining steps.
1577
+
1. If the element is the [=root element=], return the {{Promise}}returned by {{Window/scroll()}} on <var>window</var>after the method is invoked with
1578
+
{{Window/scrollX}} on <var>window</var> as first argument and <var>y</var> as second argument, and abort the remaining steps.
1562
1579
1. If the element is <a>the <code>body</code> element</a>,
1563
1580
<var>document</var> is in <a>quirks mode</a>,
1564
1581
and the element is not <a>potentially scrollable</a>,
1565
-
invoke {{Window/scroll()}} on <var>window</var>with <var>options</var> as the only argument,
1566
-
and terminate these steps.
1582
+
return the {{Promise}} returned by {{Window/scroll()}} on <var>window</var>after the method is invoked with
1583
+
<var>options</var> as the only argument, and abort the remaining steps.
1567
1584
1. If the element does not have any associated [=CSS/box=],
1568
1585
the element has no associated <a>scrolling box</a>,
1569
1586
or the element has no overflow,
1570
-
terminate these steps.
1587
+
return a resolved {{Promise}} and abort the remaining steps.
1571
1588
1. <a lt='scroll an element'>Scroll the element</a> to <var>x</var>,<var>y</var>,
1572
-
with the scroll behavior being the value of the {{ScrollOptions/behavior}} dictionary member of <var>options</var>.
1589
+
with the scroll behavior being the value of the {{ScrollOptions/behavior}} dictionary member of <var>options</var>. Let <var>scrollPromise</var> be the {{Promise}} returned from this step.
1590
+
1. Return <var>scrollPromise</var>.
1573
1591
1574
1592
When the <dfn method for=Element lt="scrollTo(options)|scrollTo(x, y)">scrollTo()</dfn> method is invoked, the
1575
1593
user agent must act as if the {{Element/scroll()}} method was invoked with the same arguments.
@@ -1588,7 +1606,7 @@ user agent must run these steps:
1588
1606
1. Let the {{ScrollToOptions/top}} dictionary member of <var>options</var> have the value <var>y</var>.
1589
1607
1. Add the value of {{Element/scrollLeft}} to the {{ScrollToOptions/left}} dictionary member.
1590
1608
1. Add the value of {{Element/scrollTop}} to the {{ScrollToOptions/top}} dictionary member.
1591
-
1. Act as if the {{Element/scroll()}} method was invoked with <var>options</var> as the only argument.
1609
+
1. Return the {{Promise}} returned by {{Element/scroll()}}after the method is invoked with <var>options</var> as the only argument.
1592
1610
1593
1611
<wpt>
1594
1612
window-scrollBy-display-change.html
@@ -1804,9 +1822,11 @@ an inline base direction position <var>inline</var>,
1804
1822
and an optional containing <a>Element</a> to stop scrolling after reaching <var>container</var>,
1805
1823
means to run these steps:
1806
1824
1825
+
1. Let <var>ancestorPromises</var> be an empty set of {{Promise}}s.
1807
1826
1. For each ancestor element or <a>viewport</a> that establishes a <a>scrolling box</a><var>scrolling box</var>,
1808
1827
in order of innermost to outermost <a>scrolling box</a>, run these substeps:
1809
-
1. If the {{Document}} associated with <var>target</var> is not <a>same origin</a> with the {{Document}} associated with the element or <a>viewport</a> associated with <var>scrolling box</var>, terminate these steps.
1828
+
1. If the {{Document}} associated with <var>target</var> is not <a>same origin</a> with the {{Document}} associated with the element or <a>viewport</a> associated with <var>scrolling box</var>,
1829
+
abort any remaining iteration of this loop.
1810
1830
1. Let <var>position</var> be the scroll position resulting from running the steps to <a>determine the scroll-into-view position</a> of <var>target</var> with <var>behavior</var> as the |scroll behavior|,
1811
1831
<var>block</var> as the |block flow position|, <var>inline</var> as the |inline base direction position| and <var>scrolling box</var> as the |scrolling box|.
1812
1832
1. If <var>position</var> is not the same as <var>scrolling box</var>'s current scroll position, or <var>scrolling box</var> has an ongoing <a>smooth scroll</a>,
@@ -1815,18 +1835,22 @@ means to run these steps:
1815
1835
<dd>
1816
1836
<a for="/">Perform a scroll</a> of the element's <var>scrolling box</var> to <var>position</var>, with the element as the associated element and
1817
1837
<var>behavior</var> as the scroll behavior.
1838
+
Add the {{Promise}} retured from this step to the set <var>ancestorPromises</var>.
1818
1839
<dt>If <var>scrolling box</var> is associated with a <a>viewport</a>
1819
1840
<dd>
1820
1841
1. Let <var>document</var> be the <a>viewport’s</a> associated {{Document}}.
1821
1842
1. Let <var>root element</var> be <var>document</var>'s [=root element=], if there is one, or null otherwise.
1822
1843
1. <a for="viewport">Perform a scroll</a> of the <a>viewport</a> to <var>position</var>, with <var>root element</var> as the associated element and <var>behavior</var>
1823
1844
as the scroll behavior.
1845
+
Add the {{Promise}} retured from this step in the set <var>ancestorPromises</var>.
1824
1846
</dl>
1825
1847
1. If <var>container</var> is not null and either <var>scrolling box</var>
1826
1848
is a [=shadow-including inclusive ancestor=] of <var>container</var> or
1827
1849
is a <a>viewport</a> whose <a for="/">document</a> is a [=shadow-including inclusive ancestor=] of <var>container</var>,
1828
-
abort the rest of these steps.
1829
-
1850
+
abort any remaining iteration of this loop.
1851
+
1. Let <var>scrollPromise</var> be a new {{Promise}}.
1852
+
1. Return <var>scrollPromise</var>, and run the remaining steps <a>in parallel</a>.
1853
+
1. Resolve <var>scrollPromise</var> when all {{Promise}}s in <var>ancestorPromises</var> have settled.
1830
1854
</div>
1831
1855
1832
1856
<div algorithm>
@@ -1849,8 +1873,10 @@ To <dfn>scroll an element</dfn> (or [=pseudo-element=]) <var>element</var> to <v
1. Let <var>position</var> be the scroll position <var>box</var> would have by aligning <a>scrolling area</a> x-coordinate <var>x</var> with the left of <var>box</var> and aligning <a>scrolling area</a> y-coordinate <var>y</var> with the top of <var>box</var>.
1852
-
1. If <var>position</var> is the same as <var>box</var>'s current scroll position, and <var>box</var> does not have an ongoing <a>smooth scroll</a>, abort these steps.
1876
+
1. If <var>position</var> is the same as <var>box</var>'s current scroll position, and <var>box</var> does not have an ongoing <a>smooth scroll</a>, return a resolved {{Promise}} and abort the remaining steps.
1853
1877
1. <a for="/">Perform a scroll</a> of <var>box</var> to <var>position</var>, <var>element</var> as the associated element and <var>behavior</var> as the scroll behavior.
1878
+
Let <var>scrollPromise</var> be the {{Promise}} returned from this step.
0 commit comments