Fix event coordinate regression when views don't line up with widgets. b=308521 Patch from Eli Friedman <sharparrow1@yahoo.com>. r+sr=roc

This commit is contained in:
dbaron%dbaron.org 2005-09-18 18:03:06 +00:00
Родитель 7d2940070e
Коммит f41157f8c0
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -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