public override double GetFloatValue(CssPrimitiveType unitType)
{
double ret;
if(PrimitiveType == CssPrimitiveType.Percentage)
{
if(unitType == CssPrimitiveType.Percentage)
{
return floatValue;
}
else
{
throw new NotImplementedException("Can't get absolute values from percentages");
}
}
else
{
switch(unitType)
{
case CssPrimitiveType.Cm:
ret = _getInLength() * CmPerIn;
break;
case CssPrimitiveType.Mm:
ret = _getInLength() * CmPerIn * 10;
break;
case CssPrimitiveType.In:
ret = _getInLength();
break;
case CssPrimitiveType.Pc:
ret = _getInLength() * 6;
break;
case CssPrimitiveType.Pt:
ret = _getInLength() * 72;
break;
case CssPrimitiveType.Ems:
ret = _getPxLength() / _getFontSize();
break;
case CssPrimitiveType.Exs:
ret = _getPxLength() / (_getFontSize() * 0.5);
break;
default:
ret = _getPxLength();
break;
}
}
return ret;
}