mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 10:45:42 +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;
|
||||
}
|
||||
|
||||
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) {
|
||||
if (!this.isScrollableElement(node)) {
|
||||
return null;
|
||||
@ -125,18 +135,13 @@ class AutoScrollController {
|
||||
}
|
||||
|
||||
if (!this._scrollable) {
|
||||
this._scrollable = aNode.ownerGlobal;
|
||||
if (this._scrollable.scrollMaxX != this._scrollable.scrollMinX) {
|
||||
this._scrolldir =
|
||||
this._scrollable.scrollMaxY != this._scrollable.scrollMinY
|
||||
? "NSEW"
|
||||
: "EW";
|
||||
} else if (this._scrollable.scrollMaxY != this._scrollable.scrollMinY) {
|
||||
this._scrolldir = "NS";
|
||||
} else if (this._scrollable.frameElement) {
|
||||
this.findNearestScrollableElement(this._scrollable.frameElement);
|
||||
} else {
|
||||
this._scrollable = null; // abort scrolling
|
||||
let direction = this.computeWindowScrollDirection(aNode.ownerGlobal);
|
||||
if (direction) {
|
||||
this._scrolldir = direction;
|
||||
this._scrollable = aNode.ownerGlobal;
|
||||
} else if (aNode.ownerGlobal.frameElement) {
|
||||
// FIXME(emilio): This won't work with Fission.
|
||||
this.findNearestScrollableElement(aNode.ownerGlobal.frameElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user