Skip to content

Commit f5ad4f3

Browse files
author
Simon Pieters
committed
[cssom-view] Support upward scroll direction in scrolling APIs
1 parent c90df7e commit f5ad4f3

2 files changed

Lines changed: 66 additions & 32 deletions

File tree

cssom-view/Overview.html

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -549,21 +549,28 @@ <h2 id="extensions-to-the-window-interface"><span class="secno">5 </span>Extensi
549549
steps must be run:</p>
550550
<ol>
551551
<li><p>If there is no <a href="#viewport">viewport</a>, abort these steps.
552+
<li><p>Let <var title="">viewport width</var> be the width of the <a href="#viewport">viewport</a> excluding the width of the scroll bar, if any.
553+
<li><p>Let <var title="">viewport height</var> be the height of the <a href="#viewport">viewport</a> excluding the height of the scroll bar, if any.
554+
<li>
552555
<dl class="switch">
553556
<dt>If the <a href="#viewport">viewport</a> has rightward <a href="#overflow-directions" title="overflow directions">overflow direction</a>
554557
<dd><p>Let <var title="">x</var> be max(0, min(<var title="">x</var>,
555-
<a href="#scrolling-area">scrolling area</a> width - <a href="#padding-edge">padding edge</a>
556-
width)).</dd>
558+
<a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a> width - <var title="">viewport width</var>)).</dd>
557559
<dt>If the <a href="#viewport">viewport</a> has leftward <a href="#overflow-directions" title="overflow directions">overflow direction</a>
558560
<dd><p>Let <var title="">x</var> be min(0, max(<var title="">x</var>,
559-
<a href="#padding-edge">padding edge</a> width - <a href="#scrolling-area">scrolling area</a>
561+
<var title="">viewport width</var> - <a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a>
560562
width)).</dd>
561563
</dl>
562-
</li>
563-
<!-- XXX support upward overflow -->
564-
<li><p>Let <var title="">y</var> be max(0, min(<var title="">y</var>,
565-
<a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a> height - <a href="#viewport">viewport</a>
566-
height excluding the size of a rendered scroll bar (if any))).</li>
564+
<li>
565+
<dl class="switch">
566+
<dt>If the <a href="#viewport">viewport</a> has downward <a href="#overflow-directions" title="overflow directions">overflow direction</a>
567+
<dd><p>Let <var title="">y</var> be max(0, min(<var title="">y</var>,
568+
<a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a> height - <var title="">viewport height</var>)).</dd>
569+
<dt>If the <a href="#viewport">viewport</a> has upward <a href="#overflow-directions" title="overflow directions">overflow direction</a>
570+
<dd><p>Let <var title="">y</var> be min(0, max(<var title="">y</var>,
571+
<var title="">viewport height</var> - <a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a>
572+
height)).</dd>
573+
</dl>
567574
<li><p>Let <var title="">position</var> be the scroll position the <a href="#viewport">viewport</a> would have by aligning the x-coordinate <var title="">x</var> of the
568575
<a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a> with the left of the <a href="#viewport">viewport</a> and aligning the y-coordinate <var title="">y</var> of the
569576
<a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a> with the top of the <a href="#viewport">viewport</a>.
@@ -1087,20 +1094,30 @@ <h3 id="element-scrolling-members"><span class="secno">7.2 </span><code title=""
10871094
<dt>If <var title="">box</var> has rightward <a href="#overflow-directions" title="overflow directions">overflow direction</a></dt>
10881095

10891096
<dd><p>Let <var title="">x</var> be max(0, min(<var title="">x</var>,
1090-
<a href="#scrolling-area">scrolling area</a> width -
1091-
<a href="#padding-edge">padding edge</a> width)).</dd>
1097+
<var title="">element</var> <a href="#scrolling-area">scrolling area</a> width -
1098+
<var title="">element</var> <a href="#padding-edge">padding edge</a> width)).</dd>
10921099

10931100
<dt>If <var title="">box</var> has leftward <a href="#overflow-directions" title="overflow directions">overflow direction</a></dt>
10941101

10951102
<dd><p>Let <var title="">x</var> be min(0, max(<var title="">x</var>,
1096-
<a href="#padding-edge">padding edge</a> width -
1097-
<a href="#scrolling-area">scrolling area</a> width)).</dd>
1103+
<var title="">element</var> <a href="#padding-edge">padding edge</a> width -
1104+
<var title="">element</var> <a href="#scrolling-area">scrolling area</a> width)).</dd>
10981105
</dl>
1099-
</li>
11001106

1101-
<!-- XXX support upward overflow -->
1102-
<li><p>Let <var title="">y</var> be max(0, min(<var title="">y</var>,
1103-
<a href="#scrolling-area">scrolling area</a> height - <a href="#padding-edge">padding edge</a> height)).</li>
1107+
<li>
1108+
<dl class="switch">
1109+
<dt>If <var title="">box</var> has downward <a href="#overflow-directions" title="overflow directions">overflow direction</a></dt>
1110+
1111+
<dd><p>Let <var title="">y</var> be max(0, min(<var title="">y</var>,
1112+
<var title="">element</var> <a href="#scrolling-area">scrolling area</a> height -
1113+
<var title="">element</var> <a href="#padding-edge">padding edge</a> height)).</dd>
1114+
1115+
<dt>If <var title="">box</var> has upward <a href="#overflow-directions" title="overflow directions">overflow direction</a></dt>
1116+
1117+
<dd><p>Let <var title="">y</var> be min(0, max(<var title="">y</var>,
1118+
<var title="">element</var> <a href="#padding-edge">padding edge</a> height -
1119+
<var title="">element</var> <a href="#scrolling-area">scrolling area</a> height)).</dd>
1120+
</dl>
11041121

