Package org.xhtmlrenderer.css.parser

Examples of org.xhtmlrenderer.css.parser.CSSParseException


            checkInheritAllowed(value, inheritAllowed);
            if (value.getCssValueType() != CSSPrimitiveValue.CSS_INHERIT) {
                checkLengthType(cssName, value);

                if (! isNegativeValuesAllowed() && value.getFloatValue() < 0.0f) {
                    throw new CSSParseException(cssName + " may not be negative", -1);
                }
            }

            return Collections.singletonList(
                    new PropertyDeclaration(cssName, value, important, origin));
View Full Code Here


                checkIdentLengthOrPercentType(cssName, second);

                if (first.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
                    IdentValue firstIdent = checkIdent(cssName, first);
                    if (firstIdent != IdentValue.AUTO) {
                        throw new CSSParseException("The only ident value allowed here is 'auto'", -1);
                    }
                } else if (((PropertyValue)first).getFloatValue() < 0.0f) {
                    throw new CSSParseException(cssName + " values cannot be negative", -1);
                }

                if (second.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT) {
                    IdentValue secondIdent = checkIdent(cssName, second);
                    if (secondIdent != IdentValue.AUTO) {
                        throw new CSSParseException("The only ident value allowed here is 'auto'", -1);
                    }
                } else if (((PropertyValue)second).getFloatValue() < 0.0f) {
                    throw new CSSParseException(cssName + " values cannot be negative", -1);
                }
               
                return createTwoValueResponse(CSSName.BACKGROUND_SIZE, first, second, origin, important);
            }
        }
View Full Code Here

        }
    }
   
    protected void checkIdentType(CSSName cssName, CSSPrimitiveValue value) {
        if (value.getPrimitiveType() != CSSPrimitiveValue.CSS_IDENT) {
            throw new CSSParseException("Value for " + cssName + " must be an identifier", -1);
        }
    }
View Full Code Here

    }
   
    protected void checkIdentOrURIType(CSSName cssName, CSSPrimitiveValue value) {
        int type = value.getPrimitiveType();
        if (type != CSSPrimitiveValue.CSS_IDENT && type != CSSPrimitiveValue.CSS_URI) {
            throw new CSSParseException("Value for " + cssName + " must be an identifier or a URI", -1);
        }
    }
View Full Code Here

    }
   
    protected void checkIdentOrColorType(CSSName cssName, CSSPrimitiveValue value) {
        int type = value.getPrimitiveType();
        if (type != CSSPrimitiveValue.CSS_IDENT && type != CSSPrimitiveValue.CSS_RGBCOLOR) {
            throw new CSSParseException("Value for " + cssName + " must be an identifier or a color", -1);
        }
    } 
View Full Code Here

        if ((type != CSSPrimitiveValue.CSS_IDENT &&
                type != CSSPrimitiveValue.CSS_NUMBER) ||
            (type == CSSPrimitiveValue.CSS_NUMBER &&
                    (int)value.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) !=
                        Math.round(value.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)))) {
            throw new CSSParseException("Value for " + cssName + " must be an identifier or an integer", -1);
        }
    }
View Full Code Here

        int type = value.getPrimitiveType();
        if (type != CSSPrimitiveValue.CSS_NUMBER ||
                (type == CSSPrimitiveValue.CSS_NUMBER &&
                    (int)value.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) !=
                        Math.round(value.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)))) {
            throw new CSSParseException("Value for " + cssName + " must be an integer", -1);
        }
    }
View Full Code Here

    }
   
    protected void checkIdentOrLengthType(CSSName cssName, CSSPrimitiveValue value) {
        int type = value.getPrimitiveType();
        if (type != CSSPrimitiveValue.CSS_IDENT && ! isLength(value)) {
            throw new CSSParseException("Value for " + cssName + " must be an identifier or a length", -1);
        }
    }
View Full Code Here

    }
   
    protected void checkIdentOrNumberType(CSSName cssName, CSSPrimitiveValue value) {
        int type = value.getPrimitiveType();
        if (type != CSSPrimitiveValue.CSS_IDENT && type != CSSPrimitiveValue.CSS_NUMBER) {
            throw new CSSParseException("Value for " + cssName + " must be an identifier or a length", -1);
        }
    }
View Full Code Here

    }
   
    protected void checkIdentLengthOrPercentType(CSSName cssName, CSSPrimitiveValue value) {
        int type = value.getPrimitiveType();
        if (type != CSSPrimitiveValue.CSS_IDENT && ! isLength(value) && type != CSSPrimitiveValue.CSS_PERCENTAGE) {
            throw new CSSParseException("Value for " + cssName + " must be an identifier, length, or percentage", -1);
        }
    }
View Full Code Here

TOP

Related Classes of org.xhtmlrenderer.css.parser.CSSParseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.