mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 18:55:30 +00:00
Bug 1582585 - Factor out a bit more code from AutoScrollController.jsm. r=botond
Also an idempotent change. Differential Revision: https://phabricator.services.mozilla.com/D46730 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
243aae81a3
commit
2e2227708b
@ -70,6 +70,16 @@ class AutoScrollController {
|
|||||||
return aNode instanceof content.XULElement;
|
return aNode instanceof content.XULElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
computeWindowScrollDirection(global) {
|
||||||
|
if (global.scrollMaxX != global.scrollMinX) {
|
||||||
|
return global.scrollMaxY != global.scrollMinY ? "NSEW" : "EW";
|
||||||
|
}
|
||||||
|
if (global.scrollMaxY != global.scrollMinY) {
|
||||||
|
return "NS";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
computeNodeScrollDirection(node) {
|
computeNodeScrollDirection(node) {
|
||||||
if (!this.isScrollableElement(node)) {
|
if (!this.isScrollableElement(node)) {
|
||||||
return null;
|
return null;
|
||||||
@ -125,18 +135,13 @@ class AutoScrollController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this._scrollable) {
|
if (!this._scrollable) {
|
||||||
this._scrollable = aNode.ownerGlobal;
|
let direction = this.computeWindowScrollDirection(aNode.ownerGlobal);
|
||||||
if (this._scrollable.scrollMaxX != this._scrollable.scrollMinX) {
|
if (direction) {
|
||||||
this._scrolldir =
|
this._scrolldir = direction;
|
||||||
this._scrollable.scrollMaxY != this._scrollable.scrollMinY
|
this._scrollable = aNode.ownerGlobal;
|
||||||
? "NSEW"
|
} else if (aNode.ownerGlobal.frameElement) {
|
||||||
: "EW";
|
// FIXME(emilio): This won't work with Fission.
|
||||||
} else if (this._scrollable.scrollMaxY != this._scrollable.scrollMinY) {
|
this.findNearestScrollableElement(aNode.ownerGlobal.frameElement);
|
||||||
this._scrolldir = "NS";
|
|
||||||
} else if (this._scrollable.frameElement) {
|
|
||||||
this.findNearestScrollableElement(this._scrollable.frameElement);
|
|
||||||
} else {
|
|
||||||
this._scrollable = null; // abort scrolling
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user