Bug 1125040: Use LayoutDeviceIntPoint for nsIWidget::WidgetToScreen r=botond
authorDavid Zbarsky <dzbarsky@gmail.com>
Wed, 04 Feb 2015 15:21:03 -0500
changeset 227576 52de461bce377bd8a247f9e8be750c0bcc8c353c
parent 227575 03fed89b215df9aecdc112d933f703c4d794b91d
child 227577 b4c9c91426b369cbbef4c9d61f01a4d3a76d1197
push id28235
push usercbook@mozilla.com
push dateThu, 05 Feb 2015 13:47:35 +0000
treeherdermozilla-central@58ce6051edf5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1125040
milestone38.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 1125040: Use LayoutDeviceIntPoint for nsIWidget::WidgetToScreen r=botond
accessible/generic/HyperTextAccessible.cpp
dom/base/nsDOMWindowUtils.cpp
dom/base/nsQueryContentEventResult.cpp
dom/events/ContentEventHandler.cpp
dom/events/Event.cpp
dom/events/EventStateManager.cpp
dom/events/IMEContentObserver.cpp
dom/events/UIEvent.h
dom/events/WheelHandlingHelper.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
embedding/browser/nsDocShellTreeOwner.cpp
gfx/tests/gtest/TestCompositor.cpp
layout/base/PositionedEventTargeting.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/base/nsPresShell.cpp
layout/generic/nsFrame.cpp
layout/xul/nsResizerFrame.cpp
layout/xul/nsXULPopupManager.cpp
view/nsView.cpp
widget/PuppetWidget.h
widget/android/AndroidJavaWrappers.cpp
widget/android/nsWindow.cpp
widget/android/nsWindow.h
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/cocoa/nsCocoaWindow.h
widget/cocoa/nsCocoaWindow.mm
widget/gonk/nsWindow.cpp
widget/gonk/nsWindow.h
widget/gtk/nsDragService.cpp
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
widget/nsIWidget.h
widget/qt/nsWindow.cpp
widget/qt/nsWindow.h
widget/windows/nsIMM32Handler.cpp
widget/windows/nsTextStore.cpp
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
widget/windows/winrt/MetroWidget.cpp
widget/windows/winrt/MetroWidget.h
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -1339,17 +1339,17 @@ HyperTextAccessible::GetCaretRect(nsIWid
   // on the widget.
   *aWidget = frame->GetNearestWidget(offset);
   NS_ENSURE_TRUE(*aWidget, nsIntRect());
   rect.MoveBy(offset);
 
   nsIntRect caretRect;
   caretRect = rect.ToOutsidePixels(frame->PresContext()->AppUnitsPerDevPixel());
   // ((content screen origin) - (content offset in the widget)) = widget origin on the screen
-  caretRect.MoveBy((*aWidget)->WidgetToScreenOffset() - (*aWidget)->GetClientOffset());
+  caretRect.MoveBy((*aWidget)->WidgetToScreenOffsetUntyped() - (*aWidget)->GetClientOffset());
 
   // Correct for character size, so that caret always matches the size of
   // the character. This is important for font size transitions, and is
   // necessary because the Gecko caret uses the previous character's size as
   // the user moves forward in the text by character.
   nsIntRect charRect = CharBounds(CaretOffset(),
                                   nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE);
   if (!charRect.IsEmpty()) {
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -2190,18 +2190,17 @@ nsDOMWindowUtils::SendQueryContentEvent(
                    NS_ERROR_FAILURE);
 
     // Fire the event on the widget at the point
     if (popupFrame) {
       targetWidget = popupFrame->GetNearestWidget();
     }
   }
 
-  pt += LayoutDeviceIntPoint::FromUntyped(
-    widget->WidgetToScreenOffset() - targetWidget->WidgetToScreenOffset());
+  pt += widget->WidgetToScreenOffset() - targetWidget->WidgetToScreenOffset();
 
   WidgetQueryContentEvent queryEvent(true, aType, targetWidget);
   InitEvent(queryEvent, &pt);
 
   switch (aType) {
     case NS_QUERY_TEXT_CONTENT:
       queryEvent.InitForQueryTextContent(aOffset, aLength, useNativeLineBreak);
       break;
--- a/dom/base/nsQueryContentEventResult.cpp
+++ b/dom/base/nsQueryContentEventResult.cpp
@@ -142,12 +142,12 @@ nsQueryContentEventResult::SetEventResul
   }
 
   nsIWidget* topWidget = aWidget->GetTopLevelWidget();
   if (!topWidget || topWidget == aWidget) {
     return;
   }
 
   // Convert the top widget related coordinates to the given widget's.
-  nsIntPoint offset =
+  LayoutDeviceIntPoint offset =
     aWidget->WidgetToScreenOffset() - topWidget->WidgetToScreenOffset();
-  mRect.MoveBy(-offset);
+  mRect.MoveBy(-LayoutDeviceIntPoint::ToUntyped(offset));
 }
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -1144,19 +1144,18 @@ ContentEventHandler::OnQueryCharacterAtP
     NS_ENSURE_TRUE(rootWidget, NS_ERROR_FAILURE);
   }
 
   WidgetQueryContentEvent eventOnRoot(true, NS_QUERY_CHARACTER_AT_POINT,
                                       rootWidget);
   eventOnRoot.mUseNativeLineBreak = aEvent->mUseNativeLineBreak;
   eventOnRoot.refPoint = aEvent->refPoint;
   if (rootWidget != aEvent->widget) {
-    eventOnRoot.refPoint += LayoutDeviceIntPoint::FromUntyped(
-      aEvent->widget->WidgetToScreenOffset() -
-        rootWidget->WidgetToScreenOffset());
+    eventOnRoot.refPoint += aEvent->widget->WidgetToScreenOffset() -
+      rootWidget->WidgetToScreenOffset();
   }
   nsPoint ptInRoot =
     nsLayoutUtils::GetEventCoordinatesRelativeTo(&eventOnRoot, rootFrame);
 
   nsIFrame* targetFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, ptInRoot);
   if (!targetFrame || targetFrame->GetType() != nsGkAtoms::textFrame ||
       !targetFrame->GetContent() ||
       !nsContentUtils::ContentIsDescendantOf(targetFrame->GetContent(),
@@ -1209,18 +1208,17 @@ ContentEventHandler::OnQueryDOMWidgetHit
 
   NS_ENSURE_TRUE(aEvent->widget, NS_ERROR_FAILURE);
 
   nsIDocument* doc = mPresShell->GetDocument();
   NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
   nsIFrame* docFrame = mPresShell->GetRootFrame();
   NS_ENSURE_TRUE(docFrame, NS_ERROR_FAILURE);
 
-  LayoutDeviceIntPoint eventLoc = aEvent->refPoint +
-    LayoutDeviceIntPoint::FromUntyped(aEvent->widget->WidgetToScreenOffset());
+  LayoutDeviceIntPoint eventLoc = aEvent->refPoint + aEvent->widget->WidgetToScreenOffset();
   nsIntRect docFrameRect = docFrame->GetScreenRect(); // Returns CSS pixels
   CSSIntPoint eventLocCSS(
     mPresContext->DevPixelsToIntCSSPixels(eventLoc.x) - docFrameRect.x,
     mPresContext->DevPixelsToIntCSSPixels(eventLoc.y) - docFrameRect.y);
 
   Element* contentUnderMouse =
     doc->ElementFromPointHelper(eventLocCSS.x, eventLocCSS.y, false, false);
   if (contentUnderMouse) {
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -897,18 +897,17 @@ Event::GetScreenCoords(nsPresContext* aP
     return nsIntPoint(0, 0);
   }
 
   WidgetGUIEvent* guiEvent = aEvent->AsGUIEvent();
   if (!guiEvent->widget) {
     return LayoutDeviceIntPoint::ToUntyped(aPoint);
   }
 
-  LayoutDeviceIntPoint offset = aPoint +
-    LayoutDeviceIntPoint::FromUntyped(guiEvent->widget->WidgetToScreenOffset());
+  LayoutDeviceIntPoint offset = aPoint + guiEvent->widget->WidgetToScreenOffset();
   nscoord factor =
     aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom();
   return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
                     nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
 }
 
 // static
 CSSIntPoint
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -1500,18 +1500,17 @@ EventStateManager::BeginTrackingDragGest
                                             WidgetMouseEvent* inDownEvent,
                                             nsIFrame* inDownFrame)
 {
   if (!inDownEvent->widget)
     return;
 
   // Note that |inDownEvent| could be either a mouse down event or a
   // synthesized mouse move event.
-  mGestureDownPoint = inDownEvent->refPoint +
-    LayoutDeviceIntPoint::FromUntyped(inDownEvent->widget->WidgetToScreenOffset());
+  mGestureDownPoint = inDownEvent->refPoint + inDownEvent->widget->WidgetToScreenOffset();
 
   inDownFrame->GetContentForEvent(inDownEvent,
                                   getter_AddRefs(mGestureDownContent));
 
   mGestureDownFrameOwner = inDownFrame->GetContent();
   mGestureModifiers = inDownEvent->modifiers;
   mGestureDownButtons = inDownEvent->buttons;
 
@@ -1539,18 +1538,17 @@ void
 EventStateManager::FillInEventFromGestureDown(WidgetMouseEvent* aEvent)
 {
   NS_ASSERTION(aEvent->widget == mCurrentTarget->GetNearestWidget(),
                "Incorrect widget in event");
 
   // Set the coordinates in the new event to the coordinates of
   // the old event, adjusted for the fact that the widget might be
   // different
-  aEvent->refPoint = mGestureDownPoint -
-    LayoutDeviceIntPoint::FromUntyped(aEvent->widget->WidgetToScreenOffset());
+  aEvent->refPoint = mGestureDownPoint - aEvent->widget->WidgetToScreenOffset();
   aEvent->modifiers = mGestureModifiers;
   aEvent->buttons = mGestureDownButtons;
 }
 
 //
 // GenerateDragGesture
 //
 // If we're in the TRACKING state of the d&d gesture tracker, check the current position
@@ -1596,18 +1594,17 @@ EventStateManager::GenerateDragGesture(n
         LookAndFeel::GetInt(LookAndFeel::eIntID_DragThresholdY, 0);
       if (!pixelThresholdX)
         pixelThresholdX = 5;
       if (!pixelThresholdY)
         pixelThresholdY = 5;
     }
 
     // fire drag gesture if mouse has moved enough
-    LayoutDeviceIntPoint pt = aEvent->refPoint +
-      LayoutDeviceIntPoint::FromUntyped(aEvent->widget->WidgetToScreenOffset());
+    LayoutDeviceIntPoint pt = aEvent->refPoint + aEvent->widget->WidgetToScreenOffset();
     LayoutDeviceIntPoint distance = pt - mGestureDownPoint;
     if (Abs(distance.x) > AssertedCast<uint32_t>(pixelThresholdX) ||
         Abs(distance.y) > AssertedCast<uint32_t>(pixelThresholdY)) {
       if (Prefs::ClickHoldContextMenu()) {
         // stop the click-hold before we fire off the drag gesture, in case
         // it takes a long time
         KillClickHoldTimer();
       }
@@ -3211,19 +3208,19 @@ EventStateManager::PostHandleEvent(nsPre
 
         nsCOMPtr<nsIWidget> widget = mCurrentTarget->GetNearestWidget();
         WidgetDragEvent event(aEvent->mFlags.mIsTrusted,
                               NS_DRAGDROP_DRAGDROP, widget);
 
         WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
         event.refPoint = mouseEvent->refPoint;
         if (mouseEvent->widget) {
-          event.refPoint += LayoutDeviceIntPoint::FromUntyped(mouseEvent->widget->WidgetToScreenOffset());
+          event.refPoint += mouseEvent->widget->WidgetToScreenOffset();
         }
-        event.refPoint -= LayoutDeviceIntPoint::FromUntyped(widget->WidgetToScreenOffset());
+        event.refPoint -= widget->WidgetToScreenOffset();
         event.modifiers = mouseEvent->modifiers;
         event.buttons = mouseEvent->buttons;
         event.inputSource = mouseEvent->inputSource;
 
         nsEventStatus status = nsEventStatus_eIgnore;
         nsCOMPtr<nsIPresShell> presShell = mPresContext->GetPresShell();
         if (presShell) {
           presShell->HandleEventWithTarget(&event, mCurrentTarget,
@@ -4018,18 +4015,18 @@ EventStateManager::GenerateMouseEnterExi
         if (aMouseEvent->refPoint != center) {
           // Mouse move doesn't finish at the center of the window. Dispatch a
           // synthetic native mouse event to move the pointer back to the center
           // of the window, to faciliate more movement. But first, record that
           // we've dispatched a synthetic mouse movement, so we can cancel it
           // in the other branch here.
           sSynthCenteringPoint = center;
           aMouseEvent->widget->SynthesizeNativeMouseMove(
-            LayoutDeviceIntPoint::ToUntyped(center) +
-              aMouseEvent->widget->WidgetToScreenOffset());
+            LayoutDeviceIntPoint::ToUntyped(center +
+              aMouseEvent->widget->WidgetToScreenOffset()));
         } else if (aMouseEvent->refPoint == sSynthCenteringPoint) {
           // This is the "synthetic native" event we dispatched to re-center the
           // pointer. Cancel it so we don't expose the centering move to content.
           aMouseEvent->mFlags.mPropagationStopped = true;
           // Clear sSynthCenteringPoint so we don't cancel other events
           // targeted at the center.
           sSynthCenteringPoint = kInvalidRefPoint;
         }
@@ -4155,33 +4152,33 @@ EventStateManager::SetPointerLock(nsIWid
 
     // Fire a synthetic mouse move to ensure event state is updated. We first
     // set the mouse to the center of the window, so that the mouse event
     // doesn't report any movement.
     sLastRefPoint = GetWindowInnerRectCenter(aElement->OwnerDoc()->GetWindow(),
                                              aWidget,
                                              mPresContext);
     aWidget->SynthesizeNativeMouseMove(
-      LayoutDeviceIntPoint::ToUntyped(sLastRefPoint) + aWidget->WidgetToScreenOffset());
+      LayoutDeviceIntPoint::ToUntyped(sLastRefPoint + aWidget->WidgetToScreenOffset()));
 
     // Retarget all events to this element via capture.
     nsIPresShell::SetCapturingContent(aElement, CAPTURE_POINTERLOCK);
 
     // Suppress DnD
     if (dragService) {
       dragService->Suppress();
     }
   } else {
     // Unlocking, so return pointer to the original position by firing a
     // synthetic mouse event. We first reset sLastRefPoint to its
     // pre-pointerlock position, so that the synthetic mouse event reports
     // no movement.
     sLastRefPoint = mPreLockPoint;
     aWidget->SynthesizeNativeMouseMove(
-      LayoutDeviceIntPoint::ToUntyped(mPreLockPoint) + aWidget->WidgetToScreenOffset());
+      LayoutDeviceIntPoint::ToUntyped(mPreLockPoint + aWidget->WidgetToScreenOffset()));
 
     // Don't retarget events to this element any more.
     nsIPresShell::SetCapturingContent(nullptr, CAPTURE_POINTERLOCK);
 
     // Unsuppress DnD
     if (dragService) {
       dragService->Unsuppress();
     }
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -444,25 +444,24 @@ IMEContentObserver::OnMouseButtonEvent(n
     return false;
   }
 
   // The result character rect is relative to the top level widget.
   // We should notify it with offset in the widget.
   nsIWidget* topLevelWidget = mWidget->GetTopLevelWidget();
   if (topLevelWidget && topLevelWidget != mWidget) {
     charAtPt.mReply.mRect.MoveBy(
-      topLevelWidget->WidgetToScreenOffset() -
-        mWidget->WidgetToScreenOffset());
+      topLevelWidget->WidgetToScreenOffsetUntyped() -
+        mWidget->WidgetToScreenOffsetUntyped());
   }
   // The refPt is relative to its widget.
   // We should notify it with offset in the widget.
   if (aMouseEvent->widget != mWidget) {
-    charAtPt.refPoint += LayoutDeviceIntPoint::FromUntyped(
-      aMouseEvent->widget->WidgetToScreenOffset() -
-        mWidget->WidgetToScreenOffset());
+    charAtPt.refPoint += aMouseEvent->widget->WidgetToScreenOffset() -
+      mWidget->WidgetToScreenOffset();
   }
 
   IMENotification notification(NOTIFY_IME_OF_MOUSE_BUTTON_EVENT);
   notification.mMouseButtonEventData.mEventMessage = aMouseEvent->message;
   notification.mMouseButtonEventData.mOffset = charAtPt.mReply.mOffset;
   notification.mMouseButtonEventData.mCursorPos.Set(
     LayoutDeviceIntPoint::ToUntyped(charAtPt.refPoint));
   notification.mMouseButtonEventData.mCharRect.Set(charAtPt.mReply.mRect);
--- a/dom/events/UIEvent.h
+++ b/dom/events/UIEvent.h
@@ -52,18 +52,17 @@ public:
       return nsIntPoint(0, 0);
     }
 
     WidgetGUIEvent* event = aEvent->AsGUIEvent();
     if (!event->widget) {
       return LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint);
     }
 
-    LayoutDeviceIntPoint offset = aEvent->refPoint +
-      LayoutDeviceIntPoint::FromUntyped(event->widget->WidgetToScreenOffset());
+    LayoutDeviceIntPoint offset = aEvent->refPoint + event->widget->WidgetToScreenOffset();
     nscoord factor =
       aPresContext->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom();
     return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
                       nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
   }
 
   static CSSIntPoint CalculateClientPoint(nsPresContext* aPresContext,
                                           WidgetEvent* aEvent,
--- a/dom/events/WheelHandlingHelper.cpp
+++ b/dom/events/WheelHandlingHelper.cpp
@@ -288,18 +288,18 @@ WheelTransaction::SetTimeout()
   NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "nsITimer::InitWithFuncCallback failed");
 }
 
 /* static */ nsIntPoint
 WheelTransaction::GetScreenPoint(WidgetGUIEvent* aEvent)
 {
   NS_ASSERTION(aEvent, "aEvent is null");
   NS_ASSERTION(aEvent->widget, "aEvent-widget is null");
-  return LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint) +
-           aEvent->widget->WidgetToScreenOffset();
+  return LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint +
+           aEvent->widget->WidgetToScreenOffset());
 }
 
 /* static */ uint32_t
 WheelTransaction::GetTimeoutTime()
 {
   return Preferences::GetUint("mousewheel.transaction.timeout", 1500);
 }
 
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -2111,18 +2111,17 @@ nsEventStatus nsPluginInstanceOwner::Pro
           nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mPluginFrame) -
           mPluginFrame->GetContentRectRelativeToSelf().TopLeft();
         nsIntPoint pluginPoint(presContext->AppUnitsToDevPixels(appPoint.x),
                                presContext->AppUnitsToDevPixels(appPoint.y));
         const WidgetMouseEvent& mouseEvent = *anEvent.AsMouseEvent();
         // Get reference point relative to screen:
         LayoutDeviceIntPoint rootPoint(-1, -1);
         if (widget)
