[WIP] Get the coordinate systems right draft
authorBotond Ballo <botond@mozilla.com>
Mon, 24 Jul 2017 22:07:41 -0400
changeset 614805 cba74d595759c87d0338b1279098684dce9ffb49
parent 614804 395557196a896bddcf255ad4b7b037b9ea043882
child 638973 952d8071fe9b955e14d5c436e56bd94ca934c2bf
push id70133
push userbballo@mozilla.com
push dateTue, 25 Jul 2017 02:09:09 +0000
milestone56.0a1
[WIP] Get the coordinate systems right MozReview-Commit-ID: 746CSntcxci
dom/ipc/TabParent.cpp
toolkit/content/browser-content.js
toolkit/content/widgets/browser.xml
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -3283,17 +3283,19 @@ TabParent::StartApzAutoscroll(float aScr
   if (!AsyncPanZoomEnabled()) {
     return NS_OK;
   }
 
   if (RenderFrameParent* renderFrame = GetRenderFrame()) {
     uint64_t layersId = renderFrame->GetLayersId();
     if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
       ScrollableLayerGuid guid{layersId, aPresShellId, aScrollId};
-      widget->StartAsyncAutoscroll(CSSPoint{aScreenX, aScreenY}, guid);
+      LayoutDevicePoint point{aScreenX, aScreenY};  // TODO: coordinates
+      point -= GetChildProcessOffset();
+      widget->StartAsyncAutoscroll(CSSPoint{point.x, point.y}, guid);  // TODO: coordinates
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TabParent::StopApzAutoscroll(nsViewID aScrollId, uint32_t aPresShellId)
 {
--- a/toolkit/content/browser-content.js
+++ b/toolkit/content/browser-content.js
@@ -145,16 +145,18 @@ var ClickEventHandler = {
       scrollable = scrollable.document.documentElement;
     }
     let scrollId = domUtils.getViewId(scrollable);
     let presShellId = domUtils.getPresShellId();
     let [enabled] = sendSyncMessage("Autoscroll:Start",
                                     {scrolldir: this._scrolldir,
                                      screenX: event.screenX,
                                      screenY: event.screenY,
+                                     clientX: event.clientX,
+                                     clientY: event.clientY,
                                      scrollId,
                                      presShellId});
     if (!enabled) {
       this._scrollable = null;
       return;
     }
 
     Services.els.addSystemEventListener(global, "mousemove", this, true);
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -1089,17 +1089,17 @@
             case "Autoscroll:Start": {
               if (!this.autoscrollEnabled) {
                 return false;
               }
               this.startScroll(data.scrolldir, data.screenX, data.screenY);
               if (this.isRemoteBrowser) {
                 let { tabParent } = this.frameLoader;
                 if (tabParent) {
-                  tabParent.startApzAutoscroll(data.screenX, data.screenY,
+                  tabParent.startApzAutoscroll(data.clientX, data.clientY,
                                                data.scrollId, data.presShellId);
                 }
                 // Save the IDs for later
                 this._autoScrollScrollId = data.scrollId;
                 this._autoScrollPresShellId = data.presShellId;
                 return true;
               }
             }