Interface CSSComputedProperties

All Superinterfaces:
org.w3c.dom.css.CSS2Properties, CSSStyleDeclaration, NodeStyleDeclaration
All Known Implementing Classes:
ComputedCSSStyle, DOMComputedStyle

public interface CSSComputedProperties extends org.w3c.dom.css.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 Summary

    Modifier and Type
    Method
    Description
    Gets the computed value(s) for the 'background-image' property.
    getBoxValues(short unitType)
    Get the box values from a simple box model.
    float
    Gets the computed value of the font-size property.
    float
    Gets the computed line height with the default 'normal' value of 1.16em.
    Gets the primitive, computed value for the 'background-color' property.
    Gets the primitive, computed value for the 'color' property.
    Gets the computed font weight.
    Gets the owner/peer node.
    Gets the computed style for the parent element.
    Retrieves the computed object representation of the value of a CSS property.
    getPropertyValue(String propertyName)
    Retrieves the String value of a CSS property.
    Gets the style database used to compute the style.
    Gets the 'used' value for the font-family property.

    Methods inherited from interface org.w3c.dom.css.CSS2Properties

    getAzimuth, getBackground, getBackgroundAttachment, getBackgroundColor, getBackgroundImage, getBackgroundPosition, getBackgroundRepeat, getBorder, getBorderBottom, getBorderBottomColor, getBorderBottomStyle, getBorderBottomWidth, getBorderCollapse, getBorderColor, getBorderLeft, getBorderLeftColor, getBorderLeftStyle, getBorderLeftWidth, getBorderRight, getBorderRightColor, getBorderRightStyle, getBorderRightWidth, getBorderSpacing, getBorderStyle, getBorderTop, getBorderTopColor, getBorderTopStyle, getBorderTopWidth, getBorderWidth, getBottom, getCaptionSide, getClear, getClip, getColor, getContent, getCounterIncrement, getCounterReset, getCssFloat, getCue, getCueAfter, getCueBefore, getCursor, getDirection, getDisplay, getElevation, getEmptyCells, getFont, getFontFamily, getFontSize, getFontSizeAdjust, getFontStretch, getFontStyle, getFontVariant, getHeight, getLeft, getLetterSpacing, getLineHeight, getListStyle, getListStyleImage, getListStylePosition, getListStyleType, getMargin, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getMarkerOffset, getMarks, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOrphans, getOutline, getOutlineColor, getOutlineStyle, getOutlineWidth, getOverflow, getPadding, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getPage, getPageBreakAfter, getPageBreakBefore, getPageBreakInside, getPause, getPauseAfter, getPauseBefore, getPitch, getPitchRange, getPlayDuring, getPosition, getQuotes, getRichness, getRight, getSize, getSpeak, getSpeakHeader, getSpeakNumeral, getSpeakPunctuation, getSpeechRate, getStress, getTableLayout, getTextAlign, getTextDecoration, getTextIndent, getTextShadow, getTextTransform, getTop, getUnicodeBidi, getVerticalAlign, getVisibility, getVoiceFamily, getVolume, getWhiteSpace, getWidows, getWidth, getWordSpacing, getZIndex, setAzimuth, setBackground, setBackgroundAttachment, setBackgroundColor, setBackgroundImage, setBackgroundPosition, setBackgroundRepeat, setBorder, setBorderBottom, setBorderBottomColor, setBorderBottomStyle, setBorderBottomWidth, setBorderCollapse, setBorderColor, setBorderLeft, setBorderLeftColor, setBorderLeftStyle, setBorderLeftWidth, setBorderRight, setBorderRightColor, setBorderRightStyle, setBorderRightWidth, setBorderSpacing, setBorderStyle, setBorderTop, setBorderTopColor, setBorderTopStyle, setBorderTopWidth, setBorderWidth, setBottom, setCaptionSide, setClear, setClip, setColor, setContent, setCounterIncrement, setCounterReset, setCssFloat, setCue, setCueAfter, setCueBefore, setCursor, setDirection, setDisplay, setElevation, setEmptyCells, setFont, setFontFamily, setFontSize, setFontSizeAdjust, setFontStretch, setFontStyle, setFontVariant, setFontWeight, setHeight, setLeft, setLetterSpacing, setLineHeight, setListStyle, setListStyleImage, setListStylePosition, setListStyleType, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setMarkerOffset, setMarks, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setOrphans, setOutline, setOutlineColor, setOutlineStyle, setOutlineWidth, setOverflow, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setPage, setPageBreakAfter, setPageBreakBefore, setPageBreakInside, setPause, setPauseAfter, setPauseBefore, setPitch, setPitchRange, setPlayDuring, setPosition, setQuotes, setRichness, setRight, setSize, setSpeak, setSpeakHeader, setSpeakNumeral, setSpeakPunctuation, setSpeechRate, setStress, setTableLayout, setTextAlign, setTextDecoration, setTextIndent, setTextShadow, setTextTransform, setTop, setUnicodeBidi, setVerticalAlign, setVisibility, setVoiceFamily, setVolume, setWhiteSpace, setWidows, setWidth, setWordSpacing, setZIndex
  • 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 org.w3c.dom.css.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.