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
authorTimothy Nikkel <tnikkel@gmail.com>
Wed, 18 Aug 2010 20:16:58 -0500
changeset 50858 5ca1e06cedf133404a8bf6b04dd2fc1bf22cbf8b
parent 50857 3b0081e69d1f05fffa784d1b690e63352274119d
child 50859 66dcf25705f96aa875d7ee152e7d5407598ef448
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersroc
bugs572599
milestone2.0b5pre
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
layout/base/nsLayoutUtils.cpp
--- 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) {