nscoord dx, dy;
nsTypedSelection::GetFrameToScrolledViewOffsets(nsIScrollableView *aScrollableView, nsIFrame *aFrame, nscoord *aX, nscoord *aY){  nsresult rv = NS_OK;  if (!mFrameSelection)    return NS_ERROR_FAILURE;//nothing to do  if (!aScrollableView || !aFrame || !aX || !aY) {    return NS_ERROR_NULL_POINTER;  }  *aX = 0;  *aY = 0;  nsIView*  scrolledView;  nsPoint   offset;  nsIView*  closestView;            // Determine the offset from aFrame to the scrolled view. We do that by  // getting the offset from its closest view and then walking up  aScrollableView->GetScrolledView(scrolledView);  nsIFocusTracker *tracker = mFrameSelection->GetTracker();  if (!tracker)    return NS_ERROR_NULL_POINTER;  nsCOMPtr<nsIPresContext> presContext;  tracker->GetPresContext(getter_AddRefs(presContext));  aFrame->GetOffsetFromView(presContext, offset, &closestView);  // XXX Deal with the case where there is a scrolled element, e.g., a  // DIV in the middle...  while (closestView && closestView != scrolledView) {    nscoord dx, dy;    // Update the offset    closestView->GetPosition(&dx, &dy);    offset.MoveBy(dx, dy);    // Get its parent view    closestView->GetParent(closestView);  }  *aX = offset.x;  *aY = offset.y;  return rv;}