-          rootPoint = anEvent.refPoint +
-            LayoutDeviceIntPoint::FromUntyped(widget->WidgetToScreenOffset());
+          rootPoint = anEvent.refPoint + widget->WidgetToScreenOffset();
 #ifdef MOZ_WIDGET_GTK
         Window root = GDK_ROOT_WINDOW();
 #elif defined(MOZ_WIDGET_QT)
         Window root = RootWindowOfScreen(DefaultScreenOfDisplay(mozilla::DefaultXDisplay()));
 #else
         Window root = None; // Could XQueryTree, but this is not important.
 #endif
 
--- a/embedding/browser/nsDocShellTreeOwner.cpp
+++ b/embedding/browser/nsDocShellTreeOwner.cpp
@@ -1447,17 +1447,17 @@ ChromeTooltipListener::sTooltipCallback(
     if (self->mTooltipTextProvider) {
       bool textFound = false;
 
       self->mTooltipTextProvider->GetNodeText(
           self->mPossibleTooltipNode, getter_Copies(tooltipText), &textFound);
 
       if (textFound) {
         nsString tipText(tooltipText);
-        nsIntPoint screenDot = widget->WidgetToScreenOffset();
+        LayoutDeviceIntPoint screenDot = widget->WidgetToScreenOffset();
         self->ShowTooltip(self->mMouseScreenX - screenDot.x,
                           self->mMouseScreenY - screenDot.y,
                           tipText);
       }
     }
 
     // release tooltip target if there is one, NO MATTER WHAT
     self->mPossibleTooltipNode = nullptr;
--- a/gfx/tests/gtest/TestCompositor.cpp
+++ b/gfx/tests/gtest/TestCompositor.cpp
@@ -66,17 +66,17 @@ public:
                                  double aWidth, double aHeight, bool aRepaint) MOZ_OVERRIDE { return NS_OK; }
 
   NS_IMETHOD              Enable(bool aState) MOZ_OVERRIDE { return NS_OK; }
   virtual bool            IsEnabled() const MOZ_OVERRIDE { return true; }
   NS_IMETHOD              SetFocus(bool aRaise) MOZ_OVERRIDE { return NS_OK; }
   virtual nsresult        ConfigureChildren(const nsTArray<Configuration>& aConfigurations) MOZ_OVERRIDE { return NS_OK; }
   NS_IMETHOD              Invalidate(const nsIntRect &aRect) MOZ_OVERRIDE { return NS_OK; }
   NS_IMETHOD              SetTitle(const nsAString& title) MOZ_OVERRIDE { return NS_OK; }
