Open shuangmianxiaoQ opened 4 years ago
JavaScript -> Style -> Layout -> Paint -> Composite
JavaScript
Style
Layout
Paint
Composite
HTML
DOM
CSS
CSSOM
Render Tree
transform
opacity
display: none
offsetLeft
scrollTop
clientWidth
DevTools
Rendering
Paint flashing
will-change
浏览器的渲染流程
HTML
=>DOM
CSS
=>CSSOM
DOM
+CSSOM
=>Render Tree
transform
,opacity
)布局与绘制
布局 -- 影响回流(Reflow)的操作
display: none
offsetLeft
,scrollTop
,clientWidth
避免布局抖动(Layout thrashing)
绘制 -- 减少重绘
DevTools
识别 paint 的瓶颈:Rendering
->Paint flashing
will-change
创建新图层(transform
,opacity
),也要避免过多的图层,