nsCOMPtr<nsIStyleContext> styleContext; aFrame.GetStyleContext(getter_AddRefs(styleContext)); if(!styleContext) ABORT0();
nsStyleContext* styleContext = aFrame.GetStyleContext(); if(!styleContext) ABORT0();
GetStyleInfo(const nsIFrame&  aFrame,             PRUint8          aSide,             PRUint8&         aStyle,             nscolor&         aColor,             PRBool           aIgnoreIfRules = PR_FALSE,             nscoord*         aWidth = nsnull,             float*           aTwipsToPixels = nsnull){  const nsStyleBorder* styleData;   aFrame.GetStyleData(eStyleStruct_Border, (const nsStyleStruct *&)styleData); if (!styleData) ABORT0();  aStyle = styleData->GetBorderStyle(aSide);  // if the rules mask is set, set the style either to none or remove the mask  if (NS_STYLE_BORDER_STYLE_RULES_MASK & aStyle) {    if (aIgnoreIfRules) {      aStyle = NS_STYLE_BORDER_STYLE_NONE;      aColor = 0;      if (aWidth) {        *aWidth = 0;      }      return;    }    else {      aStyle &= ~NS_STYLE_BORDER_STYLE_RULES_MASK;    }  }  if ((NS_STYLE_BORDER_STYLE_NONE == aStyle) || (NS_STYLE_BORDER_STYLE_HIDDEN == aStyle)) {    if (aWidth) {      *aWidth = 0;      aColor = 0;    }    return;  }  if ((NS_STYLE_BORDER_STYLE_INSET    == aStyle) ||       (NS_STYLE_BORDER_STYLE_BG_INSET == aStyle)) {    aStyle = NS_STYLE_BORDER_STYLE_GROOVE;  }  else if ((NS_STYLE_BORDER_STYLE_OUTSET    == aStyle) ||            (NS_STYLE_BORDER_STYLE_BG_OUTSET == aStyle)) {    aStyle = NS_STYLE_BORDER_STYLE_RIDGE;  }  PRBool transparent, foreground;  styleData->GetBorderColor(aSide, aColor, transparent, foreground);  if (foreground) {    nsCOMPtr<nsIStyleContext> styleContext;    aFrame.GetStyleContext(getter_AddRefs(styleContext)); if(!styleContext) ABORT0();    const nsStyleColor* colorStyle = (const nsStyleColor*)styleContext->GetStyleData(eStyleStruct_Color);    aColor = colorStyle->mColor;  }  if (aWidth && aTwipsToPixels) {    *aWidth = 0;    nscoord width;    styleData->CalcBorderFor(&aFrame, aSide, width);    *aWidth = NSToCoordRound(*aTwipsToPixels * (float)width);  }}