/**
* Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}.
*/
public Value createValue(LexicalUnit lu, CSSEngine engine)
throws DOMException {
ListValue result = new ListValue();
switch (lu.getLexicalUnitType()) {
case LexicalUnit.SAC_INHERIT:
return ValueConstants.INHERIT_VALUE;
case LexicalUnit.SAC_URI:
do {
result.append(new URIValue(lu.getStringValue(),
resolveURI(engine.getCSSBaseURI(),
lu.getStringValue())));
lu = lu.getNextLexicalUnit();
if (lu == null) {
throw createMalformedLexicalUnitDOMException();
}
if (lu.getLexicalUnitType() !=
LexicalUnit.SAC_OPERATOR_COMMA) {
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
}
lu = lu.getNextLexicalUnit();
if (lu == null) {
throw createMalformedLexicalUnitDOMException();
}
} while (lu.getLexicalUnitType() == LexicalUnit.SAC_URI);
if (lu.getLexicalUnitType() != LexicalUnit.SAC_IDENT) {
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());
}
// Fall through...
case LexicalUnit.SAC_IDENT:
String s = lu.getStringValue().toLowerCase().intern();
Object v = values.get(s);
if (v == null) {
throw createInvalidIdentifierDOMException(lu.getStringValue());
}
result.append((Value)v);
lu = lu.getNextLexicalUnit();
}
if (lu != null) {
throw createInvalidLexicalUnitDOMException
(lu.getLexicalUnitType());