Bug 1498352 - Apply root resolution when sending mouse events from child to parent; r=kats
authorJim Chen <nchen@mozilla.com>
Thu, 18 Oct 2018 16:43:40 +0000
changeset 497703 084f6e60778f01d66bee26657e0e459f8fddcc3e
parent 497702 a58112b87de672f400dc5d23ad8bac80d292a2fd
child 497704 8fc40677cc0eff1eb03a17169ea6997666136b75
push id10002
push userarchaeopteryx@coole-files.de
push dateFri, 19 Oct 2018 23:09:29 +0000
treeherdermozilla-beta@01378c910610 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1498352
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1498352 - Apply root resolution when sending mouse events from child to parent; r=kats Because the root resolution is conceptually at the parent/child process boundary, when sending mouse events from child to the parent, we need to apply that resolution to the mouse coordinates. Differential Revision: https://phabricator.services.mozilla.com/D8993
widget/PuppetWidget.cpp
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -420,16 +420,25 @@ PuppetWidget::DispatchInputEvent(WidgetI
     DispatchEvent(aEvent, status);
     return status;
   }
 
   if (!mTabChild) {
     return nsEventStatus_eIgnore;
   }
 
+  if (nsCOMPtr<nsIPresShell> presShell = mTabChild->GetPresShell()) {
+    // Because the root resolution is conceptually at the parent/child process
+    // boundary, we need to apply that resolution here because we're sending
+    // the event from the child to the parent process.
+    LayoutDevicePoint pt(aEvent->mRefPoint);
+    pt = pt * presShell->GetResolution();
+    aEvent->mRefPoint = LayoutDeviceIntPoint::Round(pt);
+  }
+
   switch (aEvent->mClass) {
     case eWheelEventClass:
       Unused <<
         mTabChild->SendDispatchWheelEvent(*aEvent->AsWheelEvent());
       break;
     case eMouseEventClass:
       Unused <<
         mTabChild->SendDispatchMouseEvent(*aEvent->AsMouseEvent());