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.IntegerborderHorizontal_The computed, cached horizontal border (left + right) of the element to which this computed style belongs.private java.lang.IntegerborderVertical_The computed, cached vertical border (top + bottom) of the element to which this computed style belongs.private ElementCssStyleDeclarationelementStyleDeclaration_The wrapped CSSStyleDeclarationstatic java.lang.StringEMPTY_FINALDenotes a value which should be returned as is.private java.lang.Integerheight_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.Integerheight2_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_DEFINITIONSThe 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.IntegerpaddingHorizontal_The computed, cached horizontal padding (left + right) of the element to which this computed style belongs.private java.lang.IntegerpaddingVertical_The computed, cached vertical padding (top + bottom) of the element to which this computed style belongs.private java.lang.Integertop_The computed, cached top of the element to which this computed style belongs.private java.lang.Integerwidth_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 voidapplyLocalStyleAttribute(java.lang.String name, java.lang.String newValue, java.lang.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 java.lang.StringdefaultIfEmpty(java.lang.String str, java.lang.String toReturnIfEmptyOrDefault, java.lang.String defaultValue)private java.lang.StringdefaultIfEmpty(java.lang.String str, StyleAttributes.Definition definition)private java.lang.StringdefaultIfEmpty(java.lang.String str, StyleAttributes.Definition definition, boolean isPixel)java.lang.StringgetBackgroundAttachment()Gets thebackgroundAttachmentstyle attribute.java.lang.StringgetBackgroundColor()Gets thebackgroundColorstyle attribute.java.lang.StringgetBackgroundImage()Gets thebackgroundImagestyle attribute.java.lang.StringgetBackgroundPosition()Gets thebackgroundPositionstyle attribute.java.lang.StringgetBackgroundRepeat()Gets thebackgroundRepeatstyle attribute.java.lang.StringgetBorderBottomColor()Gets theborderBottomColorstyle attribute.java.lang.StringgetBorderBottomStyle()Gets theborderBottomStylestyle attribute.intgetBorderBottomValue()Gets the size of the bottom border of the element.java.lang.StringgetBorderBottomWidth()Gets theborderBottomWidthstyle attribute.private intgetBorderHorizontal()java.lang.StringgetBorderLeftColor()Gets theborderLeftColorstyle attribute.java.lang.StringgetBorderLeftStyle()Gets theborderLeftStylestyle attribute.intgetBorderLeftValue()Gets the size of the left border of the element.java.lang.StringgetBorderLeftWidth()Gets theborderLeftWidthstyle attribute.java.lang.StringgetBorderRightColor()Gets theborderRightColorstyle attribute.java.lang.StringgetBorderRightStyle()Gets theborderRightStylestyle attribute.intgetBorderRightValue()Gets the size of the right border of the element.java.lang.StringgetBorderRightWidth()Gets theborderRightWidthstyle attribute.java.lang.StringgetBorderTopColor()Gets theborderTopColorstyle attribute.java.lang.StringgetBorderTopStyle()Gets theborderTopStylestyle attribute.intgetBorderTopValue()Gets the size of the top border of the element.java.lang.StringgetBorderTopWidth()Gets theborderTopWidthstyle attribute.private intgetBorderVertical()java.lang.StringgetBottom()Gets thebottomstyle attribute.java.lang.StringgetBottomWithInheritance()Returns the CSSbottomattribute, replacing inherited values with the actual parent values.BrowserVersiongetBrowserVersion()java.lang.IntegergetCachedBorderHorizontal()INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.IntegergetCachedBorderVertical()INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.IntegergetCachedHeight()INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.IntegergetCachedHeight2()INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.IntegergetCachedPaddingHorizontal()INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.IntegergetCachedPaddingVertical()INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.IntegergetCachedTop()INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.java.lang.IntegergetCachedWidth()INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.private intgetCalculatedHeight()Returns 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 intgetCalculatedWidth()intgetCalculatedWidth(boolean includeBorder, boolean includePadding)Returns the element's width in pixels, possibly including its padding and border.java.lang.StringgetColor()Gets thecolorstyle attribute.intgetContentHeight()Returns the total height of the element's children.intgetContentWidth()Returns the total width of the element's children.java.lang.StringgetCssFloat()Gets thecssFloatstyle attribute.java.lang.StringgetCssText()Returns the actual text of the style.java.lang.StringgetDisplay()Gets thedisplaystyle attribute.DomElementgetDomElement()private intgetEmptyHeight()Returns the element's calculated height taking relevant CSS into account, but not the element's child elements.java.lang.StringgetFont()Gets thefontstyle attribute.java.lang.StringgetFontFamily()Gets thefontFamilystyle attribute.java.lang.StringgetFontSize()Gets thefontSizestyle attribute.java.lang.StringgetHeight()Gets theheightstyle attribute.java.lang.StringgetLeft()intgetLeft(boolean includeMargin, boolean includeBorder, boolean includePadding)Returns the computed left (X coordinate), relative to the node's parent's left edge.java.lang.StringgetLeftWithInheritance()Returns the CSSleftattribute, replacing inherited values with the actual parent values.intgetLength()Returns thelengthproperty.java.lang.StringgetLetterSpacing()java.lang.StringgetLineHeight()java.lang.StringgetMargin()java.lang.StringgetMarginBottom()Gets themarginBottomstyle attribute.intgetMarginBottomValue()Gets the bottom margin of the element.java.lang.StringgetMarginLeft()Gets themarginLeftstyle attribute.intgetMarginLeftValue()Gets the left margin of the element.java.lang.StringgetMarginRight()Gets themarginRightstyle attribute.intgetMarginRightValue()Gets the right margin of the element.java.lang.StringgetMarginTop()Gets themarginTopstyle attribute.intgetMarginTopValue()Gets the top margin of the element.private java.lang.StringgetMarginX(java.lang.String superMarginX, StyleAttributes.Definition definition)java.lang.StringgetMaxHeight()java.lang.StringgetMaxWidth()java.lang.StringgetMinHeight()java.lang.StringgetMinWidth()java.lang.StringgetOpacity()Gets theopacitystyle attribute.java.lang.StringgetOrphans()java.lang.StringgetOutlineWidth()java.lang.StringgetPadding()java.lang.StringgetPaddingBottom()intgetPaddingBottomValue()Gets the bottom padding of the element.private intgetPaddingHorizontal()java.lang.StringgetPaddingLeft()intgetPaddingLeftValue()Gets the left padding of the element.java.lang.StringgetPaddingRight()intgetPaddingRightValue()Gets the right padding of the element.java.lang.StringgetPaddingTop()intgetPaddingTopValue()Gets the top padding of the element.private intgetPaddingVertical()org.htmlunit.cssparser.dom.AbstractCSSRuleImplgetParentRule()Returns the CSSRule that is the parent of this style block ornullif this CSSStyleDeclaration is not attached to a CSSRule.java.lang.StringgetPosition()java.lang.StringgetPositionWithInheritance()Returns the CSSpositionattribute, replacing inherited values with the actual parent values.java.lang.StringgetRight()java.lang.StringgetRightWithInheritance()Returns the CSSrightattribute, replacing inherited values with the actual parent values.java.lang.StringgetStyleAttribute(java.lang.String name)Get the value for the style attribute.java.lang.StringgetStyleAttribute(StyleAttributes.Definition definition, boolean getDefaultValueIfEmpty)Get the value for the style attribute.private java.lang.StringgetStyleAttribute(StyleAttributes.Definition definition, java.lang.String toReturnIfEmptyOrDefault, java.lang.String defaultValue)private static java.lang.StringgetStyleAttributeWorker(StyleAttributes.Definition definition, boolean getDefaultValueIfEmpty, BrowserVersion browserVersion, boolean feature, boolean isDefInheritable, ComputedCssStyleDeclaration[] queue)StyleElementgetStyleElement(java.lang.String name)Determines the StyleElement for the given name.StyleElementgetStyleElementCaseInSensitive(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.StringgetStylePriority(java.lang.String name)Returns the priority of the named style attribute, or an empty string if it is not found.java.lang.StringgetTextIndent()java.lang.StringgetTop()intgetTop(boolean includeMargin, boolean includeBorder, boolean includePadding)Returns the computed top (Y coordinate), relative to the node's parent's top edge.private intgetTopForAbsolutePositionWithInheritance()java.lang.StringgetTopWithInheritance()Returns the CSStopattribute, replacing inherited values with the actual parent values.java.lang.StringgetVerticalAlign()java.lang.StringgetWidows()java.lang.StringgetWidth()java.lang.StringgetWordSpacing()java.lang.ObjectgetZIndex()Gets thezIndexstyle attribute.booleanhasFeature(BrowserVersionFeatures property)Indicates if the browser this is associated with has the feature.private static booleanisBlock(java.lang.String display)booleanisComputed()booleanisScrollable(boolean horizontal)Returnstrueif the element is scrollable along the specified axis.private booleanisScrollable(boolean horizontal, boolean ignoreSize)java.lang.Objectitem(int index)Returns the item in the given index.private static java.lang.StringpixelString(java.lang.String value)Returns the specified length value as a pixel length value.java.lang.StringremoveStyleAttribute(java.lang.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(java.lang.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(java.lang.String value)Sets the actual text of the style.voidsetDefaultLocalStyleAttribute(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.voidsetStyleAttribute(java.lang.String name, java.lang.String newValue, java.lang.String important)Sets the specified style attribute.java.lang.StringtoString()-
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:
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
public java.lang.String getCssText()
Returns the actual text of the style.- Specified by:
getCssTextin 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:
getStyleAttributein 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:
getStyleAttributein 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 thedefaultValuedefaultValue- 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:
setCssTextin 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:
setStyleAttributein 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:
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
public java.lang.String getWidth()
- Overrides:
getWidthin classAbstractCssStyleDeclaration- Returns:
- the width
-
item
public java.lang.Object item(int index)
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
public StyleElement getStyleElement(java.lang.String name)
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
public StyleElement getStyleElementCaseInSensitive(java.lang.String name)
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
public java.util.Map<java.lang.String,StyleElement> 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
public DomElement getDomElement()
-
getBackgroundAttachment
public java.lang.String getBackgroundAttachment()
Gets thebackgroundAttachmentstyle attribute.- Overrides:
getBackgroundAttachmentin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBackgroundColor
public java.lang.String getBackgroundColor()
Gets thebackgroundColorstyle attribute.- Overrides:
getBackgroundColorin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBackgroundImage
public java.lang.String getBackgroundImage()
Gets thebackgroundImagestyle attribute.- Overrides:
getBackgroundImagein classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBackgroundPosition
public java.lang.String getBackgroundPosition()
Gets thebackgroundPositionstyle attribute.- Overrides:
getBackgroundPositionin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBackgroundRepeat
public java.lang.String getBackgroundRepeat()
Gets thebackgroundRepeatstyle attribute.- Overrides:
getBackgroundRepeatin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderBottomColor
public java.lang.String getBorderBottomColor()
Gets theborderBottomColorstyle attribute.- Overrides:
getBorderBottomColorin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderBottomStyle
public java.lang.String getBorderBottomStyle()
Gets theborderBottomStylestyle attribute.- Overrides:
getBorderBottomStylein classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderBottomWidth
public java.lang.String getBorderBottomWidth()
Gets theborderBottomWidthstyle attribute.- Overrides:
getBorderBottomWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderLeftColor
public java.lang.String getBorderLeftColor()
Gets theborderLeftColorstyle attribute.- Overrides:
getBorderLeftColorin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderLeftStyle
public java.lang.String getBorderLeftStyle()
Gets theborderLeftStylestyle attribute.- Overrides:
getBorderLeftStylein classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderLeftWidth
public java.lang.String getBorderLeftWidth()
Gets theborderLeftWidthstyle attribute.- Overrides:
getBorderLeftWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderRightColor
public java.lang.String getBorderRightColor()
Gets theborderRightColorstyle attribute.- Overrides:
getBorderRightColorin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderRightStyle
public java.lang.String getBorderRightStyle()
Gets theborderRightStylestyle attribute.- Overrides:
getBorderRightStylein classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderRightWidth
public java.lang.String getBorderRightWidth()
Gets theborderRightWidthstyle attribute.- Overrides:
getBorderRightWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderTopColor
public java.lang.String getBorderTopColor()
Gets theborderTopColorstyle attribute.- Overrides:
getBorderTopColorin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderTopStyle
public java.lang.String getBorderTopStyle()
Gets theborderTopStylestyle attribute.- Overrides:
getBorderTopStylein classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBorderTopWidth
public java.lang.String getBorderTopWidth()
Gets theborderTopWidthstyle attribute.- Overrides:
getBorderTopWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getBottom
public java.lang.String getBottom()
Description copied from class:AbstractCssStyleDeclarationGets thebottomstyle attribute.- Overrides:
getBottomin classAbstractCssStyleDeclaration- Returns:
- the bottom setting
-
getColor
public java.lang.String getColor()
Description copied from class:AbstractCssStyleDeclarationGets thecolorstyle attribute.- Overrides:
getColorin classAbstractCssStyleDeclaration- Returns:
- the color setting
-
getCssFloat
public java.lang.String getCssFloat()
Gets thecssFloatstyle attribute.- Overrides:
getCssFloatin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getDisplay
public java.lang.String getDisplay()
Description copied from class:AbstractCssStyleDeclarationGets thedisplaystyle attribute.- Overrides:
getDisplayin classAbstractCssStyleDeclaration- Returns:
- the display setting
-
getFont
public java.lang.String getFont()
Description copied from class:AbstractCssStyleDeclarationGets thefontstyle attribute.- Overrides:
getFontin classAbstractCssStyleDeclaration- Returns:
- the font setting
-
getFontFamily
public java.lang.String getFontFamily()
Description copied from class:AbstractCssStyleDeclarationGets thefontFamilystyle attribute.- Overrides:
getFontFamilyin classAbstractCssStyleDeclaration- Returns:
- the font family setting
-
getFontSize
public java.lang.String getFontSize()
Description copied from class:AbstractCssStyleDeclarationGets thefontSizestyle attribute.- Overrides:
getFontSizein classAbstractCssStyleDeclaration- Returns:
- the font size setting
-
getLineHeight
public java.lang.String getLineHeight()
- Overrides:
getLineHeightin classAbstractCssStyleDeclaration- Returns:
- the style attribute
lineHeight
-
getHeight
public java.lang.String getHeight()
Gets theheightstyle attribute.- Overrides:
getHeightin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getLeft
public java.lang.String getLeft()
- Overrides:
getLeftin classAbstractCssStyleDeclaration- Returns:
- the style attribute
left
-
getLetterSpacing
public java.lang.String getLetterSpacing()
- Overrides:
getLetterSpacingin classAbstractCssStyleDeclaration- Returns:
- the style attribute
letterSpacing
-
getMargin
public java.lang.String getMargin()
- Overrides:
getMarginin classAbstractCssStyleDeclaration- Returns:
- the style attribute
margin
-
getMarginBottom
public java.lang.String getMarginBottom()
Gets themarginBottomstyle attribute.- Overrides:
getMarginBottomin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getMarginLeft
public java.lang.String getMarginLeft()
Gets themarginLeftstyle attribute.- Overrides:
getMarginLeftin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getMarginRight
public java.lang.String getMarginRight()
Gets themarginRightstyle attribute.- Overrides:
getMarginRightin 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 themarginTopstyle attribute.- Overrides:
getMarginTopin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getMaxHeight
public java.lang.String getMaxHeight()
- Overrides:
getMaxHeightin classAbstractCssStyleDeclaration- Returns:
- the style attribute
maxHeight
-
getMaxWidth
public java.lang.String getMaxWidth()
- Overrides:
getMaxWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
maxWidth
-
getMinHeight
public java.lang.String getMinHeight()
- Overrides:
getMinHeightin classAbstractCssStyleDeclaration- Returns:
- the style attribute
minHeight
-
getMinWidth
public java.lang.String getMinWidth()
- Overrides:
getMinWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
minWidth
-
getOpacity
public java.lang.String getOpacity()
Gets theopacitystyle attribute.- Overrides:
getOpacityin classAbstractCssStyleDeclaration- Returns:
- the style attribute
-
getOrphans
public java.lang.String getOrphans()
- Overrides:
getOrphansin classAbstractCssStyleDeclaration- Returns:
- the style attribute
orphans
-
getOutlineWidth
public java.lang.String getOutlineWidth()
- Overrides:
getOutlineWidthin classAbstractCssStyleDeclaration- Returns:
- the style attribute
outlineWidth
-
getPadding
public java.lang.String getPadding()
- Overrides:
getPaddingin classAbstractCssStyleDeclaration- Returns:
- the style attribute
padding
-
getPaddingBottom
public java.lang.String getPaddingBottom()
- Overrides:
getPaddingBottomin classAbstractCssStyleDeclaration- Returns:
- the style attribute
paddingBottom
-
getPaddingLeft
public java.lang.String getPaddingLeft()
- Overrides:
getPaddingLeftin classAbstractCssStyleDeclaration- Returns:
- the style attribute
paddingLeft
-
getPaddingRight
public java.lang.String getPaddingRight()
- Overrides:
getPaddingRightin classAbstractCssStyleDeclaration- Returns:
- the style attribute
paddingRight
-
getPaddingTop
public java.lang.String getPaddingTop()
- Overrides:
getPaddingTopin classAbstractCssStyleDeclaration- Returns:
- the style attribute
paddingTop
-
getRight
public java.lang.String getRight()
- Overrides:
getRightin classAbstractCssStyleDeclaration- Returns:
- the style attribute
right
-
getTextIndent
public java.lang.String getTextIndent()
- Overrides:
getTextIndentin classAbstractCssStyleDeclaration- Returns:
- the style attribute
textIndent
-
getTop
public java.lang.String 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
private static boolean isBlock(java.lang.String display)
-
getTopWithInheritance
public java.lang.String 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
public java.lang.String 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
public java.lang.String getVerticalAlign()
- Overrides:
getVerticalAlignin classAbstractCssStyleDeclaration- Returns:
- the style attribute
verticalAlign
-
getWidows
public java.lang.String getWidows()
- Overrides:
getWidowsin classAbstractCssStyleDeclaration- Returns:
- the style attribute
widows
-
getWordSpacing
public java.lang.String getWordSpacing()
- Overrides:
getWordSpacingin classAbstractCssStyleDeclaration- Returns:
- the style attribute
wordSpacing
-
getZIndex
public java.lang.Object 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
public java.lang.String getPosition()
- Overrides:
getPositionin classAbstractCssStyleDeclaration- Returns:
- the style attribute
position
-
getPositionWithInheritance
public java.lang.String 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
public java.lang.String 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
public java.lang.String 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
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:
hasFeaturein classAbstractCssStyleDeclaration- Parameters:
property- the property name- Returns:
falseif this browser doesn't have this feature
-
getBrowserVersion
public BrowserVersion 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
public java.lang.String toString()
- Overrides:
toStringin 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 thedefaultValuedefaultValue- 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)
-
-