Skip to content

Commit bd0c28a

Browse files
author
Simon Pieters
committed
[cssom-view] Make scrollTop/Left/Width/Height make more sense. Also make scrollable body work properly in quirks mode. https://www.w3.org/Bugs/Public/show_bug.cgi?id=23603
1 parent 77cfce3 commit bd0c28a

2 files changed

Lines changed: 68 additions & 66 deletions

File tree

cssom-view/Overview.html

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<h1>CSSOM View Module</h1>
1818

19-
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 21 October 2013</h2>
19+
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 23 October 2013</h2>
2020

2121
<dl>
2222

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

86-
<p>This is the 21 October 2013 Editor's Draft of CSSOM View. Please send
86+
<p>This is the 23 October 2013 Editor's Draft of CSSOM View. Please send
8787
comments to
8888
<a href="mailto:www-style@w3.org?subject=%5Bcssom-view%5D%20">www-style@w3.org</a>
8989
(<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
@@ -1083,16 +1083,17 @@ <h2 id="extensions-to-the-element-interface"><span class="secno">7 </span>Extens
10831083
<li><p>Optionally perform some other action that brings the element to the user's attention.
10841084
</ol>
10851085

1086-
<p>The <dfn id="dom-element-scrolltop" title="dom-Element-scrollTop"><code>scrollTop</code></dfn> attribute must return the result of running these steps:</p>
1086+
<p>The <dfn id="dom-element-scrolltop" title="dom-Element-scrollTop"><code>scrollTop</code></dfn> attribute, on getting, must return the result of running these steps:</p>
10871087
<ol>
1088-
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a> or the
1089-
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
1090-
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a> return zero and terminate these steps.</li>
1088+
<li><p>If the 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
1089+
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, return zero and terminate these steps.</li>
10911090
<li><p>If the element is the root element return the value of
10921091
<code title="dom-Window-scrollY"><a href="#dom-window-scrolly">scrollY</a></code>.</li>
10931092
<li><p>If the element is <a href="#the-html-body-element">the HTML <code title="">body</code> element</a>,
1094-
the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is in <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, return the value of
1093+
the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is in <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, and the element does not have
1094+
an associated <a href="#scrolling-box">scrolling box</a>, return the value of
10951095
<code title="dom-Window-scrollY"><a href="#dom-window-scrolly">scrollY</a></code>.</li>
1096+
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a>, return zero and terminate these steps.</li>
10961097
<li><p>Return the y-coordinate of the <a href="#scrolling-area">scrolling area</a> at the
10971098
alignment point with the top of the <a href="#padding-edge">padding edge</a> of the
10981099
element.</li>
@@ -1102,34 +1103,36 @@ <h2 id="extensions-to-the-element-interface"><span class="secno">7 </span>Extens
11021103
<li><p>If the given value is a <code><a href="#scrolloptionsvertical">ScrollOptionsVertical</a></code> object, and the <code title="">y</code> dictionary member is not present, abort these steps.
11031104
<li><p>If the given value is a <code><a href="#scrolloptionsvertical">ScrollOptionsVertical</a></code> object, let <var>y</var> be the value of the <code title="">y</code> dictionary member.
11041105
Otherwise, let <var>y</var> be the given value.</li>
1105-
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a>, the
1106-
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
1107-
<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 <a href="#scrolling-box">scrolling box</a>, or the element has no
1108-
overflow, terminate these steps.</li>
1106+
<li><p>If the 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
1107+
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, terminate these steps.</li>
11091108
<li><p>If the element is the root element invoke
11101109
<code title="dom-Window-scroll"><a href="#dom-window-scroll">scroll()</a></code> with <code title="dom-Window-scrollX"><a href="#dom-window-scrollx">scrollX</a></code> as first
11111110
argument and <var>y</var> as second, and, if the given value is a <code><a href="#scrolloptionsvertical">ScrollOptionsVertical</a></code> object, the given value as the third argument.</li>
11121111
<li><p>If the element is <a href="#the-html-body-element">the HTML <code title="">body</code> element</a>,
11131112
the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is in <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, and the element
1114-
does not have any vertical overflow, invoke
1113+
does not have an associated <a href="#scrolling-box">scrolling box</a>, invoke
11151114
<code title="dom-Window-scroll"><a href="#dom-window-scroll">scroll()</a></code> with
11161115
<code title="dom-Window-scrollX"><a href="#dom-window-scrollx">scrollX</a></code> as first
1117-
argument and <var>y</var> as second, and, if the given value is a <code><a href="#scrolloptionsvertical">ScrollOptionsVertical</a></code> object, the given value as the third argument.</li>
1116+
argument and <var>y</var> as second, and, if the given value is a <code><a href="#scrolloptionsvertical">ScrollOptionsVertical</a></code> object, the given value as the third argument, and
1117+
terminate these steps.</li>
1118+
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a>, the element has no associated <a href="#scrolling-box">scrolling box</a>, or the element has no
1119+
overflow, terminate these steps.</li>
11181120
<li><p><a href="#scroll-an-element" title="scroll an element">Scroll the element</a> to
11191121
<code title="dom-Element-scrollLeft"><a href="#dom-element-scrollleft">scrollLeft</a></code>,<var>y</var>, with the scroll behavior being the value of the <code title="">behavior</code> dictionary
11201122
member if the given value is a <code><a href="#scrolloptionsvertical">ScrollOptionsVertical</a></code> object, or <code title="">auto</code> otherwise.
11211123
</ol>
11221124

1123-
<p>The <dfn id="dom-element-scrollleft" title="dom-Element-scrollLeft"><code>scrollLeft</code></dfn> attribute must return the result of running these steps:</p>
1125+
<p>The <dfn id="dom-element-scrollleft" title="dom-Element-scrollLeft"><code>scrollLeft</code></dfn> attribute, on getting, must return the result of running these steps:</p>
11241126
<ol>
1125-
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a> or the
1126-
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
1127-
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a> return zero and terminate these steps.</li>
1127+
<li><p>If the 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
1128+
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, return zero and terminate these steps.</li>
11281129
<li><p>If the element is the root element return the value of
11291130
<code title="dom-Window-scrollX"><a href="#dom-window-scrollx">scrollX</a></code>.</li>
11301131
<li><p>If the element is <a href="#the-html-body-element">the HTML <code title="">body</code> element</a>,
1131-
the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is in <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, return the value of
1132+
the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is in <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, and the element does not have
1133+
an associated <a href="#scrolling-box">scrolling box</a>, return the value of
11321134
<code title="dom-Window-scrollX"><a href="#dom-window-scrollx">scrollX</a></code>.</li>
1135+
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a>, return zero and terminate these steps.</li>
11331136
<li><p>Return the x-coordinate of the <a href="#scrolling-area">scrolling area</a> at the
11341137
alignment point with the left of the <a href="#padding-edge">padding edge</a> of the
11351138
element.</li>
@@ -1139,57 +1142,55 @@ <h2 id="extensions-to-the-element-interface"><span class="secno">7 </span>Extens
11391142
<li><p>If the given value is a <code><a href="#scrolloptionshorizontal">ScrollOptionsHorizontal</a></code> object, and the <code title="">x</code> dictionary member is not present, abort these steps.
11401143
<li><p>If the given value is a <code><a href="#scrolloptionshorizontal">ScrollOptionsHorizontal</a></code> object, let <var>x</var> be the value of the <code title="">x</code> dictionary member.
11411144
Otherwise, let <var>x</var> be the given value.</li>
1142-
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a>, the
1143-
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
1144-
<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 <a href="#scrolling-box">scrolling box</a>, or the element has no
1145-
overflow, terminate these steps.</li>
1145+
<li><p>If the 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
1146+
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, terminate these steps.</li>
11461147
<li><p>If the element is the root element invoke
11471148
<code title="dom-Window-scroll"><a href="#dom-window-scroll">scroll()</a></code> with
11481149
<var>x</var> as first argument and <code title="dom-Window-scrollY"><a href="#dom-window-scrolly">scrollY</a></code> as second, and, if the given value is a <code><a href="#scrolloptionshorizontal">ScrollOptionsHorizontal</a></code>
11491150
object, the given value as the third argument.</li>
11501151
<li><p>If the element is <a href="#the-html-body-element">the HTML <code title="">body</code> element</a>,
11511152
the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is in <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>, and the element
1152-
does not have any vertical overflow, invoke
1153+
does not have an associated <a href="#scrolling-box">scrolling box</a>, invoke
11531154
<code title="dom-Window-scroll"><a href="#dom-window-scroll">scroll()</a></code> with
11541155
<var>x</var> as first argument and
11551156
<code title="dom-Window-scrollY"><a href="#dom-window-scrolly">scrollY</a></code> as second, and, if the given value is a <code><a href="#scrolloptionshorizontal">ScrollOptionsHorizontal</a></code> object, the given value as the third
1156-
argument.</li>
1157+
argument, and terminate these steps.</li>
1158+
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a>, the element has no associated <a href="#scrolling-box">scrolling box</a>, or the element has no
1159+
overflow, terminate these steps.</li>
11571160
<li><p><a href="#scroll-an-element" title="Scroll an element">Scroll the element</a> to
11581161
<var>x</var>,<code title="dom-Element-scrollTop"><a href="#dom-element-scrolltop">scrollTop</a></code>, with the scroll behavior being the value of the <code title="">behavior</code> dictionary
11591162
member if the given value is a <code><a href="#scrolloptionshorizontal">ScrollOptionsHorizontal</a></code> object, or <code title="">auto</code> otherwise.
11601163
</ol>
11611164

11621165
<p>The <dfn id="dom-element-scrollwidth" title="dom-Element-scrollWidth"><code>scrollWidth</code></dfn> attribute must return the result of running these steps:</p>
11631166
<ol>
1164-
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a> return
1165-
zero and terminate these steps.</li>
11661167
<li><p>Let <var>viewport width</var> be the width of the <a href="#viewport">viewport</a> excluding the width of the scroll bar, if any, or zero if there is no
11671168
<a href="#viewport">viewport</a>.
11681169
<li><p>If the element is the root element and the
11691170
<code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is not in
11701171
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>
11711172
return max(<a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a> width, <var>viewport width</var>).</li>
1172-
<li><p>If the element is <a href="#the-html-body-element">the HTML <code title="">body</code> element</a>
1173-
and the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is in
1174-
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>
1173+
<li><p>If the element is <a href="#the-html-body-element">the HTML <code title="">body</code> element</a>, the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is in
1174+
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a> and the element has no associated <a href="#scrolling-box">scrolling box</a>,
11751175
return max(<a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a> width, <var>viewport width</var>).</li>
1176+
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a> return
1177+
zero and terminate these steps.</li>
11761178
<li><p>Return the width of the element's <a href="#scrolling-area">scrolling area</a>.</li>
11771179
</ol>
11781180

11791181
<p>The <dfn id="dom-element-scrollheight" title="dom-Element-scrollHeight"><code>scrollHeight</code></dfn> attribute must return the result of running these steps:</p>
11801182
<ol>
1181-
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a> return
1182-
zero and terminate these steps.</li>
11831183
<li><p>Let <var>viewport height</var> be the height of the <a href="#viewport">viewport</a> excluding the height of the scroll bar, if any, or zero if there is no
11841184
<a href="#viewport">viewport</a>.
11851185
<li><p>If the element is the root element and the
11861186
<code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is not in
11871187
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>
11881188
return max(<a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a> height, <var>viewport height</var>).</li>
1189-
<li><p>If the element is <a href="#the-html-body-element">the HTML <code title="">body</code> element</a>
1190-
and the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is in
1191-
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a>
1189+
<li><p>If the element is <a href="#the-html-body-element">the HTML <code title="">body</code> element</a>, the <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#document">Document</a></code> is in
1190+
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-document-quirks" title="concept-document-quirks">quirks mode</a> and the element has no associated <a href="#scrolling-box">scrolling box</a>,
11921191
return max(<a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a> height, <var>viewport height</var>).</li>
1192+
<li><p>If the element does not have any associated <a href="#css-layout-box">CSS layout box</a> return
1193+
zero and terminate these steps.</li>
11931194
<li><p>Return the height of the element's <a href="#scrolling-area">scrolling area</a>.</li>
11941195
</ol>
11951196

0 commit comments

Comments
 (0)