From 252c316b90b5946fd54a10a9275c58a86e51f31f Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Sun, 18 Sep 2005 18:03:06 +0000 Subject: [PATCH] Fix event coordinate regression when views don't line up with widgets. b=308521 Patch from Eli Friedman . r+sr=roc --- layout/base/nsLayoutUtils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 4d78fa3e6d7..cdc4d810afb 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -490,16 +490,16 @@ nsLayoutUtils::TranslateWidgetToView(nsPresContext* aPresContext, nsIWidget* aWidget, nsIntPoint aPt, nsIView* aView) { - nsPoint widgetToView; nsIView* baseView = nsIView::GetViewFor(aWidget); if (!baseView) return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); - nsIWidget* wid = baseView->GetNearestWidget(&widgetToView); + nsPoint viewToWidget; + nsIWidget* wid = baseView->GetNearestWidget(&viewToWidget); NS_ASSERTION(aWidget == wid, "Clashing widgets"); float pixelsToTwips = aPresContext->PixelsToTwips(); nsPoint refPointTwips(NSIntPixelsToTwips(aPt.x, pixelsToTwips), NSIntPixelsToTwips(aPt.y, pixelsToTwips)); - return refPointTwips + widgetToView - aView->GetOffsetTo(baseView); + return refPointTwips - viewToWidget - aView->GetOffsetTo(baseView); } // Combine aNewBreakType with aOrigBreakType, but limit the break types