result = view->GetParent(view);  if (NS_FAILED(result)) return result;
view = view->GetParent();
nsTypedSelection::ScrollPointIntoView(nsIPresContext *aPresContext, nsIView *aView, nsPoint& aPoint, PRBool aScrollParentViews, PRBool *aDidScroll){  if (!aPresContext || !aView || !aDidScroll)    return NS_ERROR_NULL_POINTER;  nsresult result;  *aDidScroll = PR_FALSE;  //  // Calculate the global offset of the view.  //  nsPoint globalOffset;  result = GetViewAncestorOffset(aView, nsnull, &globalOffset.x, &globalOffset.y);  if (NS_FAILED(result))    return result;  //  // Convert aPoint into global coordinates so it is easier to map  // into other views.  //  nsPoint globalPoint = aPoint + globalOffset;  //  // Scroll the point into the visible rect of the closest  // scrollable view.  //  result = ScrollPointIntoClipView(aPresContext, aView, aPoint, aDidScroll);  if (NS_FAILED(result))    return result;  //  // Now scroll the parent scrollable views.  //  if (aScrollParentViews)  {    //    // Find aView's parent scrollable view.    //    nsIScrollableView *scrollableView = 0;    result = GetClosestScrollableView(aView, &scrollableView);    if (NS_FAILED(result))      return result;    if (scrollableView)    {      //      // Convert scrollableView to nsIView.      //      nsIView *scrolledView = 0;      nsIView *view = 0;      CallQueryInterface(scrollableView, &view);      if (view)      {        //        // Now get the scrollableView's parent, then search for it's        // closest scrollable view.        //        result = view->GetParent(view);        if (NS_FAILED(result))          return result;        while (view)        {          result = GetClosestScrollableView(view, &scrollableView);          if (NS_FAILED(result))            return result;          if (!scrollableView)            break;          scrolledView = 0;          result = scrollableView->GetScrolledView(scrolledView);                    if (NS_FAILED(result))            return result;          //          // Map the global point into this scrolledView's coordinate space.          //          result = GetViewAncestorOffset(scrolledView, nsnull, &globalOffset.x, &globalOffset.y);          if (NS_FAILED(result))            return result;          nsPoint newPoint = globalPoint - globalOffset;          //          // Scroll the point into the visible rect of the scrolled view.          //          PRBool parentDidScroll = PR_FALSE;          result = ScrollPointIntoClipView(aPresContext, scrolledView, newPoint, &parentDidScroll);          if (NS_FAILED(result))            return result;          *aDidScroll = *aDidScroll || parentDidScroll;          //          // Now get the parent of this scrollable view so we          // can scroll the next parent view.          //          view = 0;          result = CallQueryInterface(scrollableView, &view);          if (!view)            return result;          view->GetParent(view);        }      }    }  }  return NS_OK;}