Package org.htmlunit.css
Class ComputedCssStyleDeclaration
- java.lang.Object
-
- org.htmlunit.css.AbstractCssStyleDeclaration
-
- org.htmlunit.css.ComputedCssStyleDeclaration
-
- All Implemented Interfaces:
java.io.Serializable
public class ComputedCssStyleDeclaration extends AbstractCssStyleDeclaration
An object for a CSSStyleDeclaration, which is computed.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Integer
borderHorizontal_
The computed, cached horizontal border (left + right) of the element to which this computed style belongs.private java.lang.Integer
borderVertical_
The computed, cached vertical border (top + bottom) of the element to which this computed style belongs.private ElementCssStyleDeclaration
elementStyleDeclaration_
The wrapped CSSStyleDeclarationstatic java.lang.String
EMPTY_FINAL
Denotes a value which should be returned as is.private java.lang.Integer
height_
The computed, cached height of the element to which this computed style belongs (no padding, borders, etc.), taking child elements into account.private java.lang.Integer
height2_
The computed, cached height of the element to which this computed style belongs (no padding, borders, etc.), not taking child elements into account.private static java.util.Set<StyleAttributes.Definition>
INHERITABLE_DEFINITIONS
The set of 'inheritable' definitions.private java.util.SortedMap<java.lang.String,StyleElement>
localModifications_
Local modifications maintained here rather than in the element.private java.lang.Integer
paddingHorizontal_
The computed, cached horizontal padding (left + right) of the element to which this computed style belongs.private java.lang.Integer
paddingVertical_
The computed, cached vertical padding (top + bottom) of the element to which this computed style belongs.private java.lang.Integer
top_
The computed, cached top of the element to which this computed style belongs.private java.lang.Integer
width_
The computed, cached width of the element to which this computed style belongs (no padding, borders, etc.).
-
Constructor Summary
Constructors Constructor Description ComputedCssStyleDeclaration(ElementCssStyleDeclaration styleDeclaration)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
applyLocalStyleAttribute(java.lang.String name, java.lang.String newValue, java.lang.String priority, org.htmlunit.cssparser.parser.selector.SelectorSpecificity specificity)
void
applyStyleFromSelector(org.htmlunit.cssparser.dom.CSSStyleDeclarationImpl declaration, org.htmlunit.cssparser.parser.selector.Selector selector)
Makes a local, "computed", modification to this CSS style.private java.lang.String
defaultIfEmpty(java.lang.String str, java.lang.String toReturnIfEmptyOrDefault, java.lang.String defaultValue)
private java.lang.String
defaultIfEmpty(java.lang.String str, StyleAttributes.Definition definition)
private java.lang.String
defaultIfEmpty(java.lang.String str, StyleAttributes.Definition definition, boolean isPixel)
java.lang.String
getBackgroundAttachment()
Gets thebackgroundAttachment
style attribute.java.lang.String
getBackgroundColor()
Gets thebackgroundColor
style attribute.java.lang.String
getBackgroundImage()
Gets thebackgroundImage
style attribute.java.lang.String
getBackgroundPosition()
Gets thebackgroundPosition
style attribute.java.lang.String
getBackgroundRepeat()
Gets thebackgroundRepeat
style attribute.java.lang.String
getBorderBottomColor()
Gets theborderBottomColor
style attribute.java.lang.String
getBorderBottomStyle()
Gets theborderBottomStyle
style attribute.int
getBorderBottomValue()
Gets the size of the bottom border of the element.java.lang.String
getBorderBottomWidth()
Gets theborderBottomWidth
style attribute.private int
getBorderHorizontal()
java.lang.String
getBorderLeftColor()
Gets theborderLeftColor
style attribute.java.lang.String
getBorderLeftStyle()
Gets theborderLeftStyle
style attribute.int
getBorderLeftValue()
Gets the size of the left border of the element.java.lang.String
getBorderLeftWidth()
Gets theborderLeftWidth
style attribute.java.lang.String
getBorderRightColor()
Gets theborderRightColor
style attribute.java.lang.String
getBorderRightStyle()
Gets theborderRightStyle
style attribute.int
getBorderRightValue()
Gets the size of the right border of the element.java.lang.String
getBorderRightWidth()
Gets theborderRightWidth
style attribute.java.lang.String
getBorderTopColor()
Gets theborderTopColor
style attribute.java.lang.String
getBorderTopStyle()
Gets theborderTopStyle
style attribute.int
getBorderTopValue()
Gets the size of the top border of the element.java.lang.String
getBorderTopWidth()
Gets theborderTopWidth
style attribute.private int
getBorderVertical()
java.lang.String
getBottom()
Gets thebottom
style attribute.java.lang.String
getBottomWithInheritance()
Returns the CSSbottom
attribute, replacing inherited values with the actual parent values.BrowserVersion
getBrowserVersion()
java.lang.Integer
getCachedBorderHorizontal()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.Integer
getCachedBorderVertical()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.Integer
getCachedHeight()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.Integer
getCachedHeight2()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.Integer
getCachedPaddingHorizontal()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.Integer
getCachedPaddingVertical()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.Integer
getCachedTop()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.Integer
getCachedWidth()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.private int
getCalculatedHeight()
Returns the element's calculated height, taking both relevant CSS and the element's children into account.int
getCalculatedHeight(boolean includeBorder, boolean includePadding)
Returns the element's height, possibly including its padding and border.private int
getCalculatedWidth()
int
getCalculatedWidth(boolean includeBorder, boolean includePadding)
Returns the element's width in pixels, possibly including its padding and border.java.lang.String
getColor()
Gets thecolor
style attribute.int
getContentHeight()
Returns the total height of the element's children.int
getContentWidth()
Returns the total width of the element's children.java.lang.String
getCssFloat()
Gets thecssFloat
style attribute.java.lang.String
getCssText()
Returns the actual text of the style.java.lang.String
getDisplay()
Gets thedisplay
style attribute.DomElement
getDomElement()
private int
getEmptyHeight()
Returns the element's calculated height taking relevant CSS into account, but not the element's child elements.java.lang.String
getFont()
Gets thefont
style attribute.java.lang.String
getFontFamily()
Gets thefontFamily
style attribute.java.lang.String
getFontSize()
Gets thefontSize
style attribute.java.lang.String
getHeight()
Gets theheight
style attribute.java.lang.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.java.lang.String
getLeftWithInheritance()
Returns the CSSleft
attribute, replacing inherited values with the actual parent values.int
getLength()
Returns thelength
property.java.lang.String
getLetterSpacing()
java.lang.String
getLineHeight()
java.lang.String
getMargin()
java.lang.String
getMarginBottom()
Gets themarginBottom
style attribute.int
getMarginBottomValue()
Gets the bottom margin of the element.java.lang.String
getMarginLeft()
Gets themarginLeft
style attribute.int
getMarginLeftValue()
Gets the left margin of the element.java.lang.String
getMarginRight()
Gets themarginRight
style attribute.int
getMarginRightValue()
Gets the right margin of the element.java.lang.String
getMarginTop()
Gets themarginTop
style attribute.int
getMarginTopValue()
Gets the top margin of the element.private java.lang.String
getMarginX(java.lang.String superMarginX, StyleAttributes.Definition definition)
java.lang.String
getMaxHeight()
java.lang.String
getMaxWidth()
java.lang.String
getMinHeight()
java.lang.String
getMinWidth()
java.lang.String
getOpacity()
Gets theopacity
style attribute.java.lang.String
getOrphans()
java.lang.String
getOutlineWidth()
java.lang.String
getPadding()
java.lang.String
getPaddingBottom()
int
getPaddingBottomValue()
Gets the bottom padding of the element.private int
getPaddingHorizontal()
java.lang.String
getPaddingLeft()
int
getPaddingLeftValue()
Gets the left padding of the element.java.lang.String
getPaddingRight()
int
getPaddingRightValue()
Gets the right padding of the element.java.lang.String
getPaddingTop()
int
getPaddingTopValue()
Gets the top padding of the element.private int
getPaddingVertical()
org.htmlunit.cssparser.dom.AbstractCSSRuleImpl
getParentRule()
Returns the CSSRule that is the parent of this style block ornull
if this CSSStyleDeclaration is not attached to a CSSRule.java.lang.String
getPosition()
java.lang.String
getPositionWithInheritance()
Returns the CSSposition
attribute, replacing inherited values with the actual parent values.java.lang.String
getRight()
java.lang.String
getRightWithInheritance()
Returns the CSSright
attribute, replacing inherited values with the actual parent values.java.lang.String
getStyleAttribute(java.lang.String name)
Get the value for the style attribute.java.lang.String
getStyleAttribute(StyleAttributes.Definition definition, boolean getDefaultValueIfEmpty)
Get the value for the style attribute.private java.lang.String
getStyleAttribute(StyleAttributes.Definition definition, java.lang.String toReturnIfEmptyOrDefault, java.lang.String defaultValue)
private static java.lang.String
getStyleAttributeWorker(StyleAttributes.Definition definition, boolean getDefaultValueIfEmpty, BrowserVersion browserVersion, boolean feature, boolean isDefInheritable, ComputedCssStyleDeclaration[] queue)
StyleElement
getStyleElement(java.lang.String name)
Determines the StyleElement for the given name.StyleElement
getStyleElementCaseInSensitive(java.lang.String name)
Determines the StyleElement for the given name.java.util.Map<java.lang.String,StyleElement>
getStyleMap()
Returns a sorted map containing style elements, keyed on style element name.java.lang.String
getStylePriority(java.lang.String name)
Returns the priority of the named style attribute, or an empty string if it is not found.java.lang.String
getTextIndent()
java.lang.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.private int
getTopForAbsolutePositionWithInheritance()
java.lang.String
getTopWithInheritance()
Returns the CSStop
attribute, replacing inherited values with the actual parent values.java.lang.String
getVerticalAlign()
java.lang.String
getWidows()
java.lang.String
getWidth()
java.lang.String
getWordSpacing()
java.lang.Object
getZIndex()
Gets thezIndex
style attribute.boolean
hasFeature(BrowserVersionFeatures property)
Indicates if the browser this is associated with has the feature.private static boolean
isBlock(java.lang.String display)
boolean
isComputed()
boolean
isScrollable(boolean horizontal)
Returnstrue
if the element is scrollable along the specified axis.private boolean
isScrollable(boolean horizontal, boolean ignoreSize)
java.lang.Object
item(int index)
Returns the item in the given index.private static java.lang.String
pixelString(java.lang.String value)
Returns the specified length value as a pixel length value.java.lang.String
removeStyleAttribute(java.lang.String name)
Removes the specified style attribute, returning the value of the removed attribute.int
setCachedBorderHorizontal(int borderHorizontal)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.int
setCachedBorderVertical(int borderVertical)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.int
setCachedHeight(int height)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.int
setCachedHeight2(int height)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.int
setCachedPaddingHorizontal(int paddingHorizontal)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.int
setCachedPaddingVertical(int paddingVertical)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.void
setCachedTop(java.lang.Integer top)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.int
setCachedWidth(int width)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.void
setCssText(java.lang.String value)
Sets the actual text of the style.void
setDefaultLocalStyleAttribute(java.lang.String name, java.lang.String newValue)
Makes a local, "computed", modification to this CSS style that won't override other style attributes of the same name.void
setStyleAttribute(java.lang.String name, java.lang.String newValue, java.lang.String important)
Sets the specified style attribute.java.lang.String
toString()
-
Methods inherited from class org.htmlunit.css.AbstractCssStyleDeclaration
getBorderTop, getOutline, getRubyAlign, getSize, getStyleAttribute, getStyleAttribute, isLength
-
-
-
-
Field Detail
-
INHERITABLE_DEFINITIONS
private static final java.util.Set<StyleAttributes.Definition> INHERITABLE_DEFINITIONS
The set of 'inheritable' definitions.
-
EMPTY_FINAL
public static final java.lang.String EMPTY_FINAL
Denotes a value which should be returned as is.
-
width_
private java.lang.Integer width_
The computed, cached width of the element to which this computed style belongs (no padding, borders, etc.).
-
height_
private java.lang.Integer height_
The computed, cached height of the element to which this computed style belongs (no padding, borders, etc.), taking child elements into account.
-
height2_
private java.lang.Integer height2_
The computed, cached height of the element to which this computed style belongs (no padding, borders, etc.), not taking child elements into account.
-
paddingHorizontal_
private java.lang.Integer paddingHorizontal_
The computed, cached horizontal padding (left + right) of the element to which this computed style belongs.
-
paddingVertical_
private java.lang.Integer paddingVertical_
The computed, cached vertical padding (top + bottom) of the element to which this computed style belongs.
-
borderHorizontal_
private java.lang.Integer borderHorizontal_
The computed, cached horizontal border (left + right) of the element to which this computed style belongs.
-
borderVertical_
private java.lang.Integer borderVertical_
The computed, cached vertical border (top + bottom) of the element to which this computed style belongs.
-
top_
private java.lang.Integer top_
The computed, cached top of the element to which this computed style belongs.
-
localModifications_
private final java.util.SortedMap<java.lang.String,StyleElement> localModifications_
Local modifications maintained here rather than in the element. We use a sorted map so that results are deterministic and thus easily testable.
-
elementStyleDeclaration_
private ElementCssStyleDeclaration elementStyleDeclaration_
The wrapped CSSStyleDeclaration
-
-
Constructor Detail
-
ComputedCssStyleDeclaration
public ComputedCssStyleDeclaration(ElementCssStyleDeclaration styleDeclaration)
-
-
Method Detail
-
getStylePriority
public java.lang.String getStylePriority(java.lang.String name)
Returns the priority of the named style attribute, or an empty string if it is not found.- Specified by:
getStylePriority
in classAbstractCssStyleDeclaration
- Parameters:
name
- the name of the style attribute whose value is to be retrieved- Returns:
- the named style attribute value, or an empty string if it is not found
-
getCssText
public java.lang.String getCssText()
Returns the actual text of the style.- Specified by:
getCssText
in classAbstractCssStyleDeclaration
- Returns:
- the actual text of the style
-
getStyleAttribute
public java.lang.String getStyleAttribute(java.lang.String name)
Get the value for the style attribute.- Specified by:
getStyleAttribute
in classAbstractCssStyleDeclaration
- Parameters:
name
- the name- Returns:
- the value
-
getStyleAttribute
public java.lang.String getStyleAttribute(StyleAttributes.Definition definition, boolean getDefaultValueIfEmpty)
Get the value for the style attribute. This impl ignores the default getDefaultValueIfEmpty flag, but there is a overload inComputedCssStyleDeclaration
.- Specified by:
getStyleAttribute
in classAbstractCssStyleDeclaration
- Parameters:
definition
- the definitiongetDefaultValueIfEmpty
- whether to get the default value if empty or not- Returns:
- the value
-
getStyleAttributeWorker
private static java.lang.String getStyleAttributeWorker(StyleAttributes.Definition definition, boolean getDefaultValueIfEmpty, BrowserVersion browserVersion, boolean feature, boolean isDefInheritable, ComputedCssStyleDeclaration[] queue)
-
getStyleAttribute
private java.lang.String getStyleAttribute(StyleAttributes.Definition definition, java.lang.String toReturnIfEmptyOrDefault, java.lang.String defaultValue)
- Parameters:
toReturnIfEmptyOrDefault
- the value to return if empty or equals thedefaultValue
defaultValue
- the default value of the string- Returns:
- the string, or
toReturnIfEmptyOrDefault
-
setCssText
public void setCssText(java.lang.String value)
Sets the actual text of the style.- Specified by:
setCssText
in classAbstractCssStyleDeclaration
- Parameters:
value
- the new text
-
setStyleAttribute
public void setStyleAttribute(java.lang.String name, java.lang.String newValue, java.lang.String important)
Sets the specified style attribute.- Specified by:
setStyleAttribute
in classAbstractCssStyleDeclaration
- Parameters:
name
- the attribute name (camel-cased)newValue
- the attribute valueimportant
- important value
-
removeStyleAttribute
public java.lang.String removeStyleAttribute(java.lang.String name)
Removes the specified style attribute, returning the value of the removed attribute.- Specified by:
removeStyleAttribute
in classAbstractCssStyleDeclaration
- Parameters:
name
- the attribute name (delimiter-separated, not camel-cased)- Returns:
- the removed value
-
getLength
public int getLength()
Returns thelength
property.- Specified by:
getLength
in classAbstractCssStyleDeclaration
- Returns:
- the
length
property
-
getWidth
public java.lang.String getWidth()
- Overrides:
getWidth
in classAbstractCssStyleDeclaration
- Returns:
- the width
-
item
public java.lang.Object item(int index)
Returns the item in the given index.- Specified by:
item
in classAbstractCssStyleDeclaration
- Parameters:
index
- the index- Returns:
- the item in the given index
-
getParentRule
public org.htmlunit.cssparser.dom.AbstractCSSRuleImpl getParentRule()
Returns the CSSRule that is the parent of this style block ornull
if this CSSStyleDeclaration is not attached to a CSSRule.- Specified by:
getParentRule
in classAbstractCssStyleDeclaration
- Returns:
- the CSSRule that is the parent of this style block or
null
if this CSSStyleDeclaration is not attached to a CSSRule
-
getStyleElement
public StyleElement getStyleElement(java.lang.String name)
Determines the StyleElement for the given name.- Specified by:
getStyleElement
in classAbstractCssStyleDeclaration
- Parameters:
name
- the name of the requested StyleElement- Returns:
- the StyleElement or null if not found
-
getStyleElementCaseInSensitive
public StyleElement getStyleElementCaseInSensitive(java.lang.String name)
Determines the StyleElement for the given name. This ignores the case of the name.- Specified by:
getStyleElementCaseInSensitive
in classAbstractCssStyleDeclaration
- Parameters:
name
- the name of the requested StyleElement- Returns:
- the StyleElement or null if not found
-
getStyleMap
public java.util.Map<java.lang.String,StyleElement> getStyleMap()
Returns a sorted map containing style elements, keyed on style element name. We use aLinkedHashMap
map so that results are deterministic and are thus testable.- Specified by:
getStyleMap
in classAbstractCssStyleDeclaration
- Returns:
- a sorted map containing style elements, keyed on style element name
-
getDomElement
public DomElement getDomElement()
-
getBackgroundAttachment
public java.lang.String getBackgroundAttachment()
Gets thebackgroundAttachment
style attribute.- Overrides:
getBackgroundAttachment
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBackgroundColor
public java.lang.String getBackgroundColor()
Gets thebackgroundColor
style attribute.- Overrides:
getBackgroundColor
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBackgroundImage
public java.lang.String getBackgroundImage()
Gets thebackgroundImage
style attribute.- Overrides:
getBackgroundImage
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBackgroundPosition
public java.lang.String getBackgroundPosition()
Gets thebackgroundPosition
style attribute.- Overrides:
getBackgroundPosition
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBackgroundRepeat
public java.lang.String getBackgroundRepeat()
Gets thebackgroundRepeat
style attribute.- Overrides:
getBackgroundRepeat
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderBottomColor
public java.lang.String getBorderBottomColor()
Gets theborderBottomColor
style attribute.- Overrides:
getBorderBottomColor
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderBottomStyle
public java.lang.String getBorderBottomStyle()
Gets theborderBottomStyle
style attribute.- Overrides:
getBorderBottomStyle
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderBottomWidth
public java.lang.String getBorderBottomWidth()
Gets theborderBottomWidth
style attribute.- Overrides:
getBorderBottomWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderLeftColor
public java.lang.String getBorderLeftColor()
Gets theborderLeftColor
style attribute.- Overrides:
getBorderLeftColor
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderLeftStyle
public java.lang.String getBorderLeftStyle()
Gets theborderLeftStyle
style attribute.- Overrides:
getBorderLeftStyle
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderLeftWidth
public java.lang.String getBorderLeftWidth()
Gets theborderLeftWidth
style attribute.- Overrides:
getBorderLeftWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderRightColor
public java.lang.String getBorderRightColor()
Gets theborderRightColor
style attribute.- Overrides:
getBorderRightColor
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderRightStyle
public java.lang.String getBorderRightStyle()
Gets theborderRightStyle
style attribute.- Overrides:
getBorderRightStyle
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderRightWidth
public java.lang.String getBorderRightWidth()
Gets theborderRightWidth
style attribute.- Overrides:
getBorderRightWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderTopColor
public java.lang.String getBorderTopColor()
Gets theborderTopColor
style attribute.- Overrides:
getBorderTopColor
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderTopStyle
public java.lang.String getBorderTopStyle()
Gets theborderTopStyle
style attribute.- Overrides:
getBorderTopStyle
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderTopWidth
public java.lang.String getBorderTopWidth()
Gets theborderTopWidth
style attribute.- Overrides:
getBorderTopWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBottom
public java.lang.String getBottom()
Description copied from class:AbstractCssStyleDeclaration
Gets thebottom
style attribute.- Overrides:
getBottom
in classAbstractCssStyleDeclaration
- Returns:
- the bottom setting
-
getColor
public java.lang.String getColor()
Description copied from class:AbstractCssStyleDeclaration
Gets thecolor
style attribute.- Overrides:
getColor
in classAbstractCssStyleDeclaration
- Returns:
- the color setting
-
getCssFloat
public java.lang.String getCssFloat()
Gets thecssFloat
style attribute.- Overrides:
getCssFloat
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getDisplay
public java.lang.String getDisplay()
Description copied from class:AbstractCssStyleDeclaration
Gets thedisplay
style attribute.- Overrides:
getDisplay
in classAbstractCssStyleDeclaration
- Returns:
- the display setting
-
getFont
public java.lang.String getFont()
Description copied from class:AbstractCssStyleDeclaration
Gets thefont
style attribute.- Overrides:
getFont
in classAbstractCssStyleDeclaration
- Returns:
- the font setting
-
getFontFamily
public java.lang.String getFontFamily()
Description copied from class:AbstractCssStyleDeclaration
Gets thefontFamily
style attribute.- Overrides:
getFontFamily
in classAbstractCssStyleDeclaration
- Returns:
- the font family setting
-
getFontSize
public java.lang.String getFontSize()
Description copied from class:AbstractCssStyleDeclaration
Gets thefontSize
style attribute.- Overrides:
getFontSize
in classAbstractCssStyleDeclaration
- Returns:
- the font size setting
-
getLineHeight
public java.lang.String getLineHeight()
- Overrides:
getLineHeight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
lineHeight
-
getHeight
public java.lang.String getHeight()
Gets theheight
style attribute.- Overrides:
getHeight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getLeft
public java.lang.String getLeft()
- Overrides:
getLeft
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
left
-
getLetterSpacing
public java.lang.String getLetterSpacing()
- Overrides:
getLetterSpacing
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
letterSpacing
-
getMargin
public java.lang.String getMargin()
- Overrides:
getMargin
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
margin
-
getMarginBottom
public java.lang.String getMarginBottom()
Gets themarginBottom
style attribute.- Overrides:
getMarginBottom
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getMarginLeft
public java.lang.String getMarginLeft()
Gets themarginLeft
style attribute.- Overrides:
getMarginLeft
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getMarginRight
public java.lang.String getMarginRight()
Gets themarginRight
style attribute.- Overrides:
getMarginRight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getMarginX
private java.lang.String getMarginX(java.lang.String superMarginX, StyleAttributes.Definition definition)
-
getMarginTop
public java.lang.String getMarginTop()
Gets themarginTop
style attribute.- Overrides:
getMarginTop
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getMaxHeight
public java.lang.String getMaxHeight()
- Overrides:
getMaxHeight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
maxHeight
-
getMaxWidth
public java.lang.String getMaxWidth()
- Overrides:
getMaxWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
maxWidth
-
getMinHeight
public java.lang.String getMinHeight()
- Overrides:
getMinHeight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
minHeight
-
getMinWidth
public java.lang.String getMinWidth()
- Overrides:
getMinWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
minWidth
-
getOpacity
public java.lang.String getOpacity()
Gets theopacity
style attribute.- Overrides:
getOpacity
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getOrphans
public java.lang.String getOrphans()
- Overrides:
getOrphans
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
orphans
-
getOutlineWidth
public java.lang.String getOutlineWidth()
- Overrides:
getOutlineWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
outlineWidth
-
getPadding
public java.lang.String getPadding()
- Overrides:
getPadding
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
padding
-
getPaddingBottom
public java.lang.String getPaddingBottom()
- Overrides:
getPaddingBottom
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
paddingBottom
-
getPaddingLeft
public java.lang.String getPaddingLeft()
- Overrides:
getPaddingLeft
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
paddingLeft
-
getPaddingRight
public java.lang.String getPaddingRight()
- Overrides:
getPaddingRight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
paddingRight
-
getPaddingTop
public java.lang.String getPaddingTop()
- Overrides:
getPaddingTop
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
paddingTop
-
getRight
public java.lang.String getRight()
- Overrides:
getRight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
right
-
getTextIndent
public java.lang.String getTextIndent()
- Overrides:
getTextIndent
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
textIndent
-
getTop
public java.lang.String getTop()
- Overrides:
getTop
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
top
-
getTop
public int getTop(boolean includeMargin, boolean includeBorder, boolean includePadding)
Returns the computed top (Y coordinate), relative to the node's parent's top edge.- Parameters:
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 calculation- Returns:
- the computed top (Y coordinate), relative to the node's parent's top edge
-
isBlock
private static boolean isBlock(java.lang.String display)
-
getTopWithInheritance
public java.lang.String getTopWithInheritance()
Returns the CSStop
attribute, replacing inherited values with the actual parent values.- Returns:
- the CSS
top
attribute, replacing inherited values with the actual parent values
-
getBottomWithInheritance
public java.lang.String getBottomWithInheritance()
Returns the CSSbottom
attribute, replacing inherited values with the actual parent values.- Returns:
- the CSS
bottom
attribute, replacing inherited values with the actual parent values
-
getVerticalAlign
public java.lang.String getVerticalAlign()
- Overrides:
getVerticalAlign
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
verticalAlign
-
getWidows
public java.lang.String getWidows()
- Overrides:
getWidows
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
widows
-
getWordSpacing
public java.lang.String getWordSpacing()
- Overrides:
getWordSpacing
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
wordSpacing
-
getZIndex
public java.lang.Object getZIndex()
Gets thezIndex
style attribute.- Overrides:
getZIndex
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getMarginLeftValue
public int getMarginLeftValue()
Gets the left margin of the element.- Returns:
- the value in pixels
-
getMarginRightValue
public int getMarginRightValue()
Gets the right margin of the element.- Returns:
- the value in pixels
-
getMarginTopValue
public int getMarginTopValue()
Gets the top margin of the element.- Returns:
- the value in pixels
-
getMarginBottomValue
public int getMarginBottomValue()
Gets the bottom margin of the element.- Returns:
- the value in pixels
-
getLeft
public int getLeft(boolean includeMargin, boolean includeBorder, boolean includePadding)
Returns the computed left (X coordinate), relative to the node's parent's left edge.- Parameters:
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 calculation- Returns:
- the computed left (X coordinate), relative to the node's parent's left edge
-
getPosition
public java.lang.String getPosition()
- Overrides:
getPosition
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
position
-
getPositionWithInheritance
public java.lang.String getPositionWithInheritance()
Returns the CSSposition
attribute, replacing inherited values with the actual parent values.- Returns:
- the CSS
position
attribute, replacing inherited values with the actual parent values
-
getLeftWithInheritance
public java.lang.String getLeftWithInheritance()
Returns the CSSleft
attribute, replacing inherited values with the actual parent values.- Returns:
- the CSS
left
attribute, replacing inherited values with the actual parent values
-
getRightWithInheritance
public java.lang.String getRightWithInheritance()
Returns the CSSright
attribute, replacing inherited values with the actual parent values.- Returns:
- the CSS
right
attribute, replacing inherited values with the actual parent values
-
getTopForAbsolutePositionWithInheritance
private int getTopForAbsolutePositionWithInheritance()
-
getCalculatedHeight
public int getCalculatedHeight(boolean includeBorder, boolean includePadding)
Returns the element's height, possibly including its padding and border.- Parameters:
includeBorder
- whether or not to include the border height in the returned valueincludePadding
- whether or not to include the padding height in the returned value- Returns:
- the element's height, possibly including its padding and border
-
getCalculatedHeight
private int getCalculatedHeight()
Returns the element's calculated height, taking both relevant CSS and the element's children into account.- Returns:
- the element's calculated height, taking both relevant CSS and the element's children into account
-
getCalculatedWidth
public int getCalculatedWidth(boolean includeBorder, boolean includePadding)
Returns the element's width in pixels, possibly including its padding and border.- Parameters:
includeBorder
- whether or not to include the border width in the returned valueincludePadding
- whether or not to include the padding width in the returned value- Returns:
- the element's width in pixels, possibly including its padding and border
-
getCalculatedWidth
private int getCalculatedWidth()
-
getContentWidth
public int getContentWidth()
Returns the total width of the element's children.- Returns:
- the total width of the element's children
-
getEmptyHeight
private int getEmptyHeight()
Returns the element's calculated height taking relevant CSS into account, but not the element's child elements.- Returns:
- the element's calculated height taking relevant CSS into account, but not the element's child elements
-
getContentHeight
public int getContentHeight()
Returns the total height of the element's children.- Returns:
- the total height of the element's children
-
isScrollable
public boolean isScrollable(boolean horizontal)
Returnstrue
if the element is scrollable along the specified axis.- Parameters:
horizontal
- iftrue
, the caller is interested in scrollability along the x-axis; iffalse
, the caller is interested in scrollability along the y-axis- Returns:
true
if the element is scrollable along the specified axis
-
isScrollable
private boolean isScrollable(boolean horizontal, boolean ignoreSize)
- Parameters:
ignoreSize
- whether to consider the content/calculated width/height
-
getBorderHorizontal
private int getBorderHorizontal()
-
getBorderVertical
private int getBorderVertical()
-
getBorderLeftValue
public int getBorderLeftValue()
Gets the size of the left border of the element.- Returns:
- the value in pixels
-
getBorderRightValue
public int getBorderRightValue()
Gets the size of the right border of the element.- Returns:
- the value in pixels
-
getBorderTopValue
public int getBorderTopValue()
Gets the size of the top border of the element.- Returns:
- the value in pixels
-
getBorderBottomValue
public int getBorderBottomValue()
Gets the size of the bottom border of the element.- Returns:
- the value in pixels
-
getPaddingHorizontal
private int getPaddingHorizontal()
-
getPaddingVertical
private int getPaddingVertical()
-
getPaddingLeftValue
public int getPaddingLeftValue()
Gets the left padding of the element.- Returns:
- the value in pixels
-
getPaddingRightValue
public int getPaddingRightValue()
Gets the right padding of the element.- Returns:
- the value in pixels
-
getPaddingTopValue
public int getPaddingTopValue()
Gets the top padding of the element.- Returns:
- the value in pixels
-
getPaddingBottomValue
public int getPaddingBottomValue()
Gets the bottom padding of the element.- Returns:
- the value in pixels
-
getCachedWidth
public java.lang.Integer getCachedWidth()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Returns:
- the cached width
-
setCachedWidth
public int setCachedWidth(int width)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Parameters:
width
- the new value- Returns:
- the param width
-
getCachedHeight
public java.lang.Integer getCachedHeight()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Returns:
- the cached height
-
setCachedHeight
public int setCachedHeight(int height)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Parameters:
height
- the new value- Returns:
- the param height
-
getCachedHeight2
public java.lang.Integer getCachedHeight2()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Returns:
- the cached height2
-
setCachedHeight2
public int setCachedHeight2(int height)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Parameters:
height
- the new value- Returns:
- the param height2
-
getCachedTop
public java.lang.Integer getCachedTop()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Returns:
- the cached top
-
setCachedTop
public void setCachedTop(java.lang.Integer top)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Parameters:
top
- the new value
-
getCachedPaddingHorizontal
public java.lang.Integer getCachedPaddingHorizontal()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Returns:
- the cached padding horizontal
-
setCachedPaddingHorizontal
public int setCachedPaddingHorizontal(int paddingHorizontal)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Parameters:
paddingHorizontal
- the new value- Returns:
- the param paddingHorizontal
-
getCachedPaddingVertical
public java.lang.Integer getCachedPaddingVertical()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Returns:
- the cached padding vertical
-
setCachedPaddingVertical
public int setCachedPaddingVertical(int paddingVertical)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Parameters:
paddingVertical
- the new value- Returns:
- the param paddingVertical
-
getCachedBorderHorizontal
public java.lang.Integer getCachedBorderHorizontal()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Returns:
- the cached border horizontal
-
setCachedBorderHorizontal
public int setCachedBorderHorizontal(int borderHorizontal)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Parameters:
borderHorizontal
- the new value- Returns:
- the param borderHorizontal
-
getCachedBorderVertical
public java.lang.Integer getCachedBorderVertical()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Returns:
- the cached border vertical
-
setCachedBorderVertical
public int setCachedBorderVertical(int borderVertical)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Parameters:
borderVertical
- the new value- Returns:
- the param borderVertical
-
applyStyleFromSelector
public void applyStyleFromSelector(org.htmlunit.cssparser.dom.CSSStyleDeclarationImpl declaration, org.htmlunit.cssparser.parser.selector.Selector selector)
Makes a local, "computed", modification to this CSS style.- Parameters:
declaration
- the style declarationselector
- the selector determining that the style applies to this element
-
applyLocalStyleAttribute
private void applyLocalStyleAttribute(java.lang.String name, java.lang.String newValue, java.lang.String priority, org.htmlunit.cssparser.parser.selector.SelectorSpecificity specificity)
-
setDefaultLocalStyleAttribute
public void setDefaultLocalStyleAttribute(java.lang.String name, java.lang.String newValue)
Makes a local, "computed", modification to this CSS style that won't override other style attributes of the same name. This method should be used to set default values for style attributes.- Parameters:
name
- the name of the style attribute to setnewValue
- the value of the style attribute to set
-
hasFeature
public boolean hasFeature(BrowserVersionFeatures property)
Indicates if the browser this is associated with has the feature.- Specified by:
hasFeature
in classAbstractCssStyleDeclaration
- Parameters:
property
- the property name- Returns:
false
if this browser doesn't have this feature
-
getBrowserVersion
public BrowserVersion getBrowserVersion()
- Specified by:
getBrowserVersion
in classAbstractCssStyleDeclaration
- Returns:
- the
BrowserVersion
-
isComputed
public boolean isComputed()
- Overrides:
isComputed
in classAbstractCssStyleDeclaration
- Returns:
- true if this is a computed style declaration
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
defaultIfEmpty
private java.lang.String defaultIfEmpty(java.lang.String str, StyleAttributes.Definition definition)
-
defaultIfEmpty
private java.lang.String defaultIfEmpty(java.lang.String str, StyleAttributes.Definition definition, boolean isPixel)
-
defaultIfEmpty
private java.lang.String defaultIfEmpty(java.lang.String str, java.lang.String toReturnIfEmptyOrDefault, java.lang.String defaultValue)
- Parameters:
toReturnIfEmptyOrDefault
- the value to return if empty or equals thedefaultValue
defaultValue
- the default value of the string- Returns:
- the string, or
toReturnIfEmptyOrDefault
-
pixelString
private static java.lang.String pixelString(java.lang.String value)
Returns the specified length value as a pixel length value. This method does NOT handle percentages correctly; use#pixelValue(Element, CssValue)
if you need percentage support).- Parameters:
value
- the length value to convert to a pixel length value- Returns:
- the specified length value as a pixel length value
- See Also:
#pixelString(Element, CSSStyleDeclaration.CssValue)
-
-