/** * Computes the style of an element with an eventual pseudo element for the given media. * @param el The DOM element. * @param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after). * @param media Used media specification. * @return The relevant declarations from the registered style sheets. */ public NodeData getElementStyle(Element el, PseudoElement pseudo, MediaSpec media) { if (rules == null) classifyAllSheets(media); List<Declaration> decls = getDeclarationsForElement(el, pseudo, rules); NodeData main = CSSFactory.createNodeData(); for (Declaration d : decls) main.push(d); return main; }
/** * Computes the style of an element with an eventual pseudo element for the given media. * @param el The DOM element. * @param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after). * @param media Used media name (e.g. "screen" or "all") * @return The relevant declarations from the registered style sheets. */ public NodeData getElementStyle(Element el, PseudoDeclaration pseudo, String media) { return getElementStyle(el, pseudo, new MediaSpec(media)); }
/** * Computes the style of an element with an eventual pseudo element for the given media. * @param el The DOM element. * @param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after). * @param media Used media specification. * @return The relevant declarations from the registered style sheets. */ public NodeData getElementStyle(Element el, PseudoDeclaration pseudo, MediaSpec media) { final OrderedRule[] applicableRules = AnalyzerUtil.getApplicableRules(sheets, el, media); return AnalyzerUtil.getElementStyle(el, pseudo, getElementMatcher(), getMatchCondition(), applicableRules); }
if (!matchSelector(s, e)) { log.trace("CombinedSelector \"{}\" NOT matched!", s); continue;
private boolean nodeSelectorMatches(final Selector s, final Node n) { if (n.getNodeType() == Node.ELEMENT_NODE) { final Element e = (Element) n; final MatchCondition matchCond = this.getMatchCondition(); return matchCond == null ? s.matches(e) : s.matches(e, matchCond); } else { return false; } }
/** * Computes the style of an element with an eventual pseudo element for the given media. * @param el The DOM element. * @param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after). * @param media Used media name (e.g. "screen" or "all") * @return The relevant declarations from the registered style sheets. */ public NodeData getElementStyle(Element el, PseudoDeclaration pseudo, String media) { Holder holder; if (UNIVERSAL_HOLDER.equals(media)) holder = rules.get(UNIVERSAL_HOLDER); else holder = Holder.union(rules.get(UNIVERSAL_HOLDER), rules.get(media)); List<Declaration> decls = getDeclarationsForElement(el, pseudo, holder); NodeData main = CSSFactory.createNodeData(); for (Declaration d : decls) main.push(d); return main; }
retval = this.elementSelectorMatches(s, current); } else if (combinator == Selector.Combinator.ADJACENT) { Node adjacent = current; retval = this.elementSelectorMatches(s, current); if (this.nodeSelectorMatches(s, preceding)) if (this.nodeSelectorMatches(s, ancestor)) retval = this.elementSelectorMatches(s, current);
if (!matchSelector(s, e)) { log.trace("CombinedSelector \"{}\" NOT matched!", s); continue;
/** * Computes the style of an element with an eventual pseudo element for the given media. * @param el The DOM element. * @param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after). * @param media Used media specification. * @return The relevant declarations from the registered style sheets. */ public NodeData getElementStyle(Element el, PseudoElementType pseudo, MediaSpec media) { final OrderedRule[] applicableRules = AnalyzerUtil.getApplicableRules(sheets, el, media); return AnalyzerUtil.getElementStyle(el, pseudo, getElementMatcher(), getMatchCondition(), applicableRules); }
/** * Computes the style of an element with an eventual pseudo element for the given media. * @param el The DOM element. * @param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after). * @param media Used media name (e.g. "screen" or "all") * @return The relevant declarations from the registered style sheets. */ public NodeData getElementStyle(Element el, PseudoElement pseudo, String media) { return getElementStyle(el, pseudo, new MediaSpec(media)); }
/** * Computes the style of an element with an eventual pseudo element for the given media. * @param el The DOM element. * @param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after). * @param media Used media name (e.g. "screen" or "all") * @return The relevant declarations from the registered style sheets. */ public NodeData getElementStyle(Element el, PseudoElementType pseudo, String media) { return getElementStyle(el, pseudo, new MediaSpec(media)); }