Improve TextBrowser::setDocument()