PR_TRUE, PR_TRUE, mLimiter != nsnull);
PR_TRUE, PR_TRUE, mLimiter != nsnull, PR_FALSE);
nsSelection::HandleDrag(nsIPresContext *aPresContext, nsIFrame *aFrame, nsPoint& aPoint){  if (!aPresContext || !aFrame)    return NS_ERROR_NULL_POINTER;  nsresult result;  nsIFrame *newFrame = 0;  nsPoint   newPoint;  result = ConstrainFrameAndPointToAnchorSubtree(aPresContext, aFrame, aPoint, &newFrame, newPoint);  if (NS_FAILED(result))    return result;  if (!newFrame)    return NS_ERROR_FAILURE;  nsCOMPtr<nsIPresShell> presShell;  result = aPresContext->GetShell(getter_AddRefs(presShell));  if (NS_FAILED(result))    return result;  PRInt32 startPos = 0;  PRInt32 contentOffsetEnd = 0;  PRBool  beginOfContent;  nsCOMPtr<nsIContent> newContent;  result = newFrame->GetContentAndOffsetsFromPoint(aPresContext, newPoint,                                                   getter_AddRefs(newContent),                                                    startPos, contentOffsetEnd, beginOfContent);  //Is the desired content and offset currently in selection?  //if the double click flag is set then dont continue selection if the desired content and offset   //are currently inside a selection.  //this will stop double click then mouse-drag from undo-ing the desired selecting of a word.  if (mMouseDoubleDownState)  {    nsFrameState  frameState;    newFrame->GetFrameState(&frameState);    PRBool insideSelection(PR_FALSE);    if ((frameState & NS_FRAME_SELECTED_CONTENT))    {      PRBool isCollapsed;      PRInt8 index = GetIndexFromSelectionType(nsISelectionController::SELECTION_NORMAL);      mDomSelections[index]->GetIsCollapsed(&isCollapsed);      if (!isCollapsed)      {        PRInt32 rangeCount;        result = mDomSelections[index]->GetRangeCount(&rangeCount);        if (NS_FAILED(result)) return result;        nsCOMPtr<nsIDOMNode> domNode;        domNode = do_QueryInterface(newContent);        if (domNode)        {          for (PRInt32 i = 0; i < rangeCount; i++)          {            nsCOMPtr<nsIDOMRange> range;            result = mDomSelections[index]->GetRangeAt(i, getter_AddRefs(range));            if (NS_FAILED(result) || !range)               continue;//dont bail yet, iterate through them all            nsCOMPtr<nsIDOMNSRange> nsrange(do_QueryInterface(range));            if (NS_FAILED(result) || !nsrange)               continue;//dont bail yet, iterate through them all            nsrange->IsPointInRange(domNode, startPos, &insideSelection);            // Done when we find a range that we are in            if (insideSelection)              break;          }        }      }    }    if (!insideSelection)      mMouseDoubleDownState = PR_FALSE;    else      return NS_OK; //dragging in selection aborted  }  // do we have CSS that changes selection behaviour?  {    //add scope for nsCOMPtr    PRBool    changeSelection;    nsCOMPtr<nsIContent>  selectContent;    PRInt32   newStart, newEnd;    if (NS_SUCCEEDED(AdjustOffsetsFromStyle(newFrame, &changeSelection, getter_AddRefs(selectContent), &newStart, &newEnd))      && changeSelection)    {      newContent = selectContent;      startPos = newStart;      contentOffsetEnd = newEnd;    }  }  if (NS_SUCCEEDED(result))  {#ifdef IBMBIDI#ifdef VISUALSELECTION    PRBool bidiEnabled = PR_FALSE;    aPresContext->GetBidiEnabled(&bidiEnabled);    if (bidiEnabled) {      PRUint8 level;      nsPeekOffsetStruct pos;      //set data using mLimiter to stop on scroll views.  If we have a limiter then we stop peeking      //when we hit scrollable views.  If no limiter then just let it go ahead      pos.SetData(mTracker, 0, eSelectDir, eDirNext, startPos, PR_FALSE,                  PR_TRUE, PR_TRUE, mLimiter != nsnull);      mHint = HINT(beginOfContent);      HINT saveHint = mHint;      newFrame->GetBidiProperty(aPresContext, nsLayoutAtoms::embeddingLevel,                                (void**)&level,sizeof(level));      if (level & 1)        mHint = (mHint==HINTLEFT) ? HINTRIGHT : HINTLEFT;      pos.mResultContent = newContent;      pos.mContentOffset = contentOffsetEnd;      result = VisualSelectFrames(aPresContext, newFrame, pos);      if (NS_FAILED(result))        result = HandleClick(newContent, startPos, contentOffsetEnd, PR_TRUE,	                     PR_FALSE, beginOfContent);      mHint = saveHint;    }    else#endif // VISUALSELECTION#endif // IBMBIDI      result = HandleClick(newContent, startPos, contentOffsetEnd, PR_TRUE,                           PR_FALSE, beginOfContent);  }  return result;}