XRLog.layout(Level.FINEST, "after layout: " + body_box);
XRLog.layout(Level.FINEST, "after layout: " + root);
    public void doActualLayout(Graphics g) {        //Uu.p("doActualLayout called");        this.removeAll();        if (g == null) {            return;        }        if (doc == null) {            return;        }// set up CSS        Context c = newContext(pageInfo, (Graphics2D) g);        synchronized (this) {            if (this.layout_context != null) this.layout_context.stopRendering();            this.layout_context = c;        }        c.setRenderQueue(queue);        setRenderWidth((int) c.getExtents().getWidth());        getRenderingContext().getTextRenderer().setupGraphics(c.getGraphics());//TODO: maybe temporary hack        if (c.getBlockFormattingContext() != null) c.popBFC();//we set one for the top level before        // do the actual layout//Uu.p("doing actual layout here");        Box root = Boxing.preLayout(c, new DomToplevelNode(doc));        setRootBox(root);        Boxing.realLayout(c, root, new DomToplevelNode(doc));//Uu.p("body box = " + body_box);        if (!c.isStylesAllPopped()) {            XRLog.layout(Level.SEVERE, "mismatch in style popping and pushing");        }        if (c.shouldStop()) {//interrupted layout            return;        }        XRLog.layout(Level.FINEST, "is a fixed child: " + body_box.isChildrenExceedBounds());// if there is a fixed child then we need to set opaque to false// so that the entire viewport will be repainted. this is slower// but that's the hit you get from using fixed layout        if (body_box.isChildrenExceedBounds()) {            super.setOpaque(false);        } else {            super.setOpaque(true);        }        getRenderingContext().setRootBox(body_box);        XRLog.layout(Level.FINEST, "after layout: " + body_box);        intrinsic_size = new Dimension(getContext().getMaxWidth(), body_box.height);        //Uu.p("intrinsic size = " + intrinsic_size);        if (intrinsic_size.width != this.getWidth()) {            //Uu.p("intrisic and this widths don't match: " + this.getSize() + " "  + intrinsic_size);            this.setPreferredSize(new Dimension(intrinsic_size.width, this.getHeight()));            //this.setPreferredSize(intrinsic_size);            this.revalidate();        }        // if doc is shorter than viewport        // then stretch canvas to fill viewport exactly        // then adjust the body element accordingly        if (enclosingScrollPane != null) {            if (intrinsic_size.height < enclosingScrollPane.getViewport().getHeight()) {                //Uu.p("int height is less than viewport height");                if (enclosingScrollPane.getViewport().getHeight() != this.getHeight()) {                    this.setPreferredSize(new Dimension(getWidth(), enclosingScrollPane.getViewport().getHeight()));                    this.revalidate();                }                //Uu.p("need to do the body hack");                if (body_box != null) {                    body_box.height = enclosingScrollPane.getViewport().getHeight();                    bodyExpandHack(body_box, body_box.height);                    intrinsic_size.height = body_box.height;                }            } else {  // if doc is taller than viewport                if (this.getHeight() != intrinsic_size.height) {                    this.setPreferredSize(new Dimension(getWidth(), intrinsic_size.height));                    this.revalidate();                }            }                                    // turn on simple scrolling mode if there's any fixed elements            if (body_box.isFixedDescendant()) {                // Uu.p("is fixed");                enclosingScrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE);            } else {                // Uu.p("is not fixed");                enclosingScrollPane.getViewport().setScrollMode(default_scroll_mode);            }        }        queue.dispatchRepaintEvent(new ReflowEvent(ReflowEvent.LAYOUT_COMPLETE));        this.fireDocumentLoaded();    }