- 16ms to render a single frame, which is actually ~10ms, given that browser also does some house keeping stuff.
- Parsed HTML
- PARSED HTML + CSS ( [Recalculate style] ) => Render Tree ( only the visible elements form the render tree)
- Once the browser knows what elements it has to display, it starts doing the layout( calculates the position and dimensions of the elements) At this point the render tree actually turns into a collection of boxes. [layout]
- [ Reflow ] is same as [ Layout ]
- Vector to Raster
- Initially all the elements are vectors they are rasterized on to pixels
- [ Paint ] steps ( example )
- drawRectangle
- drawText
- drawBitmap
- translate
- restore
- [ Composite ] layers - ( putting multiple layers together)
- Layers and tiles are uploaded to GPU
- [ Layout ] - Layout scope is usually the whole document
-
Flow 1
- Javascript/css based animation made some visual change
- Browser recalculates the style of all the affected elements.
- If the visual change made any difference in dimension/position of an element, this would trigger a reflow of the document.
- Any affected areas will need to be repainted
- Finally the painted elements need to be composited together.
-
Flow 2
- Change a paint only property like background image, text color, shadows etc ( with js or css)
- Browser recalculates styles.
- We don't do layouts, because we didn't change geometry of the elements
- Paint
- Composite
-
Flow 3
- Change so that only compositing is required( no paint or layout )
- browser recalculates
- No layouts
- No paint
- Composite