Skip to content

Commit 1b1f88a

Browse files
author
Simon Pieters
committed
[cssom-view] Make 'scroll an element into view' algorithm be aware of vertical writing modes
1 parent 72faba2 commit 1b1f88a

2 files changed

Lines changed: 64 additions & 42 deletions

File tree

cssom-view/Overview.html

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,19 @@ <h2 id="terminology"><span class="secno">3 </span>Terminology</h2>
412412
<dd><p>The bottom and left edges.
413413
</dl>
414414

415+
<p>The <dfn id="ending-edges">ending edges</dfn> of a particular set of edges of a box or element are the following edges:
416+
417+
<dl class="switch">
418+
<dt>If the <a href="#overflow-directions">overflow directions</a> are rightward and downward
419+
<dd><p>The bottom and right edges.
420+
<dt>If the <a href="#overflow-directions">overflow directions</a> are leftward and downward
421+
<dd><p>The bottom and left edges.
422+
<dt>If the <a href="#overflow-directions">overflow directions</a> are leftward and upward
423+
<dd><p>The top and left edges.
424+
<dt>If the <a href="#overflow-directions">overflow directions</a> are rightward and upward
425+
<dd><p>The top and right edges.
426+
</dl>
427+
415428
<p>The term <dfn id="css-layout-box">CSS layout box</dfn> refers to the same term in CSS. For the purpose
416429
of the requirements in this specification, elements that have a computed value of the
417430
'display' property that is 'table-column' or
@@ -1029,32 +1042,33 @@ <h3 id="the-getclientrects()-and-getboundingclientrect()-methods"><span class="s
10291042

10301043
<h3 id="element-scrolling-members"><span class="secno">7.2 </span><code title="">Element</code> Scrolling Members</h3>
10311044

1032-
<p>To <dfn id="scroll-an-element-into-view">scroll an element into view</dfn>, optionally with an <i>align to top flag</i> set, and optionally with a scroll behavior <var>behavior</var> (which
1033-
is <code title="">auto</code> if omitted), means to run these steps for each ancestor element or <a href="#viewport">viewport</a> that establishes a scrolling box
1034-
<var>box</var>, in order of innermost to outermost scrolling box:</p>
1045+
<p>To <dfn id="scroll-an-element-into-view">scroll an element into view</dfn> <var>element</var>, optionally with an <i>align to top flag</i> set, and optionally with a scroll behavior
1046+
<var>behavior</var> (which is <code title="">auto</code> if omitted), means to run these steps for each ancestor element or <a href="#viewport">viewport</a> that establishes
1047+
a scrolling box <var>box</var>, in order of innermost to outermost scrolling box:</p>
10351048

10361049
<ol>
10371050
<li><p>If the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> associated
1038-
with the element to be
1039-
scrolled into view is not <a class="external" data-anolis-spec="html" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/origin-0.html#same-origin">same origin</a> with the
1051+
with <var>element</var> is not <a class="external" data-anolis-spec="html" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/origin-0.html#same-origin">same origin</a> with the
10401052
<code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> associated with the element or
10411053
<a href="#viewport">viewport</a> associated with <var>box</var>, terminate these
10421054
steps.</li>
10431055

10441056
<li><p>Let <var>position</var> be the scroll position <var>box</var> would have by following these steps:
10451057

10461058
<ol>
1047-
<li><p>If the <i>align to top flag</i> is set align the top of
1048-
the border box of the element to be scrolled into view with the top of
1049-
<var>box</var>.</li>
1059+
<li><p>If the <i>align to top flag</i> is set align <var>element</var>'s border box <a href="#beginning-edges" title="beginning edges">beginning edge</a> in the <a href="#block-flow-direction">block
1060+
flow direction</a> with the <a href="#beginning-edges" title="beginning edges">beginning edge</a> in the <a href="#block-flow-direction">block flow direction</a> of <var>box</var>.</li>
10501061

1051-
<li><p>Otherwise, if the <i>align to top flag</i> is not set
1062+
<li><p>Otherwise, the <i>align to top flag</i> is not set;
10521063
align the bottom of the border box of the element to be scrolled into
10531064
view with the bottom of <var>box</var>.</li>
10541065

1055-
<li><p>Align the left of the border box of the element to be scrolled
1056-
into view with the left of <var>box</var>.</li>
1057-
<!-- RTL is not special cased in implementations?! -->
1066+
<li><p>Otherwise, the <i>align to top flag</i> is not set; align <var>element</var>'s border box <a href="#ending-edges" title="ending edges">ending edge</a> in the
1067+
<a href="#block-flow-direction">block flow direction</a> with the <a href="#ending-edges" title="ending edges">ending edge</a> in the <a href="#block-flow-direction">block flow direction</a> of <var>box</var>.</li>
1068+
1069+
<li><p>Align <var>element</var>'s border box <a href="#beginning-edges" title="beginning edges">beginning edge</a> in the <a href="#inline-base-direction">inline base direction</a> with the
1070+
<a href="#beginning-edges" title="beginning edges">beginning edge</a> in the <a href="#inline-base-direction">inline base direction</a> of <var>box</var>.
1071+
<!-- This is wrong. It shouldn't scroll in the inline base direction if the element is visible. It should scroll just enough to make it fully visible. -->
10581072
</ol>
10591073

