| OLD | NEW |
| 1 # `Source/core/paint` | 1 # `Source/core/paint` |
| 2 | 2 |
| 3 This directory contains implementation of painters of layout objects. | 3 This directory contains implementation of painters of layout objects. |
| 4 | 4 |
| 5 ## Glossaries | 5 ## Glossaries |
| 6 | 6 |
| 7 ### Stacked elements and stacking contexts | 7 ### Stacked elements and stacking contexts |
| 8 | 8 |
| 9 This chapter is basically a clarification of [CSS 2.1 appendix E. Elaborate desc
ription | 9 This chapter is basically a clarification of [CSS 2.1 appendix E. Elaborate desc
ription |
| 10 of Stacking Contexts](http://www.w3.org/TR/CSS21/zindex.html). | 10 of Stacking Contexts](http://www.w3.org/TR/CSS21/zindex.html). |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 In a subsequence paint, if the layer would generate exactly the same display ite
ms, we'll simply | 209 In a subsequence paint, if the layer would generate exactly the same display ite
ms, we'll simply |
| 210 output a `CachedSubsequence` display item in place of the display items, and ski
p all paintings | 210 output a `CachedSubsequence` display item in place of the display items, and ski
p all paintings |
| 211 of the layer and its descendants in painting order. After painting, `PaintContro
ller` will | 211 of the layer and its descendants in painting order. After painting, `PaintContro
ller` will |
| 212 replace `CacheSubsequence` with cached display items created in previous paintin
gs. | 212 replace `CacheSubsequence` with cached display items created in previous paintin
gs. |
| 213 | 213 |
| 214 There are many conditions affecting | 214 There are many conditions affecting |
| 215 * whether we need to generate subsequence for a PaintLayer; | 215 * whether we need to generate subsequence for a PaintLayer; |
| 216 * whether we can use cached subsequence for a PaintLayer. | 216 * whether we can use cached subsequence for a PaintLayer. |
| 217 See `shouldCreateSubsequence()` and `shouldRepaintSubsequence()` in `PaintLayerP
ainter.cpp` for | 217 See `shouldCreateSubsequence()` and `shouldRepaintSubsequence()` in `PaintLayerP
ainter.cpp` for |
| 218 the conditions. | 218 the conditions. |
| 219 |
| 220 ## Empty paint phase optimization |
| 221 |
| 222 During painting, we walk the layout tree multiple times for multiple paint phase
s. Sometimes |
| 223 a layer contain nothing needing a certain paint phase and we can skip tree walk
for such |
| 224 empty phases. Now we have optimized `PaintPhaseDescendantBlockBackgroundsOnly`, |
| 225 `PaintPhaseDescendantOutlinesOnly` and `PaintPhaseFloat` for empty paint phases. |
| 226 |
| 227 During paint invalidation, we set the containing self-painting layer's `needsPai
ntPhaseXXX` |
| 228 flag if the object has something needing to be painted in the paint phase. |
| 229 |
| 230 During painting, we check the flag before painting a paint phase and skip the tr
ee walk if |
| 231 the flag is not set. |
| 232 |
| 233 It's hard to clear a `needsPaintPhaseXXX` flag when a layer no longer needs the
paint phase, |
| 234 so we never clear the flags. |
| 235 |
| 236 When layer structure changes, and we are not invalidate paint of the changed sub
tree, |
| 237 we need to manually update the `needsPaintPhaseXXX` flags. For example, if an ob
ject changes |
| 238 style and creates a self-painting-layer, we copy the flags from its containing s
elf-painting |
| 239 layer to this layer, assuming that this layer needs all paint phases that its co
ntainer |
| 240 self-painting layer needs. |
| 241 |
| 242 We could update the `needsPaintPhaseXXX` flags in a separate tree walk, but that
would regress |
| 243 performance of the first paint. For slimming paint v2, we can update the flags d
uring the |
| 244 pre-painting tree walk to simplify the logics. |
| OLD | NEW |