Skip to content

Commit

Permalink
[cssom-view] Make the various scrolling algorithms accept a pseudo-el…
Browse files Browse the repository at this point in the history
…ement.
  • Loading branch information
tabatkins committed Nov 12, 2024
1 parent 582de32 commit 3935c33
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions cssom-view-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,11 @@ This specification depends on the WHATWG Infra standard. [[!INFRA]]

<h3 id=scrolling>Scrolling</h3>

<div algorithm="perform a scroll of a box">

When a user agent is to <dfn export>perform a scroll</dfn> of a <a>scrolling box</a> <var>box</var>,
to a given position <var>position</var>,
an associated element <var>element</var> and optionally a scroll behavior <var>behavior</var>
an associated element or [=pseudo-element=] <var>element</var> and optionally a scroll behavior <var>behavior</var>
(which is "<code>auto</code>" if omitted),
the following steps must be run:

Expand All @@ -434,6 +436,10 @@ the following steps must be run:
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.
</ol>

</div>

<div algorithm="perform a scroll of a viewport">

When a user agent is to <dfn for="viewport" export>perform a scroll</dfn> of a <a>viewport</a> to a given position <var>position</var> and optionally a scroll behavior <var>behavior</var>
(which is "<code>auto</code>" if omitted) it must perform a coordinated viewport scroll by following these steps:

Expand Down Expand Up @@ -464,6 +470,8 @@ so that the layout viewport is scrolled before the visual viewport. This is done
reasons to ensure consistent scroll event ordering. See the <a href="#example-vvanimation">example
above</a> for a visual depiction.

</div>

<div class='example'>
The user pinch-zooms into the document and ticks their mouse wheel, requesting the user agent scroll the document down by 50px. Because the document
is pinch-zoomed in, the visual viewport has 20px of room to scroll. The user agent distributes the scroll by scrolling the visual viewport down by
Expand Down Expand Up @@ -1445,8 +1453,9 @@ The <dfn attribute for=Element>currentCSSZoom</dfn> attribute must return the

<h3 id=element-scrolling-members>{{Element}} Scrolling Members</h3>

<div algorithm>

To <dfn export>determine the scroll-into-view position</dfn> of a <var>target</var>, which is an <a for="/">Element</a> or <a>Range</a>,
To <dfn export>determine the scroll-into-view position</dfn> of a <var>target</var>, which is an <a for="/">Element</a>, [=pseudo-element=], or <a>Range</a>,
with a scroll behavior <var>behavior</var>,
a block flow direction position <var>block</var>,
an inline base direction position <var>inline</var>,
Expand Down Expand Up @@ -1497,9 +1506,10 @@ run the following steps:
<dd>Align <var>element edge D</var> with <var>scrolling box edge D</var>.
</dl>
1. Return <var>position</var>.
</div>


To <dfn export>scroll a target into view</dfn> <var>target</var>, which is an <a for="/">Element</a> or <a>Range</a>,
<div algorithm>
To <dfn export>scroll a target into view</dfn> <var>target</var>, which is an <a for="/">Element</a>, [=pseudo-element=], or <a>Range</a>,
with a scroll behavior <var>behavior</var>,
a block flow direction position <var>block</var>,
and an inline base direction position <var>inline</var>,
Expand All @@ -1522,9 +1532,11 @@ a <a>scrolling box</a> <var>scrolling box</var>, in order of innermost to outerm
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>
as the scroll behavior.
</dl>
</div>

<div algorithm>

To <dfn>scroll an element</dfn> <var>element</var> to <var>x</var>,<var>y</var> optionally with a scroll behavior <var>behavior</var> (which is "<code>auto</code>" if omitted) means to:
To <dfn>scroll an element</dfn> (or [=pseudo-element=]) <var>element</var> to <var>x</var>,<var>y</var> optionally with a scroll behavior <var>behavior</var> (which is "<code>auto</code>" if omitted) means to:

1. Let <var>box</var> be <var>element</var>'s associated <a>scrolling box</a>.
1. <dl class=switch>
Expand All @@ -1544,7 +1556,7 @@ To <dfn>scroll an element</dfn> <var>element</var> to <var>x</var>,<var>y</var>
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>.
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.
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.

</div>


<h2 id=extensions-to-the-htmlelement-interface>Extensions to the {{HTMLElement}} Interface</h2>
Expand Down

0 comments on commit 3935c33

Please sign in to comment.