Skip to content

Commit bac8cd9

Browse files
author
Simon Pieters
committed
[cssom-view] Make setting scrollTop/Left do nothing if there's no scrolling box
1 parent e227371 commit bac8cd9

2 files changed

Lines changed: 42 additions & 36 deletions

File tree

cssom-view/Overview.html

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<h1>CSSOM View Module</h1>
2727

28-
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 18 June 2013</h2>
28+
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 19 June 2013</h2>
2929

3030
<dl>
3131

@@ -92,7 +92,7 @@ <h2 class="no-num no-toc" id="sotd">Status of This Document</h2>
9292
can be found in the <a href="http://www.w3.org/TR/">W3C technical reports
9393
index at http://www.w3.org/TR/.</a></em>
9494

95-
<p>This is the 18 June 2013 Editor's Draft of CSSOM View. Please send
95+
<p>This is the 19 June 2013 Editor's Draft of CSSOM View. Please send
9696
comments to
9797
<a href="mailto:www-style@w3.org?subject=%5Bcssom-view%5D%20">www-style@w3.org</a>
9898
(<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
@@ -252,7 +252,7 @@ <h2 id="terminology"><span class="secno">3 </span>Terminology</h2>
252252
<p>A scrolling box of a <a href="#viewport">viewport</a> or element has two <dfn id="overflow-directions">overflow directions</dfn>, depending on the <a href="#viewport">viewport</a>'s or element's
253253
<a href="#block-flow-direction">block flow direction</a> and <a href="#inline-base-direction">inline base direction</a>, as follows:
254254

255-
<dl>
255+
<dl class="switch">
256256
<dt>If the <a href="#block-flow-direction">block flow direction</a> is top-to-bottom and the <a href="#inline-base-direction">inline base direction</a> is left-to-right
257257
<dt>If the <a href="#block-flow-direction">block flow direction</a> is left-to-right and the <a href="#inline-base-direction">inline base direction</a> is left-to-right
258258
<dd><p>Rightward and downward.
@@ -882,7 +882,7 @@ <h2 id="extensions-to-the-element-interface"><span class="secno">7 </span>Extens
882882

883883
<p>The <dfn id="dom-element-scrollintoview" title="dom-Element-scrollIntoView"><code>scrollIntoView(<var>top</var>, <var>options</var>)</code></dfn> method must run these steps:</p>
884884
<ol>
885-
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a> terminate these steps.</li>
885+
<li><p>If the element does not have any associated <a href="#layout-box">layout box</a> terminate these steps.</li>
886886
<li><p><a href="#scroll-an-element-into-view" title="scroll an element into view">Scroll the element into view</a> with the
887887
<i>align to top flag</i> set if <var>top</var> is true, and the scroll behavior being the value of the <code title="">behavior</code>
888888
dictionary member of <var>options</var>.</li>
@@ -911,8 +911,8 @@ <h2 id="extensions-to-the-element-interface"><span class="secno">7 </span>Extens
911911
let <var>y</var> be the given value.</li>
912912
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a>, the
913913
element is the root element and the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is in
914-
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, or the element has no overflow, terminate these
915-
steps.</li>
914+
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, or the element has no associated scrolling box, or the element has no overflow,
915+
terminate these steps.</li>
916916
<li><p>If the element is the root element invoke
917917
<code title="dom-Window-scroll"><a href="#dom-window-scroll">scroll()</a></code> with zero as first
918918
argument and <var>y</var> as second, and, if the given value is a <code><a href="#scrolloptions">ScrollOptions</a></code> object, the given value as the third argument.</li>
@@ -949,8 +949,8 @@ <h2 id="extensions-to-the-element-interface"><span class="secno">7 </span>Extens
949949
let <var>x</var> be the given value.</li>
950950
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a>, the
951951
element is the root element and the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is in
952-
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, or the element has no overflow, terminate these
953-
steps.</li>
952+
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, or the element has no associated scrolling box, or the element has no overflow,
953+
terminate these steps.</li>
954954
<li><p>If the element is the root element invoke
955955
<code title="dom-Window-scroll"><a href="#dom-window-scroll">scroll()</a></code> with
956956
<var>x</var> as first argument and zero as second, and, if the given value is a <code><a href="#scrolloptions">ScrollOptions</a></code> object, the given value as the third
@@ -1047,7 +1047,7 @@ <h3 id="element-scrolling-members"><span class="secno">7.2 </span><code title=""
10471047

10481048
<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
10491049
<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
1050-
a scrolling box <var>box</var>, in order of innermost to outermost scrolling box:</p>
1050+
a scrolling box <var>scrolling box</var>, in order of innermost to outermost scrolling box:</p>
10511051

10521052
<ol>
10531053
<li><p>If the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> associated
@@ -1056,50 +1056,56 @@ <h3 id="element-scrolling-members"><span class="secno">7.2 </span><code title=""
10561056
<a href="#viewport">viewport</a> associated with <var>box</var>, terminate these
10571057
steps.</li>
10581058

1059-
<li><p>Let <var>box edge A</var> be 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>, and let
1060-
<var>element edge A</var> be <var>element</var>'s border box edge on the same physical side as that of <var>box edge A</var>.
1059+
<li><p>Let <var>element bounding border box</var> be the box that the return value of invoking
1060+
<code title="dom-Element-getBoundingClientRect"><a href="#dom-element-getboundingclientrect">getBoundingClientRect()</a></code> on <var>element</var> represents.
10611061

1062-
<li><p>Let <var>box edge B</var> be 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>, and let
1063-
<var>element edge B</var> be <var>element</var>'s border box edge on the same physical side as that of <var>box edge B</var>.
1062+
<li><p>Let <var>scrolling box edge A</var> be the <a href="#beginning-edges" title="beginning edges">beginning edge</a> in the <a href="#block-flow-direction">block flow direction</a> of
1063+
<var>scrolling box</var>, and let <var>element edge A</var> be <var>element bounding border box</var>'s edge on the same physical side as that of
1064+
<var>scrolling box edge A</var>.
1065+
1066+
<li><p>Let <var>scrolling box edge B</var> be the <a href="#ending-edges" title="ending edges">ending edge</a> in the <a href="#block-flow-direction">block flow direction</a> of <var>scrolling
1067+
box</var>, and let <var>element edge B</var> be <var>element bounding border box</var>'s edge on the same physical side as that of <var>scrolling box edge
1068+
B</var>.
10641069

1065-
<li><p>Let <var>box edge C</var> be the <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>, and
1066-
let <var>element edge C</var> be <var>element</var>'s border box edge on the same physical side as that of <var>box edge C</var>.
1070+
<li><p>Let <var>scrolling box edge C</var> be the <a href="#beginning-edges" title="beginning edges">beginning edge</a> in the <a href="#inline-base-direction">inline base direction</a> of
1071+
<var>scrolling box</var>, and let <var>element edge C</var> be <var>element bounding border box</var>'s edge on the same physical side as that of
1072+
<var>scrolling box edge C</var>.
10671073

1068-
<li><p>Let <var>box edge D</var> be the <a href="#ending-edges" title="ending edges">ending edge</a> in the <a href="#inline-base-direction">inline base direction</a> of <var>box</var>, and let
1069-
<var>element edge D</var> be <var>element</var>'s border box edge on the same physical side as that of <var>box edge D</var>.
1074+
<li><p>Let <var>scrolling box edge D</var> be the <a href="#ending-edges" title="ending edges">ending edge</a> in the <a href="#inline-base-direction">inline base direction</a> of <var>scrolling
1075+
box</var>, and let <var>element edge D</var> be <var>element bounding border box</var>'s edge on the same physical side as that of <var>box edge D</var>.
10701076

10711077
<li><p>Let <var>element width</var> be the distance between <var>element edge C</var> and <var>element edge D</var>.
10721078

1073-
<li><p>Let <var>box width</var> be the distance between <var>box edge C</var> and <var>box edge D</var>.
1079+
<li><p>Let <var>scrolling box width</var> be the distance between <var>scrolling box edge C</var> and <var>scrolling box edge D</var>.
10741080

1075-
<li><p>Let <var>position</var> be the scroll position <var>box</var> would have by following these steps:
1081+
<li><p>Let <var>position</var> be the scroll position <var>scrolling box</var> would have by following these steps:
10761082

10771083
<ol>
1078-
<li><p>If the <i>align to top flag</i> is set align <var>element edge A</var> with <var>box edge A</var>.</li>
1084+
<li><p>If the <i>align to top flag</i> is set align <var>element edge A</var> with <var>scrolling box edge A</var>.</li>
10791085

1080-
<li><p>Otherwise, the <i>align to top flag</i> is not set; align <var>element edge B</var> with <var>box edge B</var>.</li>
1086+
<li><p>Otherwise, the <i>align to top flag</i> is not set; align <var>element edge B</var> with <var>scrolling box edge B</var>.</li>
10811087

10821088
<li>
10831089
<dl class="switch">
1084-
<dt>If <var>element edge C</var> and <var>element edge D</var> are both outside <var>box edge C</var> and <var>box edge D</var>
1090+
<dt>If <var>element edge C</var> and <var>element edge D</var> are both outside <var>scrolling box edge C</var> and <var>scrolling box edge D</var>
10851091
<dd><p>Do nothing.
10861092

1087-
<dt>If <var>element edge C</var> is outside <var>box edge C</var> and <var>element width</var> is less than <var>box width</var>
1088-
<dt>If <var>element edge D</var> is outside <var>box edge D</var> and <var>element width</var> is greater than <var>box width</var>
1089-
<dd><p>Align <var>element edge C</var> with <var>box edge C</var>.
1093+
<dt>If <var>element edge C</var> is outside <var>scrolling box edge C</var> and <var>element width</var> is less than <var>scrolling box width</var>
1094+
<dt>If <var>element edge D</var> is outside <var>scrolling box edge D</var> and <var>element width</var> is greater than <var>scrolling box width</var>
1095+
<dd><p>Align <var>element edge C</var> with <var>scrolling box edge C</var>.
10901096

1091-
<dt>If <var>element edge C</var> is outside <var>box edge C</var> and <var>element width</var> is greater than <var>box width</var>
1092-
<dt>If <var>element edge D</var> is outside <var>box edge D</var> and <var>element width</var> is less than <var>box width</var>
1093-
<dd><p>Align <var>element edge D</var> with <var>box edge D</var>.
1097+
<dt>If <var>element edge C</var> is outside <var>scrolling box edge C</var> and <var>element width</var> is greater than <var>scrolling box width</var>
1098+
<dt>If <var>element edge D</var> is outside <var>scrolling box edge D</var> and <var>element width</var> is less than <var>scrolling box width</var>
1099+
<dd><p>Align <var>element edge D</var> with <var>scrolling box edge D</var>.
10941100
</dl>
10951101
</ol>
10961102

1097-
<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
1103+
<li><p>If <var>position</var> is the same as <var>scrolling box</var>'s current scroll position, and <var>scrolling box</var> does not have an ongoing
10981104
<a href="#concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</a>, abort these steps.
10991105

11001106
<li>
11011107
<dl class="switch">
1102-
<dt>If <var>box</var> is associated with an element</dt>
1108+
<dt>If <var>scrolling box</var> is associated with an element</dt>
11031109
<dd>
11041110
<p>Let <var>associated element</var> be the element.
11051111
<p>Let <var>task</var> be these steps:
@@ -1109,7 +1115,7 @@ <h3 id="element-scrolling-members"><span class="secno">7.2 </span><code title=""
11091115
</ol>
11101116
</dd>
11111117

1112-
<dt>If <var>box</var> is associated with a <a href="#viewport">viewport</a></dt>
1118+
<dt>If <var>scrolling box</var> is associated with a <a href="#viewport">viewport</a></dt>
11131119
<dd>
11141120
<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.
11151121
<p>Let <var>task</var> be these steps:
@@ -1121,7 +1127,7 @@ <h3 id="element-scrolling-members"><span class="secno">7.2 </span><code title=""
11211127
</dd>
11221128
</dl>
11231129
</li>
1124-
<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>,
1130+
<li><p><a href="#perform-a-scroll">Perform a scroll</a> of <var>scrolling box</var> to <var>position</var>, with the set of steps <var>task</var>,
11251131
<var>associated element</var> as the associated element and <var>behavior</var> as the scroll behavior.
11261132

11271133
</ol>

cssom-view/Overview.src.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -873,8 +873,8 @@ <h2>Extensions to the <code title>Element</code> Interface</h2>
873873
let <var>y</var> be the given value.</p></li>
874874
<li><p>If the element does not have any associated <span>CSS layout box</span>, the
875875
element is the root element and the <code data-anolis-spec=dom>Document</code> is in
876-
<span data-anolis-spec=dom title=concept-document-quirks>quirks mode</span>, or the element has no overflow, terminate these
877-
steps.</p></li>
876+
<span data-anolis-spec=dom title=concept-document-quirks>quirks mode</span>, or the element has no associated scrolling box, or the element has no overflow,
877+
terminate these steps.</p></li>
878878
<li><p>If the element is the root element invoke
879879
<code title=dom-Window-scroll>scroll()</code> with zero as first
880880
argument and <var>y</var> as second, and, if the given value is a <code>ScrollOptions</code> object, the given value as the third argument.</p></li>
@@ -911,8 +911,8 @@ <h2>Extensions to the <code title>Element</code> Interface</h2>
911911
let <var>x</var> be the given value.</p></li>
912912
<li><p>If the element does not have any associated <span>CSS layout box</span>, the
913913
element is the root element and the <code data-anolis-spec=dom>Document</code> is in
914-
<span data-anolis-spec=dom title=concept-document-quirks>quirks mode</span>, or the element has no overflow, terminate these
915-
steps.</p></li>
914+
<span data-anolis-spec=dom title=concept-document-quirks>quirks mode</span>, or the element has no associated scrolling box, or the element has no overflow,
915+
terminate these steps.</p></li>
916916
<li><p>If the element is the root element invoke
917917
<code title=dom-Window-scroll>scroll()</code> with
918918
<var>x</var> as first argument and zero as second, and, if the given value is a <code>ScrollOptions</code> object, the given value as the third

0 commit comments

Comments
 (0)