Bug 572599. If we get an event on a child widget that is in a disconnected view subtree the view subtree might not have a root widget. r=roc
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -999,16 +999,19 @@ static nsIntPoint GetWidgetOffset(nsIWid
nsPoint
nsLayoutUtils::TranslateWidgetToView(nsPresContext* aPresContext,
nsIWidget* aWidget, nsIntPoint aPt,
nsIView* aView)
{
nsPoint viewOffset;
nsIWidget* viewWidget = aView->GetNearestWidget(&viewOffset);
+ if (!viewWidget) {
+ return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
+ }
nsIWidget* fromRoot;
nsIntPoint fromOffset = GetWidgetOffset(aWidget, fromRoot);
nsIWidget* toRoot;
nsIntPoint toOffset = GetWidgetOffset(viewWidget, toRoot);
nsIntPoint widgetPoint;
if (fromRoot == toRoot) {