Package com.openhtmltopdf.css.sheet
Class Stylesheet
java.lang.Object
com.openhtmltopdf.css.sheet.Stylesheet
- All Implemented Interfaces:
RulesetContainer
A representation of a CSS style sheet. A Stylesheet has the sheet's rules in
Ruleset
, and has an origin--either user agent, user, or author. A
Stylesheet can only be instantiated from a SAC CSSStyleSheet instance-- this
would be the output of a SAC-compliant parser after parsing a CSS stream or
source. A Stylesheet is immutable; after instantiation, you can query the
origin and the Ruleset
, but not modify either of them.-
Field Summary
FieldsModifier and TypeFieldDescriptionMay contain page rules, media rules or rulesets.private final List
<FontFaceRule> private final List
<StylesheetInfo> private final int
user-agent, user or author fromStylesheetInfo
private final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addContent
(MediaRule rule) void
addContent
(PageRule rule) void
addContent
(Ruleset ruleset) void
addFontFaceRule
(FontFaceRule rule) void
addImportRule
(StylesheetInfo info) int
Gets the origin attribute of the Stylesheet objectgetURI()
Gets the URI of the Stylesheet object
-
Field Details
-
_uri
-
_origin
private final int _originuser-agent, user or author fromStylesheetInfo
-
_fontFaceRules
-
_importRules
-
_contents
May contain page rules, media rules or rulesets.
-
-
Constructor Details
-
Stylesheet
Creates a new instance of Stylesheet- Parameters:
uri
-origin
- user-agent, user or author fromStylesheetInfo
-
-
Method Details
-
getOrigin
public int getOrigin()Gets the origin attribute of the Stylesheet object- Specified by:
getOrigin
in interfaceRulesetContainer
- Returns:
- The origin value: user-agent, user or author from
StylesheetInfo
-
getURI
Gets the URI of the Stylesheet object- Returns:
- The URI
-
addContent
- Specified by:
addContent
in interfaceRulesetContainer
-
addContent
-
addContent
-
getContents
- Returns:
- a list containing page rules, media rules and rulesets in encounter order.
-
addImportRule
-
getImportRules
-
addFontFaceRule
-
getFontFaceRules
-