Bug 1197497 - Convert the button rect to device coordinates correctly instead of casting CSS coordinates. r?jfkthame draft
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sat, 22 Apr 2017 08:51:18 +0900
changeset 566623 e6bc66c6e452cdc04cf793c6ca1a81f871dfa69b
parent 566378 dd530a59750adcaa0d48fa4f69b0cdb52715852a
child 566740 dea2b76f07b0f83a94967a8df587f4fce870220d
push id55295
push userVYV03354@nifty.ne.jp
push dateFri, 21 Apr 2017 23:52:10 +0000
reviewersjfkthame
bugs1197497
milestone55.0a1
Bug 1197497 - Convert the button rect to device coordinates correctly instead of casting CSS coordinates. r?jfkthame MozReview-Commit-ID: EqyHnJpp2tU
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -14172,17 +14172,19 @@ nsGlobalWindow::NotifyDefaultButtonLoade
 
   // Get the button rect in screen coordinates.
   nsIFrame *frame = aDefaultButton.GetPrimaryFrame();
   if (!frame) {
     aError.Throw(NS_ERROR_FAILURE);
     return;
   }
   LayoutDeviceIntRect buttonRect =
-    LayoutDeviceIntRect::FromUnknownRect(frame->GetScreenRect());
+    LayoutDeviceIntRect::FromAppUnitsToNearest(
+      frame->GetScreenRectInAppUnits(),
+      frame->PresContext()->AppUnitsPerDevPixel());
 
   // Get the widget rect in screen coordinates.
   nsIWidget *widget = GetNearestWidget();
   if (!widget) {
     aError.Throw(NS_ERROR_FAILURE);
     return;
   }
   LayoutDeviceIntRect widgetRect = widget->GetScreenBounds();