Class AbstractCSSStyleSheetFactory

java.lang.Object
io.sf.carte.doc.style.css.om.AbstractCSSStyleSheetFactory
All Implemented Interfaces:
CSSStyleSheetFactory
Direct Known Subclasses:
BaseCSSStyleSheetFactory

public abstract class AbstractCSSStyleSheetFactory extends Object implements CSSStyleSheetFactory
Abstract class for CSS style sheet factories.
  • Field Details

  • Constructor Details

    • AbstractCSSStyleSheetFactory

      public AbstractCSSStyleSheetFactory()
  • Method Details

    • createInlineStyle

      protected abstract InlineStyle createInlineStyle(Node owner)
      Create an inline style.
      Parameters:
      owner - the style's owner node (an attribute node).
      Returns:
      the inline style.
    • createStyleSheet

      public abstract AbstractCSSStyleSheet createStyleSheet(String title, MediaQueryList media)
      Description copied from interface: CSSStyleSheetFactory
      Creates a stand-alone author style sheet.

      Specified by:
      createStyleSheet in interface CSSStyleSheetFactory
      Parameters:
      title - the advisory title.
      media - the target media for style.
      Returns:
      the style sheet.
    • createRuleStyleSheet

      protected abstract AbstractCSSStyleSheet createRuleStyleSheet(AbstractCSSRule ownerRule, String title, MediaQueryList mediaList)
      Creates a CSS style sheet owned by a CSS rule.

      Parameters:
      ownerRule - the owner rule.
      title - the advisory title.
      mediaList - the list of target media for style.
      Returns:
      the style sheet.
    • createLinkedStyleSheet

      protected abstract AbstractCSSStyleSheet createLinkedStyleSheet(Node ownerNode, String title, MediaQueryList mediaList)
      Creates an author (document-linked) CSS style sheet.

      Parameters:
      ownerNode - the node that associates the style sheet to the document. In HTML it can be a link or style element. For style sheets that are included by other style sheets, the value of this parameter is null.
      title - the advisory title.
      mediaList - the target media list for style.
      Returns:
      the style sheet.
    • createAnonymousStyleDeclaration

      public abstract AbstractCSSStyleDeclaration createAnonymousStyleDeclaration(Node node)
      Description copied from interface: CSSStyleSheetFactory
      Create a style declaration for an anonymous inline box, associated to a text/cdata node.
      Specified by:
      createAnonymousStyleDeclaration in interface CSSStyleSheetFactory
      Parameters:
      node - the node that has the declaration associated to it.
      Returns:
      the anonymous style declaration.
    • getSystemDefaultValue

      public abstract PrimitiveValue getSystemDefaultValue(String propertyName)
      Description copied from interface: CSSStyleSheetFactory
      Get a system default value for the given property.

      If the lenientSystemValues flag is true, returns a reasonable default for the property. Otherwise, it returns a system default meta-value.

      Specified by:
      getSystemDefaultValue in interface CSSStyleSheetFactory
      Parameters:
      propertyName - the property name.
      Returns:
      the system default css primitive value.
    • createSACParser

      protected abstract Parser createSACParser() throws DOMException
      Create a SAC Parser specified by the system property org.w3c.css.sac.parser.

      If that property is not set, the instantiation of a default parser will be attempted.

      If the parser is NSAC 1.1 compliant, the NSAC flags will be enabled.

      Returns:
      the SAC parser.
      Throws:
      DOMException - NOT_SUPPORTED_ERR if the Parser could not be instantiated.
    • getParserFlags

      protected abstract EnumSet<Parser2.Flag> getParserFlags()
      Get the parser flags that should be used by NSAC parsers.
      Returns:
      the NSAC parser flags.
    • hasCompatValueFlags

      protected abstract boolean hasCompatValueFlags()
      Check for compat value flags.
      Returns:
      true if the factory has compat value flags set.
    • getValueFactory

      protected abstract ValueFactory getValueFactory()
      Get a value factory set to the appropriate flags.
      Returns:
      the value factory.
    • getUserImportantStyleSheet

      protected abstract AbstractCSSStyleSheet getUserImportantStyleSheet()
      Get the priority-important part of the user style sheet, i.e. the style sheet with the declarations of important priority.
      Returns:
      the important part of the user style sheet.
    • getUserNormalStyleSheet

      protected abstract AbstractCSSStyleSheet getUserNormalStyleSheet()
      Get the normal part of the user style sheet, i.e. the style sheet with the declarations of normal priority.
      Returns:
      the normal part of the user style sheet.
    • setDefaultHTMLUserAgentSheet

      public abstract void setDefaultHTMLUserAgentSheet()
      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 interface CSSStyleSheetFactory
    • getDefaultStyleSheet

      protected abstract DocumentCSSStyleSheet getDefaultStyleSheet(CSSDocument.ComplianceMode mode)
      Get the style sheet resulting from the merge of the user agent sheet and the non-important part of the user style sheet.
      Parameters:
      mode - the compliance mode.
      Returns:
      the default style sheet at the top of the cascade.