nsIView *view = aView;  while (view && view != aAncestorView)
for (nsIView* view = aView; view && view != aAncestorView; view = view->GetParent())
nsTypedSelection::GetViewAncestorOffset(nsIView *aView, nsIView *aAncestorView, nscoord *aXOffset, nscoord *aYOffset){  // Note: A NULL aAncestorView pointer means that the caller wants  //       the view's global offset.  if (!aView || !aXOffset || !aYOffset)    return NS_ERROR_FAILURE;  *aXOffset = 0;  *aYOffset = 0;  nsIView *view = aView;  while (view && view != aAncestorView)  {    nscoord x = 0, y = 0;    nsresult result = view->GetPosition(&x, &y);    if (NS_FAILED(result))      return result;    *aXOffset += x;    *aYOffset += y;    result = view->GetParent(view);    if (NS_FAILED(result))      return result;  }  return NS_OK;}