зеркало из https://github.com/mozilla/gecko-dev.git
Bug 864684 - Prevent two way scrolling if it is not neccessary. r=vingtetun
This commit is contained in:
Родитель
4d73ec81da
Коммит
c30def58ce
|
@ -371,13 +371,20 @@ const ContentPanning = {
|
|||
let isScrolling = false;
|
||||
let oldX, oldY, newX, newY;
|
||||
let win, doc, htmlNode, bodyNode;
|
||||
let xScrollable = content.scrollWidth > content.clientWidth;
|
||||
let yScrollable = content.scrollHeight > content.clientHeight;
|
||||
|
||||
function doScroll(node, delta) {
|
||||
if (node instanceof Ci.nsIDOMHTMLElement) {
|
||||
oldX = node.scrollLeft, oldY = node.scrollTop;
|
||||
node.scrollLeft += delta.x;
|
||||
node.scrollTop += delta.y;
|
||||
newX = node.scrollLeft, newY = node.scrollTop;
|
||||
newX = oldX = node.scrollLeft, newY = oldY = node.scrollTop;
|
||||
if (xScrollable) {
|
||||
node.scrollLeft += delta.x;
|
||||
newX = node.scrollLeft;
|
||||
}
|
||||
if (yScrollable) {
|
||||
node.scrollTop += delta.y;
|
||||
newY = node.scrollTop;
|
||||
}
|
||||
return (newX != oldX || newY != oldY);
|
||||
} else if (node instanceof Ci.nsIDOMWindow) {
|
||||
win = node;
|
||||
|
|
Загрузка…
Ссылка в новой задаче