Bug 868742 - Use scroll(Left|Top)Max to detect scrollable elements. r=mfinkle

This commit is contained in:
Kartikaya Gupta 2013-05-24 15:44:26 -04:00
parent 0ddc1881c1
commit 84bb4e09a9

View File

@ -4388,8 +4388,7 @@ var BrowserEventHandler = {
* - It's a select element showing multiple rows
*/
if (checkElem) {
if (((elem.scrollHeight > elem.clientHeight) ||
(elem.scrollWidth > elem.clientWidth)) &&
if ((elem.scrollTopMax > 0 || elem.scrollLeftMax > 0) &&
(this._hasScrollableOverflow(elem) ||
elem.mozMatchesSelector("html, body, textarea")) ||
(elem instanceof HTMLSelectElement && (elem.size > 1 || elem.multiple))) {
@ -4420,10 +4419,10 @@ var BrowserEventHandler = {
_elementCanScroll: function(elem, x, y) {
let scrollX = (x < 0 && elem.scrollLeft > 0)
|| (x > 0 && elem.scrollLeft < (elem.scrollWidth - elem.clientWidth));
|| (x > 0 && elem.scrollLeft < elem.scrollLeftMax);
let scrollY = (y < 0 && elem.scrollTop > 0)
|| (y > 0 && elem.scrollTop < (elem.scrollHeight - elem.clientHeight));
|| (y > 0 && elem.scrollTop < elem.scrollTopMax);
return scrollX || scrollY;
}