Bug 1105109 - Have content send the parent process a scroll id and pres shell id as part of the Autoscroll:Start message. r=kats draft
authorBotond Ballo <botond@mozilla.com>
Mon, 19 Jun 2017 18:03:42 -0400
changeset 617930 38ead9a235ac31e2d07f8ee2a8fba206fbcf4ba9
parent 617929 15e9d42d1600ed1124f13a419dc3c722591b3a44
child 617931 c775d1d2f245878e10774e41b58d550eabb77d18
push id71164
push userbballo@mozilla.com
push dateSat, 29 Jul 2017 00:34:06 +0000
reviewerskats
bugs1105109
milestone56.0a1
Bug 1105109 - Have content send the parent process a scroll id and pres shell id as part of the Autoscroll:Start message. r=kats MozReview-Commit-ID: 5Jnr8jFsSHF
toolkit/content/browser-content.js
--- a/toolkit/content/browser-content.js
+++ b/toolkit/content/browser-content.js
@@ -129,20 +129,36 @@ var ClickEventHandler = {
 
   startScroll(event) {
 
     this.findNearestScrollableElement(event.originalTarget);
 
     if (!this._scrollable)
       return;
 
+    let domUtils = content.QueryInterface(Ci.nsIInterfaceRequestor)
+                          .getInterface(Ci.nsIDOMWindowUtils);
+    let scrollable = this._scrollable;
+    if (scrollable instanceof Ci.nsIDOMWindow) {
+      // getViewId() needs an element to operate on.
+      scrollable = scrollable.document.documentElement;
+    }
+    let scrollId = null;
+    try {
+      scrollId = domUtils.getViewId(scrollable);
+    } catch (e) {
+      // No view ID - leave it as null. Receiving side will check.
+    }
+    let presShellId = domUtils.getPresShellId();
     let [enabled] = sendSyncMessage("Autoscroll:Start",
                                     {scrolldir: this._scrolldir,
                                      screenX: event.screenX,
-                                     screenY: event.screenY});
+                                     screenY: event.screenY,
+                                     scrollId,
+                                     presShellId});
     if (!enabled) {
       this._scrollable = null;
       return;
     }
 
     Services.els.addSystemEventListener(global, "mousemove", this, true);
     addEventListener("pagehide", this, true);