int view_height = this.enclosingScrollPane.getViewport().getHeight();
if(enclosingScrollPane != null) {  int view_height = this.enclosingScrollPane.getViewport().getHeight();
    protected void startLayout(Graphics g) {        this.removeAll();        if ( g == null ) {            return;        }        if ( doc == null ) {            return;        }        Element html = (Element)doc.getDocumentElement();        Element body = x.child( html, "body" );        body = html;        newContext( g );        // set up CSS        c.setMaxWidth( 0 );        long start_time = new java.util.Date().getTime();                body_box = layout.layout( c, body );        long end_time = new java.util.Date().getTime();        if ( enclosingScrollPane != null ) {            if ( this.body_box != null ) {                this.enclosingScrollPane.getViewport().setBackground( body_box.background_color );            }        }        intrinsic_size = new Dimension( c.getMaxWidth(), layout.contents_height );        int view_height = this.enclosingScrollPane.getViewport().getHeight();                // resize the outter most box incase it is too small for the viewport        if(intrinsic_size.getHeight() < view_height) {            if(body_box != null) {                body_box.height = view_height;            }        }                if ( !intrinsic_size.equals( this.getSize() ) ) {            this.setPreferredSize( intrinsic_size );            this.revalidate();        }        this.fireDocumentLoaded();    }