Search in sources :

Example 1 with SelectorSpecificity

use of com.gargoylesoftware.css.parser.selector.SelectorSpecificity in project htmlunit by HtmlUnit.

the class ComputedCSSStyleDeclaration method applyStyleFromSelector.

/**
 * Makes a local, "computed", modification to this CSS style.
 *
 * @param declaration the style declaration
 * @param selector the selector determining that the style applies to this element
 */
public void applyStyleFromSelector(final CSSStyleDeclarationImpl declaration, final Selector selector) {
    final SelectorSpecificity specificity = selector.getSelectorSpecificity();
    for (final Property prop : declaration.getProperties()) {
        final String name = prop.getName();
        final String value = declaration.getPropertyValue(name);
        final String priority = declaration.getPropertyPriority(name);
        applyLocalStyleAttribute(name, value, priority, specificity);
    }
}
Also used : SelectorSpecificity(com.gargoylesoftware.css.parser.selector.SelectorSpecificity) AttributedString(java.text.AttributedString) Property(com.gargoylesoftware.css.dom.Property)

Aggregations

Property (com.gargoylesoftware.css.dom.Property)1 SelectorSpecificity (com.gargoylesoftware.css.parser.selector.SelectorSpecificity)1 AttributedString (java.text.AttributedString)1