11051122
<li><p>Let <var title="">position</var> be the scroll position <var title="">box</var> would have by aligning <a href="#scrolling-area">scrolling area</a> x-coordinate
11061123
<var title="">x</var> with the left of <var title="">box</var> and aligning <a href="#scrolling-area">scrolling area</a> y-coordinate <var title="">y</var> with

cssom-view/Overview.src.html

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -517,21 +517,28 @@ <h2>Extensions to the <code title>Window</code> Interface</h2>
517517
steps must be run:</p>
518518
<ol>
519519
<li><p>If there is no <span>viewport</span>, abort these steps.
520+
<li><p>Let <var title>viewport width</var> be the width of the <span>viewport</span> excluding the width of the scroll bar, if any.
521+
<li><p>Let <var title>viewport height</var> be the height of the <span>viewport</span> excluding the height of the scroll bar, if any.
522+
<li>
520523
<dl class=switch>
521524
<dt>If the <span>viewport</span> has rightward <span title="overflow directions">overflow direction</span>
522525
<dd><p>Let <var title>x</var> be max(0, min(<var title>x</var>,
523-
<span>scrolling area</span> width - <span>padding edge</span>
524-
width)).</p></dd>
526+
<span>viewport</span> <span>scrolling area</span> width - <var title>viewport width</var>)).</p></dd>
525527
<dt>If the <span>viewport</span> has leftward <span title="overflow directions">overflow direction</span>
526528
<dd><p>Let <var title>x</var> be min(0, max(<var title>x</var>,
527-
<span>padding edge</span> width - <span>scrolling area</span>
529+
<var title>viewport width</var> - <span>viewport</span> <span>scrolling area</span>
528530
width)).</p></dd>
529531
</dl>
530-
</li>
531-
<!-- XXX support upward overflow -->
532-
<li><p>Let <var title>y</var> be max(0, min(<var title>y</var>,
533-
<span>viewport</span> <span>scrolling area</span> height - <span>viewport</span>
534-
height excluding the size of a rendered scroll bar (if any))).</p></li>
532+
<li>
533+
<dl class=switch>
534+
<dt>If the <span>viewport</span> has downward <span title="overflow directions">overflow direction</span>
535+
<dd><p>Let <var title>y</var> be max(0, min(<var title>y</var>,
536+
<span>viewport</span> <span>scrolling area</span> height - <var title>viewport height</var>)).</p></dd>
537+
<dt>If the <span>viewport</span> has upward <span title="overflow directions">overflow direction</span>
538+
<dd><p>Let <var title>y</var> be min(0, max(<var title>y</var>,
539+
<var title>viewport height</var> - <span>viewport</span> <span>scrolling area</span>
540+
height)).</p></dd>
541+
</dl>
535542
<li><p>Let <var title>position</var> be the scroll position the <span>viewport</span> would have by aligning the x-coordinate <var title>x</var> of the
536543
<span>viewport</span> <span>scrolling area</span> with the left of the <span>viewport</span> and aligning the y-coordinate <var title>y</var> of the
537544
<span>viewport</span> <span>scrolling area</span> with the top of the <span>viewport</span>.
@@ -1053,20 +1060,30 @@ <h3><code title>Element</code> Scrolling Members</h3>
10531060
<dt>If <var title>box</var> has rightward <span title="overflow directions">overflow direction</span></dt>
10541061

10551062
<dd><p>Let <var title>x</var> be max(0, min(<var title>x</var>,
1056-
<span>scrolling area</span> width -
1057-
<span>padding edge</span> width)).</p></dd>
1063+
<var title>element</var> <span>scrolling area</span> width -
1064+
<var title>element</var> <span>padding edge</span> width)).</p></dd>
10581065

10591066
<dt>If <var title>box</var> has leftward <span title="overflow directions">overflow direction</span></dt>
10601067

10611068
<dd><p>Let <var title>x</var> be min(0, max(<var title>x</var>,
1062-
<span>padding edge</span> width -
1063-
<span>scrolling area</span> width)).</p></dd>
1069+
<var title>element</var> <span>padding edge</span> width -
1070+
<var title>element</var> <span>scrolling area</span> width)).</p></dd>
10641071
</dl>
1065-
</li>
10661072

1067-
<!-- XXX support upward overflow -->
1068-
<li><p>Let <var title>y</var> be max(0, min(<var title>y</var>,
1069-
<span>scrolling area</span> height - <span>padding edge</span> height)).</p></li>
1073+
<li>
1074+
<dl class=switch>
1075+
<dt>If <var title>box</var> has downward <span title="overflow directions">overflow direction</span></dt>
1076+
1077+
<dd><p>Let <var title>y</var> be max(0, min(<var title>y</var>,
1078+
<var title>element</var> <span>scrolling area</span> height -
1079+
<var title>element</var> <span>padding edge</span> height)).</p></dd>
1080+
1081+
<dt>If <var title>box</var> has upward <span title="overflow directions">overflow direction</span></dt>
1082+
1083+
<dd><p>Let <var title>y</var> be min(0, max(<var title>y</var>,
1084+
<var title>element</var> <span>padding edge</span> height -
1085+
<var title>element</var> <span>scrolling area</span> height)).</p></dd>
1086+
</dl>
10701087

10711088
<li><p>Let <var title>position</var> be the scroll position <var title>box</var> would have by aligning <span>scrolling area</span> x-coordinate
10721089
<var title>x</var> with the left of <var title>box</var> and aligning <span>scrolling area</span> y-coordinate <var title>y</var> with

0 commit comments

Comments
 (0)