protected DeclarationMap assingDeclarationsToDOM ( Document doc , MediaSpec media , final boolean inherit ) { // classify the rules classifyAllSheets ( media ) ; // resulting map DeclarationMap declarations = new DeclarationMap ( ) ; // if the holder is empty skip evaluation if ( rules != null && ! rules . isEmpty ( ) ) { Traversal < DeclarationMap > traversal = new Traversal < DeclarationMap > ( doc , ( Object ) rules , NodeFilter . SHOW_ELEMENT ) { protected void processNode ( DeclarationMap result , Node current , Object source ) { assignDeclarationsToElement ( result , walker , ( Element ) current , ( Holder ) source ) ; } } ; // list traversal will be enough if ( ! inherit ) traversal . listTraversal ( declarations ) ; // we will do level traversal to economize blind returning // in tree else traversal . levelTraversal ( declarations ) ; } return declarations ; }
Creates map of declarations assigned to each element of a DOM tree