private BoxNode createBoxTree ( ElementBox rootbox , Vector < BoxNode > boxlist , boolean useBounds , boolean useVisualBounds , boolean preserveAux ) { //a working copy of the box list Vector < BoxNode > list = new Vector < BoxNode > ( boxlist ) ; //an artificial root node BoxNode root = new BoxNode ( rootbox , page , zoom ) ; root . setOrder ( 0 ) ; //detach the nodes from any old trees for ( BoxNode node : list ) node . removeFromTree ( ) ; //when working with visual bounds, remove the boxes that are not visually separated if ( ! preserveAux ) { for ( Iterator < BoxNode > it = list . iterator ( ) ; it . hasNext ( ) ; ) { BoxNode node = it . next ( ) ; if ( ! node . isVisuallySeparated ( ) || ! node . isVisible ( ) ) it . remove ( ) ; } } //let each node choose it's children - find the roots and parents for ( BoxNode node : list ) { if ( useBounds ) node . markNodesInside ( list , useVisualBounds ) ; else node . markChildNodes ( list ) ; } //choose the roots for ( Iterator < BoxNode > it = list . iterator ( ) ; it . hasNext ( ) ; ) { BoxNode node = it . next ( ) ; /*if (!full) //DEBUG { if (node.toString().contains("mediawiki") || node.toString().contains("globalWrapper")) System.out.println(node + " => " + node.nearestParent); }*/ if ( node . isRootNode ( ) ) { root . appendChild ( node ) ; it . remove ( ) ; } } //recursively choose the children for ( int i = 0 ; i < root . getChildCount ( ) ; i ++ ) ( ( BoxNode ) root . getChildAt ( i ) ) . takeChildren ( list ) ; return root ; }
Creates a tree of box nesting based on the content bounds of the boxes . This tree is only used for determining the backgrounds .