PRBool dontChangeTextColor = mOldStyle.mSelectionTextColor == NS_DONT_CHANGE_COLOR;
DrawSelectionIterator::GetSelectionColors(nscolor *aForeColor,                                          nscolor *aBackColor,                                          PRBool  *aBackIsTransparent){  *aBackIsTransparent = PR_FALSE;  PRBool isSelection =    (mTypes && (mTypes[mCurrentIdx] & nsISelectionController::SELECTION_NORMAL)) ||    (!mTypes && mCurrentIdx == (PRUint32)mDetails->mStart);  if (!isSelection) {    *aForeColor = mOldStyle.mColor->mColor;    return PR_FALSE;  }  PRBool dontChangeTextColor = mOldStyle.mSelectionTextColor == NS_DONT_CHANGE_COLOR;  // If the selection text color is NS_DONT_CHANGE_COLOR,  // we don't accept the ::selection pseudo element.  if (!dontChangeTextColor &&      mSelectionPseudoStyle &&      mSelectionStatus == nsISelectionController::SELECTION_ON) {    *aForeColor = mSelectionPseudoFGcolor;    *aBackColor = mSelectionPseudoBGcolor;    *aBackIsTransparent = mSelectionPseudoBGIsTransparent;    return PR_TRUE;  }  if (dontChangeTextColor)    *aForeColor = mOldStyle.mColor->mColor;  else    *aForeColor = mOldStyle.mSelectionTextColor;  if (mSelectionStatus == nsISelectionController::SELECTION_ATTENTION)    *aBackColor = mAttentionColor;  else if (mSelectionStatus != nsISelectionController::SELECTION_ON)    *aBackColor = mDisabledColor;  else    *aBackColor = mOldStyle.mSelectionBGColor;  // We don't support selection color exchanging when selection text color is  // NS_DONT_CHANGE_COLOR. Because the text color should not be background color.  if (dontChangeTextColor) {    *aForeColor = EnsureDifferentColors(*aForeColor, *aBackColor);    return PR_TRUE;  }  // If the combination of selection background color and frame background color  // is sufficient contrast, don't exchange the selection colors.  PRInt32 backLuminosityDifference =            NS_LUMINOSITY_DIFFERENCE(*aBackColor, mFrameBackgroundColor);  if (backLuminosityDifference >= mSufficientContrast)    return PR_TRUE;  // Otherwise, we should use the higher-contrast color for the selection  // background color.  PRInt32 foreLuminosityDifference =            NS_LUMINOSITY_DIFFERENCE(*aForeColor, mFrameBackgroundColor);  if (backLuminosityDifference < foreLuminosityDifference) {    nscolor tmpColor = *aForeColor;    *aForeColor = *aBackColor;    *aBackColor = tmpColor;  }  return PR_TRUE;}