-  virtual nsIntPoint      WidgetToScreenOffset() MOZ_OVERRIDE { return nsIntPoint(0, 0); }
+  virtual LayoutDeviceIntPoint WidgetToScreenOffset() MOZ_OVERRIDE { return LayoutDeviceIntPoint(0, 0); }
   NS_IMETHOD              DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
                                         nsEventStatus& aStatus) MOZ_OVERRIDE { return NS_OK; }
   NS_IMETHOD              CaptureRollupEvents(nsIRollupListener * aListener, bool aDoCapture) MOZ_OVERRIDE { return NS_OK; }
   NS_IMETHOD_(void)       SetInputContext(const InputContext& aContext,
                                           const InputContextAction& aAction) MOZ_OVERRIDE {}
   NS_IMETHOD_(InputContext) GetInputContext() MOZ_OVERRIDE { abort(); }
   NS_IMETHOD              ReparentNativeWidget(nsIWidget* aNewParent) MOZ_OVERRIDE { return NS_OK; }
 private:
--- a/layout/base/PositionedEventTargeting.cpp
+++ b/layout/base/PositionedEventTargeting.cpp
@@ -468,18 +468,18 @@ FindFrameTargetedByInputEvent(WidgetGUIE
     return target;
   }
   // Now we basically undo the operations in GetEventCoordinatesRelativeTo, to
   // get back the (now-clamped) coordinates in the event's widget's space.
   nsView* view = aRootFrame->GetView();
   if (!view) {
     return target;
   }
-  nsIntPoint widgetPoint = nsLayoutUtils::TranslateViewToWidget(
+  LayoutDeviceIntPoint widgetPoint = nsLayoutUtils::TranslateViewToWidget(
         aRootFrame->PresContext(), view, point, aEvent->widget);
   if (widgetPoint.x != NS_UNCONSTRAINEDSIZE) {
     // If that succeeded, we update the point in the event
-    aEvent->refPoint = LayoutDeviceIntPoint::FromUntyped(widgetPoint);
+    aEvent->refPoint = widgetPoint;
   }
   return target;
 }
 
 }
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -2622,38 +2622,39 @@ nsLayoutUtils::TransformFrameRectToAnces
 
   float destAppUnitsPerDevPixel = aAncestor->PresContext()->AppUnitsPerDevPixel();
   return nsRect(NSFloatPixelsToAppUnits(float(result.x), destAppUnitsPerDevPixel),
                 NSFloatPixelsToAppUnits(float(result.y), destAppUnitsPerDevPixel),
                 NSFloatPixelsToAppUnits(float(result.width), destAppUnitsPerDevPixel),
                 NSFloatPixelsToAppUnits(float(result.height), destAppUnitsPerDevPixel));
 }
 
