Class StyleReference

java.lang.Object
org.xhtmlrenderer.context.StyleReference

public class StyleReference extends Object
  • Field Details

    • _nsh

      private @Nullable NamespaceHandler _nsh
    • _doc

      private @Nullable Document _doc
    • _stylesheetFactory

      private final StylesheetFactoryImpl _stylesheetFactory
    • _matcher

      private @Nullable Matcher _matcher
      Instance of our element-styles matching class. Will be null if new rules have been added since last match.
    • _uac

      private UserAgentCallback _uac
  • Constructor Details

  • Method Details

    • setDocumentContext

      public void setDocumentContext(SharedContext context, NamespaceHandler nsh, Document doc, UserInterface ui)
      Sets the documentContext attribute of the StyleReference object
      Parameters:
      context - The Context this StyleReference operates in; used for property resolution.
      nsh - The new documentContext value
      doc - The new documentContext value
      ui - The new documentContext value
    • readAndParseAll

      private List<Stylesheet> readAndParseAll(List<StylesheetInfo> infos, String medium)
    • isHoverStyled

      public boolean isHoverStyled(Element e)
    • getCascadedPropertiesMap

      public Map<String,CSSPrimitiveValue> getCascadedPropertiesMap(Element e)
      Returns a Map keyed by CSS property names (e.g. 'border-width'), and the assigned value as a SAC CSSValue instance. The properties should have been matched to the element when the Context was established for this StyleReference on the Document to which the Element belongs. See BasicPanel.setDocument(Document, String) for an example of how to establish a StyleReference and associate to a Document.
      Parameters:
      e - The DOM Element for which to find properties
      Returns:
      Map of CSS property names to CSSValue instance assigned to it.
    • getPseudoElementStyle

      public @Nullable CascadedStyle getPseudoElementStyle(Node node, String pseudoElement)
      Gets the pseudoElementStyle attribute of the StyleReference object
    • getCascadedStyle

      public CascadedStyle getCascadedStyle(@Nullable Element e, boolean restyle)
      Gets the CascadedStyle for an element. This must then be converted in the current context to a CalculatedStyle (use getDerivedStyle)
    • getPageStyle

      @CheckReturnValue public @NonNull PageInfo getPageStyle(@Nullable String pageName, String pseudoPage)
    • flushStyleSheets

      public void flushStyleSheets()
      Flushes any stylesheet associated with this style reference (based on the user agent callback) that are in cache.
    • flushAllStyleSheets

      public void flushAllStyleSheets()
    • getStylesheets

      private List<StylesheetInfo> getStylesheets()
      Gets StylesheetInfos for all stylesheets and inline styles associated with the current document. Default (user agent) stylesheet and the inline style for the current media are loaded and cached in the StyleSheetFactory by URI.
      Returns:
      The stylesheets value
    • removeStyle

      public void removeStyle(Element e)
    • getFontFaceRules

      public List<FontFaceRule> getFontFaceRules()
    • setUserAgentCallback

      public void setUserAgentCallback(UserAgentCallback userAgentCallback)
    • setSupportCMYKColors

      public void setSupportCMYKColors(boolean b)