nscoord vX = 0, vY = 0;  result = view->GetPosition(&vX, &vY);  if (NS_FAILED(result)) return result;  *offsetX += vX; *offsetY += vY;
nsPoint pt = view->GetPosition(); *offsetX += pt.x; *offsetY += pt.y;
nsSelection::GetGlobalViewOffsetsFromFrame(nsIPresContext *aPresContext, nsIFrame *aFrame, nscoord *offsetX, nscoord *offsetY){  //  // The idea here is to figure out what the offset of aFrame's view  // is within the global space. Where I define the global space to  // be the coordinate system that exists above all views.  //  // The offsets are calculated by walking up the view parent hierarchy,  // adding up all the view positions, until there are no more views.  //  // A point in a view's coordinate space can be converted to the global  // coordinate space by simply adding the offsets returned by this method  // to the point itself.  //  if (!aPresContext || !aFrame || !offsetX || !offsetY)    return NS_ERROR_NULL_POINTER;  *offsetX = *offsetY = 0;  nsresult result;  nsIFrame *frame = aFrame;  while (frame)  {    result = frame->GetParentWithView(aPresContext, &frame);    if (NS_FAILED(result))      return result;    if (frame) {      nsIView *view = frame->GetView(aPresContext);      if (view)      {        nscoord vX = 0, vY = 0;        result = view->GetPosition(&vX, &vY);        if (NS_FAILED(result))          return result;        *offsetX += vX;        *offsetY += vY;      }    }  }  return NS_OK;}