Blink PrePaint: Fragment Traversal and Paint Property Tree Construction
Blink28629 Joulu 2025

Blink PrePaint: Fragment Traversal and Paint Property Tree Construction

The provided text explains the PrePaint phase within Blink’s rendering engine, a critical stage where the system prepares for visual output by invalidating old paint and building property trees. During this process, a tree walk traverses the layout and fragment trees to establish hierarchical relationships for CSS properties like transforms, clips, and effects. This traversal is optimized to skip clean subtrees, ensuring that only "dirty" elements or those affected by ancestor changes are processed. The system specifically manages complex scenarios such as block fragmentation and out-of-flow elements, ensuring they are correctly positioned within their containing blocks. Results are stored in FragmentData objects, which provide the essential coordinate and property state used by the subsequent Paint phase to generate display items. Ultimately, this phase bridges the gap between layout geometry and the final composited layers sent to the screen.