DrawSelectionIterator::DrawSelectionIterator(const SelectionDetails *aSelDetails,
DrawSelectionIterator::DrawSelectionIterator(nsIContent *aContent, const SelectionDetails *aSelDetails,
DrawSelectionIterator::DrawSelectionIterator(const SelectionDetails *aSelDetails,                                              PRUnichar *aText,                                              PRUint32 aTextLength,                                              nsTextFrame::TextStyle &aTextStyle,                                              PRInt16 aSelectionStatus,                                              nsIPresContext *aPresContext)                                             :mOldStyle(aTextStyle){    mDetails = aSelDetails;    mCurrentIdx = 0;    mUniStr = aText;    mLength = aTextLength;    mTypes = nsnull;    mInit = PR_FALSE;    mSelectionStatus = aSelectionStatus;    // Get background colors for disabled selection at attention-getting selection (used with type ahead find)    nsCOMPtr<nsILookAndFeel> look;    if (NS_SUCCEEDED(aPresContext->GetLookAndFeel(getter_AddRefs(look))) && look) {      look->GetColor(nsILookAndFeel::eColor_TextSelectBackgroundAttention, mAttentionColor);      look->GetColor(nsILookAndFeel::eColor_TextSelectBackgroundDisabled, mDisabledColor);      mDisabledColor  = EnsureDifferentColors(mDisabledColor, mOldStyle.mSelectionBGColor);      mAttentionColor = EnsureDifferentColors(mAttentionColor, mOldStyle.mSelectionBGColor);    }    else       mDisabledColor = mAttentionColor = mOldStyle.mSelectionBGColor;    if (!aSelDetails)    {      mDone = PR_TRUE;      return;    }    mDone = (PRBool)(mCurrentIdx>=mLength);    if (mDone)      return;    //special case for 1 selection. later    const SelectionDetails *details = aSelDetails;    if (details->mNext)    {      mTypes = new PRUint8[mLength];      if (!mTypes)        return;      memset(mTypes,0,mLength);//initialize to 0      while (details)      {        if ((details->mType & SELECTION_TYPES_WE_CARE_ABOUT ) &&           (details->mStart != details->mEnd))        {          mInit = PR_TRUE;//WE FOUND SOMETHING WE CARE ABOUT          for (int i = details->mStart; i < details->mEnd; i++)          {              if ((PRUint32)i>=mLength)              {                NS_ASSERTION(0,"Selection Details out of range?");                return;//eh              }              mTypes[i]|=details->mType;//add this bit          }        }        details= details->mNext;      }	    if (!mInit && mTypes) //we have details but none that we care about.	    {          delete mTypes;    		  mTypes = nsnull;		      mDone = PR_TRUE;//we are finished	    }    }    else if (details->mStart == details->mEnd)//no collapsed selections here!    {      mDone = PR_TRUE;      return;    }    else if (!(details->mType & SELECTION_TYPES_WE_CARE_ABOUT ))//if all we have is selection we DONT care about, do nothing    {        mDone = PR_TRUE;        return;    }    mInit = PR_TRUE;}