/**
  * Affected by pseudo name in ancestor.
  *
  * @param element the element
  * @param ancestor the ancestor
  * @param elementName the element name
  * @param elementId the element id
  * @param classArray the class array
  * @param pseudoName the pseudo name
  * @return true, if successful
  */
 public final boolean affectedByPseudoNameInAncestor(
     HTMLElementImpl element,
     HTMLElementImpl ancestor,
     String elementName,
     String elementId,
     String[] classArray,
     String pseudoName) {
   String elementTL = elementName.toLowerCase();
   Collection elementRules = this.rulesByElement.get(elementTL);
   if (elementRules != null) {
     Iterator i = elementRules.iterator();
     while (i.hasNext()) {
       StyleRuleInfo styleRuleInfo = (StyleRuleInfo) i.next();
       CSSStyleSheet styleSheet = styleRuleInfo.getStyleRule().getParentStyleSheet();
       if ((styleSheet != null) && styleSheet.getDisabled()) {
         continue;
       }
       if (styleRuleInfo.affectedByPseudoNameInAncestor(element, ancestor, pseudoName)) {
         return true;
       }
     }
   }
   elementRules = this.rulesByElement.get("*");
   if (elementRules != null) {
     Iterator i = elementRules.iterator();
     while (i.hasNext()) {
       StyleRuleInfo styleRuleInfo = (StyleRuleInfo) i.next();
       CSSStyleSheet styleSheet = styleRuleInfo.getStyleRule().getParentStyleSheet();
       if ((styleSheet != null) && styleSheet.getDisabled()) {
         continue;
       }
       if (styleRuleInfo.affectedByPseudoNameInAncestor(element, ancestor, pseudoName)) {
         return true;
       }
     }
   }
   if (classArray != null) {
     for (int cidx = 0; cidx < classArray.length; cidx++) {
       String className = classArray[cidx];
       String classNameTL = className.toLowerCase();
       Map<?, ?> classMaps = this.classMapsByElement.get(elementTL);
       if (classMaps != null) {
         Collection classRules = (Collection) classMaps.get(classNameTL);
         if (classRules != null) {
           Iterator i = classRules.iterator();
           while (i.hasNext()) {
             StyleRuleInfo styleRuleInfo = (StyleRuleInfo) i.next();
             CSSStyleSheet styleSheet = styleRuleInfo.getStyleRule().getParentStyleSheet();
             if ((styleSheet != null) && styleSheet.getDisabled()) {
               continue;
             }
             if (styleRuleInfo.affectedByPseudoNameInAncestor(element, ancestor, pseudoName)) {
               return true;
             }
           }
         }
       }
       classMaps = this.classMapsByElement.get("*");
       if (classMaps != null) {
         Collection classRules = (Collection) classMaps.get(classNameTL);
         if (classRules != null) {
           Iterator i = classRules.iterator();
           while (i.hasNext()) {
             StyleRuleInfo styleRuleInfo = (StyleRuleInfo) i.next();
             CSSStyleSheet styleSheet = styleRuleInfo.getStyleRule().getParentStyleSheet();
             if ((styleSheet != null) && styleSheet.getDisabled()) {
               continue;
             }
             if (styleRuleInfo.affectedByPseudoNameInAncestor(element, ancestor, pseudoName)) {
               return true;
             }
           }
         }
       }
     }
   }
   if (elementId != null) {
     Map<?, ?> idMaps = this.idMapsByElement.get(elementTL);
     if (idMaps != null) {
       String elementIdTL = elementId.toLowerCase();
       Collection idRules = (Collection) idMaps.get(elementIdTL);
       if (idRules != null) {
         Iterator i = idRules.iterator();
         while (i.hasNext()) {
           StyleRuleInfo styleRuleInfo = (StyleRuleInfo) i.next();
           CSSStyleSheet styleSheet = styleRuleInfo.getStyleRule().getParentStyleSheet();
           if ((styleSheet != null) && styleSheet.getDisabled()) {
             continue;
           }
           if (styleRuleInfo.affectedByPseudoNameInAncestor(element, ancestor, pseudoName)) {
             return true;
           }
         }
       }
     }
     idMaps = this.idMapsByElement.get("*");
     if (idMaps != null) {
       String elementIdTL = elementId.toLowerCase();
       Collection idRules = (Collection) idMaps.get(elementIdTL);
       if (idRules != null) {
         Iterator i = idRules.iterator();
         while (i.hasNext()) {
           StyleRuleInfo styleRuleInfo = (StyleRuleInfo) i.next();
           CSSStyleSheet styleSheet = styleRuleInfo.getStyleRule().getParentStyleSheet();
           if ((styleSheet != null) && styleSheet.getDisabled()) {
             continue;
           }
           if (styleRuleInfo.affectedByPseudoNameInAncestor(element, ancestor, pseudoName)) {
             return true;
           }
         }
       }
     }
   }
   return false;
 }
 /**
  * Gets the active style declarations.
  *
  * @param element the element
  * @param elementName the element name
  * @param elementId the element id
  * @param className the class name
  * @param pseudoNames the pseudo names
  * @return the active style declarations
  */
 public final Collection<CSSStyleDeclaration> getActiveStyleDeclarations(
     HTMLElementImpl element,
     String elementName,
     String elementId,
     String className,
     Set pseudoNames) {
   Collection<CSSStyleDeclaration> styleDeclarations = null;
   String elementTL = elementName.toLowerCase();
   Collection elementRules = this.rulesByElement.get(elementTL);
   if (elementRules != null) {
     Iterator i = elementRules.iterator();
     while (i.hasNext()) {
       StyleRuleInfo styleRuleInfo = (StyleRuleInfo) i.next();
       if (styleRuleInfo.isSelectorMatch(element, pseudoNames)) {
         CSSStyleRule styleRule = styleRuleInfo.getStyleRule();
         CSSStyleSheet styleSheet = styleRule.getParentStyleSheet();
         if ((styleSheet != null) && styleSheet.getDisabled()) {
           continue;
         }
         if (styleDeclarations == null) {
           styleDeclarations = new LinkedList<CSSStyleDeclaration>();
         }
         styleDeclarations.add(styleRule.getStyle());
       } else {
       }
     }
   }
   elementRules = this.rulesByElement.get("*");
   if (elementRules != null) {
     Iterator i = elementRules.iterator();
     while (i.hasNext()) {
       StyleRuleInfo styleRuleInfo = (StyleRuleInfo) i.next();
       if (styleRuleInfo.isSelectorMatch(element, pseudoNames)) {
         CSSStyleRule styleRule = styleRuleInfo.getStyleRule();
         CSSStyleSheet styleSheet = styleRule.getParentStyleSheet();
         if ((styleSheet != null) && styleSheet.getDisabled()) {
           continue;
         }
         if (styleDeclarations == null) {
           styleDeclarations = new LinkedList<CSSStyleDeclaration>();
         }
         styleDeclarations.add(styleRule.getStyle());
       }
     }
   }
   if (className != null) {
     String classNameTL = className.toLowerCase();
     Map<?, ?> classMaps = this.classMapsByElement.get(elementTL);
     if (classMaps != null) {
       Collection classRules = (Collection) classMaps.get(classNameTL);
       if (classRules != null) {
         Iterator i = classRules.iterator();
         while (i.hasNext()) {
           StyleRuleInfo styleRuleInfo = (StyleRuleInfo) i.next();
           if (styleRuleInfo.isSelectorMatch(element, pseudoNames)) {
             CSSStyleRule styleRule = styleRuleInfo.getStyleRule();
             CSSStyleSheet styleSheet = styleRule.getParentStyleSheet();
             if ((styleSheet != null) && styleSheet.getDisabled()) {
               continue;
             }
             if (styleDeclarations == null) {
               styleDeclarations = new LinkedList<CSSStyleDeclaration>();
             }
             styleDeclarations.add(styleRule.getStyle());
           }
         }
       }
     }
     classMaps = this.classMapsByElement.get("*");
     if (classMaps != null) {
       Collection classRules = (Collection) classMaps.get(classNameTL);
       if (classRules != null) {
         Iterator i = classRules.iterator();
         while (i.hasNext()) {
           StyleRuleInfo styleRuleInfo = (StyleRuleInfo) i.next();
           if (styleRuleInfo.isSelectorMatch(element, pseudoNames)) {
             CSSStyleRule styleRule = styleRuleInfo.getStyleRule();
             CSSStyleSheet styleSheet = styleRule.getParentStyleSheet();
             if ((styleSheet != null) && styleSheet.getDisabled()) {
               continue;
             }
             if (styleDeclarations == null) {
               styleDeclarations = new LinkedList<CSSStyleDeclaration>();
             }
             styleDeclarations.add(styleRule.getStyle());
           }
         }
       }
     }
   }
   if (elementId != null) {
     Map<?, ?> idMaps = this.idMapsByElement.get(elementTL);
     if (idMaps != null) {
       String elementIdTL = elementId.toLowerCase();
       Collection idRules = (Collection) idMaps.get(elementIdTL);
       if (idRules != null) {
         Iterator i = idRules.iterator();
         while (i.hasNext()) {
           StyleRuleInfo styleRuleInfo = (StyleRuleInfo) i.next();
           if (styleRuleInfo.isSelectorMatch(element, pseudoNames)) {
             CSSStyleRule styleRule = styleRuleInfo.getStyleRule();
             CSSStyleSheet styleSheet = styleRule.getParentStyleSheet();
             if ((styleSheet != null) && styleSheet.getDisabled()) {
               continue;
             }
             if (styleDeclarations == null) {
               styleDeclarations = new LinkedList<CSSStyleDeclaration>();
             }
             styleDeclarations.add(styleRule.getStyle());
           }
         }
       }
     }
     idMaps = this.idMapsByElement.get("*");
     if (idMaps != null) {
       String elementIdTL = elementId.toLowerCase();
       Collection idRules = (Collection) idMaps.get(elementIdTL);
       if (idRules != null) {
         Iterator i = idRules.iterator();
         while (i.hasNext()) {
           StyleRuleInfo styleRuleInfo = (StyleRuleInfo) i.next();
           if (styleRuleInfo.isSelectorMatch(element, pseudoNames)) {
             CSSStyleRule styleRule = styleRuleInfo.getStyleRule();
             CSSStyleSheet styleSheet = styleRule.getParentStyleSheet();
             if ((styleSheet != null) && styleSheet.getDisabled()) {
               continue;
             }
             if (styleDeclarations == null) {
               styleDeclarations = new LinkedList<CSSStyleDeclaration>();
             }
             styleDeclarations.add(styleRule.getStyle());
           }
         }
       }
     }
   }
   return styleDeclarations;
 }