diff --git a/accessible/generic/HyperTextAccessible.cpp b/accessible/generic/HyperTextAccessible.cpp index 3d394e24a0f..5681aa01331 100644 --- a/accessible/generic/HyperTextAccessible.cpp +++ b/accessible/generic/HyperTextAccessible.cpp @@ -1344,7 +1344,7 @@ HyperTextAccessible::GetCaretRect(nsIWidget** aWidget) 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 diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 32662d687f3..07f45b1f2ec 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -2195,8 +2195,7 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType, } } - pt += LayoutDeviceIntPoint::FromUntyped( - widget->WidgetToScreenOffset() - targetWidget->WidgetToScreenOffset()); + pt += widget->WidgetToScreenOffset() - targetWidget->WidgetToScreenOffset(); WidgetQueryContentEvent queryEvent(true, aType, targetWidget); InitEvent(queryEvent, &pt); diff --git a/dom/base/nsQueryContentEventResult.cpp b/dom/base/nsQueryContentEventResult.cpp index bd2b7aee63b..c451952a03f 100644 --- a/dom/base/nsQueryContentEventResult.cpp +++ b/dom/base/nsQueryContentEventResult.cpp @@ -147,7 +147,7 @@ nsQueryContentEventResult::SetEventResult(nsIWidget* aWidget, } // 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)); } diff --git a/dom/events/ContentEventHandler.cpp b/dom/events/ContentEventHandler.cpp index f5e83a2e89b..3c3665a50a9 100644 --- a/dom/events/ContentEventHandler.cpp +++ b/dom/events/ContentEventHandler.cpp @@ -1149,9 +1149,8 @@ ContentEventHandler::OnQueryCharacterAtPoint(WidgetQueryContentEvent* aEvent) 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); @@ -1214,8 +1213,7 @@ ContentEventHandler::OnQueryDOMWidgetHittest(WidgetQueryContentEvent* aEvent) 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, diff --git a/dom/events/Event.cpp b/dom/events/Event.cpp index e7d967814d3..04dbbf56b06 100644 --- a/dom/events/Event.cpp +++ b/dom/events/Event.cpp @@ -902,8 +902,7 @@ Event::GetScreenCoords(nsPresContext* aPresContext, 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), diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index f30e9d7f459..32a14b9721b 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -1505,8 +1505,7 @@ EventStateManager::BeginTrackingDragGesture(nsPresContext* aPresContext, // 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)); @@ -1544,8 +1543,7 @@ EventStateManager::FillInEventFromGestureDown(WidgetMouseEvent* aEvent) // 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; } @@ -1601,8 +1599,7 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext, } // 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(pixelThresholdX) || Abs(distance.y) > AssertedCast(pixelThresholdY)) { @@ -3216,9 +3213,9 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext, 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; @@ -4023,8 +4020,8 @@ EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent) // 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. @@ -4160,7 +4157,7 @@ EventStateManager::SetPointerLock(nsIWidget* aWidget, 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); @@ -4176,7 +4173,7 @@ EventStateManager::SetPointerLock(nsIWidget* aWidget, // 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); diff --git a/dom/events/IMEContentObserver.cpp b/dom/events/IMEContentObserver.cpp index 836c6882abc..ac9de57b071 100644 --- a/dom/events/IMEContentObserver.cpp +++ b/dom/events/IMEContentObserver.cpp @@ -449,15 +449,14 @@ IMEContentObserver::OnMouseButtonEvent(nsPresContext* aPresContext, 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); diff --git a/dom/events/UIEvent.h b/dom/events/UIEvent.h index d13dc788019..81b6097286b 100644 --- a/dom/events/UIEvent.h +++ b/dom/events/UIEvent.h @@ -57,8 +57,7 @@ public: 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), diff --git a/dom/events/WheelHandlingHelper.cpp b/dom/events/WheelHandlingHelper.cpp index ba586cfc368..35441dd930a 100644 --- a/dom/events/WheelHandlingHelper.cpp +++ b/dom/events/WheelHandlingHelper.cpp @@ -293,8 +293,8 @@ 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 diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index 388af25cf89..340d985f664 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -2116,8 +2116,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent) // 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) diff --git a/embedding/browser/nsDocShellTreeOwner.cpp b/embedding/browser/nsDocShellTreeOwner.cpp index e4490a61e9e..4787a2c2408 100644 --- a/embedding/browser/nsDocShellTreeOwner.cpp +++ b/embedding/browser/nsDocShellTreeOwner.cpp @@ -1452,7 +1452,7 @@ ChromeTooltipListener::sTooltipCallback(nsITimer *aTimer, if (textFound) { nsString tipText(tooltipText); - nsIntPoint screenDot = widget->WidgetToScreenOffset(); + LayoutDeviceIntPoint screenDot = widget->WidgetToScreenOffset(); self->ShowTooltip(self->mMouseScreenX - screenDot.x, self->mMouseScreenY - screenDot.y, tipText); diff --git a/gfx/tests/gtest/TestCompositor.cpp b/gfx/tests/gtest/TestCompositor.cpp index cf0b9bf3664..a8cf3c2674b 100644 --- a/gfx/tests/gtest/TestCompositor.cpp +++ b/gfx/tests/gtest/TestCompositor.cpp @@ -71,7 +71,7 @@ public: virtual nsresult ConfigureChildren(const nsTArray& 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; } diff --git a/layout/base/PositionedEventTargeting.cpp b/layout/base/PositionedEventTargeting.cpp index 99c26818c86..21c87473ab7 100644 --- a/layout/base/PositionedEventTargeting.cpp +++ b/layout/base/PositionedEventTargeting.cpp @@ -473,11 +473,11 @@ FindFrameTargetedByInputEvent(WidgetGUIEvent* aEvent, 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; } diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index b1beb142d52..6da06c3d4a0 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -2627,8 +2627,8 @@ nsLayoutUtils::TransformFrameRectToAncestor(nsIFrame* aFrame, 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(); @@ -2637,18 +2637,19 @@ static nsIntPoint GetWidgetOffset(nsIWidget* aWidget, nsIWidget*& aRootWidget) { } 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; @@ -2667,14 +2668,13 @@ nsLayoutUtils::TranslateWidgetToView(nsPresContext* aPresContext, 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) @@ -2682,11 +2682,11 @@ nsLayoutUtils::TranslateViewToWidget(nsPresContext* aPresContext, nsPoint viewOffset; nsIWidget* viewWidget = aView->GetNearestWidget(&viewOffset); if (!viewWidget) { - return nsIntPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); + return LayoutDeviceIntPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); } - nsIntPoint relativeToViewWidget(aPresContext->AppUnitsToDevPixels(aPt.x + viewOffset.x), - aPresContext->AppUnitsToDevPixels(aPt.y + viewOffset.y)); + LayoutDeviceIntPoint relativeToViewWidget(aPresContext->AppUnitsToDevPixels(aPt.x + viewOffset.x), + aPresContext->AppUnitsToDevPixels(aPt.y + viewOffset.y)); return relativeToViewWidget + WidgetToWidgetOffset(viewWidget, aWidget); } diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 6e67309c3fc..5a8b0540e1b 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -728,9 +728,10 @@ public: * @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 { /** diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 78d299df069..4f1c7bd62a8 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -8474,9 +8474,9 @@ PresShell::AdjustContextMenuKeyEvent(WidgetMouseEvent* aEvent) nsCOMPtr 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; diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 1d3d38c3c7d..37656030c33 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -4815,7 +4815,7 @@ nsRect nsIFrame::GetScreenRectInAppUnits() const nsCOMPtr 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); } diff --git a/layout/xul/nsResizerFrame.cpp b/layout/xul/nsResizerFrame.cpp index 228fbd77ae0..afdab2b2291 100644 --- a/layout/xul/nsResizerFrame.cpp +++ b/layout/xul/nsResizerFrame.cpp @@ -117,8 +117,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext, 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; @@ -166,8 +165,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext, 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. diff --git a/layout/xul/nsXULPopupManager.cpp b/layout/xul/nsXULPopupManager.cpp index d11f665d32e..b55ccdc11eb 100644 --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -746,7 +746,7 @@ nsXULPopupManager::ShowTooltipAtScreen(nsIContent* aPopup, if (rootPresContext) { nsIWidget *rootWidget = rootPresContext->GetRootWidget(); if (rootWidget) { - mCachedMousePoint -= rootWidget->WidgetToScreenOffset(); + mCachedMousePoint -= rootWidget->WidgetToScreenOffsetUntyped(); } } diff --git a/view/nsView.cpp b/view/nsView.cpp index 7ca917cb8a6..63b0e4ba46e 100644 --- a/view/nsView.cpp +++ b/view/nsView.cpp @@ -220,7 +220,7 @@ nsIntRect nsView::CalcWidgetBounds(nsWindowType aType) 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)); } diff --git a/widget/PuppetWidget.h b/widget/PuppetWidget.h index d9c5dd6d00b..95f9b77083f 100644 --- a/widget/PuppetWidget.h +++ b/widget/PuppetWidget.h @@ -126,8 +126,8 @@ public: { 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); diff --git a/widget/android/AndroidJavaWrappers.cpp b/widget/android/AndroidJavaWrappers.cpp index a3aefec79b2..27e9ffed4d7 100644 --- a/widget/android/AndroidJavaWrappers.cpp +++ b/widget/android/AndroidJavaWrappers.cpp @@ -730,7 +730,7 @@ AndroidGeckoEvent::MakeTouchEvent(nsIWidget* widget) 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 @@ -796,7 +796,7 @@ AndroidGeckoEvent::MakeMultiTouchInput(nsIWidget* widget) 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; @@ -853,11 +853,10 @@ AndroidGeckoEvent::MakeMouseEvent(nsIWidget* widget) // 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; } diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index 6d7bf270c97..84edc194d12 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -630,7 +630,7 @@ nsWindow::BringToFront() NS_IMETHODIMP nsWindow::GetScreenBounds(nsIntRect &aRect) { - nsIntPoint p = WidgetToScreenOffset(); + LayoutDeviceIntPoint p = WidgetToScreenOffset(); aRect.x = p.x; aRect.y = p.y; @@ -640,10 +640,10 @@ nsWindow::GetScreenBounds(nsIntRect &aRect) return NS_OK; } -nsIntPoint +LayoutDeviceIntPoint nsWindow::WidgetToScreenOffset() { - nsIntPoint p(0, 0); + LayoutDeviceIntPoint p(0, 0); nsWindow *w = this; while (w && !w->IsTopLevel()) { @@ -1041,8 +1041,7 @@ nsWindow::OnContextmenuEvent(AndroidGeckoEvent *ae) 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; diff --git a/widget/android/nsWindow.h b/widget/android/nsWindow.h index 0c8f5d13380..e21edf050c1 100644 --- a/widget/android/nsWindow.h +++ b/widget/android/nsWindow.h @@ -100,7 +100,7 @@ public: 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); diff --git a/widget/cocoa/nsChildView.h b/widget/cocoa/nsChildView.h index 65aaef78f2f..a1be2604df4 100644 --- a/widget/cocoa/nsChildView.h +++ b/widget/cocoa/nsChildView.h @@ -401,7 +401,7 @@ public: virtual void* GetNativeData(uint32_t aDataType) MOZ_OVERRIDE; virtual nsresult ConfigureChildren(const nsTArray& 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) diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 2bbf250b33e..369eadd17ed 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -923,7 +923,7 @@ NS_IMETHODIMP nsChildView::GetClientBounds(nsIntRect &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; } @@ -931,7 +931,7 @@ NS_IMETHODIMP nsChildView::GetClientBounds(nsIntRect &aRect) NS_IMETHODIMP nsChildView::GetScreenBounds(nsIntRect &aRect) { GetBounds(aRect); - aRect.MoveTo(WidgetToScreenOffset()); + aRect.MoveTo(WidgetToScreenOffsetUntyped()); return NS_OK; } @@ -1482,7 +1482,7 @@ void nsChildView::ReportSizeEvent() // 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; @@ -1500,9 +1500,9 @@ nsIntPoint nsChildView::WidgetToScreenOffset() FlipCocoaScreenCoordinate(origin); // convert to device pixels - return CocoaPointsToDevPixels(origin); + return LayoutDeviceIntPoint::FromUntyped(CocoaPointsToDevPixels(origin)); - NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(nsIntPoint(0,0)); + NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0)); } NS_IMETHODIMP nsChildView::CaptureRollupEvents(nsIRollupListener * aListener, diff --git a/widget/cocoa/nsCocoaWindow.h b/widget/cocoa/nsCocoaWindow.h index 814cd73b019..530f05c4a58 100644 --- a/widget/cocoa/nsCocoaWindow.h +++ b/widget/cocoa/nsCocoaWindow.h @@ -260,7 +260,7 @@ public: 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; diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm index e4a87bc15fd..1dc2a788064 100644 --- a/widget/cocoa/nsCocoaWindow.mm +++ b/widget/cocoa/nsCocoaWindow.mm @@ -1812,7 +1812,7 @@ NS_IMETHODIMP nsCocoaWindow::SetFocus(bool aState) return NS_OK; } -nsIntPoint nsCocoaWindow::WidgetToScreenOffset() +LayoutDeviceIntPoint nsCocoaWindow::WidgetToScreenOffset() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; @@ -1823,9 +1823,9 @@ nsIntPoint nsCocoaWindow::WidgetToScreenOffset() } r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(rect, BackingScaleFactor()); - return r.TopLeft(); + return LayoutDeviceIntPoint::FromUntyped(r.TopLeft()); - NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(nsIntPoint(0,0)); + NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0)); } nsIntPoint nsCocoaWindow::GetClientOffset() diff --git a/widget/gonk/nsWindow.cpp b/widget/gonk/nsWindow.cpp index 4977500e2fd..fd41496b892 100644 --- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -505,10 +505,10 @@ nsWindow::Invalidate(const nsIntRect &aRect) return NS_OK; } -nsIntPoint +LayoutDeviceIntPoint nsWindow::WidgetToScreenOffset() { - nsIntPoint p(0, 0); + LayoutDeviceIntPoint p(0, 0); nsWindow *w = this; while (w && w->mParent) { diff --git a/widget/gonk/nsWindow.h b/widget/gonk/nsWindow.h index cf5d140c4ad..925623a72d6 100644 --- a/widget/gonk/nsWindow.h +++ b/widget/gonk/nsWindow.h @@ -86,7 +86,7 @@ public: { return NS_OK; } - virtual nsIntPoint WidgetToScreenOffset(); + virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset(); void DispatchTouchInputViaAPZ(mozilla::MultiTouchInput& aInput); NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent, nsEventStatus& aStatus); diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp index 3fe0abb39bf..cc16157ea81 100644 --- a/widget/gtk/nsDragService.cpp +++ b/widget/gtk/nsDragService.cpp @@ -1755,7 +1755,7 @@ nsDragService::ScheduleDropEvent(nsWindow *aWindow, return FALSE; } - SetDragEndPoint(aWindowPoint + aWindow->WidgetToScreenOffset()); + SetDragEndPoint(aWindowPoint + aWindow->WidgetToScreenOffsetUntyped()); // We'll reply with gtk_drag_finish(). return TRUE; diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index cf945b0765d..f37863dd864 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -1473,10 +1473,10 @@ nsWindow::GetScreenBounds(nsIntRect &aRect) // 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 @@ -1797,7 +1797,7 @@ nsWindow::SetIcon(const nsAString& aIconSpec) } -nsIntPoint +LayoutDeviceIntPoint nsWindow::WidgetToScreenOffset() { gint x = 0, y = 0; @@ -2617,8 +2617,7 @@ nsWindow::OnMotionNotifyEvent(GdkEventMotion *aEvent) } else { LayoutDeviceIntPoint point(NSToIntFloor(aEvent->x_root), NSToIntFloor(aEvent->y_root)); - event.refPoint = point - - LayoutDeviceIntPoint::FromUntyped(WidgetToScreenOffset()); + event.refPoint = point - WidgetToScreenOffset(); } modifierState = aEvent->state; @@ -2696,8 +2695,7 @@ nsWindow::InitButtonEvent(WidgetMouseEvent& aEvent, } 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; @@ -3209,8 +3207,7 @@ nsWindow::OnScrollEvent(GdkEventScroll *aEvent) // 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); @@ -6338,7 +6335,7 @@ nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, // 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; @@ -6499,11 +6496,11 @@ 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 diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h index f8665036627..a0d6d5487d8 100644 --- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h @@ -138,7 +138,7 @@ public: 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, @@ -498,7 +498,7 @@ private: // From GDK int GdkCoordToDevicePixels(gint coord); - nsIntPoint GdkPointToDevicePixels(GdkPoint point); + mozilla::LayoutDeviceIntPoint GdkPointToDevicePixels(GdkPoint point); nsIntRect GdkRectToDevicePixels(GdkRectangle rect); }; diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index ee76fed042f..2983a6158bb 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -1668,12 +1668,16 @@ class nsIWidget : public nsISupports { 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, diff --git a/widget/qt/nsWindow.cpp b/widget/qt/nsWindow.cpp index 193d39e22be..680356b530b 100644 --- a/widget/qt/nsWindow.cpp +++ b/widget/qt/nsWindow.cpp @@ -626,7 +626,7 @@ nsWindow::Invalidate(const nsIntRect &aRect) return NS_OK; } -nsIntPoint +LayoutDeviceIntPoint nsWindow::WidgetToScreenOffset() { NS_ENSURE_TRUE(mWidget, nsIntPoint(0,0)); @@ -634,7 +634,7 @@ nsWindow::WidgetToScreenOffset() QPoint origin(0, 0); origin = mWidget->mapToGlobal(origin); - return nsIntPoint(origin.x(), origin.y()); + return LayoutDeviceIntPoint(origin.x(), origin.y()); } void* diff --git a/widget/qt/nsWindow.h b/widget/qt/nsWindow.h index 70db05e6087..bf970a09120 100644 --- a/widget/qt/nsWindow.h +++ b/widget/qt/nsWindow.h @@ -124,7 +124,7 @@ public: { return NS_OK; } - virtual nsIntPoint WidgetToScreenOffset(); + virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset(); NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent, nsEventStatus& aStatus); NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener, diff --git a/widget/windows/nsIMM32Handler.cpp b/widget/windows/nsIMM32Handler.cpp index e5a922d0fbb..7eb9bd321e5 100644 --- a/widget/windows/nsIMM32Handler.cpp +++ b/widget/windows/nsIMM32Handler.cpp @@ -1957,7 +1957,7 @@ nsIMM32Handler::SetIMERelatedWindowsPosOnPlugin(nsWindow* aWindow, // 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. @@ -1974,7 +1974,7 @@ nsIMM32Handler::SetIMERelatedWindowsPosOnPlugin(nsWindow* aWindow, 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. @@ -2013,10 +2013,10 @@ nsIMM32Handler::ResolveIMECaretPos(nsIWidget* aReferenceWidget, return; if (aReferenceWidget) - aOutRect.MoveBy(aReferenceWidget->WidgetToScreenOffset()); + aOutRect.MoveBy(aReferenceWidget->WidgetToScreenOffsetUntyped()); if (aNewOriginWidget) - aOutRect.MoveBy(-aNewOriginWidget->WidgetToScreenOffset()); + aOutRect.MoveBy(-aNewOriginWidget->WidgetToScreenOffsetUntyped()); } /* static */ nsresult diff --git a/widget/windows/nsTextStore.cpp b/widget/windows/nsTextStore.cpp index 8156c4248d4..ae7d53a8b0f 100644 --- a/widget/windows/nsTextStore.cpp +++ b/widget/windows/nsTextStore.cpp @@ -3198,7 +3198,7 @@ nsTextStore::GetTextExt(TsViewCookie vcView, return E_FAIL; } - event.mReply.mRect.MoveBy(refWindow->WidgetToScreenOffset()); + event.mReply.mRect.MoveBy(refWindow->WidgetToScreenOffsetUntyped()); } // get bounding screen rect to test for clipping @@ -3336,7 +3336,7 @@ nsTextStore::GetScreenExtInternal(RECT &aScreenExt) // 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 { @@ -4325,8 +4325,8 @@ nsTextStore::CreateNativeCaret() } if (toplevelWindow != window) { - caretRect.MoveBy(toplevelWindow->WidgetToScreenOffset()); - caretRect.MoveBy(-window->WidgetToScreenOffset()); + caretRect.MoveBy(toplevelWindow->WidgetToScreenOffsetUntyped()); + caretRect.MoveBy(-window->WidgetToScreenOffsetUntyped()); } ::SetCaretPos(caretRect.x, caretRect.y); diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 5bd07ff155e..46340afd430 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -1991,7 +1991,7 @@ nsIntPoint nsWindow::GetClientOffset() RECT r1; GetWindowRect(mWnd, &r1); - nsIntPoint pt = WidgetToScreenOffset(); + LayoutDeviceIntPoint pt = WidgetToScreenOffset(); return nsIntPoint(pt.x - r1.left, pt.y - r1.top); } @@ -3061,13 +3061,13 @@ NS_METHOD nsWindow::SetIcon(const nsAString& aIconSpec) * **************************************************************/ -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) @@ -3819,7 +3819,7 @@ bool nsWindow::DispatchMouseEvent(uint32_t aEventType, WPARAM wParam, 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) diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h index e580254debe..d76931dd824 100644 --- a/widget/windows/nsWindow.h +++ b/widget/windows/nsWindow.h @@ -136,7 +136,7 @@ public: 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); diff --git a/widget/windows/winrt/MetroWidget.cpp b/widget/windows/winrt/MetroWidget.cpp index 2c4ad6e0603..a194f128663 100644 --- a/widget/windows/winrt/MetroWidget.cpp +++ b/widget/windows/winrt/MetroWidget.cpp @@ -1492,10 +1492,10 @@ MetroWidget::SetTitle(const nsAString& aTitle) return NS_OK; } -nsIntPoint +LayoutDeviceIntPoint MetroWidget::WidgetToScreenOffset() { - return nsIntPoint(0,0); + return LayoutDeviceIntPoint(0,0); } NS_IMETHODIMP diff --git a/widget/windows/winrt/MetroWidget.h b/widget/windows/winrt/MetroWidget.h index 74742d98705..bd6c2d46566 100644 --- a/widget/windows/winrt/MetroWidget.h +++ b/widget/windows/winrt/MetroWidget.h @@ -172,7 +172,7 @@ public: virtual nsresult ConfigureChildren(const nsTArray& aConfigurations); virtual void* GetNativeData(uint32_t aDataType); virtual void FreeNativeData(void * data, uint32_t aDataType); - virtual nsIntPoint WidgetToScreenOffset(); + virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset(); already_AddRefed GetPresShell();