public class ComputedCssStyleDeclaration extends AbstractCssStyleDeclaration
Window.getComputedStyle(Object, String)
,
Serialized FormModifier 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 |
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 |
getCachedHeight()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
Integer |
getCachedHeight2()
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 |
updateCachedHeight(int height)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
|
int |
updateCachedHeight2(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, getStyleAttribute
public static final String EMPTY_FINAL
public ComputedCssStyleDeclaration(ElementCssStyleDeclaration styleDeclaration)
styleDeclaration
- the ElementCssStyleDeclaration
this is based onpublic String getStylePriority(String name)
getStylePriority
in class AbstractCssStyleDeclaration
name
- the name of the style attribute whose value is to be retrievedpublic String getCssText()
getCssText
in class AbstractCssStyleDeclaration
public String getStyleAttribute(String name)
getStyleAttribute
in class AbstractCssStyleDeclaration
name
- the namepublic String getStyleAttribute(StyleAttributes.Definition definition, boolean getDefaultValueIfEmpty)
ComputedCssStyleDeclaration
.getStyleAttribute
in class AbstractCssStyleDeclaration
definition
- the definitiongetDefaultValueIfEmpty
- whether to get the default value if empty or notpublic void setCssText(String value)
setCssText
in class AbstractCssStyleDeclaration
value
- the new textpublic void setStyleAttribute(String name, String newValue, String important)
setStyleAttribute
in class AbstractCssStyleDeclaration
name
- the attribute name (camel-cased)newValue
- the attribute valueimportant
- important valuepublic String removeStyleAttribute(String name)
removeStyleAttribute
in class AbstractCssStyleDeclaration
name
- the attribute name (delimiter-separated, not camel-cased)public int getLength()
length
property.getLength
in class AbstractCssStyleDeclaration
length
propertypublic String getWidth()
getWidth
in class AbstractCssStyleDeclaration
public String item(int index)
item
in class AbstractCssStyleDeclaration
index
- the indexpublic org.htmlunit.cssparser.dom.AbstractCSSRuleImpl getParentRule()
null
if this CSSStyleDeclaration is
not attached to a CSSRule.getParentRule
in class AbstractCssStyleDeclaration
null
if this CSSStyleDeclaration is
not attached to a CSSRulepublic StyleElement getStyleElement(String name)
getStyleElement
in class AbstractCssStyleDeclaration
name
- the name of the requested StyleElementpublic StyleElement getStyleElementCaseInSensitive(String name)
getStyleElementCaseInSensitive
in class AbstractCssStyleDeclaration
name
- the name of the requested StyleElementpublic Map<String,StyleElement> getStyleMap()
LinkedHashMap
map so that results are deterministic and are thus testable.getStyleMap
in class AbstractCssStyleDeclaration
public DomElement getDomElement()
DomElement
the backing ElementCssStyleDeclaration
is associated withpublic String getBackgroundAttachment()
backgroundAttachment
style attribute.getBackgroundAttachment
in class AbstractCssStyleDeclaration
public String getBackgroundColor()
backgroundColor
style attribute.getBackgroundColor
in class AbstractCssStyleDeclaration
public String getBackgroundImage()
backgroundImage
style attribute.getBackgroundImage
in class AbstractCssStyleDeclaration
public String getBackgroundPosition()
backgroundPosition
style attribute.getBackgroundPosition
in class AbstractCssStyleDeclaration
public String getBackgroundRepeat()
backgroundRepeat
style attribute.getBackgroundRepeat
in class AbstractCssStyleDeclaration
public String getBorderBottomColor()
borderBottomColor
style attribute.getBorderBottomColor
in class AbstractCssStyleDeclaration
public String getBorderBottomStyle()
borderBottomStyle
style attribute.getBorderBottomStyle
in class AbstractCssStyleDeclaration
public String getBorderBottomWidth()
borderBottomWidth
style attribute.getBorderBottomWidth
in class AbstractCssStyleDeclaration
public String getBorderLeftColor()
borderLeftColor
style attribute.getBorderLeftColor
in class AbstractCssStyleDeclaration
public String getBorderLeftStyle()
borderLeftStyle
style attribute.getBorderLeftStyle
in class AbstractCssStyleDeclaration
public String getBorderLeftWidth()
borderLeftWidth
style attribute.getBorderLeftWidth
in class AbstractCssStyleDeclaration
public String getBorderRightColor()
borderRightColor
style attribute.getBorderRightColor
in class AbstractCssStyleDeclaration
public String getBorderRightStyle()
borderRightStyle
style attribute.getBorderRightStyle
in class AbstractCssStyleDeclaration
public String getBorderRightWidth()
borderRightWidth
style attribute.getBorderRightWidth
in class AbstractCssStyleDeclaration
public String getBorderTopColor()
borderTopColor
style attribute.getBorderTopColor
in class AbstractCssStyleDeclaration
public String getBorderTopStyle()
borderTopStyle
style attribute.getBorderTopStyle
in class AbstractCssStyleDeclaration
public String getBorderTopWidth()
borderTopWidth
style attribute.getBorderTopWidth
in class AbstractCssStyleDeclaration
public String getBottom()
AbstractCssStyleDeclaration
bottom
style attribute.getBottom
in class AbstractCssStyleDeclaration
public String getColor()
AbstractCssStyleDeclaration
color
style attribute.getColor
in class AbstractCssStyleDeclaration
public String getCssFloat()
cssFloat
style attribute.getCssFloat
in class AbstractCssStyleDeclaration
public String getDisplay()
AbstractCssStyleDeclaration
display
style attribute.getDisplay
in class AbstractCssStyleDeclaration
public String getFont()
AbstractCssStyleDeclaration
font
style attribute.getFont
in class AbstractCssStyleDeclaration
public String getFontFamily()
AbstractCssStyleDeclaration
fontFamily
style attribute.getFontFamily
in class AbstractCssStyleDeclaration
public String getFontSize()
AbstractCssStyleDeclaration
fontSize
style attribute.getFontSize
in class AbstractCssStyleDeclaration
public String getLineHeight()
getLineHeight
in class AbstractCssStyleDeclaration
lineHeight
public String getHeight()
height
style attribute.getHeight
in class AbstractCssStyleDeclaration
public String getLeft()
getLeft
in class AbstractCssStyleDeclaration
left
public String getLetterSpacing()
getLetterSpacing
in class AbstractCssStyleDeclaration
letterSpacing
public String getMargin()
getMargin
in class AbstractCssStyleDeclaration
margin
public String getMarginBottom()
marginBottom
style attribute.getMarginBottom
in class AbstractCssStyleDeclaration
public String getMarginLeft()
marginLeft
style attribute.getMarginLeft
in class AbstractCssStyleDeclaration
public String getMarginRight()
marginRight
style attribute.getMarginRight
in class AbstractCssStyleDeclaration
public String getMarginTop()
marginTop
style attribute.getMarginTop
in class AbstractCssStyleDeclaration
public String getMaxHeight()
getMaxHeight
in class AbstractCssStyleDeclaration
maxHeight
public String getMaxWidth()
getMaxWidth
in class AbstractCssStyleDeclaration
maxWidth
public String getMinHeight()
getMinHeight
in class AbstractCssStyleDeclaration
minHeight
public String getMinWidth()
getMinWidth
in class AbstractCssStyleDeclaration
minWidth
public String getOpacity()
opacity
style attribute.getOpacity
in class AbstractCssStyleDeclaration
public String getOrphans()
getOrphans
in class AbstractCssStyleDeclaration
orphans
public String getOutlineWidth()
getOutlineWidth
in class AbstractCssStyleDeclaration
outlineWidth
public String getPadding()
getPadding
in class AbstractCssStyleDeclaration
padding
public String getPaddingBottom()
getPaddingBottom
in class AbstractCssStyleDeclaration
paddingBottom
public String getPaddingLeft()
getPaddingLeft
in class AbstractCssStyleDeclaration
paddingLeft
public String getPaddingRight()
getPaddingRight
in class AbstractCssStyleDeclaration
paddingRight
public String getPaddingTop()
getPaddingTop
in class AbstractCssStyleDeclaration
paddingTop
public String getRight()
getRight
in class AbstractCssStyleDeclaration
right
public String getTextIndent()
getTextIndent
in class AbstractCssStyleDeclaration
textIndent
public String getTop()
getTop
in class AbstractCssStyleDeclaration
top
public 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 AbstractCssStyleDeclaration
verticalAlign
public String getWidows()
getWidows
in class AbstractCssStyleDeclaration
widows
public String getWordSpacing()
getWordSpacing
in class AbstractCssStyleDeclaration
wordSpacing
public String getZIndex()
zIndex
style attribute.getZIndex
in class AbstractCssStyleDeclaration
public 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 AbstractCssStyleDeclaration
position
public 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 getCachedHeight2()
public int updateCachedHeight2(int height)
height
- 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 AbstractCssStyleDeclaration
property
- the property namefalse
if this browser doesn't have this featurepublic BrowserVersion getBrowserVersion()
getBrowserVersion
in class AbstractCssStyleDeclaration
BrowserVersion
public boolean isComputed()
isComputed
in class AbstractCssStyleDeclaration
Copyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.