protected void checkInheritAllowed(CSSPrimitiveValue value, boolean inheritAllowed) { if (value.getCssValueType() == CSSPrimitiveValue.CSS_INHERIT && ! inheritAllowed) { throw new CSSParseException("Invalid use of inherit", -1); } }
protected List checkInheritAll(CSSName[] all, List values, int origin, boolean important, boolean inheritAllowed) { if (values.size() == 1) { CSSPrimitiveValue value = (CSSPrimitiveValue)values.get(0); checkInheritAllowed(value, inheritAllowed); if (value.getCssValueType() == CSSPrimitiveValue.CSS_INHERIT) { List result = new ArrayList(all.length); for (int i = 0; i < all.length; i++) { result.add( new PropertyDeclaration(all[i], value, important, origin)); } return result; } } return null; } }
public List buildDeclarations( CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) { checkValueCount(cssName, 1, values.size()); CSSPrimitiveValue value = (CSSPrimitiveValue)values.get(0); checkInheritAllowed(value, inheritAllowed); if (value.getCssValueType() != CSSPrimitiveValue.CSS_INHERIT) { checkIdentType(cssName, value); IdentValue ident = checkIdent(cssName, value); checkValidity(cssName, getAllowed(), ident); } return Collections.singletonList( new PropertyDeclaration(cssName, value, important, origin)); } }
public List buildDeclarations( CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) { checkValueCount(cssName, 1, values.size()); CSSPrimitiveValue value = (CSSPrimitiveValue)values.get(0); checkInheritAllowed(value, inheritAllowed); if (value.getCssValueType() != CSSPrimitiveValue.CSS_INHERIT) { checkIdentOrURIType(cssName, value); if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { IdentValue ident = checkIdent(cssName, value); checkValidity(cssName, ALLOWED, ident); } } return Collections.singletonList( new PropertyDeclaration(cssName, value, important, origin)); } }
public List buildDeclarations( CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) { checkValueCount(cssName, 1, values.size()); CSSPrimitiveValue value = (CSSPrimitiveValue)values.get(0); checkInheritAllowed(value, inheritAllowed); if (value.getCssValueType() != CSSPrimitiveValue.CSS_INHERIT) { checkIdentOrIntegerType(cssName, value); if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { IdentValue ident = checkIdent(cssName, value); checkValidity(cssName, ALLOWED, ident); } } return Collections.singletonList( new PropertyDeclaration(cssName, value, important, origin)); } }
public List buildDeclarations( CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) { checkValueCount(cssName, 1, values.size()); CSSPrimitiveValue value = (CSSPrimitiveValue)values.get(0); checkInheritAllowed(value, inheritAllowed); if (value.getCssValueType() != CSSPrimitiveValue.CSS_INHERIT) { checkIdentType(cssName, value); if (! value.getStringValue().equals("auto")) { // Treat as string since it won't be a proper IdentValue value = new PropertyValue( CSSPrimitiveValue.CSS_STRING, value.getStringValue(), value.getCssText()); } } return Collections.singletonList( new PropertyDeclaration(cssName, value, important, origin)); } }
CSSPrimitiveValue value = (CSSPrimitiveValue)values.get(0); checkInheritAllowed(value, inheritAllowed); if (value.getCssValueType() == CSSPrimitiveValue.CSS_INHERIT) { return Collections.singletonList( new PropertyDeclaration(cssName, value, important, origin));
@Override public List buildDeclarations( CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) { checkValueCount(cssName, 1, values.size()); CSSPrimitiveValue value = (CSSPrimitiveValue)values.get(0); checkInheritAllowed(value, inheritAllowed); if (value.getCssValueType() != CSSPrimitiveValue.CSS_INHERIT) { checkIdentOrIntegerType(cssName, value); if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { IdentValue ident = checkIdent(cssName, value); checkValidity(cssName, ALLOWED, ident); } else if (value.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) < 1) { throw new CSSParseException("column-count must be one or greater", -1); } } return Collections.singletonList( new PropertyDeclaration(cssName, value, important, origin)); } }
CSSPrimitiveValue value = (CSSPrimitiveValue)values.get(0); boolean goWithSingle = false; if (value.getCssValueType() == CSSPrimitiveValue.CSS_INHERIT) { goWithSingle = true; } else {
public List buildDeclarations( CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) { checkValueCount(cssName, 1, values.size()); CSSPrimitiveValue value = (CSSPrimitiveValue)values.get(0); checkInheritAllowed(value, inheritAllowed); if (value.getCssValueType() != CSSPrimitiveValue.CSS_INHERIT) { checkIdentOrString(cssName, value); if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { // Convert to string return Collections.singletonList( new PropertyDeclaration( cssName, new PropertyValue( CSSPrimitiveValue.CSS_STRING, value.getStringValue(), value.getCssText()), important, origin)); } } return Collections.singletonList( new PropertyDeclaration(cssName, value, important, origin)); } }
@Override public List buildDeclarations(CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) { checkValueCount(cssName, 1, values.size()); CSSPrimitiveValue value = (CSSPrimitiveValue) values.get(0); checkInheritAllowed(value, inheritAllowed); if (value.getCssValueType() == CSSPrimitiveValue.CSS_INHERIT) { return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin)); } if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { IdentValue ident = checkIdent(cssName, value); checkValidity(cssName, ALLOWED, ident); if (ident == IdentValue.LEFT) { return Collections.singletonList(new PropertyDeclaration(cssName, new PropertyValue(CSSPrimitiveValue.CSS_PERCENTAGE, 0f, "0%"), important, origin)); } else if (ident == IdentValue.CENTER) { return Collections.singletonList(new PropertyDeclaration(cssName, new PropertyValue(CSSPrimitiveValue.CSS_PERCENTAGE, 50f, "50%"), important, origin)); } else { // if (ident == IdentValue.RIGHT) return Collections.singletonList(new PropertyDeclaration(cssName, new PropertyValue(CSSPrimitiveValue.CSS_PERCENTAGE, 100f, "100%"), important, origin)); } } else { checkLengthOrPercentType(cssName, value); return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin)); } } }
@Override public List buildDeclarations(CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) { checkValueCount(cssName, 1, values.size()); CSSPrimitiveValue value = (CSSPrimitiveValue) values.get(0); checkInheritAllowed(value, inheritAllowed); if (value.getCssValueType() == CSSPrimitiveValue.CSS_INHERIT) { return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin)); } if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { IdentValue ident = checkIdent(cssName, value); checkValidity(cssName, ALLOWED, ident); if (ident == IdentValue.TOP) { return Collections.singletonList(new PropertyDeclaration(cssName, new PropertyValue(CSSPrimitiveValue.CSS_PERCENTAGE, 0f, "0%"), important, origin)); } else if (ident == IdentValue.CENTER) { return Collections.singletonList(new PropertyDeclaration(cssName, new PropertyValue(CSSPrimitiveValue.CSS_PERCENTAGE, 50f, "50%"), important, origin)); } else { // if (ident == IdentValue.BOTTOM) return Collections.singletonList(new PropertyDeclaration(cssName, new PropertyValue(CSSPrimitiveValue.CSS_PERCENTAGE, 100f, "100%"), important, origin)); } } else { checkLengthOrPercentType(cssName, value); return Collections.singletonList(new PropertyDeclaration(cssName, value, important, origin)); } } }
public List buildDeclarations( CSSName cssName, List values, int origin, boolean important, boolean inheritAllowed) { checkValueCount(cssName, 1, values.size()); CSSPrimitiveValue value = (CSSPrimitiveValue)values.get(0); checkInheritAllowed(value, inheritAllowed); if (value.getCssValueType() != CSSPrimitiveValue.CSS_INHERIT) { checkIdentOrColorType(cssName, value); if (value.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) { FSRGBColor color = Conversions.getColor(value.getStringValue()); if (color != null) { return Collections.singletonList( new PropertyDeclaration( cssName, new PropertyValue(color), important, origin)); } IdentValue ident = checkIdent(cssName, value); checkValidity(cssName, ALLOWED, ident); } } return Collections.singletonList( new PropertyDeclaration(cssName, value, important, origin)); } }
first.getCssValueType() == CSSPrimitiveValue.CSS_INHERIT) { return Collections.singletonList( new PropertyDeclaration(cssName, first, important, origin));
first.getCssValueType() == CSSPrimitiveValue.CSS_INHERIT) { return Collections.singletonList( new PropertyDeclaration(cssName, first, important, origin));
((CSSPrimitiveValue)values.get(0)).getCssValueType() == CSSPrimitiveValue.CSS_INHERIT) { CSSPrimitiveValue value = (CSSPrimitiveValue)values.get(0); addAll(result, props[0], value, origin, important);