- All Superinterfaces:
CSS2Properties
,CSSStyleDeclaration
,ExtendedCSSStyleDeclaration
,NodeStyleDeclaration
- All Known Implementing Classes:
ComputedCSSStyle
,DOMComputedStyle
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 TypeMethodDescriptionString[]
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.getPropertyCSSValue
(String propertyName) 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
Methods inherited from interface org.w3c.dom.css.CSSStyleDeclaration
getCssText, getLength, getPropertyPriority, item, removeProperty, setCssText, setProperty
Methods inherited from interface io.sf.carte.doc.style.css.ExtendedCSSStyleDeclaration
getMinifiedCssText, getParentRule, writeCssText
-
Method Details
-
getPropertyCSSValue
Retrieves the computed object representation of the value of a CSS property. This method returnsnull
if the property is a shorthand property.- Specified by:
getPropertyCSSValue
in interfaceCSSStyleDeclaration
- Specified by:
getPropertyCSSValue
in interfaceExtendedCSSStyleDeclaration
- Parameters:
propertyName
- The name of the CSS property.- Returns:
- the object value of the property.
-
getPropertyValue
Retrieves the String value of a CSS property.- Specified by:
getPropertyValue
in interfaceCSSStyleDeclaration
- Specified by:
getPropertyValue
in interfaceExtendedCSSStyleDeclaration
- 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
ExtendedCSSPrimitiveValue getCSSColor()Gets the primitive, computed value for the 'color' property.- Returns:
- the value for the 'color' property.
-
getCSSBackgroundColor
ExtendedCSSPrimitiveValue 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 interfaceCSS2Properties
- 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
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 interfaceNodeStyleDeclaration
- 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.
-