Menu

Chrome composites 10 layers on our static FAQ page, and an invisible word is responsible for three of them
📰

Chrome composites 10 layers on our static FAQ page, and an invisible word is responsible for three of them

DEV Community: css·Daniel Pertu·2 days ago
#CFpZrks8
#devtocss#devto#dev#document#layer
Reading 0:00
15s threshold

A page of ours is prerendered HTML, a stylesheet and some text. I assumed Chrome drew it in one layer. It does not: our FAQ page runs on 10 compositing layers , and the reasons are all readable from outside with the DevTools protocol.

await page . cdp ( "LayerTree.enable" , { } ) ; // scroll once, because the tree is only reported when it changes const ev = await page . events ( ) ; const layers = ev . filter ( e => e . method === "LayerTree.layerTreeDidChange" ) . pop ( ) . params . layers ; for ( const l of layers ) { const r = await page . cdp ( "LayerTree.compositingReasons" , { layerId : l . layerId } ) ; console . log ( l . width , l . height , l . paintCount , r .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.