Interface CSSComputedProperties

All Superinterfaces:
CSS2Properties, CSSStyleDeclaration, NodeStyleDeclaration
All Known Implementing Classes:
ComputedCSSStyle, DOMComputedStyle

public interface CSSComputedProperties extends CSS2Properties, NodeStyleDeclaration
Interface that allows the retrieval of the primitive, "computed" values of CSS properties.

A few convenience methods have been added to handle specific properties.

  • Method Details

    • getPropertyCSSValue

      CSSValue getPropertyCSSValue(String propertyName)
      Retrieves the computed object representation of the value of a CSS property.
      Specified by:
      getPropertyCSSValue in interface CSSStyleDeclaration
      Parameters:
      propertyName - The name of the CSS property.
      Returns:
      the object value of the property, or null if the property is a shorthand property.
    • getPropertyValue

      String getPropertyValue(String propertyName)
      Retrieves the String value of a CSS property.
      Specified by:
      getPropertyValue in interface CSSStyleDeclaration
      Parameters:
      propertyName - The name of the CSS property. See the CSS property index.
      Returns:
      the value of the property, or the empty string if the property is not known or is a shorthand that could not be serialized.
    • getCSSColor

      CSSTypedValue getCSSColor()
      Gets the primitive, computed value for the 'color' property.
      Returns:
      the value for the 'color' property.
    • getCSSBackgroundColor

      CSSTypedValue getCSSBackgroundColor()
      Gets the primitive, computed value for the 'background-color' property.
      Returns:
      the value for the 'background-color' property.
    • getBackgroundImages

      String[] getBackgroundImages()
      Gets the computed value(s) for the 'background-image' property.
      Returns:
      an array with the values for the layered 'background-image' property, or null if no background image was set for the element.
    • getUsedFontFamily

      String getUsedFontFamily()
      Gets the 'used' value for the font-family property.

      This method requires a style database.

      Returns:
      the value of the font-family property.
      Throws:
      IllegalStateException - if the style database has not been set.
    • getFontWeight

      String getFontWeight()
      Gets the computed font weight.
      Specified by:
      getFontWeight in interface CSS2Properties
      Returns:
      the font weight.
    • getComputedFontSize

      float getComputedFontSize()
      Gets the computed value of the font-size property.

      May require a style database to give accurate results.

      Returns:
      the value of the font-size property, in typographic points.
    • getComputedLineHeight

      float getComputedLineHeight()
      Gets the computed line height with the default 'normal' value of 1.16em.
      Returns:
      the default computed line height, in typographic points.
    • getBoxValues

      BoxValues getBoxValues(short unitType) throws DOMException, StyleDatabaseRequiredException
      Get the box values from a simple box model.
      Parameters:
      unitType - the desired unit type.
      Returns:
      the box values, in the specified unit.
      Throws:
      DOMException - if the document contains features that are not supported by the simple model.
      StyleDatabaseRequiredException - when a computation that requires a style database is attempted, but no style database has been set.
    • getOwnerNode

      CSSElement getOwnerNode()
      Gets the owner/peer node.
      Specified by:
      getOwnerNode in interface NodeStyleDeclaration
      Returns:
      the owner node.
    • getParentComputedStyle

      CSSComputedProperties getParentComputedStyle()
      Gets the computed style for the parent element.
      Returns:
      the computed style for the parent element, or null if there is no parent element.
    • getStyleDatabase

      StyleDatabase getStyleDatabase()
      Gets the style database used to compute the style.
      Returns:
      the style database.