if (eStyleUnit_Normal == unit) {
nsHTMLReflowState::CalcLineHeight(nsIPresContext& aPresContext,                                  nsIFrame* aFrame){  nscoord lineHeight = -1;  nsIStyleContext* sc;  aFrame->GetStyleContext(&sc);  const nsStyleFont* elementFont = nsnull;  if (nsnull != sc) {    elementFont = (const nsStyleFont*)sc->GetStyleData(eStyleStruct_Font);    for (;;) {      const nsStyleText* text = (const nsStyleText*)        sc->GetStyleData(eStyleStruct_Text);      if (nsnull != text) {        nsStyleUnit unit = text->mLineHeight.GetUnit();        if (eStyleUnit_Normal == unit) {          // Normal value#ifdef NOISY_VERTICAL_ALIGN          printf("  line-height: normal\n");#endif          break;        } else if (eStyleUnit_Factor == unit) {          // CSS2 spec says that the number is inherited, not the          // computed value. Therefore use the font size of the          // element times the inherited number.          nscoord size = elementFont->mFont.size;          lineHeight = nscoord(size * text->mLineHeight.GetFactorValue());          if (lineHeight < 0) {            lineHeight = -1;          }#ifdef NOISY_VERTICAL_ALIGN          printf("  line-height: factor=%g result=%d\n",                 text->mLineHeight.GetFactorValue(), lineHeight);#endif          break;        }        else if (eStyleUnit_Coord == unit) {          lineHeight = text->mLineHeight.GetCoordValue();          if (lineHeight < 0) {            lineHeight = -1;          }          break;        }        else if (eStyleUnit_Percent == unit) {          // XXX This could arguably be the font-metrics actual height          // instead since the spec says use the computed height.          const nsStyleFont* font = (const nsStyleFont*)            sc->GetStyleData(eStyleStruct_Font);          nscoord size = font->mFont.size;          lineHeight = nscoord(size * text->mLineHeight.GetPercentValue());          if (lineHeight < 0) {            lineHeight = -1;          }          break;        }        else if (eStyleUnit_Inherit == unit) {          nsIStyleContext* parentSC;          parentSC = sc->GetParent();          if (nsnull == parentSC) {            // Note: Break before releasing to avoid double-releasing sc            break;          }          NS_RELEASE(sc);          sc = parentSC;        }        else {          // other units are not part of the spec so don't bother          // looping          break;        }      }    }    NS_RELEASE(sc);  }  return lineHeight;}