10601074
<li><p>If <var>position</var> is the same as <var>box</var>'s current scroll position, and <var>box</var> does not have an ongoing
@@ -1064,19 +1078,17 @@ <h3 id="element-scrolling-members"><span class="secno">7.2 </span><code title=""
10641078
<dl class="switch">
10651079
<dt>If <var>box</var> is associated with an element</dt>
10661080
<dd>
1067-
<p>Let <var>element</var> be the element.
1081+
<p>Let <var>associated element</var> be the element.
10681082
<p>Let <var>task</var> be these steps:
10691083
<ol>
10701084
<li><p><a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">Fire an event</a>
1071-
named <code title="">scroll</code> at the element
1072-
associated <var>box</var>.</p>
1085+
named <code title="">scroll</code> at <var>associated element</var>.</p>
10731086
</ol>
10741087
</dd>
10751088

10761089
<dt>If <var>box</var> is associated with a <a href="#viewport">viewport</a></dt>
10771090
<dd>
1078-
<p>Let <var>element</var> be the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code>'s root element as the associated element, if there is one, or
1079-
null otherwise.
1091+
<p>Let <var>associated element</var> be the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code>'s root element, if there is one, or null otherwise.
10801092
<p>Let <var>task</var> be these steps:
10811093
<ol>
10821094
<li><p><a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">Fire an event</a>
@@ -1087,15 +1099,14 @@ <h3 id="element-scrolling-members"><span class="secno">7.2 </span><code title=""
10871099
</dl>
10881100
</li>
10891101
<li><p><a href="#perform-a-scroll">Perform a scroll</a> of <var>box</var> to <var>position</var>, with the set of steps <var>task</var>,
1090-
<var>element</var> as the associated element and <var>behavior</var> as the scroll behavior.
1102+
<var>associated element</var> as the associated element and <var>behavior</var> as the scroll behavior.
10911103

10921104
</ol>
10931105

1094-
<p>To <dfn id="scroll-an-element">scroll an element</dfn> to <var>x</var>,<var>y</var> optionally with a scroll behavior <var>behavior</var> (which is <code title="">auto</code> if
1095-
omitted) means to:</p>
1106+
<p>To <dfn id="scroll-an-element">scroll an element</dfn> <var>element</var> to <var>x</var>,<var>y</var> optionally with a scroll behavior <var>behavior</var> (which is
1107+
<code title="">auto</code> if omitted) means to:</p>
10961108

10971109
<ol>
1098-
<li><p>Let <var>element</var> be the element.
10991110
<li><p>Let <var>box</var> be <var>element</var>'s associated scrolling box.
11001111
<li>
11011112
<dl class="switch">

cssom-view/Overview.src.html

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,19 @@ <h2>Terminology</h2>
372372
<dd><p>The bottom and left edges.
373373
</dl>
374374

375+
<p>The <dfn>ending edges</dfn> of a particular set of edges of a box or element are the following edges:
376+
377+
<dl class=switch>
378+
<dt>If the <span>overflow directions</span> are rightward and downward
379+
<dd><p>The bottom and right edges.
380+
<dt>If the <span>overflow directions</span> are leftward and downward
381+
<dd><p>The bottom and left edges.
382+
<dt>If the <span>overflow directions</span> are leftward and upward
383+
<dd><p>The top and left edges.
384+
<dt>If the <span>overflow directions</span> are rightward and upward
385+
<dd><p>The top and right edges.
386+
</dl>
387+
375388
<p>The term <dfn>CSS layout box</dfn> refers to the same term in CSS. For the purpose
376389
of the requirements in this specification, elements that have a computed value of the
377390
'display' property that is 'table-column' or
@@ -987,32 +1000,33 @@ <h3>The <code title>getClientRects()</code> and
9871000

9881001
<h3><code title>Element</code> Scrolling Members</h3>
9891002

990-
<p>To <dfn>scroll an element into view</dfn>, optionally with an <i>align to top flag</i> set, and optionally with a scroll behavior <var>behavior</var> (which
991-
is <code title>auto</code> if omitted), means to run these steps for each ancestor element or <span>viewport</span> that establishes a scrolling box
992-
<var>box</var>, in order of innermost to outermost scrolling box:</p>
1003+
<p>To <dfn>scroll an element into view</dfn> <var>element</var>, optionally with an <i>align to top flag</i> set, and optionally with a scroll behavior
1004+
<var>behavior</var> (which is <code title>auto</code> if omitted), means to run these steps for each ancestor element or <span>viewport</span> that establishes
1005+
a scrolling box <var>box</var>, in order of innermost to outermost scrolling box:</p>
9931006

