aDesiredSize.width = nscoord(pct * aReflowState.maxSize.width);
if (aReflowState.maxSize.width == NS_UNCONSTRAINEDSIZE) { aDesiredSize.width = 1; } else { aDesiredSize.width = nscoord(pct * aReflowState.maxSize.width); }
HRuleFrame::GetDesiredSize(nsIPresContext* aPresContext,                           const nsReflowState& aReflowState,                           nsReflowMetrics& aDesiredSize){  const nsStylePosition* position = (const nsStylePosition*)    mStyleContext->GetStyleData(eStyleStruct_Position);  if (position->mWidth.GetUnit() == eStyleUnit_Coord) {    aDesiredSize.width = position->mWidth.GetCoordValue();  }  else if (position->mWidth.GetUnit() == eStyleUnit_Percent) {    float pct = position->mWidth.GetPercentValue();    aDesiredSize.width = nscoord(pct * aReflowState.maxSize.width);  }  else {    if (aReflowState.maxSize.width == NS_UNCONSTRAINEDSIZE) {      aDesiredSize.width = 1;    } else {      aDesiredSize.width = aReflowState.maxSize.width;    }  }  if (aReflowState.maxSize.width != NS_UNCONSTRAINEDSIZE) {    if (aDesiredSize.width  < aReflowState.maxSize.width) {      aDesiredSize.width = aReflowState.maxSize.width;    }  }  // XXX should we interpret css's height property as thickness? or as  // line-height? In the meantime, ignore it...  nscoord lineHeight;  // Get the thickness of the rule (this is not css's height property)  float p2t = aPresContext->GetPixelsToTwips();  nscoord thickness = nscoord(p2t * ((HRulePart*)mContent)->GetThickness());  // Compute height of "line" that hrule will layout within. Use the  // default font to do this.  lineHeight = thickness + nscoord(p2t * 2);  const nsFont& defaultFont = aPresContext->GetDefaultFont();  nsIFontMetrics* fm = aPresContext->GetMetricsFor(defaultFont);  nscoord defaultLineHeight = fm->GetHeight();  NS_RELEASE(fm);  if (lineHeight < defaultLineHeight) {    lineHeight = defaultLineHeight;  }  aDesiredSize.height = lineHeight;  aDesiredSize.ascent = lineHeight;  aDesiredSize.descent = 0;}