private static class GenericBorderWidth extends AbstractPropertyBuilder {
public List buildDeclarations(
CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) {
checkValueCount(cssName, 1, values.size());
PropertyValue value = (PropertyValue)values.get(0);
checkInheritAllowed(value, inheritAllowed);
if (value.getCssValueType() != CSSPrimitiveValue.CSS_INHERIT) {
checkIdentOrLengthType(cssName, value);
if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
IdentValue ident = checkIdent(cssName, value);
checkValidity(cssName, BORDER_WIDTHS, ident);
return Collections.singletonList(
new PropertyDeclaration(
cssName, Conversions.getBorderWidth(ident.toString()), important, origin));
} else {
if (value.getFloatValue() < 0.0f) {
throw new CSSParseException(cssName + " may not be negative", -1);
}
}
}