pos.mIsKeyboardSelect = PR_TRUE;
PresShell::CompleteMove(PRBool aForward, PRBool aExtend){  nsIScrollableView *scrollableView;  if (!mViewManager)     return NS_ERROR_UNEXPECTED;  nsresult result = mViewManager->GetRootScrollableView(&scrollableView);  if (NS_FAILED(result))     return result;  if (!scrollableView)     return NS_ERROR_UNEXPECTED;  nsIView *scrolledView;  result = scrollableView->GetScrolledView(scrolledView);  // get a frame  void *clientData;  scrolledView->GetClientData(clientData);  nsIFrame *frame = (nsIFrame *)clientData;  if (!frame)    return NS_ERROR_FAILURE;  //we need to get to the area frame.  nsCOMPtr<nsIAtom> frameType;   do   {    frame->GetFrameType(getter_AddRefs(frameType));    if (frameType != nsLayoutAtoms::areaFrame)    {      result = frame->FirstChild(mPresContext, nsnull, &frame);      if (NS_FAILED(result) || !frame)        break;    }  }while(frameType != nsLayoutAtoms::areaFrame);    if (!frame)    return NS_ERROR_FAILURE; //could not find an area frame.  PRInt8  outsideLimit = -1;//search from beginning  nsPeekOffsetStruct pos;  pos.mAmount = eSelectLine;  pos.mTracker = this;  pos.mContentOffset = 0;  pos.mContentOffsetEnd = 0;  pos.mScrollViewStop = PR_FALSE;//dont stop on scrolled views.  if (aForward)  {    outsideLimit = 1;//search from end    nsRect rect;    frame->GetRect(rect);    pos.mDesiredX = rect.width * 2;//search way off to right of line    pos.mDirection = eDirPrevious; //seach backwards from the end  }  else  {    pos.mDesiredX = -1; //start before line    pos.mDirection = eDirNext; //search forwards from before beginning  }    do  {    result = nsFrame::GetNextPrevLineFromeBlockFrame(mPresContext,                                &pos,                                frame,                                 0, //irrelavent since we set outsidelimit                                 outsideLimit                                );    if (NS_POSITION_BEFORE_TABLE == result) //NS_POSITION_BEFORE_TABLE should ALSO break      break;    if (NS_OK != result || !pos.mResultFrame )       return result?result:NS_ERROR_FAILURE;    nsCOMPtr<nsILineIteratorNavigator> newIt;     //check to see if this is ANOTHER blockframe inside the other one if so then call into its lines    result = pos.mResultFrame->QueryInterface(NS_GET_IID(nsILineIteratorNavigator),getter_AddRefs(newIt));    if (NS_SUCCEEDED(result) && newIt)      frame = pos.mResultFrame;  }  while (NS_SUCCEEDED(result));//end 'do'    mSelection->HandleClick(pos.mResultContent ,pos.mContentOffset ,pos.mContentOffsetEnd ,aExtend, PR_FALSE, pos.mPreferLeft);  return ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL, nsISelectionController::SELECTION_FOCUS_REGION, PR_TRUE);}