mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 16: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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user