src/main/java/org/fit/layout/cssbox/CSSBoxTreeBuilder.java
protected BoxNode buildTree(ElementBox rootbox)
    {
        //create the working list of nodes
        log.trace("LIST");
        Vector<BoxNode> boxlist = new Vector<BoxNode>();
        order_counter = 1;
        createBoxList(rootbox, boxlist);
        
        //create the tree
        if (useVisualBounds)
        {
            //two-phase algorithm considering the visual bounds
            log.trace("A1");
            BoxNode root = createBoxTree(rootbox, boxlist, true, true, true); //create a nesting tree based on the content bounds
            System.out.println("ZOOM " + zoom);
            log.trace("A2");
            Color bg = rootbox.getBgcolor();
            if (bg == null) bg = Color.WHITE;
            computeBackgrounds(root, bg); //compute the efficient background colors
            log.trace("A2.5");
            root.recomputeVisualBounds(); //compute the visual bounds for the whole tree
            log.trace("A3");
            root = createBoxTree(rootbox, boxlist, true, true, preserveAux); //create the nesting tree based on the visual bounds or content bounds depending on the settings
            root.recomputeVisualBounds(); //compute the visual bounds for the whole tree
            root.recomputeBounds(); //compute the real bounds of each node
            log.trace("A4");
            //root.applyTransforms(); //TODO test this first; actually the transform should be applied according to the drawing tree, not this tree
            return root;
        }
        else
        {
            //simplified algorihm - use the original box nesting
            BoxNode root = createBoxTree(rootbox, boxlist, false, true, true);
            Color bg = rootbox.getBgcolor();
            if (bg == null) bg = Color.WHITE;
            computeBackgrounds(root, bg); //compute the efficient background colors
            root.recomputeVisualBounds(); //compute the visual bounds for the whole tree
            root.recomputeBounds(); //compute the real bounds of each node
            root.applyTransforms();
            return root;
        }
    }
protected BoxNode buildTree(ElementBox rootbox)
    {
        //create the working list of nodes
        log.trace("LIST");
        Vector<BoxNode> boxlist = new Vector<BoxNode>();
        order_counter = 1;
        createBoxList(rootbox, boxlist);
        
        //create the tree
        if (useVisualBounds)
        {
            //two-phase algorithm considering the visual bounds
            log.trace("A1");
            BoxNode root = createBoxTree(rootbox, boxlist, true, true, true); //create a nesting tree based on the content bounds
            System.out.println("ZOOM " + zoom);
            log.trace("A2");
            Color bg = rootbox.getBgcolor();
            if (bg == null) bg = Color.WHITE;
            computeBackgrounds(root, bg); //compute the efficient background colors
            log.trace("A2.5");
            root.recomputeVisualBounds(); //compute the visual bounds for the whole tree
            log.trace("A3");
            root = createBoxTree(rootbox, boxlist, true, true, preserveAux); //create the nesting tree based on the visual bounds or content bounds depending on the settings
            root.recomputeVisualBounds(); //compute the visual bounds for the whole tree
            root.recomputeBounds(); //compute the real bounds of each node
            log.trace("A4");
            //root.applyTransforms(); //TODO test this first; actually the transform should be applied according to the drawing tree, not this tree
            return root;
        }
        else
        {
            //simplified algorihm - use the original box nesting
            BoxNode root = createBoxTree(rootbox, boxlist, false, true, true);
            Color bg = rootbox.getBgcolor();
            if (bg == null) bg = Color.WHITE;
            computeBackgrounds(root, bg); //compute the efficient background colors
            root.recomputeVisualBounds(); //compute the visual bounds for the whole tree
            root.recomputeBounds(); //compute the real bounds of each node
            root.applyTransforms();
            return root;
        }
    }
===================================================================