Browser Rendering Pipeline (Critical Rendering Path)
Avoid 60fps-killing main-thread reflows by targeting compositor-only properties—every geometric DOM write forces Style, Layout, Paint, and Composite to re-run.
About this page
Frame Execution in Blink (16.6 ms at 60 Hz)
Observe which pipeline phases activate depending on the mutation type.
Script sets el.style.width = '320px'. The node is marked dirty for Style and Layout.
card.style.width = '320px';- dirtyFlags
- STYLE | LAYOUT | PAINT
- mainThread
- Blocked
- compositorThread
- Waiting
Under the Hood#
Blink executes frame rendering as a strict unidirectional pipeline from Style through Layout, Paint, Layerize, and Composite. Modifying geometry at Layout invalidates every downstream stage, whereas mutating transform or opacity updates a GPU compositor matrix directly without re-running Style, Layout, or Paint.
- Style (Recalc Style): Blink matches every node from DOM & CSSOM Construction against CSSOM rules (governed by CSS Cascade Layers) and computes resolved
ComputedStylevalues (unless skipped offscreen via content-visibility). - Layout (Reflow): The engine computes exact geometry (boxes,
x/ycoordinates, widths, heights) in theLayoutTree. - Paint: Emits a list of draw instructions (
DisplayItems: backgrounds, borders, glyphs) sorted by CSS Stacking Context, without rasterizing yet. - Composite: The
Compositor Threadsplits GPU Compositor Layers into tiles, rasterizes them on GPU, and appliestransform/opacitywithout blocking the main thread.
/* Triggers Layout -> Paint -> Composite (expensive on main thread) */
.drawer.open {
left: 0;
width: 320px;
}
/* Skips Layout and Paint; runs on Compositor Thread */
.drawer-fast.open {
transform: translate3d(0, 0, 0);
}| Mutated Property | Triggered Phases | Main Thread Cost |
|---|---|---|
width / top / margin | Style -> Layout -> Paint -> Composite | High |
background-color / box-shadow | Style -> Paint -> Composite | Medium |
transform / opacity | Composite only (if promoted layer) | Near zero |
Problem Genealogy#
- 1999 (DOM Level 1): Every DOM read/write triggers synchronous recalculations on a single thread, an architecture designed for static hypertext, later abused for interactive apps.
- 2008 (Hardware Acceleration): Separation of the
Compositor Threadto animate scrolling and transforms off the main thread. - 2021+ (RenderingNG): Modular pipeline architecture isolating each phase for parallel GPU rasterization.
Production Pitfalls#
- Layout Thrashing: Reading
element.offsetHeightimmediately after writingelement.style.widthinside aforloop forces a synchronous Layout on every iteration, turning a 16 ms frame budget into a 200 ms stall. - Layer Explosion: Applying
will-change: transformto hundreds of nodes exhausts mobile GPU VRAM and crashes tabs.
Where this connects
Prerequisites
DOM & CSSOM Construction
Style calculation requires parsed DOM and CSSOM trees before constructing the render tree.
GPU Compositor Layers and will-change
Delegates promoted element layers to the GPU compositor thread after paint and layerization.
Next & related
The Accessibility Tree and WAI-ARIA Semantics
CSS visibility (display: none, visibility: hidden) prunes nodes from the Accessibility Tree.
Core Web Vitals Mechanics (LCP, INP, CLS)
LCP, INP, and CLS directly measure paint timestamps, layout shifts, and next-frame presentation.
CSS Houdini @property
Type registration changes how the Style phase parses and interpolates custom properties.
DOM XSS Prevention with Trusted Types
DOM sinks invoke the HTML parser and script execution pipeline directly from JavaScript.
GPU Compositor Layers and will-change
Promotion happens after Paint during the Layerize phase prior to GPU upload.
IntersectionObserver and Asynchronous Visibility
IntersectionObserver computes intersections once per frame immediately after the Layout phase.
Layout Thrashing (Forced Synchronous Layout)
Thrashing stems from repeated invalidation of the Layout phase.
Render Tree & Layout
Layout is the geometry-solving stage inside the main-thread frame pipeline.
requestAnimationFrame & VSync
Mutations inside rAF are batched directly into the upcoming Style/Layout/Paint cycle.
Virtualized Lists & Windowing
Rendering 10,000+ DOM nodes chokes style recalculation and layout passes; windowing caps active nodes.
content-visibility & Skipping Offscreen Work
content-visibility: auto skips Layout and Paint for offscreen subtrees instead of running the full pipeline.
Mechanical Comparisons
- Contrasts Withcontent-visibility & Skipping Offscreen Work vs Browser Rendering Pipeline (Critical Rendering Path)
content-visibility: auto skips Layout and Paint for offscreen subtrees instead of running the full pipeline.