Rendering PipelineBaseline · Widely

Browser Rendering Pipeline (Critical Rendering Path)

Mental Model

The rendering engine executes five sequential phases: Style, Layout, Paint, Layerize, and Composite. Mutating geometric properties invalidates every downstream phase; mutating transform or opacity bypasses Style, Layout, and Paint directly to the Compositor Thread.

Interactive Simulator

Frame Execution in Blink (16.6 ms at 60 Hz)

Observe which pipeline phases activate depending on the mutation type.

JS
Style
Layout
Paint
Composite
Step 1 / 4: 1. JS Mutation (width)

Script sets el.style.width = '320px'. The node is marked dirty for Style and Layout.

card.style.width = '320px';
Internal State / Memory
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.

  1. Style (Recalc Style): Blink matches every node from DOM & CSSOM Construction against CSSOM rules (governed by CSS Cascade Layers) and computes resolved ComputedStyle values (unless skipped offscreen via content-visibility).
  2. Layout (Reflow): The engine computes exact geometry (boxes, x/y coordinates, widths, heights) in the LayoutTree.
  3. Paint: Emits a list of draw instructions (DisplayItems: backgrounds, borders, glyphs) sorted by CSS Stacking Context, without rasterizing yet.
  4. Composite: The Compositor Thread splits GPU Compositor Layers into tiles, rasterizes them on GPU, and applies transform / opacity without blocking the main thread.
CSS
/* 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 PropertyTriggered PhasesMain Thread Cost
width / top / marginStyle -> Layout -> Paint -> CompositeHigh
background-color / box-shadowStyle -> Paint -> CompositeMedium
transform / opacityComposite 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 Thread to animate scrolling and transforms off the main thread.
  • 2021+ (RenderingNG): Modular pipeline architecture isolating each phase for parallel GPU rasterization.

Production Pitfalls

Production Pitfall
  • Layout Thrashing: Reading element.offsetHeight immediately after writing element.style.width inside a for loop forces a synchronous Layout on every iteration, turning a 16 ms frame budget into a 200 ms stall.
  • Layer Explosion: Applying will-change: transform to hundreds of nodes exhausts mobile GPU VRAM and crashes tabs.
When Not to Use
  • When not to use manual promotion: Do not force translateZ(0) on static elements; let the engine promote layers only during active animations.

Connections & Logical Next Steps

What This UnlocksBaseline · Widely
The Accessibility Tree and WAI-ARIA Semantics
Security & Accessibility

CSS visibility (display: none, visibility: hidden) prunes nodes from the Accessibility Tree.

What This UnlocksBaseline · Newly
Core Web Vitals Mechanics (LCP, INP, CLS)
Network & Performance

LCP, INP, and CLS directly measure paint timestamps, layout shifts, and next-frame presentation.

What This UnlocksBaseline · Newly
CSS Houdini @property
Rendering Pipeline

Type registration changes how the Style phase parses and interpolates custom properties.

What This UnlocksExperimental
DOM XSS Prevention with Trusted Types
Security & Accessibility

DOM sinks invoke the HTML parser and script execution pipeline directly from JavaScript.

What This UnlocksBaseline · Widely
GPU Compositor Layers and will-change
Rendering Pipeline

Promotion happens after Paint during the Layerize phase prior to GPU upload.

What This UnlocksBaseline · Widely
IntersectionObserver and Asynchronous Visibility
DOM & Events

IntersectionObserver computes intersections once per frame immediately after the Layout phase.

What This UnlocksBaseline · Widely
Layout Thrashing (Forced Synchronous Layout)
Rendering Pipeline

Thrashing stems from repeated invalidation of the Layout phase.

What This UnlocksBaseline · Widely
Render Tree & Layout
Rendering Pipeline

Layout is the geometry-solving stage inside the main-thread frame pipeline.

What This UnlocksBaseline · Widely
requestAnimationFrame & VSync
Rendering Pipeline

Mutations inside rAF are batched directly into the upcoming Style/Layout/Paint cycle.

What This UnlocksBaseline · Widely
Virtualized Lists & Windowing
State & Architecture

Rendering 10,000+ DOM nodes chokes style recalculation and layout passes; windowing caps active nodes.

Useful PrerequisitesBaseline · Widely
DOM & CSSOM Construction
Rendering Pipeline

Style calculation requires parsed DOM and CSSOM trees before constructing the render tree.

Under the HoodBaseline · Widely
GPU Compositor Layers and will-change
Rendering Pipeline

Delegates promoted element layers to the GPU compositor thread after paint and layerization.

Under the HoodBaseline · Widely
Back/Forward Cache (bfcache)
Network & Performance

Freezes the full DOM, layout tree, and compositor state in RAM to restore frames without re-parsing.

Under the HoodBaseline · Widely
CSS Cascade Layers (@layer)
CSS & Layout

Evaluated during the Recalc Style phase when sorting CSSOM declarations.

Under the HoodBaseline · Widely
CSS Container Queries (@container)
CSS & Layout

Requires contain: inline-size (layout containment) to break parent-child circular dependencies.

Under the HoodBaseline · Newly
CSS :has() Relational Selector
CSS & Layout

Uses ancestor invalidation bitmasks and bloom filters during Recalc Style to avoid O(n^2) matching.

Under the HoodBaseline · Widely
CSS Stacking Context
Rendering Pipeline

Stacking context order determines DisplayItem emission order during the Paint phase.

Under the HoodBaseline · Widely
Debounce, Throttle & rAF Coalescing
State & Architecture

Coalescing pointermove writes into one rAF per frame prevents redundant style/layout work between VSyncs.

Under the HoodBaseline · Widely
Dedicated Web Workers and Transferables
Web APIs

Offloading CPU work keeps the main thread free for style, layout, and paint deadlines.

Under the HoodBaseline · Widely
DOM & CSSOM Construction
Rendering Pipeline

DOM and CSSOM trees are the two mandatory inputs to Render Tree construction.

Under the HoodBaseline · Widely
Event Loop, Macrotasks, and Microtask Queue
JS Runtime

Update the Rendering runs only after the Microtask Queue is completely drained.

Under the HoodBaseline · Widely
HTTP/2 & HTTP/3 Multiplexing
Network & Performance

Stream prioritization determines whether CSS and fonts arrive before render-blocking frames.

Under the HoodSuperseded
JS ResizeObserver Pattern for Adaptive Layout
CSS & Layout

ResizeObserver callbacks execute between Layout and Paint, triggering a second style recalculation cycle.

Under the HoodBaseline · Widely
Long Tasks and Interaction to Next Paint (INP)
JS Runtime

Presentation Delay reflects the Style, Layout, Paint, and Composite cost after the handler returns.

Under the HoodBaseline · Newly
Preload Scanner and fetchpriority Attribute
Network & Performance

Governs availability of critical resources (CSS, fonts, LCP hero image) prior to first Paint.

Often Confused WithBaseline · Newly
content-visibility & Skipping Offscreen Work
Rendering Pipeline

content-visibility: auto skips Layout and Paint for offscreen subtrees instead of running the full pipeline.

Mechanical Comparisons