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 IntegerThe computed, cached horizontal border (left + right) of the element to which this computed style belongs.private IntegerThe computed, cached vertical border (top + bottom) of the element to which this computed style belongs.private ElementCssStyleDeclarationThe wrapped CSSStyleDeclarationstatic final StringDenotes a value which should be returned as is.private IntegerThe computed, cached height of the element to which this computed style belongs (no padding, borders, etc.), taking child elements into account.private IntegerThe 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 IntegerThe computed, cached horizontal padding (left + right) of the element to which this computed style belongs.private IntegerThe computed, cached vertical padding (top + bottom) of the element to which this computed style belongs.private IntegerThe computed, cached top of the element to which this computed style belongs.private IntegerThe computed, cached width of the element to which this computed style belongs (no padding, borders, etc.). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidapplyLocalStyleAttribute(String name, String newValue, String priority, org.htmlunit.cssparser.parser.selector.SelectorSpecificity specificity) voidapplyStyleFromSelector(org.htmlunit.cssparser.dom.CSSStyleDeclarationImpl declaration, org.htmlunit.cssparser.parser.selector.Selector selector) Makes a local, "computed", modification to this CSS style.private StringdefaultIfEmpty(String str, String toReturnIfEmptyOrDefault, String defaultValue) private StringdefaultIfEmpty(String str, StyleAttributes.Definition definition) private StringdefaultIfEmpty(String str, StyleAttributes.Definition definition, boolean isPixel) Gets thebackgroundAttachmentstyle attribute.Gets thebackgroundColorstyle attribute.Gets thebackgroundImagestyle attribute.Gets thebackgroundPositionstyle attribute.Gets thebackgroundRepeatstyle attribute.Gets theborderBottomColorstyle attribute.Gets theborderBottomStylestyle attribute.intGets the size of the bottom border of the element.Gets theborderBottomWidthstyle attribute.private intGets theborderLeftColorstyle attribute.Gets theborderLeftStylestyle attribute.intGets the size of the left border of the element.Gets theborderLeftWidthstyle attribute.Gets theborderRightColorstyle attribute.Gets theborderRightStylestyle attribute.intGets the size of the right border of the element.Gets theborderRightWidthstyle attribute.Gets theborderTopColorstyle attribute.Gets theborderTopStylestyle attribute.intGets the size of the top border of the element.Gets theborderTopWidthstyle attribute.private intGets thebottomstyle attribute.Returns the CSSbottomattribute, 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 intReturns the element's calculated height, taking both relevant CSS and the element's children into account.intgetCalculatedHeight(boolean includeBorder, boolean includePadding) Returns the element's height, possibly including its padding and border.private intintgetCalculatedWidth(boolean includeBorder, boolean includePadding) Returns the element's width in pixels, possibly including its padding and border.getColor()Gets thecolorstyle attribute.intReturns the total height of the element's children.intReturns the total width of the element's children.Gets thecssFloatstyle attribute.Returns the actual text of the style.Gets thedisplaystyle attribute.private intReturns the element's calculated height taking relevant CSS into account, but not the element's child elements.getFont()Gets thefontstyle attribute.Gets thefontFamilystyle attribute.Gets thefontSizestyle attribute.Gets theheightstyle attribute.getLeft()intgetLeft(boolean includeMargin, boolean includeBorder, boolean includePadding) Returns the computed left (X coordinate), relative to the node's parent's left edge.Returns the CSSleftattribute, replacing inherited values with the actual parent values.intReturns thelengthproperty.Gets themarginBottomstyle attribute.intGets the bottom margin of the element.Gets themarginLeftstyle attribute.intGets the left margin of the element.Gets themarginRightstyle attribute.intGets the right margin of the element.Gets themarginTopstyle attribute.intGets the top margin of the element.private StringgetMarginX(String superMarginX, StyleAttributes.Definition definition) Gets theopacitystyle attribute.intGets the bottom padding of the element.private intintGets the left padding of the element.intGets the right padding of the element.intGets the top padding of the element.private intorg.htmlunit.cssparser.dom.AbstractCSSRuleImplReturns the CSSRule that is the parent of this style block ornullif this CSSStyleDeclaration is not attached to a CSSRule.Returns the CSSpositionattribute, replacing inherited values with the actual parent values.getRight()Returns the CSSrightattribute, 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 StringgetStyleAttribute(StyleAttributes.Definition definition, String toReturnIfEmptyOrDefault, String defaultValue) private static StringgetStyleAttributeWorker(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()intgetTop(boolean includeMargin, boolean includeBorder, boolean includePadding) Returns the computed top (Y coordinate), relative to the node's parent's top edge.private intReturns the CSStopattribute, replacing inherited values with the actual parent values.getWidth()Gets thezIndexstyle attribute.booleanhasFeature(BrowserVersionFeatures property) Indicates if the browser this is associated with has the feature.private static booleanbooleanbooleanisScrollable(boolean horizontal) Returnstrueif the element is scrollable along the specified axis.private booleanisScrollable(boolean horizontal, boolean ignoreSize) item(int index) Returns the item in the given index.private static StringpixelString(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.intsetCachedBorderHorizontal(int borderHorizontal) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.intsetCachedBorderVertical(int borderVertical) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.intsetCachedHeight(int height) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.intsetCachedHeight2(int height) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.intsetCachedPaddingHorizontal(int paddingHorizontal) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.intsetCachedPaddingVertical(int paddingVertical) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.voidsetCachedTop(Integer top) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.intsetCachedWidth(int width) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.voidsetCssText(String value) Sets the actual text of the style.voidsetDefaultLocalStyleAttribute(String name, String newValue) Makes a local, "computed", modification to this CSS style that won't override other style attributes of the same name.voidsetStyleAttribute(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:
getStylePriorityin 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:
getCssTextin classAbstractCssStyleDeclaration- Returns:
- the actual text of the style
-
getStyleAttribute
Get the value for the style attribute.- Specified by:
getStyleAttributein 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:
getStyleAttributein 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 thedefaultValuedefaultValue- the default value of the string- Returns:
- the string, or
toReturnIfEmptyOrDefault
-
setCssText
Sets the actual text of the style.- Specified by:
setCssTextin classAbstractCssStyleDeclaration- Parameters:
value- the new text
-
setStyleAttribute
Sets the specified style attribute.- Specified by:
setStyleAttributein 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:
removeStyleAttributein classAbstractCssStyleDeclaration- Parameters:
name- the attribute name (delimiter-separated, not camel-cased)- Returns:
- the removed value
-
getLength
public int getLength()Returns thelengthproperty.- Specified by:
getLengthin classAbstractCssStyleDeclaration- Returns:
- the
lengthproperty
-
getWidth
- Overrides:
getWidthin classAbstractCssStyleDeclaration- Returns:
- the width
-
item
Returns the item in the given index.- Specified by:
itemin 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 ornullif this CSSStyleDeclaration is not attached to a CSSRule.- Specified by:
getParentRulein classAbstractCssStyleDeclaration- Returns:
- the CSSRule that is the parent of this style block or
nullif this CSSStyleDeclaration is not attached to a CSSRule
-
getStyleElement
Determines the StyleElement for the given name.- Specified by:
getStyleElementin 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:
getStyleElementCaseInSensitivein 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 aLinkedHashMapmap so that results are deterministic and are thus testable.- Specified by:
getStyleMapin classAbstractCssStyleDeclaration- Returns:
- a sorted map containing style elements, keyed on style element name
-
getDomElement
-
getBackgroundAttachment
Gets thebackgroundAttachmentstyle attribute.- Overrides:
getBackgroundAttachmentin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBackgroundColor
Gets thebackgroundColorstyle attribute.- Overrides:
getBackgroundColorin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBackgroundImage
Gets thebackgroundImagestyle attribute.- Overrides:
getBackgroundImagein classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBackgroundPosition
Gets thebackgroundPositionstyle attribute.- Overrides:
getBackgroundPositionin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBackgroundRepeat
Gets thebackgroundRepeatstyle attribute.- Overrides:
getBackgroundRepeatin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderBottomColor
Gets theborderBottomColorstyle attribute.- Overrides:
getBorderBottomColorin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderBottomStyle
Gets theborderBottomStylestyle attribute.- Overrides:
getBorderBottomStylein classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderBottomWidth
Gets theborderBottomWidthstyle attribute.- Overrides:
getBorderBottomWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderLeftColor
Gets theborderLeftColorstyle attribute.- Overrides:
getBorderLeftColorin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderLeftStyle
Gets theborderLeftStylestyle attribute.- Overrides:
getBorderLeftStylein classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderLeftWidth
Gets theborderLeftWidthstyle attribute.- Overrides:
getBorderLeftWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderRightColor
Gets theborderRightColorstyle attribute.- Overrides:
getBorderRightColorin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderRightStyle
Gets theborderRightStylestyle attribute.- Overrides:
getBorderRightStylein classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderRightWidth
Gets theborderRightWidthstyle attribute.- Overrides:
getBorderRightWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderTopColor
Gets theborderTopColorstyle attribute.- Overrides:
getBorderTopColorin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderTopStyle
Gets theborderTopStylestyle attribute.- Overrides:
getBorderTopStylein classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderTopWidth
Gets theborderTopWidthstyle attribute.- Overrides:
getBorderTopWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBottom
Description copied from class:AbstractCssStyleDeclarationGets thebottomstyle attribute.- Overrides:
getBottomin classAbstractCssStyleDeclaration- Returns:
- the bottom setting
-
getColor
Description copied from class:AbstractCssStyleDeclarationGets thecolorstyle attribute.- Overrides:
getColorin classAbstractCssStyleDeclaration- Returns:
- the color setting
-
getCssFloat
Gets thecssFloatstyle attribute.- Overrides:
getCssFloatin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getDisplay
Description copied from class:AbstractCssStyleDeclarationGets thedisplaystyle attribute.- Overrides:
getDisplayin classAbstractCssStyleDeclaration- Returns:
- the display setting
-
getFont
Description copied from class:AbstractCssStyleDeclarationGets thefontstyle attribute.- Overrides:
getFontin classAbstractCssStyleDeclaration- Returns:
- the font setting
-
getFontFamily
Description copied from class:AbstractCssStyleDeclarationGets thefontFamilystyle attribute.- Overrides:
getFontFamilyin classAbstractCssStyleDeclaration- Returns:
- the font family setting
-
getFontSize
Description copied from class:AbstractCssStyleDeclarationGets thefontSizestyle attribute.- Overrides:
getFontSizein classAbstractCssStyleDeclaration- Returns:
- the font size setting
-
getLineHeight
- Overrides:
getLineHeightin classAbstractCssStyleDeclaration- Returns:
- the style attribute
lineHeight
-
getHeight
Gets theheightstyle attribute.- Overrides:
getHeightin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getLeft
- Overrides:
getLeftin classAbstractCssStyleDeclaration- Returns:
- the style attribute
left
-
getLetterSpacing
- Overrides:
getLetterSpacingin classAbstractCssStyleDeclaration- Returns:
- the style attribute
letterSpacing
-
getMargin
- Overrides:
getMarginin classAbstractCssStyleDeclaration- Returns:
- the style attribute
margin
-
getMarginBottom
Gets themarginBottomstyle attribute.- Overrides:
getMarginBottomin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getMarginLeft
Gets themarginLeftstyle attribute.- Overrides:
getMarginLeftin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getMarginRight
Gets themarginRightstyle attribute.- Overrides:
getMarginRightin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getMarginX
-
getMarginTop
Gets themarginTopstyle attribute.- Overrides:
getMarginTopin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getMaxHeight
- Overrides:
getMaxHeightin classAbstractCssStyleDeclaration- Returns:
- the style attribute
maxHeight
-
getMaxWidth
- Overrides:
getMaxWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
maxWidth
-
getMinHeight
- Overrides:
getMinHeightin classAbstractCssStyleDeclaration- Returns:
- the style attribute
minHeight
-
getMinWidth
- Overrides:
getMinWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
minWidth
-
getOpacity
Gets theopacitystyle attribute.- Overrides:
getOpacityin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getOrphans
- Overrides:
getOrphansin classAbstractCssStyleDeclaration- Returns:
- the style attribute
orphans
-
getOutlineWidth
- Overrides:
getOutlineWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
outlineWidth
-
getPadding
- Overrides:
getPaddingin classAbstractCssStyleDeclaration- Returns:
- the style attribute
padding
-
getPaddingBottom
- Overrides:
getPaddingBottomin classAbstractCssStyleDeclaration- Returns:
- the style attribute
paddingBottom
-
getPaddingLeft
- Overrides:
getPaddingLeftin classAbstractCssStyleDeclaration- Returns:
- the style attribute
paddingLeft
-
getPaddingRight
- Overrides:
getPaddingRightin classAbstractCssStyleDeclaration- Returns:
- the style attribute
paddingRight
-
getPaddingTop
- Overrides:
getPaddingTopin classAbstractCssStyleDeclaration- Returns:
- the style attribute
paddingTop
-
getRight
- Overrides:
getRightin classAbstractCssStyleDeclaration- Returns:
- the style attribute
right
-
getTextIndent
- Overrides:
getTextIndentin classAbstractCssStyleDeclaration- Returns:
- the style attribute
textIndent
-
getTop
- Overrides:
getTopin 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 CSStopattribute, replacing inherited values with the actual parent values.- Returns:
- the CSS
topattribute, replacing inherited values with the actual parent values
-
getBottomWithInheritance
Returns the CSSbottomattribute, replacing inherited values with the actual parent values.- Returns:
- the CSS
bottomattribute, replacing inherited values with the actual parent values
-
getVerticalAlign
- Overrides:
getVerticalAlignin classAbstractCssStyleDeclaration- Returns:
- the style attribute
verticalAlign
-
getWidows
- Overrides:
getWidowsin classAbstractCssStyleDeclaration- Returns:
- the style attribute
widows
-
getWordSpacing
- Overrides:
getWordSpacingin classAbstractCssStyleDeclaration- Returns:
- the style attribute
wordSpacing
-
getZIndex
Gets thezIndexstyle attribute.- Overrides:
getZIndexin 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:
getPositionin classAbstractCssStyleDeclaration- Returns:
- the style attribute
position
-
getPositionWithInheritance
Returns the CSSpositionattribute, replacing inherited values with the actual parent values.- Returns:
- the CSS
positionattribute, replacing inherited values with the actual parent values
-
getLeftWithInheritance
Returns the CSSleftattribute, replacing inherited values with the actual parent values.- Returns:
- the CSS
leftattribute, replacing inherited values with the actual parent values
-
getRightWithInheritance
Returns the CSSrightattribute, replacing inherited values with the actual parent values.- Returns:
- the CSS
rightattribute, 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) Returnstrueif 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:
trueif 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:
hasFeaturein classAbstractCssStyleDeclaration- Parameters:
property- the property name- Returns:
falseif this browser doesn't have this feature
-
getBrowserVersion
- Specified by:
getBrowserVersionin classAbstractCssStyleDeclaration- Returns:
- the
BrowserVersion
-
isComputed
public boolean isComputed()- Overrides:
isComputedin classAbstractCssStyleDeclaration- Returns:
- true if this is a computed style declaration
-
toString
-
defaultIfEmpty
-
defaultIfEmpty
-
defaultIfEmpty
- Parameters:
toReturnIfEmptyOrDefault- the value to return if empty or equals thedefaultValuedefaultValue- 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; useif you need percentage support).invalid 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:
-