Class ComputedCSSStyle
- All Implemented Interfaces:
CSSComputedProperties
,CSSStyleDeclaration
,NodeStyleDeclaration
,Serializable
,Cloneable
,org.w3c.dom.css.CSS2Properties
- Direct Known Subclasses:
DOMComputedStyle
See section 6.1 of the Document Object Model CSS spec.
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
ComputedCSSStyle
(BaseDocumentCSSStyleSheet docSheet) protected
ComputedCSSStyle
(ComputedCSSStyle copiedObject) -
Method Summary
Modifier and TypeMethodDescriptionabstract ComputedCSSStyle
clone()
String[]
Gets the computed value(s) for the 'background-image' property.getBoxValues
(short unitType) Get the box values from a simple box model.getCascadedValue
(String property) float
Gets the computed value of the font-size property.float
Gets the computed line height with the default 'normal' value of 1.16em.float
getComputedLineHeight
(float defval) Gets the computed line height, in typographic points.Gets the primitive, computed value for the 'background-color' property.Gets the primitive, computed value for the 'color' property.Retrieves the parsable textual representation of the declaration block (excluding the surrounding curly braces).getCSSValue
(String property) Gets the absolute, primitive "computed" value for the given property.protected TypedValue
protected String
getHref
(CSSTypedValue cssVal, String baseHref) Attempts to get the absolute Href from the string value of a (uri) property.Retrieves a minified textual representation of the declaration block (excluding the surrounding curly braces).The node that owns this declaration.protected BaseDocumentCSSStyleSheet
abstract ComputedCSSStyle
Gets the computed style for the parent element.getPropertyValue
(String propertyName) Gets the text value of a CSS property if it has been explicitly set within this declaration block.getRevertStyle
(Condition pseudoElt) Get the error handler for this style declaration.getText()
Gets the (whitespace-trimmed) text content of the node associated to this style.Gets the used value of the font-family property.protected void
setOwnerNode
(CSSElement node) protected void
setPropertyCSSValue
(String propertyName, StyleValue value, String hrefcontext) void
writeCssText
(io.sf.carte.util.SimpleWriter wri, StyleFormattingContext context) Writes a textual representation of the declaration block (excluding the surrounding curly braces) to aSimpleWriter
, and according to aStyleFormattingContext
.Methods inherited from class io.sf.carte.doc.style.css.om.BaseCSSStyleDeclaration
addOverrideProperty, addProperty, addStyle, appendLonghandMinifiedCssText, appendShorthandMinifiedCssText, compatLonghand, computeBoundProperty, diff, equals, 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, getDeclaredCSSValue, getDirection, getDisplay, getElevation, getEmptyCells, getFont, getFontFamily, getFontSize, getFontSizeAdjust, getFontStretch, getFontStyle, getFontVariant, getFontWeight, getHeight, getLeft, getLength, 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, getParentRule, getPause, getPauseAfter, getPauseBefore, getPitch, getPitchRange, getPlayDuring, getPosition, getPropertyCSSValue, getPropertyPriority, getQuotes, getRichness, getRight, getSize, getSpeak, getSpeakHeader, getSpeakNumeral, getSpeakPunctuation, getSpeechRate, getStress, getStyleDatabase, getStyleSheetFactory, getTableLayout, getTextAlign, getTextDecoration, getTextIndent, getTextShadow, getTextTransform, getTop, getUnicodeBidi, getValueFactory, getVerticalAlign, getVisibility, getVoiceFamily, getVolume, getWhiteSpace, getWidows, getWidth, getWordSpacing, getZIndex, hashCode, isEmpty, item, prioritySplit, removeProperty, 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, setCssText, setCue, setCueAfter, setCueBefore, setCursor, setDirection, setDisplay, setElevation, setEmptyCells, setFont, setFontFamily, setFontSize, setFontSizeAdjust, setFontStretch, setFontStyle, setFontVariant, setFontWeight, setHeight, setLeft, setLetterSpacing, setLexicalProperty, setLineHeight, setListStyle, setListStyleImage, setListStylePosition, setListStyleType, setLonghandProperty, 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, setProperty, setProperty, 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, shorthandError, testColor, toString, writeLonghandCssText, writeShorthandCssText
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
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 io.sf.carte.doc.style.css.CSSComputedProperties
getFontWeight, getPropertyCSSValue, getStyleDatabase
Methods inherited from interface io.sf.carte.doc.style.css.CSSStyleDeclaration
getLength, getParentRule, getPropertyPriority, item, removeProperty, setCssText, setProperty
-
Constructor Details
-
ComputedCSSStyle
-
ComputedCSSStyle
-
-
Method Details
-
setOwnerNode
-
getOwnerNode
Description copied from class:BaseCSSStyleDeclaration
The node that owns this declaration.For computed styles, the owner is always the element for which the style was computed.
- Specified by:
getOwnerNode
in interfaceCSSComputedProperties
- Specified by:
getOwnerNode
in interfaceNodeStyleDeclaration
- Overrides:
getOwnerNode
in classBaseCSSStyleDeclaration
- Returns:
- the node that owns this declaration, or null if none.
-
getOwnerSheet
-
getStyleDeclarationErrorHandler
Description copied from class:AbstractCSSStyleDeclaration
Get the error handler for this style declaration.- Overrides:
getStyleDeclarationErrorHandler
in classBaseCSSStyleDeclaration
- Returns:
- the error handler, or
null
if this is an anonymous style declaration.
-
getPropertyValue
Description copied from interface:CSSStyleDeclaration
Gets the text value of a CSS property if it has been explicitly set within this declaration block.If the declaration was created by a factory with the
IEVALUES
flag enabled, the compatibility values shall appear in the cssText serializations, but its value won't be returned by this method unless no other valid value was previously specified for the property.- Specified by:
getPropertyValue
in interfaceCSSComputedProperties
- Specified by:
getPropertyValue
in interfaceCSSStyleDeclaration
- Overrides:
getPropertyValue
in classBaseCSSStyleDeclaration
- Parameters:
propertyName
- The name of the CSS property.- Returns:
- the value of the property if it has been explicitly set for this declaration block, or the empty string if the property has not been set or is a shorthand that could not be serialized.
-
setPropertyCSSValue
- Overrides:
setPropertyCSSValue
in classBaseCSSStyleDeclaration
-
getCascadedValue
- Throws:
StyleDatabaseRequiredException
-
getCSSValue
Gets the absolute, primitive "computed" value for the given property.The rendering context is not taken into account for this method.
See paragraph 6.1.2 of the Document Object Model CSS specification for the definition of "computed" values.
- Overrides:
getCSSValue
in classBaseCSSStyleDeclaration
- Parameters:
property
- the property that we want to evaluate.- Returns:
- the primitive value of the property, a CSSShorthandValue if the property is a shorthand, or null if the property is not known.
- Throws:
StyleDatabaseRequiredException
- when a computation that requires a style database is attempted, but no style database has been set.
-
getComputedFontSize
public float getComputedFontSize()Gets the computed value of the font-size property.May require a style database to give accurate results.
- Specified by:
getComputedFontSize
in interfaceCSSComputedProperties
- Returns:
- the value of the font-size property, in typographic points.
-
getComputedLineHeight
public float getComputedLineHeight()Gets the computed line height with the default 'normal' value of 1.16em.- Specified by:
getComputedLineHeight
in interfaceCSSComputedProperties
- Returns:
- the default computed line height, in typographic points.
-
getComputedLineHeight
public float getComputedLineHeight(float defval) Gets the computed line height, in typographic points.- Parameters:
defval
- the default value in EMs.- Returns:
- the computed line height, or the default value if the computed value could not be found.
-
getCurrentColor
- Overrides:
getCurrentColor
in classBaseCSSStyleDeclaration
-
getCSSColor
Description copied from interface:CSSComputedProperties
Gets the primitive, computed value for the 'color' property.- Specified by:
getCSSColor
in interfaceCSSComputedProperties
- Overrides:
getCSSColor
in classBaseCSSStyleDeclaration
- Returns:
- the value for the 'color' property.
-
getCSSBackgroundColor
Description copied from interface:CSSComputedProperties
Gets the primitive, computed value for the 'background-color' property.- Specified by:
getCSSBackgroundColor
in interfaceCSSComputedProperties
- Returns:
- the value for the 'background-color' property.
-
getBackgroundImages
Description copied from interface:CSSComputedProperties
Gets the computed value(s) for the 'background-image' property.- Specified by:
getBackgroundImages
in interfaceCSSComputedProperties
- Returns:
- an array with the values for the layered 'background-image' property, or null if no background image was set for the element.
-
getHref
Attempts to get the absolute Href from the string value of a (uri) property.- Parameters:
cssVal
- the uri value.baseHref
- the base href context.- Returns:
- the base URL, or null if could not be determined.
-
getUsedFontFamily
Gets the used value of the font-family property.If the computed value is a list, it returns the first item. If a style database is available, it returns the 'used' value.
If no font family is set, a default value of
Serif
is used.- Specified by:
getUsedFontFamily
in interfaceCSSComputedProperties
- Returns:
- the value of the font-family property.
-
getBoxValues
Get the box values from a simple box model.- Specified by:
getBoxValues
in interfaceCSSComputedProperties
- 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.
-
getCssText
Description copied from class:BaseCSSStyleDeclaration
Retrieves the parsable textual representation of the declaration block (excluding the surrounding curly braces).- Specified by:
getCssText
in interfaceCSSStyleDeclaration
- Overrides:
getCssText
in classBaseCSSStyleDeclaration
- Returns:
- the textual representation of the declaration block.
-
writeCssText
public void writeCssText(io.sf.carte.util.SimpleWriter wri, StyleFormattingContext context) throws IOException Description copied from class:AbstractCSSStyleDeclaration
Writes a textual representation of the declaration block (excluding the surrounding curly braces) to aSimpleWriter
, and according to aStyleFormattingContext
.- Specified by:
writeCssText
in interfaceCSSStyleDeclaration
- Overrides:
writeCssText
in classBaseCSSStyleDeclaration
- Parameters:
wri
- the simple writer to write to.context
- the style formatting context.- Throws:
IOException
- if a problem occurs while writing the text.
-
getMinifiedCssText
Description copied from class:AbstractCSSStyleDeclaration
Retrieves a minified textual representation of the declaration block (excluding the surrounding curly braces).- Specified by:
getMinifiedCssText
in interfaceCSSStyleDeclaration
- Overrides:
getMinifiedCssText
in classBaseCSSStyleDeclaration
- Returns:
- the minified representation of this style declaration.
-
getRevertStyle
-
getParentComputedStyle
Gets the computed style for the parent element.- Specified by:
getParentComputedStyle
in interfaceCSSComputedProperties
- Returns:
- the computed style for the parent element, or null if there is no parent element, or has no style associated.
-
getText
Gets the (whitespace-trimmed) text content of the node associated to this style.- Returns:
- the text content, or the empty string if the box has no text.
-
clone
- Overrides:
clone
in classBaseCSSStyleDeclaration
-