зеркало из https://github.com/mozilla/gecko-dev.git
Bug 305825. Bulletproof event handling so we don't crash when the presentation goes away that the event is based on. r+sr=roc, patch by Eli Friedman
This commit is contained in:
Родитель
e612da96ae
Коммит
cc4c158fff
|
@ -452,9 +452,14 @@ nsLayoutUtils::GetEventCoordinatesRelativeTo(nsEvent* aEvent, nsIFrame* aFrame)
|
|||
nsPoint frameToView;
|
||||
nsIView* frameView = aFrame->GetClosestView(&frameToView);
|
||||
|
||||
return TranslateWidgetToView(aFrame->GetPresContext(),
|
||||
nsPoint widgetToView = TranslateWidgetToView(aFrame->GetPresContext(),
|
||||
GUIEvent->widget, GUIEvent->refPoint,
|
||||
frameView) - frameToView;
|
||||
frameView);
|
||||
|
||||
if (widgetToView == nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE))
|
||||
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
|
||||
return widgetToView - frameToView;
|
||||
}
|
||||
|
||||
nsPoint
|
||||
|
@ -487,6 +492,8 @@ nsLayoutUtils::TranslateWidgetToView(nsPresContext* aPresContext,
|
|||
{
|
||||
nsPoint widgetToView;
|
||||
nsIView* baseView = nsIView::GetViewFor(aWidget);
|
||||
if (!baseView)
|
||||
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
nsIWidget* wid = baseView->GetNearestWidget(&widgetToView);
|
||||
NS_ASSERTION(aWidget == wid, "Clashing widgets");
|
||||
float pixelsToTwips = aPresContext->PixelsToTwips();
|
||||
|
|
Загрузка…
Ссылка в новой задаче