summaryrefslogtreecommitdiffstats
path: root/toolkit/actors/AutoScrollParent.jsm
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/actors/AutoScrollParent.jsm')
-rw-r--r--toolkit/actors/AutoScrollParent.jsm33
1 files changed, 33 insertions, 0 deletions
diff --git a/toolkit/actors/AutoScrollParent.jsm b/toolkit/actors/AutoScrollParent.jsm
new file mode 100644
index 0000000000..f5e6b7b8c3
--- /dev/null
+++ b/toolkit/actors/AutoScrollParent.jsm
@@ -0,0 +1,33 @@
+/* vim: set ts=2 sw=2 sts=2 et tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+"use strict";
+
+var EXPORTED_SYMBOLS = ["AutoScrollParent"];
+
+class AutoScrollParent extends JSWindowActorParent {
+ receiveMessage(msg) {
+ let browser = this.manager.browsingContext.top.embedderElement;
+ if (!browser) {
+ return null;
+ }
+
+ let data = msg.data;
+ switch (msg.name) {
+ case "Autoscroll:Start":
+ return Promise.resolve(browser.startScroll(data));
+ case "Autoscroll:MaybeStartInParent":
+ let parent = this.browsingContext.parent;
+ if (parent) {
+ let actor = parent.currentWindowGlobal.getActor("AutoScroll");
+ actor.sendAsyncMessage("Autoscroll:MaybeStart", data);
+ }
+ break;
+ case "Autoscroll:Cancel":
+ browser.cancelScroll();
+ break;
+ }
+ return null;
+ }
+}