if (IsScrollingEnabled()) return ScrollFrameIntoView(aFrame, NS_PRESSHELL_SCROLL_ANYWHERE, NS_PRESSHELL_SCROLL_ANYWHERE); return NS_OK;
}  if (mViewManager) {  nsIScrollableView* scrollingView; mViewManager->GetRootScrollableView(&scrollingView);  if (scrollingView) { nsIView*  scrolledView; nsPoint   offset; nsIView*  closestView;    scrollingView->GetScrolledView(scrolledView); aFrame->GetOffsetFromView(mPresContext, offset, &closestView);    while ((closestView != nsnull) && (closestView != scrolledView)) { nscoord x, y;   closestView->GetPosition(&x, &y); offset.MoveBy(x, y);   closestView->GetParent(closestView); }    const nsIView*  clipView; nsRect          visibleRect;  scrollingView->GetScrollPosition(visibleRect.x, visibleRect.y); scrollingView->GetClipView(&clipView); clipView->GetDimensions(&visibleRect.width, &visibleRect.height);   nscoord scrollOffsetX = visibleRect.x; nscoord scrollOffsetY = visibleRect.y;   nsRect  frameBounds; aFrame->GetRect(frameBounds); frameBounds.x = offset.x; frameBounds.y = offset.y;   if (NS_PRESSHELL_SCROLL_ANYWHERE == aVPercent) {   if (frameBounds.y < visibleRect.y) {  scrollOffsetY = frameBounds.y; } else if (frameBounds.YMost() > visibleRect.YMost()) {   scrollOffsetY += frameBounds.YMost() - visibleRect.YMost(); if (scrollOffsetY > frameBounds.y) { scrollOffsetY = frameBounds.y; } } } else {  nscoord frameAlignY = frameBounds.y + (frameBounds.height * aVPercent) / 100; scrollOffsetY = frameAlignY - (visibleRect.height * aVPercent) / 100; }   if (NS_PRESSHELL_SCROLL_ANYWHERE == aHPercent) {   if (frameBounds.x < visibleRect.x) {  scrollOffsetX = frameBounds.x; } else if (frameBounds.XMost() > visibleRect.XMost()) {   scrollOffsetX += frameBounds.XMost() - visibleRect.XMost(); if (scrollOffsetX > frameBounds.x) { scrollOffsetX = frameBounds.x; } }  } else {  nscoord frameAlignX = frameBounds.x + (frameBounds.width * aHPercent) / 100; scrollOffsetX = frameAlignX - (visibleRect.width * aHPercent) / 100; }  scrollingView->ScrollTo(scrollOffsetX, scrollOffsetY, NS_VMREFRESH_IMMEDIATE); } } return rv;
PresShell::ScrollFrameIntoView(nsIFrame *aFrame){  if (!aFrame)    return NS_ERROR_NULL_POINTER;  if (IsScrollingEnabled())    return ScrollFrameIntoView(aFrame, NS_PRESSHELL_SCROLL_ANYWHERE,                               NS_PRESSHELL_SCROLL_ANYWHERE);  return NS_OK;}