Package org.htmlunit.css
Class ComputedCssStyleDeclaration
java.lang.Object
org.htmlunit.css.AbstractCssStyleDeclaration
org.htmlunit.css.ComputedCssStyleDeclaration
- All Implemented Interfaces:
Serializable
An object for a CSSStyleDeclaration, which is computed.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Integer
The computed, cached horizontal border (left + right) of the element to which this computed style belongs.private Integer
The computed, cached vertical border (top + bottom) of the element to which this computed style belongs.private ElementCssStyleDeclaration
The wrapped CSSStyleDeclarationstatic final String
Denotes a value which should be returned as is.private Integer
The computed, cached height of the element to which this computed style belongs (no padding, borders, etc.), taking child elements into account.private Integer
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 final Set
<StyleAttributes.Definition> The set of 'inheritable' definitions.private final SortedMap
<String, StyleElement> Local modifications maintained here rather than in the element.private Integer
The computed, cached horizontal padding (left + right) of the element to which this computed style belongs.private Integer
The computed, cached vertical padding (top + bottom) of the element to which this computed style belongs.private Integer
The computed, cached top of the element to which this computed style belongs.private Integer
The computed, cached width of the element to which this computed style belongs (no padding, borders, etc.). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
applyLocalStyleAttribute
(String name, String newValue, 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 String
defaultIfEmpty
(String str, String toReturnIfEmptyOrDefault, String defaultValue) private String
defaultIfEmpty
(String str, StyleAttributes.Definition definition) private String
defaultIfEmpty
(String str, StyleAttributes.Definition definition, boolean isPixel) Gets thebackgroundAttachment
style attribute.Gets thebackgroundColor
style attribute.Gets thebackgroundImage
style attribute.Gets thebackgroundPosition
style attribute.Gets thebackgroundRepeat
style attribute.Gets theborderBottomColor
style attribute.Gets theborderBottomStyle
style attribute.int
Gets the size of the bottom border of the element.Gets theborderBottomWidth
style attribute.private int
Gets theborderLeftColor
style attribute.Gets theborderLeftStyle
style attribute.int
Gets the size of the left border of the element.Gets theborderLeftWidth
style attribute.Gets theborderRightColor
style attribute.Gets theborderRightStyle
style attribute.int
Gets the size of the right border of the element.Gets theborderRightWidth
style attribute.Gets theborderTopColor
style attribute.Gets theborderTopStyle
style attribute.int
Gets the size of the top border of the element.Gets theborderTopWidth
style attribute.private int
Gets thebottom
style attribute.Returns the CSSbottom
attribute, replacing inherited values with the actual parent values.INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.private int
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
int
getCalculatedWidth
(boolean includeBorder, boolean includePadding) Returns the element's width in pixels, possibly including its padding and border.getColor()
Gets thecolor
style attribute.int
Returns the total height of the element's children.int
Returns the total width of the element's children.Gets thecssFloat
style attribute.Returns the actual text of the style.Gets thedisplay
style attribute.private int
Returns the element's calculated height taking relevant CSS into account, but not the element's child elements.getFont()
Gets thefont
style attribute.Gets thefontFamily
style attribute.Gets thefontSize
style attribute.Gets theheight
style attribute.getLeft()
int
getLeft
(boolean includeMargin, boolean includeBorder, boolean includePadding) Returns the computed left (X coordinate), relative to the node's parent's left edge.Returns the CSSleft
attribute, replacing inherited values with the actual parent values.int
Returns thelength
property.Gets themarginBottom
style attribute.int
Gets the bottom margin of the element.Gets themarginLeft
style attribute.int
Gets the left margin of the element.Gets themarginRight
style attribute.int
Gets the right margin of the element.Gets themarginTop
style attribute.int
Gets the top margin of the element.private String
getMarginX
(String superMarginX, StyleAttributes.Definition definition) Gets theopacity
style attribute.int
Gets the bottom padding of the element.private int
int
Gets the left padding of the element.int
Gets the right padding of the element.int
Gets the top padding of the element.private int
org.htmlunit.cssparser.dom.AbstractCSSRuleImpl
Returns the CSSRule that is the parent of this style block ornull
if this CSSStyleDeclaration is not attached to a CSSRule.Returns the CSSposition
attribute, replacing inherited values with the actual parent values.getRight()
Returns the CSSright
attribute, replacing inherited values with the actual parent values.getStyleAttribute
(String name) Get the value for the style attribute.getStyleAttribute
(StyleAttributes.Definition definition, boolean getDefaultValueIfEmpty) Get the value for the style attribute.private String
getStyleAttribute
(StyleAttributes.Definition definition, String toReturnIfEmptyOrDefault, String defaultValue) private static String
getStyleAttributeWorker
(StyleAttributes.Definition definition, boolean getDefaultValueIfEmpty, BrowserVersion browserVersion, boolean feature, boolean isDefInheritable, ComputedCssStyleDeclaration[] queue) getStyleElement
(String name) Determines the StyleElement for the given name.Determines the StyleElement for the given name.Returns a sorted map containing style elements, keyed on style element name.getStylePriority
(String name) Returns the priority of the named style attribute, or an empty string if it is not found.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
Returns the CSStop
attribute, replacing inherited values with the actual parent values.getWidth()
Gets thezIndex
style attribute.boolean
hasFeature
(BrowserVersionFeatures property) Indicates if the browser this is associated with has the feature.private static boolean
boolean
boolean
isScrollable
(boolean horizontal) Returnstrue
if the element is scrollable along the specified axis.private boolean
isScrollable
(boolean horizontal, boolean ignoreSize) item
(int index) Returns the item in the given index.private static String
pixelString
(String value) Returns the specified length value as a pixel length value.removeStyleAttribute
(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
(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
(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.toString()
Methods inherited from class org.htmlunit.css.AbstractCssStyleDeclaration
getBorderTop, getOutline, getRubyAlign, getSize, getStyleAttribute, getStyleAttribute, isLength
-
Field Details
-
INHERITABLE_DEFINITIONS
The set of 'inheritable' definitions. -
EMPTY_FINAL
Denotes a value which should be returned as is. -
width_
The computed, cached width of the element to which this computed style belongs (no padding, borders, etc.). -
height_
The computed, cached height of the element to which this computed style belongs (no padding, borders, etc.), taking child elements into account. -
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_
The computed, cached horizontal padding (left + right) of the element to which this computed style belongs. -
paddingVertical_
The computed, cached vertical padding (top + bottom) of the element to which this computed style belongs. -
borderHorizontal_
The computed, cached horizontal border (left + right) of the element to which this computed style belongs. -
borderVertical_
The computed, cached vertical border (top + bottom) of the element to which this computed style belongs. -
top_
The computed, cached top of the element to which this computed style belongs. -
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_
The wrapped CSSStyleDeclaration
-
-
Constructor Details
-
ComputedCssStyleDeclaration
-
-
Method Details
-
getStylePriority
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
Returns the actual text of the style.- Specified by:
getCssText
in classAbstractCssStyleDeclaration
- Returns:
- the actual text of the style
-
getStyleAttribute
Get the value for the style attribute.- Specified by:
getStyleAttribute
in classAbstractCssStyleDeclaration
- Parameters:
name
- the name- Returns:
- the value
-
getStyleAttribute
public 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 String getStyleAttributeWorker(StyleAttributes.Definition definition, boolean getDefaultValueIfEmpty, BrowserVersion browserVersion, boolean feature, boolean isDefInheritable, ComputedCssStyleDeclaration[] queue) -
getStyleAttribute
private String getStyleAttribute(StyleAttributes.Definition definition, String toReturnIfEmptyOrDefault, 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
Sets the actual text of the style.- Specified by:
setCssText
in classAbstractCssStyleDeclaration
- Parameters:
value
- the new text
-
setStyleAttribute
Sets the specified style attribute.- Specified by:
setStyleAttribute
in classAbstractCssStyleDeclaration
- Parameters:
name
- the attribute name (camel-cased)newValue
- the attribute valueimportant
- important value
-
removeStyleAttribute
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
- Overrides:
getWidth
in classAbstractCssStyleDeclaration
- Returns:
- the width
-
item
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
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
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
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
-
getBackgroundAttachment
Gets thebackgroundAttachment
style attribute.- Overrides:
getBackgroundAttachment
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBackgroundColor
Gets thebackgroundColor
style attribute.- Overrides:
getBackgroundColor
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBackgroundImage
Gets thebackgroundImage
style attribute.- Overrides:
getBackgroundImage
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBackgroundPosition
Gets thebackgroundPosition
style attribute.- Overrides:
getBackgroundPosition
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBackgroundRepeat
Gets thebackgroundRepeat
style attribute.- Overrides:
getBackgroundRepeat
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderBottomColor
Gets theborderBottomColor
style attribute.- Overrides:
getBorderBottomColor
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderBottomStyle
Gets theborderBottomStyle
style attribute.- Overrides:
getBorderBottomStyle
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderBottomWidth
Gets theborderBottomWidth
style attribute.- Overrides:
getBorderBottomWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderLeftColor
Gets theborderLeftColor
style attribute.- Overrides:
getBorderLeftColor
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderLeftStyle
Gets theborderLeftStyle
style attribute.- Overrides:
getBorderLeftStyle
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderLeftWidth
Gets theborderLeftWidth
style attribute.- Overrides:
getBorderLeftWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderRightColor
Gets theborderRightColor
style attribute.- Overrides:
getBorderRightColor
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderRightStyle
Gets theborderRightStyle
style attribute.- Overrides:
getBorderRightStyle
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderRightWidth
Gets theborderRightWidth
style attribute.- Overrides:
getBorderRightWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderTopColor
Gets theborderTopColor
style attribute.- Overrides:
getBorderTopColor
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderTopStyle
Gets theborderTopStyle
style attribute.- Overrides:
getBorderTopStyle
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBorderTopWidth
Gets theborderTopWidth
style attribute.- Overrides:
getBorderTopWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getBottom
Description copied from class:AbstractCssStyleDeclaration
Gets thebottom
style attribute.- Overrides:
getBottom
in classAbstractCssStyleDeclaration
- Returns:
- the bottom setting
-
getColor
Description copied from class:AbstractCssStyleDeclaration
Gets thecolor
style attribute.- Overrides:
getColor
in classAbstractCssStyleDeclaration
- Returns:
- the color setting
-
getCssFloat
Gets thecssFloat
style attribute.- Overrides:
getCssFloat
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getDisplay
Description copied from class:AbstractCssStyleDeclaration
Gets thedisplay
style attribute.- Overrides:
getDisplay
in classAbstractCssStyleDeclaration
- Returns:
- the display setting
-
getFont
Description copied from class:AbstractCssStyleDeclaration
Gets thefont
style attribute.- Overrides:
getFont
in classAbstractCssStyleDeclaration
- Returns:
- the font setting
-
getFontFamily
Description copied from class:AbstractCssStyleDeclaration
Gets thefontFamily
style attribute.- Overrides:
getFontFamily
in classAbstractCssStyleDeclaration
- Returns:
- the font family setting
-
getFontSize
Description copied from class:AbstractCssStyleDeclaration
Gets thefontSize
style attribute.- Overrides:
getFontSize
in classAbstractCssStyleDeclaration
- Returns:
- the font size setting
-
getLineHeight
- Overrides:
getLineHeight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
lineHeight
-
getHeight
Gets theheight
style attribute.- Overrides:
getHeight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getLeft
- Overrides:
getLeft
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
left
-
getLetterSpacing
- Overrides:
getLetterSpacing
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
letterSpacing
-
getMargin
- Overrides:
getMargin
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
margin
-
getMarginBottom
Gets themarginBottom
style attribute.- Overrides:
getMarginBottom
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getMarginLeft
Gets themarginLeft
style attribute.- Overrides:
getMarginLeft
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getMarginRight
Gets themarginRight
style attribute.- Overrides:
getMarginRight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getMarginX
-
getMarginTop
Gets themarginTop
style attribute.- Overrides:
getMarginTop
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getMaxHeight
- Overrides:
getMaxHeight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
maxHeight
-
getMaxWidth
- Overrides:
getMaxWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
maxWidth
-
getMinHeight
- Overrides:
getMinHeight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
minHeight
-
getMinWidth
- Overrides:
getMinWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
minWidth
-
getOpacity
Gets theopacity
style attribute.- Overrides:
getOpacity
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
-
getOrphans
- Overrides:
getOrphans
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
orphans
-
getOutlineWidth
- Overrides:
getOutlineWidth
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
outlineWidth
-
getPadding
- Overrides:
getPadding
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
padding
-
getPaddingBottom
- Overrides:
getPaddingBottom
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
paddingBottom
-
getPaddingLeft
- Overrides:
getPaddingLeft
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
paddingLeft
-
getPaddingRight
- Overrides:
getPaddingRight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
paddingRight
-
getPaddingTop
- Overrides:
getPaddingTop
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
paddingTop
-
getRight
- Overrides:
getRight
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
right
-
getTextIndent
- Overrides:
getTextIndent
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
textIndent
-
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
-
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
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
- Overrides:
getVerticalAlign
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
verticalAlign
-
getWidows
- Overrides:
getWidows
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
widows
-
getWordSpacing
- Overrides:
getWordSpacing
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
wordSpacing
-
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
- Overrides:
getPosition
in classAbstractCssStyleDeclaration
- Returns:
- the style attribute
position
-
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
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
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
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
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
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
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Returns:
- the cached top
-
setCachedTop
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.- Parameters:
top
- the new value
-
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
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
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
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
-
setDefaultLocalStyleAttribute
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
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
- 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
-
defaultIfEmpty
-
defaultIfEmpty
-
defaultIfEmpty
- Parameters:
toReturnIfEmptyOrDefault
- the value to return if empty or equals thedefaultValue
defaultValue
- the default value of the string- Returns:
- the string, or
toReturnIfEmptyOrDefault
-
pixelString
Returns the specified length value as a pixel length value. This method does NOT handle percentages correctly; useinvalid reference
#pixelValue(Element, CssValue)
- Parameters:
value
- the length value to convert to a pixel length value- Returns:
- the specified length value as a pixel length value
- See Also:
-