-static nsIntPoint GetWidgetOffset(nsIWidget* aWidget, nsIWidget*& aRootWidget) {
-  nsIntPoint offset(0, 0);
+static LayoutDeviceIntPoint GetWidgetOffset(nsIWidget* aWidget, nsIWidget*& aRootWidget) {
+  LayoutDeviceIntPoint offset(0, 0);
   while ((aWidget->WindowType() == eWindowType_child ||
           aWidget->IsPlugin())) {
     nsIWidget* parent = aWidget->GetParent();
     if (!parent) {
       break;
     }
     nsIntRect bounds;
     aWidget->GetBounds(bounds);
-    offset += bounds.TopLeft();
+    offset += LayoutDeviceIntPoint::FromUntyped(bounds.TopLeft());
     aWidget = parent;
   }
   aRootWidget = aWidget;
   return offset;
 }
 
-static nsIntPoint WidgetToWidgetOffset(nsIWidget* aFrom, nsIWidget* aTo) {
+static LayoutDeviceIntPoint
+WidgetToWidgetOffset(nsIWidget* aFrom, nsIWidget* aTo) {
   nsIWidget* fromRoot;
-  nsIntPoint fromOffset = GetWidgetOffset(aFrom, fromRoot);
+  LayoutDeviceIntPoint fromOffset = GetWidgetOffset(aFrom, fromRoot);
   nsIWidget* toRoot;
-  nsIntPoint toOffset = GetWidgetOffset(aTo, toRoot);
+  LayoutDeviceIntPoint toOffset = GetWidgetOffset(aTo, toRoot);
 
   if (fromRoot == toRoot) {
     return fromOffset - toOffset;
   }
   return aFrom->WidgetToScreenOffset() - aTo->WidgetToScreenOffset();
 }
 
 nsPoint
@@ -2662,36 +2663,35 @@ nsLayoutUtils::TranslateWidgetToView(nsP
                                      nsView* aView)
 {
   nsPoint viewOffset;
   nsIWidget* viewWidget = aView->GetNearestWidget(&viewOffset);
   if (!viewWidget) {
     return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
   }
 
-  LayoutDeviceIntPoint widgetPoint = aPt +
-    LayoutDeviceIntPoint::FromUntyped(WidgetToWidgetOffset(aWidget, viewWidget));
+  LayoutDeviceIntPoint widgetPoint = aPt + WidgetToWidgetOffset(aWidget, viewWidget);
   nsPoint widgetAppUnits(aPresContext->DevPixelsToAppUnits(widgetPoint.x),
                          aPresContext->DevPixelsToAppUnits(widgetPoint.y));
   return widgetAppUnits - viewOffset;
 }
 
-nsIntPoint
+LayoutDeviceIntPoint
 nsLayoutUtils::TranslateViewToWidget(nsPresContext* aPresContext,
                                      nsView* aView, nsPoint aPt,
                                      nsIWidget* aWidget)
 {
   nsPoint viewOffset;
   nsIWidget* viewWidget = aView->GetNearestWidget(&viewOffset);
   if (!viewWidget) {
-    return nsIntPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
-  }
-
-  nsIntPoint relativeToViewWidget(aPresContext->AppUnitsToDevPixels(aPt.x + viewOffset.x),
-                                  aPresContext->AppUnitsToDevPixels(aPt.y + viewOffset.y));
+    return LayoutDeviceIntPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
+  }
+
+  LayoutDeviceIntPoint relativeToViewWidget(aPresContext->AppUnitsToDevPixels(aPt.x + viewOffset.x),
+                                            aPresContext->AppUnitsToDevPixels(aPt.y + viewOffset.y));
   return relativeToViewWidget + WidgetToWidgetOffset(viewWidget, aWidget);
 }
 
 // Combine aNewBreakType with aOrigBreakType, but limit the break types
 // to NS_STYLE_CLEAR_LEFT, RIGHT, BOTH.
 uint8_t
 nsLayoutUtils::CombineBreakType(uint8_t aOrigBreakType,
                                 uint8_t aNewBreakType)
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -723,19 +723,20 @@ public:
   /**
    * Translate from view coordinates to the widget's coordinates.
    * @param aPresContext the PresContext for the view
    * @param aView the view
    * @param aPt the point relative to the view
    * @param aWidget the widget to which returned coordinates are relative
    * @return the point in the view's coordinates
    */
-  static nsIntPoint TranslateViewToWidget(nsPresContext* aPresContext,
-                                          nsView* aView, nsPoint aPt,
-                                          nsIWidget* aWidget);
+  static mozilla::LayoutDeviceIntPoint
+    TranslateViewToWidget(nsPresContext* aPresContext,
+                          nsView* aView, nsPoint aPt,
+                          nsIWidget* aWidget);
 
   enum FrameForPointFlags {
     /**
      * When set, paint suppression is ignored, so we'll return non-root page
      * elements even if paint suppression is stopping them from painting.
      */
     IGNORE_PAINT_SUPPRESSION = 0x01,
     /**
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -8469,19 +8469,19 @@ PresShell::AdjustContextMenuKeyEvent(Wid
     if (popupFrame) {
       nsIFrame* itemFrame =
         (static_cast<nsMenuPopupFrame *>(popupFrame))->GetCurrentMenuItem();
       if (!itemFrame)
         itemFrame = popupFrame;
 
       nsCOMPtr<nsIWidget> widget = popupFrame->GetNearestWidget();
       aEvent->widget = widget;
-      nsIntPoint widgetPoint = widget->WidgetToScreenOffset();
+      LayoutDeviceIntPoint widgetPoint = widget->WidgetToScreenOffset();
       aEvent->refPoint = LayoutDeviceIntPoint::FromUntyped(
-        itemFrame->GetScreenRect().BottomLeft() - widgetPoint);
+        itemFrame->GetScreenRect().BottomLeft()) - widgetPoint;
 
       mCurrentEventContent = itemFrame->GetContent();
       mCurrentEventFrame = itemFrame;
 
       return true;
     }
   }
 #endif
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -4810,17 +4810,17 @@ nsRect nsIFrame::GetScreenRectInAppUnits
         parentPresContext->AppUnitsPerDevPixel();
     nsPoint rootPt = parentScreenRectAppUnits.TopLeft() + rootFrameOffsetInParent;
     rootScreenPos.x = NS_round(parentScale*rootPt.x);
     rootScreenPos.y = NS_round(parentScale*rootPt.y);
   } else {
     nsCOMPtr<nsIWidget> rootWidget;
     presContext->PresShell()->GetViewManager()->GetRootWidget(getter_AddRefs(rootWidget));
     if (rootWidget) {
-      nsIntPoint rootDevPx = rootWidget->WidgetToScreenOffset();
+      LayoutDeviceIntPoint rootDevPx = rootWidget->WidgetToScreenOffset();
       rootScreenPos.x = presContext->DevPixelsToAppUnits(rootDevPx.x);
       rootScreenPos.y = presContext->DevPixelsToAppUnits(rootDevPx.y);
     }
   }
 
   return nsRect(rootScreenPos + GetOffsetTo(rootFrame), GetSize());
 }
 
--- a/layout/xul/nsResizerFrame.cpp
+++ b/layout/xul/nsResizerFrame.cpp
@@ -112,18 +112,17 @@ nsResizerFrame::HandleEvent(nsPresContex
           window->GetPositionAndSize(&mMouseDownRect.x, &mMouseDownRect.y,
                                      &mMouseDownRect.width, &mMouseDownRect.height);
         }
 
         // remember current mouse coordinates
         LayoutDeviceIntPoint refPoint;
         if (!GetEventPoint(aEvent, refPoint))
           return NS_OK;
-        mMouseDownPoint = refPoint +
-          LayoutDeviceIntPoint::FromUntyped(aEvent->widget->WidgetToScreenOffset());
+        mMouseDownPoint = refPoint + aEvent->widget->WidgetToScreenOffset();
 
         // we're tracking
         mTrackingMouseMove = true;
 
         nsIPresShell::SetCapturingContent(GetContent(), CAPTURE_IGNOREALLOWED);
       }
     }
     break;
@@ -161,18 +160,17 @@ nsResizerFrame::HandleEvent(nsPresContex
       // both MouseMove and direction are negative when pointing to the
       // top and left, and positive when pointing to the bottom and right
 
       // retrieve the offset of the mousemove event relative to the mousedown.
       // The difference is how much the resize needs to be
       LayoutDeviceIntPoint refPoint;
       if (!GetEventPoint(aEvent, refPoint))
         return NS_OK;
-      LayoutDeviceIntPoint screenPoint = refPoint +
-        LayoutDeviceIntPoint::FromUntyped(aEvent->widget->WidgetToScreenOffset());
+      LayoutDeviceIntPoint screenPoint = refPoint + aEvent->widget->WidgetToScreenOffset();
       LayoutDeviceIntPoint mouseMove(screenPoint - mMouseDownPoint);
 
       // Determine which direction to resize by checking the dir attribute.
       // For windows and menus, ensure that it can be resized in that direction.
       Direction direction = GetDirection();
       if (window || menuPopupFrame) {
         if (menuPopupFrame) {
           menuPopupFrame->CanAdjustEdges(
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -741,17 +741,17 @@ nsXULPopupManager::ShowTooltipAtScreen(n
   mCachedMousePoint = nsIntPoint(pc->CSSPixelsToDevPixels(aXPos),
                                  pc->CSSPixelsToDevPixels(aYPos));
 
   // coordinates are relative to the root widget
   nsPresContext* rootPresContext = pc->GetRootPresContext();
   if (rootPresContext) {
     nsIWidget *rootWidget = rootPresContext->GetRootWidget();
     if (rootWidget) {
-      mCachedMousePoint -= rootWidget->WidgetToScreenOffset();
+      mCachedMousePoint -= rootWidget->WidgetToScreenOffsetUntyped();
     }
   }
 
   popupFrame->InitializePopupAtScreen(aTriggerContent, aXPos, aYPos, false);
 
   FirePopupShowingEvent(aPopup, false, false);
 }
 
--- a/view/nsView.cpp
+++ b/view/nsView.cpp
@@ -215,17 +215,17 @@ nsIntRect nsView::CalcWidgetBounds(nsWin
     nsPoint offset;
     parentWidget = parent->GetNearestWidget(&offset, p2a);
     // make viewBounds be relative to the parent widget, in appunits
     viewBounds += offset;
 
     if (parentWidget && aType == eWindowType_popup &&
         IsEffectivelyVisible()) {
       // put offset into screen coordinates. (based on client area origin)
-      nsIntPoint screenPoint = parentWidget->WidgetToScreenOffset();
+      LayoutDeviceIntPoint screenPoint = parentWidget->WidgetToScreenOffset();
       viewBounds += nsPoint(NSIntPixelsToAppUnits(screenPoint.x, p2a),
                             NSIntPixelsToAppUnits(screenPoint.y, p2a));
     }
   }
 
   // Compute widget bounds in device pixels
   nsIntRect newBounds = viewBounds.ToNearestPixels(p2a);
 
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -121,18 +121,18 @@ public:
   NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) MOZ_OVERRIDE
   { return NS_ERROR_UNEXPECTED; }
 
   // PuppetWidgets don't have any concept of titles. 
   NS_IMETHOD SetTitle(const nsAString& aTitle) MOZ_OVERRIDE
   { return NS_ERROR_UNEXPECTED; }
   
   // PuppetWidgets are always at <0, 0>.
-  virtual nsIntPoint WidgetToScreenOffset() MOZ_OVERRIDE
-  { return nsIntPoint(0, 0); }
+  virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() MOZ_OVERRIDE
+  { return mozilla::LayoutDeviceIntPoint(0, 0); }
 
   void InitEvent(WidgetGUIEvent& aEvent, nsIntPoint* aPoint = nullptr);
 
   NS_IMETHOD DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus) MOZ_OVERRIDE;
 
   NS_IMETHOD CaptureRollupEvents(nsIRollupListener* aListener,
                                  bool aDoCapture) MOZ_OVERRIDE
   { return NS_ERROR_UNEXPECTED; }
--- a/widget/android/AndroidJavaWrappers.cpp
+++ b/widget/android/AndroidJavaWrappers.cpp
@@ -725,17 +725,17 @@ AndroidGeckoEvent::MakeTouchEvent(nsIWid
     if (type == NS_EVENT_NULL) {
         // An event we don't know about
         return event;
     }
 
     event.modifiers = DOMModifiers();
     event.time = Time();
 
-    const nsIntPoint& offset = widget->WidgetToScreenOffset();
+    const LayoutDeviceIntPoint& offset = widget->WidgetToScreenOffset();
     event.touches.SetCapacity(endIndex - startIndex);
     for (int i = startIndex; i < endIndex; i++) {
         // In this code branch, we are dispatching this event directly
         // into Gecko (as opposed to going through the AsyncPanZoomController),
         // and the Points() array has points in CSS pixels, which we need
         // to convert.
         CSSToLayoutDeviceScale scale = widget->GetDefaultScale();
         LayoutDeviceIntPoint pt(
@@ -791,17 +791,17 @@ AndroidGeckoEvent::MakeMultiTouchInput(n
     MultiTouchInput event(type, Time(), TimeStamp(), 0);
     event.modifiers = DOMModifiers();
 
     if (type < 0) {
         // An event we don't know about
         return event;
     }
 
-    const nsIntPoint& offset = widget->WidgetToScreenOffset();
+    const nsIntPoint& offset = widget->WidgetToScreenOffsetUntyped();
     event.mTouches.SetCapacity(endIndex - startIndex);
     for (int i = startIndex; i < endIndex; i++) {
         nsIntPoint point = Points()[i] - offset;
         nsIntPoint radius = PointRadii()[i];
         SingleTouchData data(PointIndicies()[i],
                              ScreenIntPoint::FromUnknownPoint(
                                gfx::IntPoint(point.x, point.y)),
                              ScreenSize::FromUnknownSize(
@@ -848,21 +848,20 @@ AndroidGeckoEvent::MakeMouseEvent(nsIWid
         event.clickCount = 1;
     }
     event.modifiers = DOMModifiers();
     event.time = Time();
 
     // We are dispatching this event directly into Gecko (as opposed to going
     // through the AsyncPanZoomController), and the Points() array has points
     // in CSS pixels, which we need to convert to LayoutDevice pixels.
-    const nsIntPoint& offset = widget->WidgetToScreenOffset();
+    const LayoutDeviceIntPoint& offset = widget->WidgetToScreenOffset();
     CSSToLayoutDeviceScale scale = widget->GetDefaultScale();
     event.refPoint = LayoutDeviceIntPoint((Points()[0].x * scale.scale) - offset.x,
                                           (Points()[0].y * scale.scale) - offset.y);
-
     return event;
 }
 
 Modifiers
 AndroidGeckoEvent::DOMModifiers() const
 {
     Modifiers result = 0;
     if (mMetaState & AMETA_ALT_MASK) {
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -625,30 +625,30 @@ nsWindow::BringToFront()
     // force a window resize
     nsAppShell::gAppShell->ResendLastResizeEvent(newTop);
     RedrawAll();
 }
 
 NS_IMETHODIMP
 nsWindow::GetScreenBounds(nsIntRect &aRect)
 {
-    nsIntPoint p = WidgetToScreenOffset();
+    LayoutDeviceIntPoint p = WidgetToScreenOffset();
 
     aRect.x = p.x;
     aRect.y = p.y;
     aRect.width = mBounds.width;
     aRect.height = mBounds.height;
     
     return NS_OK;
 }
 
-nsIntPoint
+LayoutDeviceIntPoint
 nsWindow::WidgetToScreenOffset()
 {
-    nsIntPoint p(0, 0);
+    LayoutDeviceIntPoint p(0, 0);
     nsWindow *w = this;
 
     while (w && !w->IsTopLevel()) {
         p.x += w->mBounds.x;
         p.y += w->mBounds.y;
 
         w = w->mParent;
     }
@@ -1036,18 +1036,17 @@ nsWindow::OnContextmenuEvent(AndroidGeck
     if (points.Length() > 0) {
         pt = CSSPoint(points[0].x, points[0].y);
     }
 
     // Send the contextmenu event.
     WidgetMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
                                       WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
     contextMenuEvent.refPoint =
-        LayoutDeviceIntPoint(RoundedToInt(pt * GetDefaultScale())) -
-        LayoutDeviceIntPoint::FromUntyped(WidgetToScreenOffset());
+        RoundedToInt(pt * GetDefaultScale()) - WidgetToScreenOffset();
     contextMenuEvent.ignoreRootScrollFrame = true;
     contextMenuEvent.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
 
     nsEventStatus contextMenuStatus;
     DispatchEvent(&contextMenuEvent, contextMenuStatus);
 
     // If the contextmenu event was consumed (preventDefault issued), we follow with a
     // touchcancel event. This avoids followup touchend events passsing through and
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -95,17 +95,17 @@ public:
                            nsIWidget *aWidget,
                            bool aActivate);
     NS_IMETHOD SetSizeMode(int32_t aMode);
     NS_IMETHOD Enable(bool aState);
     virtual bool IsEnabled() const;
     NS_IMETHOD Invalidate(const nsIntRect &aRect);
     NS_IMETHOD SetFocus(bool aRaise = false);
     NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
-    virtual nsIntPoint WidgetToScreenOffset();
+    virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset();
     NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
                              nsEventStatus& aStatus);
     nsEventStatus DispatchEvent(mozilla::WidgetGUIEvent* aEvent);
     NS_IMETHOD MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen = nullptr);
     NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
 
 
 
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -396,17 +396,17 @@ public:
   virtual double          GetDefaultScaleInternal() MOZ_OVERRIDE;
 
   virtual int32_t         RoundsWidgetCoordinatesTo() MOZ_OVERRIDE;
 
   NS_IMETHOD              Invalidate(const nsIntRect &aRect) MOZ_OVERRIDE;
 
   virtual void*           GetNativeData(uint32_t aDataType) MOZ_OVERRIDE;
   virtual nsresult        ConfigureChildren(const nsTArray<Configuration>& aConfigurations) MOZ_OVERRIDE;
-  virtual nsIntPoint      WidgetToScreenOffset() MOZ_OVERRIDE;
+  virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() MOZ_OVERRIDE;
   virtual bool            ShowsResizeIndicator(nsIntRect* aResizerRect) MOZ_OVERRIDE;
 
   static  bool            ConvertStatus(nsEventStatus aStatus)
                           { return aStatus == nsEventStatus_eConsumeNoDefault; }
   NS_IMETHOD              DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
                                         nsEventStatus& aStatus) MOZ_OVERRIDE;
 
   virtual bool            ComputeShouldAccelerate(bool aDefault) MOZ_OVERRIDE;
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -918,25 +918,25 @@ NS_IMETHODIMP nsChildView::GetBounds(nsI
 }
 
 NS_IMETHODIMP nsChildView::GetClientBounds(nsIntRect &aRect)
 {
   GetBounds(aRect);
   if (!mParentWidget) {
     // For top level widgets we want the position on screen, not the position
     // of this view inside the window.
-    aRect.MoveTo(WidgetToScreenOffset());
+    aRect.MoveTo(WidgetToScreenOffsetUntyped());
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP nsChildView::GetScreenBounds(nsIntRect &aRect)
 {
   GetBounds(aRect);
-  aRect.MoveTo(WidgetToScreenOffset());
+  aRect.MoveTo(WidgetToScreenOffsetUntyped());
   return NS_OK;
 }
 
 double
 nsChildView::GetDefaultScaleInternal()
 {
   return BackingScaleFactor();
 }
@@ -1477,17 +1477,17 @@ void nsChildView::ReportSizeEvent()
   if (mWidgetListener)
     mWidgetListener->WindowResized(this, mBounds.width, mBounds.height);
 }
 
 #pragma mark -
 
 //    Return the offset between this child view and the screen.
 //    @return       -- widget origin in device-pixel coords
-nsIntPoint nsChildView::WidgetToScreenOffset()
+LayoutDeviceIntPoint nsChildView::WidgetToScreenOffset()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   NSPoint origin = NSMakePoint(0, 0);
 
   // 1. First translate view origin point into window coords.
   // The returned point is in bottom-left coordinates.
   origin = [mView convertPoint:origin toView:nil];
@@ -1495,19 +1495,19 @@ nsIntPoint nsChildView::WidgetToScreenOf
   // 2. We turn the window-coord rect's origin into screen (still bottom-left) coords.
   origin = [[mView window] convertBaseToScreen:origin];
 
   // 3. Since we're dealing in bottom-left coords, we need to make it top-left coords
   //    before we pass it back to Gecko.
   FlipCocoaScreenCoordinate(origin);
 
   // convert to device pixels
-  return CocoaPointsToDevPixels(origin);
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(nsIntPoint(0,0));
+  return LayoutDeviceIntPoint::FromUntyped(CocoaPointsToDevPixels(origin));
+
+  NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
 }
 
 NS_IMETHODIMP nsChildView::CaptureRollupEvents(nsIRollupListener * aListener,
                                                bool aDoCapture)
 {
   // this never gets called, only top-level windows can be rollup widgets
   return NS_OK;
 }
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -255,17 +255,17 @@ public:
 
     NS_IMETHOD              Show(bool aState) MOZ_OVERRIDE;
     virtual nsIWidget*      GetSheetWindowParent(void) MOZ_OVERRIDE;
     NS_IMETHOD              Enable(bool aState) MOZ_OVERRIDE;
     virtual bool            IsEnabled() const MOZ_OVERRIDE;
     NS_IMETHOD              SetModal(bool aState) MOZ_OVERRIDE;
     virtual bool            IsVisible() const MOZ_OVERRIDE;
     NS_IMETHOD              SetFocus(bool aState=false) MOZ_OVERRIDE;
-    virtual nsIntPoint WidgetToScreenOffset() MOZ_OVERRIDE;
+    virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() MOZ_OVERRIDE;
     virtual nsIntPoint GetClientOffset() MOZ_OVERRIDE;
     virtual nsIntSize ClientToWindowSize(const nsIntSize& aClientSize) MOZ_OVERRIDE;
 
     virtual void* GetNativeData(uint32_t aDataType) MOZ_OVERRIDE;
 
     NS_IMETHOD              ConstrainPosition(bool aAllowSlop,
                                               int32_t *aX, int32_t *aY) MOZ_OVERRIDE;
     virtual void            SetSizeConstraints(const SizeConstraints& aConstraints) MOZ_OVERRIDE;
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -1807,30 +1807,30 @@ NS_IMETHODIMP nsCocoaWindow::SetFocus(bo
 
     [mWindow makeKeyAndOrderFront:nil];
     SendSetZLevelEvent();
   }
 
   return NS_OK;
 }
 
-nsIntPoint nsCocoaWindow::WidgetToScreenOffset()
+LayoutDeviceIntPoint nsCocoaWindow::WidgetToScreenOffset()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   NSRect rect = NSZeroRect;
   nsIntRect r;
   if (mWindow) {
     rect = [mWindow contentRectForFrameRect:[mWindow frame]];
   }
   r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(rect, BackingScaleFactor());
 
-  return r.TopLeft();
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(nsIntPoint(0,0));
+  return LayoutDeviceIntPoint::FromUntyped(r.TopLeft());
+
+  NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
 }
 
 nsIntPoint nsCocoaWindow::GetClientOffset()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   nsIntRect clientRect;
   GetClientBounds(clientRect);
--- a/widget/gonk/nsWindow.cpp
+++ b/widget/gonk/nsWindow.cpp
@@ -500,20 +500,20 @@ nsWindow::Invalidate(const nsIntRect &aR
     if (top != sTopWindows[0] && this != sTopWindows[0])
         return NS_OK;
 
     gDrawRequest = true;
     mozilla::NotifyEvent();
     return NS_OK;
 }
 
-nsIntPoint
+LayoutDeviceIntPoint
 nsWindow::WidgetToScreenOffset()
 {
-    nsIntPoint p(0, 0);
+    LayoutDeviceIntPoint p(0, 0);
     nsWindow *w = this;
 
     while (w && w->mParent) {
         p.x += w->mBounds.x;
         p.y += w->mBounds.y;
 
         w = w->mParent;
     }
--- a/widget/gonk/nsWindow.h
+++ b/widget/gonk/nsWindow.h
@@ -81,17 +81,17 @@ public:
     NS_IMETHOD SetFocus(bool aRaise = false);
     NS_IMETHOD ConfigureChildren(const nsTArray<nsIWidget::Configuration>&);
     NS_IMETHOD Invalidate(const nsIntRect &aRect);
     virtual void* GetNativeData(uint32_t aDataType);
     NS_IMETHOD SetTitle(const nsAString& aTitle)
     {
         return NS_OK;
     }
-    virtual nsIntPoint WidgetToScreenOffset();
+    virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset();
     void DispatchTouchInputViaAPZ(mozilla::MultiTouchInput& aInput);
     NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
                              nsEventStatus& aStatus);
     virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
                                                 TouchPointerState aPointerState,
                                                 nsIntPoint aPointerScreenPoint,
                                                 double aPointerPressure,
                                                 uint32_t aPointerOrientation) MOZ_OVERRIDE;
--- a/widget/gtk/nsDragService.cpp
+++ b/widget/gtk/nsDragService.cpp
@@ -1750,17 +1750,17 @@ nsDragService::ScheduleDropEvent(nsWindo
                                  nsIntPoint aWindowPoint, guint aTime)
 {
     if (!Schedule(eDragTaskDrop, aWindow,
                   aDragContext, aWindowPoint, aTime)) {
         NS_WARNING("Additional drag drop ignored");
         return FALSE;        
     }
 
-    SetDragEndPoint(aWindowPoint + aWindow->WidgetToScreenOffset());
+    SetDragEndPoint(aWindowPoint + aWindow->WidgetToScreenOffsetUntyped());
 
     // We'll reply with gtk_drag_finish().
     return TRUE;
 }
 
 gboolean
 nsDragService::Schedule(DragTask aTask, nsWindow *aWindow,
                         GdkDragContext *aDragContext,
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -1468,20 +1468,20 @@ nsWindow::SetFocus(bool aRaise)
 
 NS_IMETHODIMP
 nsWindow::GetScreenBounds(nsIntRect &aRect)
 {
     if (mIsTopLevel && mContainer) {
         // use the point including window decorations
         gint x, y;
         gdk_window_get_root_origin(gtk_widget_get_window(GTK_WIDGET(mContainer)), &x, &y);
-        aRect.MoveTo(GdkPointToDevicePixels({ x, y }));
+        aRect.MoveTo(LayoutDevicePixel::ToUntyped(GdkPointToDevicePixels({ x, y })));
     }
     else {
-        aRect.MoveTo(WidgetToScreenOffset());
+        aRect.MoveTo(WidgetToScreenOffsetUntyped());
     }
     // mBounds.Size() is the window bounds, not the window-manager frame
     // bounds (bug 581863).  gdk_window_get_frame_extents would give the
     // frame bounds, but mBounds.Size() is returned here for consistency
     // with Resize.
     aRect.SizeTo(mBounds.Size());
     LOG(("GetScreenBounds %d,%d | %dx%d\n",
          aRect.x, aRect.y, aRect.width, aRect.height));
@@ -1792,17 +1792,17 @@ nsWindow::SetIcon(const nsAString& aIcon
     if (foundIcon) {
         gtk_window_set_icon_name(GTK_WINDOW(mShell), iconName.get());
     }
 
     return NS_OK;
 }
 
 
-nsIntPoint
+LayoutDeviceIntPoint
 nsWindow::WidgetToScreenOffset()
 {
     gint x = 0, y = 0;
 
     if (mGdkWindow) {
         gdk_window_get_origin(mGdkWindow, &x, &y);
     }
 
@@ -2612,18 +2612,17 @@ nsWindow::OnMotionNotifyEvent(GdkEventMo
     else {
         // XXX see OnScrollEvent()
         if (aEvent->window == mGdkWindow) {
             event.refPoint.x = nscoord(aEvent->x);
             event.refPoint.y = nscoord(aEvent->y);
         } else {
             LayoutDeviceIntPoint point(NSToIntFloor(aEvent->x_root),
                                        NSToIntFloor(aEvent->y_root));
-            event.refPoint = point -
-                LayoutDeviceIntPoint::FromUntyped(WidgetToScreenOffset());
+            event.refPoint = point - WidgetToScreenOffset();
         }
 
         modifierState = aEvent->state;
 
         event.time = aEvent->time;
     }
 
     KeymapWrapper::InitInputEvent(event, modifierState);
@@ -2691,18 +2690,17 @@ nsWindow::InitButtonEvent(WidgetMouseEve
 {
     // XXX see OnScrollEvent()
     if (aGdkEvent->window == mGdkWindow) {
         aEvent.refPoint.x = nscoord(aGdkEvent->x);
         aEvent.refPoint.y = nscoord(aGdkEvent->y);
     } else {
         LayoutDeviceIntPoint point(NSToIntFloor(aGdkEvent->x_root),
                                    NSToIntFloor(aGdkEvent->y_root));
-        aEvent.refPoint = point -
-            LayoutDeviceIntPoint::FromUntyped(WidgetToScreenOffset());
+        aEvent.refPoint = point - WidgetToScreenOffset();
     }
 
     guint modifierState = aGdkEvent->state;
     // aEvent's state doesn't include this event's information.  Therefore,
     // if aEvent is mouse button down event, we need to set it manually.
     // Note that we cannot do same thing for NS_MOUSE_BUTTON_UP because
     // system may have two or more mice and same button of another mouse
     // may be still pressed.
@@ -3204,18 +3202,17 @@ nsWindow::OnScrollEvent(GdkEventScroll *
         wheelEvent.refPoint.x = nscoord(aEvent->x);
         wheelEvent.refPoint.y = nscoord(aEvent->y);
     } else {
         // XXX we're never quite sure which GdkWindow the event came from due to our custom bubbling
         // in scroll_event_cb(), so use ScreenToWidget to translate the screen root coordinates into
         // coordinates relative to this widget.
         LayoutDeviceIntPoint point(NSToIntFloor(aEvent->x_root),
                                    NSToIntFloor(aEvent->y_root));
-        wheelEvent.refPoint = point -
-            LayoutDeviceIntPoint::FromUntyped(WidgetToScreenOffset());
+        wheelEvent.refPoint = point - WidgetToScreenOffset();
     }
 
     KeymapWrapper::InitInputEvent(wheelEvent, aEvent->state);
 
     wheelEvent.time = aEvent->time;
 
     if (mAPZC) {
         uint64_t inputBlockId = 0;
@@ -6333,17 +6330,17 @@ nsWindow::GetDragInfo(WidgetMouseEvent* 
         return false;
     }
 
     // FIXME: It would be nice to have the widget position at the time
     // of the event, but it's relatively unlikely that the widget has
     // moved since the mousedown.  (On the other hand, it's quite likely
     // that the mouse has moved, which is why we use the mouse position
     // from the event.)
-    nsIntPoint offset = aMouseEvent->widget->WidgetToScreenOffset();
+    LayoutDeviceIntPoint offset = aMouseEvent->widget->WidgetToScreenOffset();
     *aRootX = aMouseEvent->refPoint.x + offset.x;
     *aRootY = aMouseEvent->refPoint.y + offset.y;
 
     return true;
 }
 
 NS_IMETHODIMP
 nsWindow::BeginMoveDrag(WidgetMouseEvent* aEvent)
@@ -6494,21 +6491,21 @@ nsWindow::DevicePixelsToGdkRectRoundOut(
     return { x, y, right - x, bottom - y };
 }
 
 int
 nsWindow::GdkCoordToDevicePixels(gint coord) {
     return coord * GdkScaleFactor();
 }
 
-nsIntPoint
+LayoutDeviceIntPoint
 nsWindow::GdkPointToDevicePixels(GdkPoint point) {
     gint scale = GdkScaleFactor();
-    return nsIntPoint(point.x * scale,
-                      point.y * scale);
+    return LayoutDeviceIntPoint(point.x * scale,
+                                point.y * scale);
 }
 
 nsIntRect
 nsWindow::GdkRectToDevicePixels(GdkRectangle rect) {
     gint scale = GdkScaleFactor();
     return nsIntRect(rect.x * scale,
                      rect.y * scale,
                      rect.width * scale,
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -133,17 +133,17 @@ public:
     NS_IMETHOD         SetCursor(imgIContainer* aCursor,
                                  uint32_t aHotspotX, uint32_t aHotspotY) MOZ_OVERRIDE;
     NS_IMETHOD         Invalidate(const nsIntRect &aRect) MOZ_OVERRIDE;
     virtual void*      GetNativeData(uint32_t aDataType) MOZ_OVERRIDE;
     void               SetNativeData(uint32_t aDataType, uintptr_t aVal) MOZ_OVERRIDE;
     NS_IMETHOD         SetTitle(const nsAString& aTitle) MOZ_OVERRIDE;
     NS_IMETHOD         SetIcon(const nsAString& aIconSpec) MOZ_OVERRIDE;
     NS_IMETHOD         SetWindowClass(const nsAString& xulWinType) MOZ_OVERRIDE;
-    virtual nsIntPoint WidgetToScreenOffset() MOZ_OVERRIDE;
+    virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() MOZ_OVERRIDE;
     NS_IMETHOD         EnableDragDrop(bool aEnable) MOZ_OVERRIDE;
     NS_IMETHOD         CaptureMouse(bool aCapture) MOZ_OVERRIDE;
     NS_IMETHOD         CaptureRollupEvents(nsIRollupListener *aListener,
                                            bool aDoCapture) MOZ_OVERRIDE;
     NS_IMETHOD         GetAttention(int32_t aCycleCount) MOZ_OVERRIDE;
     virtual nsresult   SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
                                            bool aIntersectWithExisting) MOZ_OVERRIDE;
     virtual bool       HasPendingInputEvent() MOZ_OVERRIDE;
@@ -493,17 +493,17 @@ private:
     // To GDK
     gint DevicePixelsToGdkCoordRoundUp(int pixels);
     gint DevicePixelsToGdkCoordRoundDown(int pixels);
     GdkPoint DevicePixelsToGdkPointRoundDown(nsIntPoint point);
     GdkRectangle DevicePixelsToGdkRectRoundOut(nsIntRect rect);
 
     // From GDK
     int GdkCoordToDevicePixels(gint coord);
-    nsIntPoint GdkPointToDevicePixels(GdkPoint point);
+    mozilla::LayoutDeviceIntPoint GdkPointToDevicePixels(GdkPoint point);
     nsIntRect GdkRectToDevicePixels(GdkRectangle rect);
 };
 
 class nsChildWindow : public nsWindow {
 public:
     nsChildWindow();
     ~nsChildWindow();
 };
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -1663,22 +1663,26 @@ class nsIWidget : public nsISupports {
      * @param anIconSpec string specifying the icon to use; convention is to pass
      *                   a resource: URL from which a platform-dependent resource
      *                   file name will be constructed
      */
 
     NS_IMETHOD SetIcon(const nsAString& anIconSpec) = 0;
 
     /**
-     * Return this widget's origin in screen coordinates.
+     * Return this widget's origin in screen coordinates. The untyped version
+     * exists temporarily to ease conversion to typed coordinates.
      *
      * @return screen coordinates stored in the x,y members
      */
 
-    virtual nsIntPoint WidgetToScreenOffset() = 0;
+    virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() = 0;
+    virtual nsIntPoint WidgetToScreenOffsetUntyped() {
+      return mozilla::LayoutDeviceIntPoint::ToUntyped(WidgetToScreenOffset());
+    }
 
     /**
      * Given the specified client size, return the corresponding window size,
      * which includes the area for the borders and titlebar. This method
      * should work even when the window is not yet visible.
      */
     virtual nsIntSize ClientToWindowSize(const nsIntSize& aClientSize) = 0;
 
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -621,25 +621,25 @@ nsWindow::Invalidate(const nsIntRect &aR
         return NS_OK;
     }
 
     mWidget->renderLater();
 
     return NS_OK;
 }
 
-nsIntPoint
+LayoutDeviceIntPoint
 nsWindow::WidgetToScreenOffset()
 {
     NS_ENSURE_TRUE(mWidget, nsIntPoint(0,0));
 
     QPoint origin(0, 0);
     origin = mWidget->mapToGlobal(origin);
 
-    return nsIntPoint(origin.x(), origin.y());
+    return LayoutDeviceIntPoint(origin.x(), origin.y());
 }
 
 void*
 nsWindow::GetNativeData(uint32_t aDataType)
 {
     switch (aDataType) {
     case NS_NATIVE_WINDOW:
     case NS_NATIVE_WIDGET: {
--- a/widget/qt/nsWindow.h
+++ b/widget/qt/nsWindow.h
@@ -119,17 +119,17 @@ public:
     virtual void*      GetNativeData(uint32_t aDataType);
     NS_IMETHOD         SetTitle(const nsAString& aTitle);
     NS_IMETHOD         SetCursor(nsCursor aCursor);
     NS_IMETHOD         SetCursor(imgIContainer* aCursor,
                                  uint32_t aHotspotX, uint32_t aHotspotY)
     {
         return NS_OK;
     }
-    virtual nsIntPoint WidgetToScreenOffset();
+    virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset();
     NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
                              nsEventStatus& aStatus);
     NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
                                    bool aDoCapture)
     {
         return NS_ERROR_NOT_IMPLEMENTED;
     }
     NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
--- a/widget/windows/nsIMM32Handler.cpp
+++ b/widget/windows/nsIMM32Handler.cpp
@@ -1952,34 +1952,34 @@ nsIMM32Handler::SetIMERelatedWindowsPosO
        "FAILED (NS_QUERY_EDITOR_RECT)"));
     return;
   }
 
   // Clip the plugin rect by the client rect of the window because composition
   // window needs to be specified the position in the client area.
   nsWindow* toplevelWindow = aWindow->GetTopLevelWindow(false);
   nsIntRect pluginRectInScreen =
