Class CascadedStyle

java.lang.Object
com.openhtmltopdf.css.newmatch.CascadedStyle

public class CascadedStyle extends Object
Holds a set of PropertyDeclarations for each unique CSS property name. What properties belong in the set is not determined, except that multiple entries are resolved into a single set using cascading rules. The set is cascaded during instantiation, so once you have a CascadedStyle, the PropertyDeclarations you retrieve from it will have been resolved following the CSS cascading rules. Note that this class knows nothing about CSS selector-matching rules. Before creating a CascadedStyle, you will need to determine which PropertyDeclarations belong in the set--for example, by matching Rulesets to Document Elements via their selectors. You can get individual properties by using propertyByName(CSSName) or an Iterator of properties with getCascadedPropertyDeclarations(). Check for individual property assignments using hasProperty(CSSName). A CascadedStyle is immutable, as properties can not be added or removed from it once instantiated.
  • Field Details

    • cascadedProperties

      private final Map<CSSName,PropertyDeclaration> cascadedProperties
      Map of PropertyDeclarations, keyed by CSSName
    • fingerprint

      private String fingerprint
    • emptyCascadedStyle

      public static final CascadedStyle emptyCascadedStyle
      Get an empty singleton, used to negate inheritance of properties
  • Constructor Details

    • CascadedStyle

      CascadedStyle(Iterator<PropertyDeclaration> iter)
      Constructs a new CascadedStyle, given an Iterator of PropertyDeclarations already sorted by specificity of the CSS selector they came from. The Iterator can have multiple PropertyDeclarations with the same name; the property cascade will be resolved during instantiation, resulting in a set of PropertyDeclarations. Once instantiated, properties may be retrieved using the normal API for the class.
      Parameters:
      iter - An Iterator containing PropertyDeclarations in order of specificity.
    • CascadedStyle

      private CascadedStyle(CascadedStyle startingPoint, Iterator<PropertyDeclaration> props)
    • CascadedStyle

      private CascadedStyle()
      Default constructor with no initialization. Don't use this to instantiate the class, as the class is immutable and this will leave it without any properties.
  • Method Details