Skip to content

Commit b02ad91

Browse files
committed
[cssom-view] Tweak the check for 'is body scrollable?' to better match Gecko. Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=28487
1 parent ad098d6 commit b02ad91

2 files changed

Lines changed: 22 additions & 8 deletions

File tree

cssom-view/Overview.bs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ spec:css-display-3; type:value; for:display; text:table
8181
spec:css-position-3; type:property; text:position
8282
</pre>
8383

84+
<script src=https://resources.whatwg.org/file-bug.js async></script>
85+
8486
Background {#background}
8587
========================
8688

@@ -115,6 +117,16 @@ HTML.
115117
Elements and <a>viewports</a> have an associated <dfn>scrolling box</dfn> if has a scrolling mechanism<!--XXX xref--> or it overflows
116118
its content area<!--XXX xref--> and the used value of the 'overflow-x' or 'overflow-y' property is ''overflow/hidden''. [[!CSS3-BOX]]
117119

120+
An element is <dfn>potentially scrollable</dfn> if all of the following conditions are true:
121+
122+
* The element has an associated <a>CSS layout box</a>.
123+
* The element is not <a>the HTML <code>body</code> element</a>, or it is and
124+
the root element's used value of the 'overflow-x' or 'overflow-y' properties is not ''overflow/visible''.
125+
* The element's used value of the 'overflow-x' or 'overflow-y' properties is not ''overflow/visible''.
126+
127+
Note: An element that is <a>potentially scrollable</a> might not have a <a>scrolling box</a>.
128+
For instance, it could have 'overflow' set to ''overflow/auto'' but not have its content overflowing its content area.
129+
118130
A <a>scrolling box</a> of a <a>viewport</a> or element has two <dfn>overflow directions</dfn>, depending on the <a>viewport’s</a> or
119131
element's <a>block flow direction</a> and <a>inline base direction</a>, as follows:
120132

@@ -922,7 +934,7 @@ revision of CSS or HTML.
922934
<p class=atrisk>The <dfn attribute for=Document>scrollingElement</dfn> attribute, on getting, must run these steps:
923935

924936
1. If the {{Document}} is in <a>quirks mode</a>, follow these substeps:
925-
1. If <a>the HTML <code>body</code> element</a> exists, and it does not have an associated <a>scrolling box</a>, return <a>the HTML <code>body</code> element</a> and abort these steps.
937+
1. If <a>the HTML <code>body</code> element</a> exists, and it is not <a>potentially scrollable</a>, return <a>the HTML <code>body</code> element</a> and abort these steps.
926938
1. Return null and abort these steps.
927939
1. If there is a root element, return the root element and abort these steps.
928940
1. Return null.
@@ -1062,7 +1074,7 @@ The <dfn method for=Element lt="scroll(options)|scroll(x, y)">scroll()</dfn> met
10621074
and terminate these steps.
10631075
1. If the element is <a>the HTML <code>body</code> element</a>,
10641076
the {{Document}} is in <a>quirks mode</a>,
1065-
and the element does not have an associated <a>scrolling box</a>,
1077+
and the element is not <a>potentially scrollable</a>,
10661078
invoke {{Window/scroll()}} with <var>options</var> as the only argument,
10671079
and terminate these steps.
10681080
1. If the element does not have any associated <a>CSS layout box</a>,
@@ -1095,7 +1107,7 @@ The <dfn attribute for=Element>scrollTop</dfn> attribute, on getting, must retur
10951107

10961108
1. If the element is the root element and the {{Document}} is in <a>quirks mode</a>, return zero and terminate these steps.
10971109
1. If the element is the root element return the value of {{Window/scrollY}}.
1098-
1. If the element is <a>the HTML <code>body</code> element</a>, the {{Document}} is in <a>quirks mode</a>, and the element does not have an associated <a>scrolling box</a>, return the value of {{Window/scrollY}}.
1110+
1. If the element is <a>the HTML <code>body</code> element</a>, the {{Document}} is in <a>quirks mode</a>, and the element is not <a>potentially scrollable</a>, return the value of {{Window/scrollY}}.
10991111
1. If the element does not have any associated <a>CSS layout box</a>, return zero and terminate these steps.
11001112
1. Return the y-coordinate of the <a>scrolling area</a> at the alignment point with the top of the <a>padding edge</a> of the element.
11011113

@@ -1105,15 +1117,15 @@ When setting the {{Element/scrollTop}} attribute these steps must be run:
11051117
1. <a>Normalize non-finite values</a> for <var>y</var>.
11061118
1. If the element is the root element and the {{Document}} is in <a>quirks mode</a>, terminate these steps.
11071119
1. If the element is the root element invoke {{Window/scroll()}} with {{Window/scrollX}} as first argument and <var>y</var> as second argument, and terminate these steps.
1108-
1. If the element is <a>the HTML <code>body</code> element</a>, the {{Document}} is in <a>quirks mode</a>, and the element does not have an associated <a>scrolling box</a>, invoke {{Window/scroll()}} with {{Window/scrollX}} as first argument and <var>y</var> as second argument, and terminate these steps.
1120+
1. If the element is <a>the HTML <code>body</code> element</a>, the {{Document}} is in <a>quirks mode</a>, and the element is not <a>potentially scrollable</a>, invoke {{Window/scroll()}} with {{Window/scrollX}} as first argument and <var>y</var> as second argument, and terminate these steps.
11091121
1. If the element does not have any associated <a>CSS layout box</a>, the element has no associated <a>scrolling box</a>, or the element has no overflow, terminate these steps.
11101122
1. <a lt='scroll an element'>Scroll the element</a> to {{Element/scrollLeft}},<var>y</var>, with the scroll behavior being <code>"auto"</code>.
11111123

11121124
The <dfn attribute for=Element>scrollLeft</dfn> attribute, on getting, must return the result of running these steps:
11131125

11141126
1. If the element is the root element and the {{Document}} is in <a>quirks mode</a>, return zero and terminate these steps.
11151127
1. If the element is the root element return the value of {{Window/scrollX}}.
1116-
1. If the element is <a>the HTML <code>body</code> element</a>, the {{Document}} is in <a>quirks mode</a>, and the element does not have an associated <a>scrolling box</a>, return the value of {{Window/scrollX}}.
1128+
1. If the element is <a>the HTML <code>body</code> element</a>, the {{Document}} is in <a>quirks mode</a>, and the element is not <a>potentially scrollable</a>, return the value of {{Window/scrollX}}.
11171129
1. If the element does not have any associated <a>CSS layout box</a>, return zero and terminate these steps.
11181130
1. Return the x-coordinate of the <a>scrolling area</a> at the alignment point with the left of the <a>padding edge</a> of the element.
11191131

@@ -1123,23 +1135,23 @@ When setting the {{Element/scrollLeft}} attribute these steps must be run:
11231135
1. <a>Normalize non-finite values</a> for <var>x</var>.
11241136
1. If the element is the root element and the {{Document}} is in <a>quirks mode</a>, terminate these steps.
11251137
1. If the element is the root element invoke {{Window/scroll()}} with <var>x</var> as first argument and {{Window/scrollY}} as second argument, and terminate these steps.
1126-
1. If the element is <a>the HTML <code>body</code> element</a>, the {{Document}} is in <a>quirks mode</a>, and the element does not have an associated <a>scrolling box</a>, invoke {{Window/scroll()}} with <var>x</var> as first argument and {{Window/scrollY}} as second argument, and terminate these steps.
1138+
1. If the element is <a>the HTML <code>body</code> element</a>, the {{Document}} is in <a>quirks mode</a>, and the element is not <a>potentially scrollable</a>, invoke {{Window/scroll()}} with <var>x</var> as first argument and {{Window/scrollY}} as second argument, and terminate these steps.
11271139
1. If the element does not have any associated <a>CSS layout box</a>, the element has no associated <a>scrolling box</a>, or the element has no overflow, terminate these steps.
11281140
1. <a lt='scroll an element'>Scroll the element</a> to <var>x</var>,{{Element/scrollTop}}, with the scroll behavior being <code>"auto"</code>.
11291141

11301142
The <dfn attribute for=Element>scrollWidth</dfn> attribute must return the result of running these steps:
11311143

11321144
1. Let <var>viewport width</var> be the width of the <a>viewport</a> excluding the width of the scroll bar, if any, or zero if there is no <a>viewport</a>.
11331145
1. If the element is the root element and the {{Document}} is not in <a>quirks mode</a> return max(<a>viewport</a> <a>scrolling area</a> width, <var>viewport width</var>).
1134-
1. If the element is <a>the HTML <code>body</code> element</a>, the {{Document}} is in <a>quirks mode</a> and the element has no associated <a>scrolling box</a>, return max(<a>viewport</a> <a>scrolling area</a> width, <var>viewport width</var>).
1146+
1. If the element is <a>the HTML <code>body</code> element</a>, the {{Document}} is in <a>quirks mode</a> and the element is not <a>potentially scrollable</a>, return max(<a>viewport</a> <a>scrolling area</a> width, <var>viewport width</var>).
11351147
1. If the element does not have any associated <a>CSS layout box</a> return zero and terminate these steps.
11361148
1. Return the width of the element's <a>scrolling area</a>.
11371149

11381150
The <dfn attribute for=Element>scrollHeight</dfn> attribute must return the result of running these steps:
11391151

11401152
1. Let <var>viewport height</var> be the height of the <a>viewport</a> excluding the height of the scroll bar, if any, or zero if there is no <a>viewport</a>.
11411153
1. If the element is the root element and the {{Document}} is not in <a>quirks mode</a> return max(<a>viewport</a> <a>scrolling area</a> height, <var>viewport height</var>).
1142-
1. If the element is <a>the HTML <code>body</code> element</a>, the {{Document}} is in <a>quirks mode</a> and the element has no associated <a>scrolling box</a>, return max(<a>viewport</a> <a>scrolling area</a> height, <var>viewport height</var>).
1154+
1. If the element is <a>the HTML <code>body</code> element</a>, the {{Document}} is in <a>quirks mode</a> and the element is not <a>potentially scrollable</a>, return max(<a>viewport</a> <a>scrolling area</a> height, <var>viewport height</var>).
11431155
1. If the element does not have any associated <a>CSS layout box</a> return zero and terminate these steps.
11441156
1. Return the height of the element's <a>scrolling area</a>.
11451157

cssom/Overview.bs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ spec:css-position-3; type:property; text:left
116116
spec:html5; type:element; text:style
117117
</pre>
118118

119+
<script src=https://resources.whatwg.org/file-bug.js async></script>
120+
119121
Introduction {#introduction}
120122
============================
121123

0 commit comments

Comments
 (0)