| 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 ## Stacked contents and stacking contexts | 5 ## Stacked contents and stacking contexts |
| 6 | 6 |
| 7 This chapter is basically a clarification of [CSS 2.1 appendix E. Elaborate desc
ription | 7 This chapter is basically a clarification of [CSS 2.1 appendix E. Elaborate desc
ription |
| 8 of Stacking Contexts](http://www.w3.org/TR/CSS21/zindex.html). | 8 of Stacking Contexts](http://www.w3.org/TR/CSS21/zindex.html). |
| 9 | 9 |
| 10 According to the documentation, we can have the following types of elements that
are | 10 According to the documentation, we can have the following types of elements that
are |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 In a subsequence paint, if the layer would generate exactly the same display ite
ms, we'll simply | 136 In a subsequence paint, if the layer would generate exactly the same display ite
ms, we'll simply |
| 137 output a `CachedSubsequence` display item in place of the display items, and ski
p all paintings | 137 output a `CachedSubsequence` display item in place of the display items, and ski
p all paintings |
| 138 of the layer and its descendants in painting order. After painting, `PaintContro
ller` will | 138 of the layer and its descendants in painting order. After painting, `PaintContro
ller` will |
| 139 replace `CacheSubsequence` with cached display items created in previous paintin
gs. | 139 replace `CacheSubsequence` with cached display items created in previous paintin
gs. |
| 140 | 140 |
| 141 There are many conditions affecting | 141 There are many conditions affecting |
| 142 * whether we need to generate subsequence for a PaintLayer; | 142 * whether we need to generate subsequence for a PaintLayer; |
| 143 * whether we can use cached subsequence for a PaintLayer. | 143 * whether we can use cached subsequence for a PaintLayer. |
| 144 See `shouldCreateSubsequence()` and `shouldRepaintSubsequence()` in `PaintLayerP
ainter.cpp` for | 144 See `shouldCreateSubsequence()` and `shouldRepaintSubsequence()` in `PaintLayerP
ainter.cpp` for |
| 145 the conditions. | 145 the conditions. |
| 146 | |
| 147 ## Optimization for empty paint phases | |
| 148 | |
| 149 During painting, we walk the layout tree multiple times for multiple paint phase
s. Sometimes | |
| 150 a layer contain nothing needing a certain paint phase and we can skip tree walk
for such | |
| 151 empty phases. Now we have optimized `PaintPhaseDescendantBlockBackgroundsOnly`, | |
| 152 `PaintPhaseDescendantOutlinesOnly` and `PaintPhaseFloat` for empty paint phases. | |
| 153 | |
| 154 During paint invaliidation, we set the containing self-painting layer's `needsPa
intPhaseXXX` | |
| 155 flag if the object has something needing to be painted in the paint phase. | |
| 156 | |
| 157 During painting, we check the flag before painting a paint phase and skip the tr
ee walk if | |
| 158 the flag is not set. | |
| 159 | |
| 160 It's hard to clear a `needsPaintPhaseXXX` flag when a layer no longer needs the
paint phase, | |
| 161 so we never clear the flags. Instead, we use another set of flags (`previousPain
tPhaseXXXWasEmpty`) | |
| 162 to record if a painting of a phase actually produced nothing. We'll skip the nex
t | |
| 163 painting of the phase if the flag is set, regardless of the corresponding | |
| 164 `needsPaintPhaseXXX` flag. We will clear the `previousPaintPhaseXXXWasEmpty` fla
gs when | |
| 165 we paint with different clipping, scroll offset or interest rect from the previo
us paint. | |
| 166 | |
| 167 We don't clear the `previousPaintPhaseXXXWasEmpty` flags when the layer is marke
d `needsRepaint`. | |
| 168 Instead we clear the flag when the corresponding `needsPaintPhaseXXX` is set. Th
is ensures that | |
| 169 we won't clear `previousPaintPhaseXXXWasEmpty` flags when unrelated things chang
ed which won't | |
| 170 cause the paint phases to become non-empty. | |
| OLD | NEW |