Package com.openhtmltopdf.context
Class StylesheetFactoryImpl
java.lang.Object
com.openhtmltopdf.context.StylesheetFactoryImpl
- All Implemented Interfaces:
StylesheetFactory
A Factory class for Cascading Style Sheets. Sheets are parsed using a single
parser instance for all sheets. Sheets are cached by URI using a LRU test,
but timestamp of file is not checked.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CSSParser
This may avoid @import loops, ie.private UserAgentCallback
the UserAgentCallback to resolve urisprivate static final int
The maximum number of times a stylesheet uri can be link or imported before we give up and conclude there is a loop. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetStylesheet
(StylesheetInfo info) Returns a sheet by its key null if not able to loadprivate Stylesheet
parse
(StylesheetInfo info) parse
(Reader reader, StylesheetInfo info) parseStyleDeclaration
(int origin, String styleDeclaration) void
setSupportCMYKColors
(boolean b) void
setUserAgentCallback
(UserAgentCallback userAgent)
-
Field Details
-
_userAgentCallback
the UserAgentCallback to resolve uris -
_seenStylesheetUris
This may avoid @import loops, ie. one.css includes two.css which then includes one.css. -
MAX_STYLESHEET_INCLUDES
private static final int MAX_STYLESHEET_INCLUDESThe maximum number of times a stylesheet uri can be link or imported before we give up and conclude there is a loop.- See Also:
-
_cssParser
-
-
Constructor Details
-
StylesheetFactoryImpl
-
-
Method Details
-
parse
- Specified by:
parse
in interfaceStylesheetFactory
-
parse
- Returns:
- Returns null if uri could not be loaded
-
parseStyleDeclaration
- Specified by:
parseStyleDeclaration
in interfaceStylesheetFactory
-
getStylesheet
Returns a sheet by its key null if not able to load- Specified by:
getStylesheet
in interfaceStylesheetFactory
- Parameters:
info
- The StylesheetInfo for this sheet- Returns:
- The stylesheet
-
setUserAgentCallback
-
setSupportCMYKColors
public void setSupportCMYKColors(boolean b)
-