util: Add a new `tree` module to avoid duplicating pointer stitching.

Add some basic support to AbstractNode for it.
dom: Document the node structure better and remove the node pointer stitching routines
layout: Port the flow tree over to the new generic tree functions
layout: Remove duplicate methods from flows
dom: Remove duplicate methods from the DOM node type