Package org.xhtmlrenderer.css.parser
Class CSSParser
java.lang.Object
org.xhtmlrenderer.css.parser.CSSParser
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CSSErrorHandler
private final Lexer
private @Nullable Token
private boolean
private @Nullable String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addPseudoClassOrElement
(Token t, Selector selector) private void
addPseudoClassOrElementFunction
(Token t, Selector selector) private void
addPseudoElement
(Token t, Selector selector) private void
private boolean
checkCSSName
(@Nullable CSSName cssName, String propertyName) private void
class_selector
(Selector selector) private Token
private int
convertToInteger
(char hexchar1) private int
convertToInteger
(char hexchar1, char hexchar2) private FSCMYKColor
createCMYKColorFromFunction
(List<PropertyValue> params) private FSRGBColor
createRGBColorFromFunction
(List<PropertyValue> params) private void
declaration
(Ruleset ruleset, boolean inFontFace) private void
declaration_list
(Ruleset ruleset, boolean expectEOF, boolean expectAtRule, boolean inFontFace) private void
error
(CSSParseException e, String what, boolean rethrowEOF) private List<PropertyValue>
expr
(boolean literal) private String
private float
extractRgbValue
(int i, PropertyValue value) private String
extractUnit
(Token t) private void
font_face
(Stylesheet stylesheet) private static float
fromZeroTo255
(float f) private PropertyValue
private int
private String
private String
private String
getTokenValue
(Token t, boolean literal) private PropertyValue
private void
import_rule
(Stylesheet stylesheet) private static boolean
isHexChar
(char c) private boolean
private boolean
isRelativeURI
(String uri) private boolean
boolean
private Token
la()
private Map<MarginBoxName,
List<PropertyDeclaration>> margin
(Stylesheet stylesheet) private void
media
(Stylesheet stylesheet) private String
medium()
private @Nullable Selector
mergeSimpleSelectors
(List<Selector> selectors, List<Token> combinators) private void
private Token
next()
private void
operator()
private void
page
(Stylesheet stylesheet) private float
parseCMYKColorComponent
(PropertyValue value, int paramNo) parseDeclaration
(StylesheetInfo.Origin origin, String text) @Nullable PropertyValue
parsePropertyValue
(CSSName cssName, StylesheetInfo.Origin origin, String expr) parseStylesheet
(@Nullable String uri, StylesheetInfo.Origin origin, Reader reader) private void
prio()
private static String
processEscapes
(char[] ch, int start, int end) private String
property()
private void
private String
private void
private void
recover
(boolean needBlock, boolean stopBeforeBlockClose) void
private void
ruleset
(RulesetContainer container) private void
void
setSupportCMYKColors
(boolean b) private String
sign
(float sign) private Selector
simple_selector
(Ruleset ruleset) private void
private void
private void
stylesheet
(Stylesheet stylesheet) private PropertyValue
private CSSParser.NamespacePair
typed_value
(boolean matchAttribute) private int
-
Field Details
-
SUPPORTED_PSEUDO_ELEMENTS
-
CSS21_PSEUDO_ELEMENTS
-
_saved
-
_lexer
-
_errorHandler
-
_uri
-
_namespaces
-
_supportCMYKColors
private boolean _supportCMYKColors
-
-
Constructor Details
-
CSSParser
-
-
Method Details
-
parseStylesheet
@CheckReturnValue public Stylesheet parseStylesheet(@Nullable String uri, StylesheetInfo.Origin origin, Reader reader) throws IOException - Throws:
IOException
-
parseDeclaration
-
parsePropertyValue
public @Nullable PropertyValue parsePropertyValue(CSSName cssName, StylesheetInfo.Origin origin, String expr) -
stylesheet
- Throws:
IOException
-
import_rule
- Throws:
IOException
-
namespace
- Throws:
IOException
-
media
- Throws:
IOException
-
medium
- Throws:
IOException
-
font_face
- Throws:
IOException
-
page
- Throws:
IOException
-
margin
private Map<MarginBoxName,List<PropertyDeclaration>> margin(Stylesheet stylesheet) throws IOException - Throws:
IOException
-
pseudo_page
- Throws:
IOException
-
operator
- Throws:
IOException
-
combinator
- Throws:
IOException
-
unary_operator
- Throws:
IOException
-
property
- Throws:
IOException
-
declaration_list
private void declaration_list(Ruleset ruleset, boolean expectEOF, boolean expectAtRule, boolean inFontFace) throws IOException - Throws:
IOException
-
ruleset
- Throws:
IOException
-
selector
- Throws:
IOException
-
mergeSimpleSelectors
-
simple_selector
- Throws:
IOException
-
typed_value
- Throws:
IOException
-
class_selector
- Throws:
IOException
-
attrib
- Throws:
IOException
-
addPseudoClassOrElement
-
addPseudoClassOrElementFunction
- Throws:
IOException
-
addPseudoElement
-
pseudo
- Throws:
IOException
-
checkCSSName
-
declaration
- Throws:
IOException
-
prio
- Throws:
IOException
-
expr
- Throws:
IOException
-
extractNumber
-
extractUnit
-
sign
-
term
- Throws:
IOException
-
function
- Throws:
IOException
-
createCMYKColorFromFunction
-
parseCMYKColorComponent
-
createRGBColorFromFunction
-
extractRgbValue
-
fromZeroTo255
private static float fromZeroTo255(float f) -
hexcolor
- Throws:
IOException
-
isHexString
-
convertToInteger
private int convertToInteger(char hexchar1, char hexchar2) -
convertToInteger
private int convertToInteger(char hexchar1) -
skip_whitespace
- Throws:
IOException
-
skip_whitespace_and_cdocdc
- Throws:
IOException
-
next
- Throws:
IOException
-
push
-
la
- Throws:
IOException
-
error
-
recover
- Throws:
IOException
-
reset
-
getRawTokenValue
-
getTokenValue
-
getTokenValue
-
isRelativeURI
-
isServerRelativeURI
-
getCurrentLine
private int getCurrentLine() -
isHexChar
private static boolean isHexChar(char c) -
processEscapes
-
isSupportCMYKColors
public boolean isSupportCMYKColors() -
setSupportCMYKColors
public void setSupportCMYKColors(boolean b) -
setOf
-