| 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 ## Painters | 5 ## Painters |
| 6 | 6 |
| 7 ## Paint invalidation | 7 ## Paint invalidation |
| 8 | 8 |
| 9 Paint invalidation marks anything that need to be painted differently from the o
riginal | 9 Paint invalidation marks anything that need to be painted differently from the o
riginal |
| 10 cached painting. | 10 cached painting. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 In a subsequence paint, if the layer would generate exactly the same display ite
ms, we'll simply | 83 In a subsequence paint, if the layer would generate exactly the same display ite
ms, we'll simply |
| 84 output a `CachedSubsequence` display item in place of the display items, and ski
p all paintings | 84 output a `CachedSubsequence` display item in place of the display items, and ski
p all paintings |
| 85 of the layer and its descendants in painting order. After painting, `PaintContro
ller` will | 85 of the layer and its descendants in painting order. After painting, `PaintContro
ller` will |
| 86 replace `CacheSubsequence` with cached display items created in previous paintin
gs. | 86 replace `CacheSubsequence` with cached display items created in previous paintin
gs. |
| 87 | 87 |
| 88 There are many conditions affecting | 88 There are many conditions affecting |
| 89 * whether we need to generate subsequence for a PaintLayer; | 89 * whether we need to generate subsequence for a PaintLayer; |
| 90 * whether we can use cached subsequence for a PaintLayer. | 90 * whether we can use cached subsequence for a PaintLayer. |
| 91 See `shouldCreateSubsequence()` and `shouldRepaintSubsequence()` in `PaintLayerP
ainter.cpp` for | 91 See `shouldCreateSubsequence()` and `shouldRepaintSubsequence()` in `PaintLayerP
ainter.cpp` for |
| 92 the conditions. | 92 the conditions. |
| 93 |
| 94 ## Optimization for empty paint phases |
| 95 |
| 96 During painting, we walk the layout tree multiple times for multiple paint phase
s. Sometimes |
| 97 a layer contain nothing needing a certain paint phase and we can skip tree walk
for such |
| 98 empty phases. Now we have optimized `PaintPhaseDescendantBlockBackgroundsOnly`, |
| 99 `PaintPhaseDescendantOutlinesOnly` and `PaintPhaseFloat` for empty paint phases. |
| 100 |
| 101 During paint invaliidation, we set the containing self-painting layer's `needsPa
intPhaseXXX` |
| 102 flag if the object has something needing to be painted in the paint phase. |
| 103 |
| 104 During painting, we check the flag before painting a paint phase and skip the tr
ee walk if |
| 105 the flag is not set. |
| 106 |
| 107 It's hard to clear a `needsPaintPhaseXXX` flag when a layer no longer needs the
paint phase, |
| 108 so we never clear the flags. Instead, we use another set of flags (`previousPain
tPhaseXXXWasEmpty`) |
| 109 to record if a painting of a phase actually produced nothing. We'll skip the nex
t |
| 110 painting of the phase if the flag is set, regardless of the corresponding |
| 111 `needsPaintPhaseXXX` flag. We will clear the `previousPaintPhaseXXXWasEmpty` fla
gs when |
| 112 we paint with different clipping, scroll offset or interest rect from the previo
us paint. |
| 113 |
| 114 We don't clear the `previousPaintPhaseXXXWasEmpty` flags when the layer is marke
d `needsRepaint`. |
| 115 Instead we clear the flag when the corresponding `needsPaintPhaseXXX` is set. Th
is ensures that |
| 116 we won't clear `previousPaintPhaseXXXWasEmpty` flags when unrelated things chang
ed which won't |
| 117 cause the paint phases to become non-empty. |
| OLD | NEW |