public class ComputedCssStyleDeclaration extends AbstractCssStyleDeclaration
Window.getComputedStyle(Object, String),
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static String |
EMPTY_FINAL
Denotes a value which should be returned as is.
|
| Constructor and Description |
|---|
ComputedCssStyleDeclaration(ElementCssStyleDeclaration styleDeclaration)
Ctor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyStyleFromSelector(org.htmlunit.cssparser.dom.CSSStyleDeclarationImpl declaration,
org.htmlunit.cssparser.parser.selector.Selector selector)
Makes a local, "computed", modification to this CSS style.
|
String |
getBackgroundAttachment()
Gets the
backgroundAttachment style attribute. |
String |
getBackgroundColor()
Gets the
backgroundColor style attribute. |
String |
getBackgroundImage()
Gets the
backgroundImage style attribute. |
String |
getBackgroundPosition()
Gets the
backgroundPosition style attribute. |
String |
getBackgroundRepeat()
Gets the
backgroundRepeat style attribute. |
String |
getBlockSize()
Gets the
blockSize style attribute. |
String |
getBorderBottomColor()
Gets the
borderBottomColor style attribute. |
String |
getBorderBottomStyle()
Gets the
borderBottomStyle style attribute. |
int |
getBorderBottomValue()
Gets the size of the bottom border of the element.
|
String |
getBorderBottomWidth()
Gets the
borderBottomWidth style attribute. |
String |
getBorderLeftColor()
Gets the
borderLeftColor style attribute. |
String |
getBorderLeftStyle()
Gets the
borderLeftStyle style attribute. |
int |
getBorderLeftValue()
Gets the size of the left border of the element.
|
String |
getBorderLeftWidth()
Gets the
borderLeftWidth style attribute. |
String |
getBorderRightColor()
Gets the
borderRightColor style attribute. |
String |
getBorderRightStyle()
Gets the
borderRightStyle style attribute. |
int |
getBorderRightValue()
Gets the size of the right border of the element.
|
String |
getBorderRightWidth()
Gets the
borderRightWidth style attribute. |
String |
getBorderTopColor()
Gets the
borderTopColor style attribute. |
String |
getBorderTopStyle()
Gets the
borderTopStyle style attribute. |
int |
getBorderTopValue()
Gets the size of the top border of the element.
|
String |
getBorderTopWidth()
Gets the
borderTopWidth style attribute. |
String |
getBottom()
Gets the
bottom style attribute. |
String |
getBottomWithInheritance()
Returns the CSS
bottom attribute, replacing inherited values with the actual parent values. |
BrowserVersion |
getBrowserVersion() |
Integer |
getCachedBorderHorizontal()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
Integer |
getCachedBorderVertical()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
Integer |
getCachedEmptyHeight()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
Integer |
getCachedHeight()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
Integer |
getCachedPaddingHorizontal()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
Integer |
getCachedPaddingVertical()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
Integer |
getCachedTop()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
Integer |
getCachedWidth()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
int |
getCalculatedHeight(boolean includeBorder,
boolean includePadding)
Returns the element's height, possibly including its padding and border.
|
int |
getCalculatedWidth(boolean includeBorder,
boolean includePadding)
Returns the element's width in pixels, possibly including its padding and border.
|
String |
getColor()
Gets the
color style attribute. |
int |
getContentHeight()
Returns the total height of the element's children.
|
int |
getContentWidth()
Returns the total width of the element's children.
|
String |
getCssFloat()
Gets the
cssFloat style attribute. |
String |
getCssText()
Returns the actual text of the style.
|
String |
getDisplay()
Gets the
display style attribute. |
DomElement |
getDomElement() |
String |
getFont()
Gets the
font style attribute. |
String |
getFontFamily()
Gets the
fontFamily style attribute. |
String |
getFontSize()
Gets the
fontSize style attribute. |
String |
getHeight()
Gets the
height style attribute. |
String |
getLeft() |
int |
getLeft(boolean includeMargin,
boolean includeBorder,
boolean includePadding)
Returns the computed left (X coordinate), relative to the node's parent's left edge.
|
String |
getLeftWithInheritance()
Returns the CSS
left attribute, replacing inherited values with the actual parent values. |
int |
getLength()
Returns the
length property. |
String |
getLetterSpacing() |
String |
getLineHeight() |
String |
getMargin() |
String |
getMarginBottom()
Gets the
marginBottom style attribute. |
int |
getMarginBottomValue()
Gets the bottom margin of the element.
|
String |
getMarginLeft()
Gets the
marginLeft style attribute. |
int |
getMarginLeftValue()
Gets the left margin of the element.
|
String |
getMarginRight()
Gets the
marginRight style attribute. |
int |
getMarginRightValue()
Gets the right margin of the element.
|
String |
getMarginTop()
Gets the
marginTop style attribute. |
int |
getMarginTopValue()
Gets the top margin of the element.
|
String |
getMaxHeight() |
String |
getMaxWidth() |
String |
getMinHeight() |
String |
getMinWidth() |
String |
getOpacity()
Gets the
opacity style attribute. |
String |
getOrphans() |
String |
getOutlineWidth() |
String |
getPadding() |
String |
getPaddingBottom() |
int |
getPaddingBottomValue()
Gets the bottom padding of the element.
|
String |
getPaddingLeft() |
int |
getPaddingLeftValue()
Gets the left padding of the element.
|
String |
getPaddingRight() |
int |
getPaddingRightValue()
Gets the right padding of the element.
|
String |
getPaddingTop() |
int |
getPaddingTopValue()
Gets the top padding of the element.
|
org.htmlunit.cssparser.dom.AbstractCSSRuleImpl |
getParentRule()
Returns the CSSRule that is the parent of this style block or
null if this CSSStyleDeclaration is
not attached to a CSSRule. |
String |
getPosition() |
String |
getPositionWithInheritance()
Returns the CSS
position attribute, replacing inherited values with the actual parent values. |
String |
getRight() |
String |
getRightWithInheritance()
Returns the CSS
right attribute, replacing inherited values with the actual parent values. |
String |
getStyleAttribute(String name)
Get the value for the style attribute.
|
String |
getStyleAttribute(StyleAttributes.Definition definition,
boolean getDefaultValueIfEmpty)
Get the value for the style attribute.
|
StyleElement |
getStyleElement(String name)
Determines the StyleElement for the given name.
|
StyleElement |
getStyleElementCaseInSensitive(String name)
Determines the StyleElement for the given name.
|
Map<String,StyleElement> |
getStyleMap()
Returns a sorted map containing style elements, keyed on style element name.
|
String |
getStylePriority(String name)
Returns the priority of the named style attribute, or an empty string if it is not found.
|
String |
getTextIndent() |
String |
getTop() |
int |
getTop(boolean includeMargin,
boolean includeBorder,
boolean includePadding)
Returns the computed top (Y coordinate), relative to the node's parent's top edge.
|
String |
getTopWithInheritance()
Returns the CSS
top attribute, replacing inherited values with the actual parent values. |
String |
getVerticalAlign() |
String |
getWidows() |
String |
getWidth() |
String |
getWordSpacing() |
String |
getZIndex()
Gets the
zIndex style attribute. |
boolean |
hasFeature(BrowserVersionFeatures property)
Indicates if the browser this is associated with has the feature.
|
boolean |
isComputed() |
boolean |
isScrollable(boolean horizontal)
Returns
true if the element is scrollable along the specified axis. |
String |
item(int index) |
String |
removeStyleAttribute(String name)
Removes the specified style attribute, returning the value of the removed attribute.
|
void |
setCachedTop(Integer top)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
void |
setCssText(String value)
Sets the actual text of the style.
|
void |
setDefaultLocalStyleAttribute(String name,
String newValue)
Makes a local, "computed", modification to this CSS style that won't override other
style attributes of the same name.
|
void |
setStyleAttribute(String name,
String newValue,
String important)
Sets the specified style attribute.
|
String |
toString() |
int |
updateCachedBorderHorizontal(int borderHorizontal)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
int |
updateCachedBorderVertical(int borderVertical)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
int |
updateCachedEmptyHeight(int emptyHeight)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
int |
updateCachedHeight(int height)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
int |
updateCachedPaddingHorizontal(int paddingHorizontal)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
int |
updateCachedPaddingVertical(int paddingVertical)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
int |
updateCachedWidth(int width)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
getBorderTop, getOutline, getRubyAlign, getSize, getStyleAttributepublic static final String EMPTY_FINAL
public ComputedCssStyleDeclaration(ElementCssStyleDeclaration styleDeclaration)
styleDeclaration - the ElementCssStyleDeclaration this is based onpublic String getStylePriority(String name)
getStylePriority in class AbstractCssStyleDeclarationname - the name of the style attribute whose value is to be retrievedpublic String getCssText()
getCssText in class AbstractCssStyleDeclarationpublic String getStyleAttribute(String name)
getStyleAttribute in class AbstractCssStyleDeclarationname - the namepublic String getStyleAttribute(StyleAttributes.Definition definition, boolean getDefaultValueIfEmpty)
ComputedCssStyleDeclaration.getStyleAttribute in class AbstractCssStyleDeclarationdefinition - the definitiongetDefaultValueIfEmpty - whether to get the default value if empty or notpublic void setCssText(String value)
setCssText in class AbstractCssStyleDeclarationvalue - the new textpublic void setStyleAttribute(String name, String newValue, String important)
setStyleAttribute in class AbstractCssStyleDeclarationname - the attribute name (camel-cased)newValue - the attribute valueimportant - important valuepublic String removeStyleAttribute(String name)
removeStyleAttribute in class AbstractCssStyleDeclarationname - the attribute name (delimiter-separated, not camel-cased)public int getLength()
length property.getLength in class AbstractCssStyleDeclarationlength propertypublic String getWidth()
getWidth in class AbstractCssStyleDeclarationpublic String item(int index)
item in class AbstractCssStyleDeclarationindex - the indexpublic org.htmlunit.cssparser.dom.AbstractCSSRuleImpl getParentRule()
null if this CSSStyleDeclaration is
not attached to a CSSRule.getParentRule in class AbstractCssStyleDeclarationnull if this CSSStyleDeclaration is
not attached to a CSSRulepublic StyleElement getStyleElement(String name)
getStyleElement in class AbstractCssStyleDeclarationname - the name of the requested StyleElementpublic StyleElement getStyleElementCaseInSensitive(String name)
getStyleElementCaseInSensitive in class AbstractCssStyleDeclarationname - the name of the requested StyleElementpublic Map<String,StyleElement> getStyleMap()
LinkedHashMap map so that results are deterministic and are thus testable.getStyleMap in class AbstractCssStyleDeclarationpublic DomElement getDomElement()
DomElement the backing ElementCssStyleDeclaration
is associated withpublic String getBackgroundAttachment()
backgroundAttachment style attribute.getBackgroundAttachment in class AbstractCssStyleDeclarationpublic String getBackgroundColor()
backgroundColor style attribute.getBackgroundColor in class AbstractCssStyleDeclarationpublic String getBackgroundImage()
backgroundImage style attribute.getBackgroundImage in class AbstractCssStyleDeclarationpublic String getBackgroundPosition()
backgroundPosition style attribute.getBackgroundPosition in class AbstractCssStyleDeclarationpublic String getBackgroundRepeat()
backgroundRepeat style attribute.getBackgroundRepeat in class AbstractCssStyleDeclarationpublic String getBlockSize()
blockSize style attribute.getBlockSize in class AbstractCssStyleDeclarationpublic String getBorderBottomColor()
borderBottomColor style attribute.getBorderBottomColor in class AbstractCssStyleDeclarationpublic String getBorderBottomStyle()
borderBottomStyle style attribute.getBorderBottomStyle in class AbstractCssStyleDeclarationpublic String getBorderBottomWidth()
borderBottomWidth style attribute.getBorderBottomWidth in class AbstractCssStyleDeclarationpublic String getBorderLeftColor()
borderLeftColor style attribute.getBorderLeftColor in class AbstractCssStyleDeclarationpublic String getBorderLeftStyle()
borderLeftStyle style attribute.getBorderLeftStyle in class AbstractCssStyleDeclarationpublic String getBorderLeftWidth()
borderLeftWidth style attribute.getBorderLeftWidth in class AbstractCssStyleDeclarationpublic String getBorderRightColor()
borderRightColor style attribute.getBorderRightColor in class AbstractCssStyleDeclarationpublic String getBorderRightStyle()
borderRightStyle style attribute.getBorderRightStyle in class AbstractCssStyleDeclarationpublic String getBorderRightWidth()
borderRightWidth style attribute.getBorderRightWidth in class AbstractCssStyleDeclarationpublic String getBorderTopColor()
borderTopColor style attribute.getBorderTopColor in class AbstractCssStyleDeclarationpublic String getBorderTopStyle()
borderTopStyle style attribute.getBorderTopStyle in class AbstractCssStyleDeclarationpublic String getBorderTopWidth()
borderTopWidth style attribute.getBorderTopWidth in class AbstractCssStyleDeclarationpublic String getBottom()
AbstractCssStyleDeclarationbottom style attribute.getBottom in class AbstractCssStyleDeclarationpublic String getColor()
AbstractCssStyleDeclarationcolor style attribute.getColor in class AbstractCssStyleDeclarationpublic String getCssFloat()
cssFloat style attribute.getCssFloat in class AbstractCssStyleDeclarationpublic String getDisplay()
AbstractCssStyleDeclarationdisplay style attribute.getDisplay in class AbstractCssStyleDeclarationpublic String getFont()
AbstractCssStyleDeclarationfont style attribute.getFont in class AbstractCssStyleDeclarationpublic String getFontFamily()
AbstractCssStyleDeclarationfontFamily style attribute.getFontFamily in class AbstractCssStyleDeclarationpublic String getFontSize()
AbstractCssStyleDeclarationfontSize style attribute.getFontSize in class AbstractCssStyleDeclarationpublic String getLineHeight()
getLineHeight in class AbstractCssStyleDeclarationlineHeightpublic String getHeight()
height style attribute.getHeight in class AbstractCssStyleDeclarationpublic String getLeft()
getLeft in class AbstractCssStyleDeclarationleftpublic String getLetterSpacing()
getLetterSpacing in class AbstractCssStyleDeclarationletterSpacingpublic String getMargin()
getMargin in class AbstractCssStyleDeclarationmarginpublic String getMarginBottom()
marginBottom style attribute.getMarginBottom in class AbstractCssStyleDeclarationpublic String getMarginLeft()
marginLeft style attribute.getMarginLeft in class AbstractCssStyleDeclarationpublic String getMarginRight()
marginRight style attribute.getMarginRight in class AbstractCssStyleDeclarationpublic String getMarginTop()
marginTop style attribute.getMarginTop in class AbstractCssStyleDeclarationpublic String getMaxHeight()
getMaxHeight in class AbstractCssStyleDeclarationmaxHeightpublic String getMaxWidth()
getMaxWidth in class AbstractCssStyleDeclarationmaxWidthpublic String getMinHeight()
getMinHeight in class AbstractCssStyleDeclarationminHeightpublic String getMinWidth()
getMinWidth in class AbstractCssStyleDeclarationminWidthpublic String getOpacity()
opacity style attribute.getOpacity in class AbstractCssStyleDeclarationpublic String getOrphans()
getOrphans in class AbstractCssStyleDeclarationorphanspublic String getOutlineWidth()
getOutlineWidth in class AbstractCssStyleDeclarationoutlineWidthpublic String getPadding()
getPadding in class AbstractCssStyleDeclarationpaddingpublic String getPaddingBottom()
getPaddingBottom in class AbstractCssStyleDeclarationpaddingBottompublic String getPaddingLeft()
getPaddingLeft in class AbstractCssStyleDeclarationpaddingLeftpublic String getPaddingRight()
getPaddingRight in class AbstractCssStyleDeclarationpaddingRightpublic String getPaddingTop()
getPaddingTop in class AbstractCssStyleDeclarationpaddingToppublic String getRight()
getRight in class AbstractCssStyleDeclarationrightpublic String getTextIndent()
getTextIndent in class AbstractCssStyleDeclarationtextIndentpublic String getTop()
getTop in class AbstractCssStyleDeclarationtoppublic int getTop(boolean includeMargin,
boolean includeBorder,
boolean includePadding)
includeMargin - whether or not to take the margin into account in the calculationincludeBorder - whether or not to take the border into account in the calculationincludePadding - whether or not to take the padding into account in the calculationpublic String getTopWithInheritance()
top attribute, replacing inherited values with the actual parent values.top attribute, replacing inherited values with the actual parent valuespublic String getBottomWithInheritance()
bottom attribute, replacing inherited values with the actual parent values.bottom attribute, replacing inherited values with the actual parent valuespublic String getVerticalAlign()
getVerticalAlign in class AbstractCssStyleDeclarationverticalAlignpublic String getWidows()
getWidows in class AbstractCssStyleDeclarationwidowspublic String getWordSpacing()
getWordSpacing in class AbstractCssStyleDeclarationwordSpacingpublic String getZIndex()
zIndex style attribute.getZIndex in class AbstractCssStyleDeclarationpublic int getMarginLeftValue()
public int getMarginRightValue()
public int getMarginTopValue()
public int getMarginBottomValue()
public int getLeft(boolean includeMargin,
boolean includeBorder,
boolean includePadding)
includeMargin - whether or not to take the margin into account in the calculationincludeBorder - whether or not to take the border into account in the calculationincludePadding - whether or not to take the padding into account in the calculationpublic String getPosition()
getPosition in class AbstractCssStyleDeclarationpositionpublic String getPositionWithInheritance()
position attribute, replacing inherited values with the actual parent values.position attribute, replacing inherited values with the actual parent valuespublic String getLeftWithInheritance()
left attribute, replacing inherited values with the actual parent values.left attribute, replacing inherited values with the actual parent valuespublic String getRightWithInheritance()
right attribute, replacing inherited values with the actual parent values.right attribute, replacing inherited values with the actual parent valuespublic int getCalculatedHeight(boolean includeBorder,
boolean includePadding)
includeBorder - whether or not to include the border height in the returned valueincludePadding - whether or not to include the padding height in the returned valuepublic int getCalculatedWidth(boolean includeBorder,
boolean includePadding)
includeBorder - whether or not to include the border width in the returned valueincludePadding - whether or not to include the padding width in the returned valuepublic int getContentWidth()
public int getContentHeight()
public boolean isScrollable(boolean horizontal)
true if the element is scrollable along the specified axis.horizontal - if true, the caller is interested in scrollability along the x-axis;
if false, the caller is interested in scrollability along the y-axistrue if the element is scrollable along the specified axispublic int getBorderLeftValue()
public int getBorderRightValue()
public int getBorderTopValue()
public int getBorderBottomValue()
public int getPaddingLeftValue()
public int getPaddingRightValue()
public int getPaddingTopValue()
public int getPaddingBottomValue()
public Integer getCachedWidth()
public int updateCachedWidth(int width)
width - the new valuepublic Integer getCachedHeight()
public int updateCachedHeight(int height)
height - the new valuepublic Integer getCachedEmptyHeight()
public int updateCachedEmptyHeight(int emptyHeight)
emptyHeight - the new valuepublic Integer getCachedTop()
public void setCachedTop(Integer top)
top - the new valuepublic Integer getCachedPaddingHorizontal()
public int updateCachedPaddingHorizontal(int paddingHorizontal)
paddingHorizontal - the new valuepublic Integer getCachedPaddingVertical()
public int updateCachedPaddingVertical(int paddingVertical)
paddingVertical - the new valuepublic Integer getCachedBorderHorizontal()
public int updateCachedBorderHorizontal(int borderHorizontal)
borderHorizontal - the new valuepublic Integer getCachedBorderVertical()
public int updateCachedBorderVertical(int borderVertical)
borderVertical - the new valuepublic void applyStyleFromSelector(org.htmlunit.cssparser.dom.CSSStyleDeclarationImpl declaration, org.htmlunit.cssparser.parser.selector.Selector selector)
declaration - the style declarationselector - the selector determining that the style applies to this elementpublic void setDefaultLocalStyleAttribute(String name, String newValue)
name - the name of the style attribute to setnewValue - the value of the style attribute to setpublic boolean hasFeature(BrowserVersionFeatures property)
hasFeature in class AbstractCssStyleDeclarationproperty - the property namefalse if this browser doesn't have this featurepublic BrowserVersion getBrowserVersion()
getBrowserVersion in class AbstractCssStyleDeclarationBrowserVersionpublic boolean isComputed()
isComputed in class AbstractCssStyleDeclarationCopyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.