9941007
<ol>
9951008
<li><p>If the <code data-anolis-spec=dom>Document</code> associated
996-
with the element to be
997-
scrolled into view is not <span data-anolis-spec=html>same origin</span> with the
1009+
with <var>element</var> is not <span data-anolis-spec=html>same origin</span> with the
9981010
<code data-anolis-spec=dom>Document</code> associated with the element or
9991011
<span>viewport</span> associated with <var>box</var>, terminate these
10001012
steps.</p></li>
10011013

10021014
<li><p>Let <var>position</var> be the scroll position <var>box</var> would have by following these steps:
10031015

10041016
<ol>
1005-
<li><p>If the <i>align to top flag</i> is set align the top of
1006-
the border box of the element to be scrolled into view with the top of
1007-
<var>box</var>.</p></li>
1017+
<li><p>If the <i>align to top flag</i> is set align <var>element</var>'s border box <span title="beginning edges">beginning edge</span> in the <span>block
1018+
flow direction</span> with the <span title="beginning edges">beginning edge</span> in the <span>block flow direction</span> of <var>box</var>.</p></li>
10081019

1009-
<li><p>Otherwise, if the <i>align to top flag</i> is not set
1020+
<li><p>Otherwise, the <i>align to top flag</i> is not set;
10101021
align the bottom of the border box of the element to be scrolled into
10111022
view with the bottom of <var>box</var>.</p></li>
10121023

1013-
<li><p>Align the left of the border box of the element to be scrolled
1014-
into view with the left of <var>box</var>.</p></li>
1015-
<!-- RTL is not special cased in implementations?! -->
1024+
<li><p>Otherwise, the <i>align to top flag</i> is not set; align <var>element</var>'s border box <span title="ending edges">ending edge</span> in the
1025+
<span>block flow direction</span> with the <span title="ending edges">ending edge</span> in the <span>block flow direction</span> of <var>box</var>.</p></li>
1026+
1027+
<li><p>Align <var>element</var>'s border box <span title="beginning edges">beginning edge</span> in the <span>inline base direction</span> with the
1028+
<span title="beginning edges">beginning edge</span> in the <span>inline base direction</span> of <var>box</var>.
1029+
<!-- This is wrong. It shouldn't scroll in the inline base direction if the element is visible. It should scroll just enough to make it fully visible. -->
10161030
</ol>
10171031

10181032
<li><p>If <var>position</var> is the same as <var>box</var>'s current scroll position, and <var>box</var> does not have an ongoing
@@ -1022,19 +1036,17 @@ <h3><code title>Element</code> Scrolling Members</h3>
10221036
<dl class=switch>
10231037
<dt>If <var>box</var> is associated with an element</dt>
10241038
<dd>
1025-
<p>Let <var>element</var> be the element.
1039+
<p>Let <var>associated element</var> be the element.
10261040
<p>Let <var>task</var> be these steps:
10271041
<ol>
10281042
<li><p><span data-anolis-spec=dom title=concept-event-fire>Fire an event</span>
1029-
named <code title>scroll</code> at the element
1030-
associated <var>box</var>.</p>
1043+
named <code title>scroll</code> at <var>associated element</var>.</p>
10311044
</ol>
10321045
</dd>
10331046

10341047
<dt>If <var>box</var> is associated with a <span>viewport</span></dt>
10351048
<dd>
1036-
<p>Let <var>element</var> be the <code data-anolis-spec=dom>Document</code>'s root element as the associated element, if there is one, or
1037-
null otherwise.
1049+
<p>Let <var>associated element</var> be the <code data-anolis-spec=dom>Document</code>'s root element, if there is one, or null otherwise.
10381050
<p>Let <var>task</var> be these steps:
10391051
<ol>
10401052
<li><p><span data-anolis-spec=dom title=concept-event-fire>Fire an event</span>
@@ -1045,15 +1057,14 @@ <h3><code title>Element</code> Scrolling Members</h3>
10451057
</dl>
10461058
</li>
10471059
<li><p><span>Perform a scroll</span> of <var>box</var> to <var>position</var>, with the set of steps <var>task</var>,
1048-
<var>element</var> as the associated element and <var>behavior</var> as the scroll behavior.
1060+
<var>associated element</var> as the associated element and <var>behavior</var> as the scroll behavior.
10491061

10501062
</ol>
10511063

1052-
<p>To <dfn>scroll an element</dfn> to <var>x</var>,<var>y</var> optionally with a scroll behavior <var>behavior</var> (which is <code title>auto</code> if
1053-
omitted) means to:</p>
1064+
<p>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
1065+
<code title>auto</code> if omitted) means to:</p>
10541066

10551067
<ol>
1056-
<li><p>Let <var>element</var> be the element.
10571068
<li><p>Let <var>box</var> be <var>element</var>'s associated scrolling box.
10581069
<li>
10591070
<dl class=switch>

0 commit comments

Comments
 (0)