}
public boolean setFloatValueInternal(SourceCode cssTextCode)
{
// Se supone que hay almenos un token
Token token0 = cssTextCode.getToken(0);
if (!(token0 instanceof FloatNumber))
return false;
FloatNumber tokenNumber = (FloatNumber)token0;
float floatValue = tokenNumber.getFloat();
short unitType = -1;
if (cssTextCode.tokenCount() > 2)
throw new DOMException(DOMException.INVALID_ACCESS_ERR,"CSS: number format error: " + cssTextCode.toString());
if (cssTextCode.tokenCount() == 1)
{
// No tiene sufijo
unitType = CSS_NUMBER;
}
else
{
// Tiene sufijo
Token token1 = cssTextCode.getToken(1);
if (!(token1 instanceof Identifier) && !(token1 instanceof Percent))
throw new DOMException(DOMException.INVALID_ACCESS_ERR,"CSS: expected a unit identifier: " + cssTextCode.toString());
String suffix = token1.toString();
suffix = suffix.toLowerCase();
if ("%".equals(suffix))
{
unitType = CSS_PERCENTAGE;