nscoord x = 0, y = 0; nsresult result = view->GetPosition(&x, &y);  if (NS_FAILED(result)) return result;  *aXOffset += x; *aYOffset += y;
nsPoint pt = view->GetPosition(); *aXOffset += pt.x; *aYOffset += pt.y;
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;  for (nsIView* view = aView; view && view != aAncestorView;       view = view->GetParent())  {    nscoord x = 0, y = 0;    nsresult result = view->GetPosition(&x, &y);    if (NS_FAILED(result))      return result;    *aXOffset += x;    *aYOffset += y;  }  return NS_OK;}