Module org.htmlunit

Class WrappedCssStyleDeclaration

java.lang.Object
org.htmlunit.css.AbstractCssStyleDeclaration
org.htmlunit.css.WrappedCssStyleDeclaration
All Implemented Interfaces:
Serializable

public class WrappedCssStyleDeclaration extends AbstractCssStyleDeclaration
A css StyleDeclaration backed by a CSSStyleDeclarationImpl.
Author:
Mike Bowler, Christian Sell, Daniel Gredler, Chris Erskine, Ahmed Ashour, Rodney Gitzel, Sudhan Moghe, Ronald Brill, Frank Danek, Dennis Duysak, cd alexndr
See Also:
  • Constructor Details

    • WrappedCssStyleDeclaration

      public WrappedCssStyleDeclaration(org.htmlunit.cssparser.dom.CSSStyleDeclarationImpl cssStyleDeclarationImpl, BrowserVersion browserVersion)
      Creates an instance which wraps the specified style declaration implementation.
      Parameters:
      cssStyleDeclarationImpl - the style declaration to wrap
      browserVersion - the BrowserVersion
  • Method Details

    • getStylePriority

      public String getStylePriority(String name)
      Returns the priority of the named style attribute, or an empty string if it is not found.
      Specified by:
      getStylePriority in class AbstractCssStyleDeclaration
      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 String getCssText()
      Returns the actual text of the style.
      Specified by:
      getCssText in class AbstractCssStyleDeclaration
      Returns:
      the actual text of the style
    • getStyleAttribute

      public String getStyleAttribute(String name)
      Get the value for the style attribute.
      Specified by:
      getStyleAttribute in class AbstractCssStyleDeclaration
      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 an overload in ComputedCssStyleDeclaration.
      Specified by:
      getStyleAttribute in class AbstractCssStyleDeclaration
      Parameters:
      definition - the definition
      getDefaultValueIfEmpty - whether to get the default value if empty or not
      Returns:
      the value
    • setCssText

      public void setCssText(String value)
      Sets the actual text of the style.
      Specified by:
      setCssText in class AbstractCssStyleDeclaration
      Parameters:
      value - the new text
    • setStyleAttribute

      public void setStyleAttribute(String name, String newValue, String important)
      Sets the specified style attribute.
      Specified by:
      setStyleAttribute in class AbstractCssStyleDeclaration
      Parameters:
      name - the attribute name (camel-cased)
      newValue - the attribute value
      important - important value
    • removeStyleAttribute

      public String removeStyleAttribute(String name)
      Removes the specified style attribute, returning the value of the removed attribute.
      Specified by:
      removeStyleAttribute in class AbstractCssStyleDeclaration
      Parameters:
      name - the attribute name (delimiter-separated, not camel-cased)
      Returns:
      the removed value
    • getLength

      public int getLength()
      Returns the length property.
      Specified by:
      getLength in class AbstractCssStyleDeclaration
      Returns:
      the length property
    • item

      public String item(int index)
      Returns the name of the CSS property at the specified index.
      Specified by:
      item in class AbstractCssStyleDeclaration
      Parameters:
      index - the index
      Returns:
      the name of the CSS property at the specified index
    • getParentRule

      public org.htmlunit.cssparser.dom.AbstractCSSRuleImpl getParentRule()
      Returns the CSSRule that is the parent of this style block or null if this CSSStyleDeclaration is not attached to a CSSRule.
      Specified by:
      getParentRule in class AbstractCssStyleDeclaration
      Returns:
      the CSSRule that is the parent of this style block or null if this CSSStyleDeclaration is not attached to a CSSRule
    • getStyleElement

      public StyleElement getStyleElement(String name)
      Determines the StyleElement for the given name.
      Specified by:
      getStyleElement in class AbstractCssStyleDeclaration
      Parameters:
      name - the name of the requested StyleElement
      Returns:
      the StyleElement or null if not found
    • getStyleElementCaseInSensitive

      public StyleElement getStyleElementCaseInSensitive(String name)
      Determines the StyleElement for the given name. This ignores the case of the name.
      Specified by:
      getStyleElementCaseInSensitive in class AbstractCssStyleDeclaration
      Parameters:
      name - the name of the requested StyleElement
      Returns:
      the StyleElement or null if not found
    • getStyleMap

      public Map<String,StyleElement> getStyleMap()
      Returns a sorted map containing style elements, keyed on style element name. We use a LinkedHashMap map so that results are deterministic and are thus testable.
      Specified by:
      getStyleMap in class AbstractCssStyleDeclaration
      Returns:
      a sorted map containing style elements, keyed on style element name
    • hasFeature

      public boolean hasFeature(BrowserVersionFeatures property)
      Indicates if the browser this is associated with has the feature.
      Specified by:
      hasFeature in class AbstractCssStyleDeclaration
      Parameters:
      property - the property name
      Returns:
      false if this browser doesn't have this feature
    • getBrowserVersion

      public BrowserVersion getBrowserVersion()
      Returns the the BrowserVersion.
      Specified by:
      getBrowserVersion in class AbstractCssStyleDeclaration
      Returns:
      the BrowserVersion