At the moment, the page is painted by walking the layout tree, and invoking paint calls if needed. This is fine, but having a paint tree that is constructed based on a layout tree is better for a few reasons:
- The paint tree can be individually optimized, for example if there are two overlapping background with the same size, only the last one is needed.
- The paint tree can be divided to compliment the tile-based rendering.
- Scrolling the page can reuse existing tiles that are painted using these paint nodes, and new tiles can be painted without losing the complete page.
Blocks #21.