if (NS_SUCCEEDED(rv) && autoCopyService) { PRInt8 index = GetIndexFromSelectionType(nsISelectionController::SELECTION_NORMAL); if (mDomSelections[index]) autoCopyService->Listen(mDomSelections[index]);
if (NS_SUCCEEDED(rv) && autoCopyService) { PRInt8 index = GetIndexFromSelectionType(nsISelectionController::SELECTION_NORMAL); if (mDomSelections[index]) autoCopyService->Listen(mDomSelections[index]); } }
nsSelection::nsSelection(){  NS_INIT_REFCNT();  PRInt32 i;  for (i = 0;i<nsISelectionController::NUM_SELECTIONTYPES;i++){    mDomSelections[i] = nsnull;  }  for (i = 0;i<nsISelectionController::NUM_SELECTIONTYPES;i++){    mDomSelections[i] = new nsDOMSelection(this);    if (!mDomSelections[i])      return;    mDomSelections[i]->AddRef();    mDomSelections[i]->SetType(GetSelectionTypeFromIndex(i));  }  mBatching = 0;  mChangesDuringBatching = PR_FALSE;  mNotifyFrames = PR_TRUE;  mLimiter = nsnull; //no default limiter.      if (sInstanceCount <= 0)  {    sTableAtom = NS_NewAtom("table");    sCellAtom = NS_NewAtom("td");    sTbodyAtom = NS_NewAtom("tbody");    sTableStyleColor.mColor =  NS_RGB(128,0,0);    sTableStyleColor.mBackgroundColor =  NS_RGB(128,0,0);    sTableStyleColor.mOpacity=  (float)1;    sTableStyleColor.mBackgroundAttachment=0;    sTableStyleColor.mBackgroundFlags=NS_STYLE_BG_IMAGE_NONE;    sTableStyleColor.mBackgroundRepeat=1;    sTableStyleColor.mBackgroundXPosition=0;    sTableStyleColor.mBackgroundYPosition=0;    sTableStyleColor.mCursor=1;  }  mHint = HINTLEFT;  sInstanceCount ++;  mSelectingTableCells = PR_FALSE;  mSelectingTableCellMode = 0;  mSelectedCellIndex = 0;#ifdef XP_UNIX//AUTO COPY REGISTRATION -- FOR UNIX ONLY. // TODO: Make this a pref so other platforms can use it.  nsresult rv;  NS_WITH_SERVICE(nsIAutoCopyService, autoCopyService, "component://netscape/autocopy", &rv);  if (NS_SUCCEEDED(rv) && autoCopyService)  {    PRInt8 index = GetIndexFromSelectionType(nsISelectionController::SELECTION_NORMAL);    if (mDomSelections[index])      autoCopyService->Listen(mDomSelections[index]);  }#endif  mDisplaySelection = nsISelectionController::SELECTION_OFF;  mDelayCaretOverExistingSelection = PR_TRUE;  mDelayedMouseEventValid = PR_FALSE;}