more systematic treatment of internal state, which belongs strictly to the main actor, not the Swing thread;
do not re-use mutable DOM -- avoid races wrt. the rendering engine;
more thorough resize -- always recalculate metrics/margin synchronously;
asynchronous setDocument;
tuned;