if (mNotAtRef && (nsnull != mRef) && (nsnull != mRefContent)) {
if (mRef && mRef->Length() > 0) {
HTMLContentSink::ScrollToRef(){  if (mNotAtRef && (nsnull != mRef) && (nsnull != mRefContent)) {    // See if the ref content has been reflowed by finding its frame    PRInt32 i, ns = mDocument->GetNumberOfShells();    for (i = 0; i < ns; i++) {      nsCOMPtr<nsIPresShell> shell( dont_AddRef(mDocument->GetShellAt(i)) );      if (shell) {        nsIFrame* frame;        shell->GetPrimaryFrameFor(mRefContent, &frame);        if (nsnull != frame) {          nsCOMPtr<nsIViewManager> vm;          shell->GetViewManager(getter_AddRefs(vm));          if (vm) {            nsIScrollableView* sview = nsnull;            vm->GetRootScrollableView(&sview);            if (sview) {              // Determine the x,y scroll offsets for the given              // frame. The offsets are relative to the              // ScrollableView's upper left corner so we need frame              // coordinates that are relative to that.              nsPoint offset;              nsIView* view;              nsCOMPtr<nsIPresContext> presContext;              shell->GetPresContext(getter_AddRefs(presContext));              frame->GetOffsetFromView(presContext, offset, &view);              nscoord x = 0;              nscoord y = offset.y;              sview->SetScrollPreference(mOriginalScrollPreference);              // XXX If view != scrolledView, then there is a scrolled frame,              // e.g., a DIV with 'overflow' of 'scroll', somewhere in the middle,              // or maybe an absolutely positioned element that has a view. We              // need to handle these cases...              sview->ScrollTo(x, y, NS_VMREFRESH_IMMEDIATE);              // Note that we did this so that we don't bother doing it again              mNotAtRef = PR_FALSE;            }          }        }      }    }  }}