Rendering PipelineBaseline · Newly

content-visibility & Skipping Offscreen Work

Mental Model

content-visibility: auto instructs the engine to skip Style, Layout, and Paint for off-screen subtrees until they approach the viewport. Paired with contain-intrinsic-size: auto, it slashes initial rendering cost without removing nodes from the DOM or breaking Ctrl+F search.

Interactive Simulator

Eager Off-Screen Rendering vs content-visibility: auto

Compare initial frame cost on a 200-section document.

Lines of Code
Before
4
After
4
Reflows / Browser Cost
Before
Full tree (~180ms)
After
Viewport only (~18ms)
BeforeEager Full-Document Layout
.article-section {
  margin-bottom: 2rem;
  /* All 200 sections laid out & painted at load */
}
Lines: 4Reflows: Full tree (~180ms)Dependencies: 0 JS

Main thread blocks on off-screen sections nobody sees yet.

After (Native)content-visibility: auto + intrinsic hint
.article-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 420px;
}
Lines: 4Reflows: Viewport only (~18ms)Dependencies: 0 JS

Off-screen sections reserve 420px and skip Layout/Paint.

Under the Hood

Like a stage crew only lighting sets as actors walk toward them, content-visibility: auto keeps DOM nodes intact while deferring pixel work.

  1. Relevance Check: The engine checks whether the element is near the viewport, focused, or selected.
  2. Work Suppression: When irrelevant, it enforces CSS Containment (layout, style, paint, size) and skips Render Tree & Layout for descendants.
  3. Placeholder Sizing: contain-intrinsic-size: auto 400px supplies a fallback height until the element renders once, after which auto remembers its real measured height.
CSS
.long-list-chunk {
  content-visibility: auto;
  /* Remembers real height after first render; 360px before */
  contain-intrinsic-size: auto 360px;
}

Problem Genealogy

  • 2015–2019: Developers built fragile JS virtual-scrollers that broke browser Ctrl+F, anchor links, and screen-reader navigation.
  • 2020–2024: content-visibility: auto moved off-screen work skipping into the native C++ layout engine.

Production Pitfalls

Production Pitfall
  • Missing contain-intrinsic-size: Without an intrinsic size hint, skipped containers collapse to 0px, causing the scrollbar thumb to jump as you scroll.
  • One giant wrapper: Wrapping 10,000 items in a single content-visibility: auto container defeats incremental rendering; chunk them into groups of 25–50.
When Not to Use
  • When not to use content-visibility: auto: Do not apply it to small above-the-fold elements or containers with overflowing popovers (it implies contain: paint).

Connections & Logical Next Steps

Rendering Pipelinecontent-visibility & Skipping Offscreen Work

Seen in Architecture Autopsies

Mechanical Comparisons