1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 23:17:59 +01:00

Take some more jabs at the new scrolling code. Begin crafting a gecko-shaped voodoo doll.

This commit is contained in:
Kris Maglione
2009-10-11 03:36:42 -04:00
parent b261b4ba56
commit 1c6e31a73b

View File

@@ -76,21 +76,24 @@ function Buffer() //{{{
function findScrollable(dir, horizontal) function findScrollable(dir, horizontal)
{ {
let pos = "scrollTop", size = "clientHeight", max = "scrollHeight", overflow = "overflowX", let pos = "scrollTop", size = "clientHeight", max = "scrollHeight", layoutSize = "offsetHeight",
border1 = "borderTopWidth", border2 = "borderBottomWidth"; overflow = "overflowX", border1 = "borderTopWidth", border2 = "borderBottomWidth";
if (horizontal) if (horizontal)
pos = "scrollLeft", size = "clientWidth", max = "scrollWidth", overflow = "overflowX", pos = "scrollLeft", size = "clientWidth", max = "scrollWidth", layoutSize = "offsetWidth",
border1 = "borderLeftWidth", border2 = "borderRightWidth"; overflow = "overflowX", border1 = "borderLeftWidth", border2 = "borderRightWidth";
function find(elem) function find(elem)
{ {
for (; elem && elem.parentNode instanceof Element; elem = elem.parentNode) for (; elem && elem.parentNode instanceof Element; elem = elem.parentNode)
{ {
let realSize = elem[size];
let style = util.computedStyle(elem); let style = util.computedStyle(elem);
let borderSize = parseInt(style[border1]) + parseInt(style[border2]);
let realSize = elem[size];
// Stupid Gecko eccentricities. May fail for quirks mode documents. // Stupid Gecko eccentricities. May fail for quirks mode documents.
if (elem[size] + borderSize == elem[layoutSize] || elem[size] == 0) // Stupid, fallible heuristic.
continue;
if (style[overflow] == "hidden") if (style[overflow] == "hidden")
realSize += parseInt(style[border1]) + style[border2]; realSize += borderSize;
if (dir < 0 && elem[pos] > 0 || dir > 0 && elem[pos] + realSize < elem[max]) if (dir < 0 && elem[pos] > 0 || dir > 0 && elem[pos] + realSize < elem[max])
break; break;
} }