liveBook · Manning

Paint

As explained in CSS in Depth, Second Edition

Paint is the rendering stage that draws visual content such as text, images, borders, and shadows into memory.

Paint is the rendering stage that fills memory with pixels after layout determines each element’s size and position. It draws text, images, borders, and shadows into painted layers. section 16.3.1

Paint interacts with browser rendering in practical ways:

  • Changing a background color triggers repainting but does not require layout recalculation, because it does not change element size or position. section 16.3.1
  • Under suitable conditions, browsers promote an element to its own layer, paint it separately, and may send that layer to the GPU. section 16.3.1

A background-color change

Changing an element’s background color repaints its pixels while avoiding the broader reflow caused by changing its width, height, or position. section 16.3.1

Figure 16.12 The three stages of the rendering pipeline
figure

Use the rendering-pipeline diagram to place paint between layout and composite. section 16.3.1

How CSS in Depth, Second Edition covers it

How deep it goes
Explains pixel filling, repaint triggers, layers, and GPU handoff without detailing paint algorithms.
Examples
Uses text, images, borders, shadows, background-color changes, layers, and GPU rendering as concrete examples.
What it assumes
Assumes familiarity with computed styles and introduces the relationship between layout, paint, and composite.
What you can do after
Diagnose why visual changes repaint pixels without necessarily recalculating layout.
How it connects
Connects paint with layout, composite, rendering layers, reflow, and hardware acceleration.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of CSS in Depth, Second Edition. The section links point to the parts of the book it draws on.