-    editorRectEvent.mReply.mRect + toplevelWindow->WidgetToScreenOffset();
+    editorRectEvent.mReply.mRect + toplevelWindow->WidgetToScreenOffsetUntyped();
   nsIntRect winRectInScreen;
   aWindow->GetClientBounds(winRectInScreen);
   // composition window cannot be positioned on the edge of client area.
   winRectInScreen.width--;
   winRectInScreen.height--;
   nsIntRect clippedPluginRect;
   clippedPluginRect.x =
     std::min(std::max(pluginRectInScreen.x, winRectInScreen.x),
              winRectInScreen.XMost());
   clippedPluginRect.y =
     std::min(std::max(pluginRectInScreen.y, winRectInScreen.y),
              winRectInScreen.YMost());
   int32_t xMost = std::min(pluginRectInScreen.XMost(), winRectInScreen.XMost());
   int32_t yMost = std::min(pluginRectInScreen.YMost(), winRectInScreen.YMost());
   clippedPluginRect.width = std::max(0, xMost - clippedPluginRect.x);
   clippedPluginRect.height = std::max(0, yMost - clippedPluginRect.y);
-  clippedPluginRect -= aWindow->WidgetToScreenOffset();
+  clippedPluginRect -= aWindow->WidgetToScreenOffsetUntyped();
 
   // Cover the plugin with native caret.  This prevents IME's window and plugin
   // overlap.
   if (mNativeCaretIsCreated) {
     ::DestroyCaret();
   }
   mNativeCaretIsCreated =
     ::CreateCaret(aWindow->GetWindowHandle(), nullptr,
@@ -2008,20 +2008,20 @@ nsIMM32Handler::ResolveIMECaretPos(nsIWi
                                    nsIntRect& aOutRect)
 {
   aOutRect = aCursorRect;
 
   if (aReferenceWidget == aNewOriginWidget)
     return;
 
   if (aReferenceWidget)
-    aOutRect.MoveBy(aReferenceWidget->WidgetToScreenOffset());
+    aOutRect.MoveBy(aReferenceWidget->WidgetToScreenOffsetUntyped());
 
   if (aNewOriginWidget)
-    aOutRect.MoveBy(-aNewOriginWidget->WidgetToScreenOffset());
+    aOutRect.MoveBy(-aNewOriginWidget->WidgetToScreenOffsetUntyped());
 }
 
 /* static */ nsresult
 nsIMM32Handler::OnMouseButtonEvent(nsWindow* aWindow,
                                    const IMENotification& aIMENotification)
 {
   // We don't need to create the instance of the handler here.
   if (!gIMM32Handler) {
--- a/widget/windows/nsTextStore.cpp
+++ b/widget/windows/nsTextStore.cpp
@@ -3193,17 +3193,17 @@ nsTextStore::GetTextExt(TsViewCookie vcV
     refWindow = refWindow->GetTopLevelWindow(false);
     if (!refWindow) {
       PR_LOG(sTextStoreLog, PR_LOG_ERROR,
              ("TSF: 0x%p   nsTextStore::GetTextExt() FAILED due to "
               "no top level window", this));
       return E_FAIL;
     }
 
-    event.mReply.mRect.MoveBy(refWindow->WidgetToScreenOffset());
+    event.mReply.mRect.MoveBy(refWindow->WidgetToScreenOffsetUntyped());
   }
 
   // get bounding screen rect to test for clipping
   if (!GetScreenExtInternal(*prc)) {
     PR_LOG(sTextStoreLog, PR_LOG_ERROR,
            ("TSF: 0x%p   nsTextStore::GetTextExt() FAILED due to "
             "GetScreenExtInternal() failure", this));
     return E_FAIL;
@@ -3331,17 +3331,17 @@ nsTextStore::GetScreenExtInternal(RECT &
       return false;
     }
 
     boundRect.MoveTo(0, 0);
 
     // Clip frame rect to window rect
     boundRect.IntersectRect(event.mReply.mRect, boundRect);
     if (!boundRect.IsEmpty()) {
-      boundRect.MoveBy(refWindow->WidgetToScreenOffset());
+      boundRect.MoveBy(refWindow->WidgetToScreenOffsetUntyped());
       ::SetRect(&aScreenExt, boundRect.x, boundRect.y,
                 boundRect.XMost(), boundRect.YMost());
     } else {
       ::SetRectEmpty(&aScreenExt);
     }
   }
 
   PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
@@ -4320,18 +4320,18 @@ nsTextStore::CreateNativeCaret()
   if (!toplevelWindow) {
     PR_LOG(sTextStoreLog, PR_LOG_ERROR,
            ("TSF: 0x%p   nsTextStore::CreateNativeCaret() FAILED due to "
             "no top level window", this));
     return;
   }
 
   if (toplevelWindow != window) {
-    caretRect.MoveBy(toplevelWindow->WidgetToScreenOffset());
-    caretRect.MoveBy(-window->WidgetToScreenOffset());
+    caretRect.MoveBy(toplevelWindow->WidgetToScreenOffsetUntyped());
+    caretRect.MoveBy(-window->WidgetToScreenOffsetUntyped());
   }
 
   ::SetCaretPos(caretRect.x, caretRect.y);
 }
 
 void
 nsTextStore::CommitCompositionInternal(bool aDiscard)
 {
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1986,17 +1986,17 @@ NS_METHOD nsWindow::GetRestoredBounds(ns
 nsIntPoint nsWindow::GetClientOffset()
 {
   if (!mWnd) {
     return nsIntPoint(0, 0);
   }
 
   RECT r1;
   GetWindowRect(mWnd, &r1);
-  nsIntPoint pt = WidgetToScreenOffset();
+  LayoutDeviceIntPoint pt = WidgetToScreenOffset();
   return nsIntPoint(pt.x - r1.left, pt.y - r1.top);
 }
 
 void
 nsWindow::SetDrawsInTitlebar(bool aState)
 {
   nsWindow * window = GetTopLevelWindow(true);
   if (window && window != this) {
@@ -3056,23 +3056,23 @@ NS_METHOD nsWindow::SetIcon(const nsAStr
 /**************************************************************
  *
  * SECTION: nsIWidget::WidgetToScreenOffset
  *
  * Return this widget's origin in screen coordinates.
  *
  **************************************************************/
 
-nsIntPoint nsWindow::WidgetToScreenOffset()
+LayoutDeviceIntPoint nsWindow::WidgetToScreenOffset()
 {
   POINT point;
   point.x = 0;
   point.y = 0;
   ::ClientToScreen(mWnd, &point);
-  return nsIntPoint(point.x, point.y);
+  return LayoutDeviceIntPoint(point.x, point.y);
 }
 
 nsIntSize nsWindow::ClientToWindowSize(const nsIntSize& aClientSize)
 {
   if (mWindowType == eWindowType_popup && !IsPopupWithTitleBar())
     return aClientSize;
 
   // just use (200, 200) as the position
@@ -3814,17 +3814,17 @@ bool nsWindow::DispatchMouseEvent(uint32
   modifierKeyState.InitInputEvent(event);
   event.button    = aButton;
   event.inputSource = aInputSource;
   // Convert Mouse events generated by pen device or if mouse not generated from touch
   event.convertToPointer =
     aInputSource == nsIDOMMouseEvent::MOZ_SOURCE_PEN ||
     !(WinUtils::GetIsMouseFromTouch(aEventType) && mTouchWindow);
 
-  nsIntPoint mpScreen = eventPoint + WidgetToScreenOffset();
+  nsIntPoint mpScreen = eventPoint + WidgetToScreenOffsetUntyped();
 
   // Suppress mouse moves caused by widget creation
   if (aEventType == NS_MOUSE_MOVE) 
   {
     if ((sLastMouseMovePoint.x == mpScreen.x) && (sLastMouseMovePoint.y == mpScreen.y))
       return result;
     sLastMouseMovePoint.x = mpScreen.x;
     sLastMouseMovePoint.y = mpScreen.y;
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -131,17 +131,17 @@ public:
   NS_IMETHOD              Invalidate(bool aEraseBackground = false,
                                      bool aUpdateNCArea = false,
                                      bool aIncludeChildren = false);
   NS_IMETHOD              Invalidate(const nsIntRect & aRect);
   virtual void*           GetNativeData(uint32_t aDataType);
   virtual void            FreeNativeData(void * data, uint32_t aDataType);
   NS_IMETHOD              SetTitle(const nsAString& aTitle);
   NS_IMETHOD              SetIcon(const nsAString& aIconSpec);
-  virtual nsIntPoint      WidgetToScreenOffset();
+  virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset();
   virtual nsIntSize       ClientToWindowSize(const nsIntSize& aClientSize);
   NS_IMETHOD              DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
                                         nsEventStatus& aStatus);
   NS_IMETHOD              EnableDragDrop(bool aEnable);
   NS_IMETHOD              CaptureMouse(bool aCapture);
   NS_IMETHOD              CaptureRollupEvents(nsIRollupListener * aListener,
                                               bool aDoCapture);
   NS_IMETHOD              GetAttention(int32_t aCycleCount);
--- a/widget/windows/winrt/MetroWidget.cpp
+++ b/widget/windows/winrt/MetroWidget.cpp
@@ -1487,20 +1487,20 @@ MetroWidget::FreeNativeData(void * data,
 }
 
 NS_IMETHODIMP
 MetroWidget::SetTitle(const nsAString& aTitle)
 {
   return NS_OK;
 }
 
-nsIntPoint
+LayoutDeviceIntPoint
 MetroWidget::WidgetToScreenOffset()
 {
-  return nsIntPoint(0,0);
+  return LayoutDeviceIntPoint(0,0);
 }
 
 NS_IMETHODIMP
 MetroWidget::CaptureRollupEvents(nsIRollupListener * aListener,
                                  bool aDoCapture)
 {
   return NS_OK;
 }
--- a/widget/windows/winrt/MetroWidget.h
+++ b/widget/windows/winrt/MetroWidget.h
@@ -167,17 +167,17 @@ public:
   void SizeModeChanged();
   void Activated(bool aActiveated);
   void Paint(const nsIntRegion& aInvalidRegion);
 
   MetroWidget* MetroWidget::GetTopLevelWindow(bool aStopOnDialogOrPopup) { return this; }
   virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
   virtual void* GetNativeData(uint32_t aDataType);
   virtual void  FreeNativeData(void * data, uint32_t aDataType);
-  virtual nsIntPoint WidgetToScreenOffset();
+  virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset();
 
   already_AddRefed<nsIPresShell> GetPresShell();
 
   void UserActivity();
 
 #ifdef ACCESSIBILITY
   mozilla::a11y::Accessible* DispatchAccessibleEvent(uint32_t aEventType);
   mozilla::a11y::Accessible* GetAccessible();