OLD | NEW |
1 # `Source/core/paint` | 1 # `Source/core/paint` |
2 | 2 |
3 This directory contains implementation of painters of layout objects. It covers | 3 This directory contains implementation of painters of layout objects. It covers |
4 the following document lifecycle states: | 4 the following document lifecycle states: |
5 | 5 |
6 * PaintInvalidation (`InPaintInvalidation` and `PaintInvalidationClean`) | 6 * PaintInvalidation (`InPaintInvalidation` and `PaintInvalidationClean`) |
7 * PrePaint (`InPrePaint` and `PrePaintClean`) | 7 * PrePaint (`InPrePaint` and `PrePaintClean`) |
8 * Paint (`InPaint` and `PaintClean`) | 8 * Paint (`InPaint` and `PaintClean`) |
9 | 9 |
10 ## Glossaries | 10 ## Glossaries |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 it's implemented. | 208 it's implemented. |
209 | 209 |
210 ## Paint result caching | 210 ## Paint result caching |
211 | 211 |
212 `PaintController` holds the previous painting result as a cache of display items
. | 212 `PaintController` holds the previous painting result as a cache of display items
. |
213 If some painter would generate results same as those of the previous painting, | 213 If some painter would generate results same as those of the previous painting, |
214 we'll skip the painting and reuse the display items from cache. | 214 we'll skip the painting and reuse the display items from cache. |
215 | 215 |
216 ### Display item caching | 216 ### Display item caching |
217 | 217 |
218 We'll create a `CachedDisplayItem` when a painter would create a `DrawingDisplay
Item` exactly | 218 When a painter would create a `DrawingDisplayItem` exactly the same as the displ
ay item |
219 the same as the display item created in the previous painting. After painting, `
PaintController` | 219 created in the previous painting, we'll reuse the previous one instead of repain
ting it. |
220 will replace `CachedDisplayItem` with the corresponding display item from the ca
che. | |
221 | 220 |
222 ### Subsequence caching | 221 ### Subsequence caching |
223 | 222 |
224 When possible, we enclose the display items that `PaintLayerPainter::paintConten
ts()` generates | 223 When possible, we enclose the display items that `PaintLayerPainter::paintConten
ts()` generates |
225 (including display items generated by sublayers) in a pair of `BeginSubsequence/
EndSubsequence` | 224 (including display items generated by sublayers) in a pair of `BeginSubsequence/
EndSubsequence` |
226 display items. | 225 display items. |
227 | 226 |
228 In a subsequence paint, if the layer would generate exactly the same display ite
ms, we'll simply | 227 In a subsequence paint, if the layer would generate exactly the same display ite
ms, we'll get |
229 output a `CachedSubsequence` display item in place of the display items, and ski
p all paintings | 228 the whole subsequence from the cache instead of repainting them. |
230 of the layer and its descendants in painting order. After painting, `PaintContro
ller` will | |
231 replace `CacheSubsequence` with cached display items created in previous paintin
gs. | |
232 | 229 |
233 There are many conditions affecting | 230 There are many conditions affecting |
234 * whether we need to generate subsequence for a PaintLayer; | 231 * whether we need to generate subsequence for a PaintLayer; |
235 * whether we can use cached subsequence for a PaintLayer. | 232 * whether we can use cached subsequence for a PaintLayer. |
236 See `shouldCreateSubsequence()` and `shouldRepaintSubsequence()` in `PaintLayerP
ainter.cpp` for | 233 See `shouldCreateSubsequence()` and `shouldRepaintSubsequence()` in `PaintLayerP
ainter.cpp` for |
237 the conditions. | 234 the conditions. |
238 | 235 |
239 ## Empty paint phase optimization | 236 ## Empty paint phase optimization |
240 | 237 |
241 During painting, we walk the layout tree multiple times for multiple paint phase
s. Sometimes | 238 During painting, we walk the layout tree multiple times for multiple paint phase
s. Sometimes |
(...skipping 12 matching lines...) Expand all Loading... |
254 | 251 |
255 When layer structure changes, and we are not invalidate paint of the changed sub
tree, | 252 When layer structure changes, and we are not invalidate paint of the changed sub
tree, |
256 we need to manually update the `needsPaintPhaseXXX` flags. For example, if an ob
ject changes | 253 we need to manually update the `needsPaintPhaseXXX` flags. For example, if an ob
ject changes |
257 style and creates a self-painting-layer, we copy the flags from its containing s
elf-painting | 254 style and creates a self-painting-layer, we copy the flags from its containing s
elf-painting |
258 layer to this layer, assuming that this layer needs all paint phases that its co
ntainer | 255 layer to this layer, assuming that this layer needs all paint phases that its co
ntainer |
259 self-painting layer needs. | 256 self-painting layer needs. |
260 | 257 |
261 We could update the `needsPaintPhaseXXX` flags in a separate tree walk, but that
would regress | 258 We could update the `needsPaintPhaseXXX` flags in a separate tree walk, but that
would regress |
262 performance of the first paint. For slimming paint v2, we can update the flags d
uring the | 259 performance of the first paint. For slimming paint v2, we can update the flags d
uring the |
263 pre-painting tree walk to simplify the logics. | 260 pre-painting tree walk to simplify the logics. |
OLD | NEW |