}
public OMCSSValue parse(String cssText) {
OMCSSValue[] values = null;
if (SVGConstants.CSS_NONE_VALUE.equals(cssText) || cssText == null || cssText.length() == 0) {
return new OMCSSPrimitiveValue(cssText, OMCSSPrimitiveValue.CSS_IDENT);
} else if (SVGConstants.CSS_INHERIT_VALUE.equals(cssText)) {
return new OMCSSPrimitiveValue(cssText, OMCSSPrimitiveValue.CSS_IDENT);
}
List<OMCSSPrimitiveValue> lengths = new ArrayList<OMCSSPrimitiveValue>();
String[] lengthArray = cssText.split(COMMA);
for (int i = 0; i < lengthArray.length; i++) {
if (lengthArray[i].length() > 0) {
LENGTH.setLastIndex(0);
String length = lengthArray[i].trim();
MatchResult result = LENGTH.exec(length);
if (result != null && result.getGroupCount() == 3) {
short primitiveType = CSSPrimitiveValue.CSS_NUMBER;
String unit = result.getGroup(2);
if (unit != null) {
primitiveType = unitToPrimitiveType.get(unit.toLowerCase());
}
float value = Float.parseFloat(result.getGroup(1));
lengths.add(new OMCSSPrimitiveValue(value, primitiveType));
} else {
throw new JavaScriptException("Invalid length spec: " + length);
}
}
}