This page is for planning the new layout engine scheduled for NetSurf 4.0.
At the moment NetSurf can only run layout on the whole box tree. This happens every time the window width is changed, to let NetSurf reflow the content. There are some optimisations where the layout code knows if bits of the layout are fixed-width and won't be affected by a reflow.
Currently we don't handle partial layouts of sections of the box tree. For example, if a scroll:auto; is laid out to available width, and the contained content exceeds a specified height, a scrollbar needs to be inserted. This should cause the descendants to the scroll:auto; to be laid out to available width - scrollbar width.
Things that require the layout engine to be able to run on parts of an already-laid-out page are:
- New image fetched and it has width/height not specified in HTML or CSS
- Overflow scrollbar insertion affects available width
- Frame scrollbar insertion affects available width
- Dynamic CSS pseudo classes
Working out which bits of the page are affected by any given change may not be easy.