- All Implemented Interfaces:
CSSStyleSheetFactory
,Serializable
Allows the creation of stand-alone style sheets; also provides a method
(createCSSDocument(Document)
) to wrap any DOM Document
into a
CSSDocument
, and access to an implementation of
UserAgent
based on those wrapped documents.
- See Also:
-
Nested Class Summary
-
Field Summary
Fields inherited from class io.sf.carte.doc.style.css.om.AbstractCSSStyleSheetFactory
STRING_DOUBLE_QUOTE, STRING_SINGLE_QUOTE
Fields inherited from interface io.sf.carte.doc.style.css.CSSStyleSheetFactory
FLAG_STRING_DOUBLE_QUOTE, FLAG_STRING_SINGLE_QUOTE, ORIGIN_AUTHOR, ORIGIN_USER, ORIGIN_USER_AGENT, ORIGIN_USER_IMPORTANT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreate a style declaration for an anonymous inline box, associated to a text/cdata node.createCSSDocument
(Document document) Wrap a DOM document with a CSS-enabled wrapper that allows styles to be computed.protected DOMDocumentCSSStyleSheet
createDocumentStyleSheet
(byte origin) Creates a Document CSS style sheet for all media.protected EntityResolver
protected InlineStyle
createInlineStyle
(Node owner) Create an inline style.protected BaseCSSStyleSheet
createLinkedStyleSheet
(Node ownerNode, String title, MediaQueryList mediaList) Creates an author (document-linked) CSS style sheet.protected DOMCSSStyleSheet
createRuleStyleSheet
(AbstractCSSRule ownerRule, String title, MediaQueryList mediaList) Creates a CSS style sheet owned by a CSS rule.protected BaseDocumentCSSStyleSheet
Get the style sheet resulting from the merge of the user agent sheet and the non-important part of the user style sheet.Gets a lazily instantiated user agent, appropriate to retrieve resources.Gets the User Agent default CSS style sheet to be used by this factory.void
Sets a default HTML default style sheet as the user agent style sheet.Methods inherited from class io.sf.carte.doc.style.css.om.BaseCSSStyleSheetFactory
createDefaultStyleFormattingFactory, createImmutableMediaQueryList, createInlineStyleErrorHandler, createMediaQueryList, createPropertyDefinition, createSACParser, createSheetErrorHandler, createStyleDeclarationErrorHandler, createStyleSheet, getDeviceFactory, getParserFlags, getStyleFormattingFactory, getSystemDefaultValue, getUserImportantStyleSheet, getUserNormalStyleSheet, getValueFactory, hasCompatValueFlags, hasFactoryFlag, htmlDefaultSheet, htmlQuirksDefaultSheet, setClassLoader, setDeviceFactory, setFactoryFlag, setLenientSystemValues, setStyleFormattingFactory, setUserStyleSheet, setUserStyleSheet
-
Constructor Details
-
DOMCSSStyleSheetFactory
public DOMCSSStyleSheetFactory() -
DOMCSSStyleSheetFactory
-
-
Method Details
-
createDocumentStyleSheet
Description copied from class:BaseCSSStyleSheetFactory
Creates a Document CSS style sheet for all media.- Specified by:
createDocumentStyleSheet
in classBaseCSSStyleSheetFactory
- Parameters:
origin
- the origin of the sheet (likeauthor
,user agent
, etc.)- Returns:
- the style sheet.
-
createRuleStyleSheet
protected DOMCSSStyleSheet createRuleStyleSheet(AbstractCSSRule ownerRule, String title, MediaQueryList mediaList) Description copied from class:BaseCSSStyleSheetFactory
Creates a CSS style sheet owned by a CSS rule.- Specified by:
createRuleStyleSheet
in classBaseCSSStyleSheetFactory
- Parameters:
ownerRule
- the owner rule.title
- the advisory title.mediaList
- the list of target media for style.- Returns:
- the style sheet.
-
createLinkedStyleSheet
protected BaseCSSStyleSheet createLinkedStyleSheet(Node ownerNode, String title, MediaQueryList mediaList) Description copied from class:AbstractCSSStyleSheetFactory
Creates an author (document-linked) CSS style sheet.- Specified by:
createLinkedStyleSheet
in classAbstractCSSStyleSheetFactory
- Parameters:
ownerNode
- the node that associates the style sheet to the document. In HTML it can be alink
orstyle
element. For style sheets that are included by other style sheets, the value of this parameter isnull
.title
- the advisory title.mediaList
- the target media list for style.- Returns:
- the style sheet.
-
getUserAgentStyleSheet
Gets the User Agent default CSS style sheet to be used by this factory.This implementation does not support !important rules in the user agent style sheet, as that support would imply some overhead that is unnecessary with the usual user agent sheets.
The sheet will be appropriately merged with the non-important part of the user-preference style sheet to provide the document's default sheet.
- Parameters:
mode
- the compliance mode.- Returns:
- the default style sheet, or an empty sheet if no User Agent sheet was defined.
-
getDefaultStyleSheet
Description copied from class:AbstractCSSStyleSheetFactory
Get the style sheet resulting from the merge of the user agent sheet and the non-important part of the user style sheet.- Specified by:
getDefaultStyleSheet
in classAbstractCSSStyleSheetFactory
- Parameters:
mode
- the compliance mode.- Returns:
- the default style sheet at the top of the cascade.
-
setDefaultHTMLUserAgentSheet
public void setDefaultHTMLUserAgentSheet()Description copied from class:AbstractCSSStyleSheetFactory
Sets a default HTML default style sheet as the user agent style sheet.The sheet will be appropriately merged with the non-important part of the user-preference style sheet to provide the document's default sheet.
- Specified by:
setDefaultHTMLUserAgentSheet
in interfaceCSSStyleSheetFactory
- Specified by:
setDefaultHTMLUserAgentSheet
in classAbstractCSSStyleSheetFactory
-
getUserAgent
Gets a lazily instantiated user agent, appropriate to retrieve resources.It reads XML documents with a DocumentBuilder that can be set with
DOMCSSStyleSheetFactory.WrapperUserAgent.setDocumentBuilder(DocumentBuilder)
and wraps them with CSS capabilities.- Returns:
- the user agent.
-
createCSSDocument
Wrap a DOM document with a CSS-enabled wrapper that allows styles to be computed.The resulting document is read-only, and does not apply non-CSS presentational hints.
- Parameters:
document
- the document to wrap.- Returns:
- the CSS-enabled document wrapper.
-
createAnonymousStyleDeclaration
Description copied from interface:CSSStyleSheetFactory
Create a style declaration for an anonymous inline box, associated to a text/cdata node.- Specified by:
createAnonymousStyleDeclaration
in interfaceCSSStyleSheetFactory
- Specified by:
createAnonymousStyleDeclaration
in classAbstractCSSStyleSheetFactory
- Parameters:
node
- the node that has the declaration associated to it.- Returns:
- the anonymous style declaration.
-
createInlineStyle
Description copied from class:AbstractCSSStyleSheetFactory
Create an inline style.- Specified by:
createInlineStyle
in classAbstractCSSStyleSheetFactory
- Parameters:
owner
- the style's owner node (an attribute node).- Returns:
- the inline style.
-
createEntityResolver
-