Bug 1202176, adjust coordinates from device to css pixels when drag popup moves, r=tn
authorNeil Deakin <neil@mozilla.com>
Mon, 14 Sep 2015 15:18:44 -0400
changeset 295029 aa3457f5ddc2adb70c72879c0465e5eee92f6be0
parent 295028 d7b18f4aa01089dab89973f19ebb2e2bfc6a56a9
child 295030 165e0853088e940816b9c3a73c01eaff86e7f7bf
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1202176
milestone43.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 1202176, adjust coordinates from device to css pixels when drag popup moves, r=tn
widget/nsBaseDragService.cpp
--- a/widget/nsBaseDragService.cpp
+++ b/widget/nsBaseDragService.cpp
@@ -426,17 +426,20 @@ nsBaseDragService::FireDragEventAtSource
  * the drag popup itself.
  */
 NS_IMETHODIMP
 nsBaseDragService::DragMoved(int32_t aX, int32_t aY)
 {
   if (mDragPopup) {
     nsIFrame* frame = mDragPopup->GetPrimaryFrame();
     if (frame && frame->GetType() == nsGkAtoms::menuPopupFrame) {
-      (static_cast<nsMenuPopupFrame *>(frame))->MoveTo(aX - mImageX, aY - mImageY, true);
+      nsPresContext* presContext = frame->PresContext();
+      int32_t x = presContext->DevPixelsToIntCSSPixels(aX - mImageX);
+      int32_t y = presContext->DevPixelsToIntCSSPixels(aY - mImageY);
+      (static_cast<nsMenuPopupFrame *>(frame))->MoveTo(x, y, true);
     }
   }
 
   return NS_OK;
 }
 
 static nsIPresShell*
 GetPresShellForContent(nsIDOMNode* aDOMNode)