Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/README.md |
| diff --git a/third_party/WebKit/Source/core/paint/README.md b/third_party/WebKit/Source/core/paint/README.md |
| index b3516cd501f3a5c86cdc1c2ea030bd61b121f2b2..aaee2423cd5ad23ef28d329432fb13084b79ade1 100644 |
| --- a/third_party/WebKit/Source/core/paint/README.md |
| +++ b/third_party/WebKit/Source/core/paint/README.md |
| @@ -216,3 +216,29 @@ There are many conditions affecting |
| * whether we can use cached subsequence for a PaintLayer. |
| See `shouldCreateSubsequence()` and `shouldRepaintSubsequence()` in `PaintLayerPainter.cpp` for |
| the conditions. |
| + |
| +## Empty paint phase optimization |
| + |
| +During painting, we walk the layout tree multiple times for multiple paint phases. Sometimes |
| +a layer contain nothing needing a certain paint phase and we can skip tree walk for such |
| +empty phases. Now we have optimized `PaintPhaseDescendantBlockBackgroundsOnly`, |
| +`PaintPhaseDescendantOutlinesOnly` and `PaintPhaseFloat` for empty paint phases. |
| + |
| +During paint invalidation, we set the containing self-painting layer's `needsPaintPhaseXXX` |
| +flag if the object has something needing to be painted in the paint phase. |
| + |
| +During painting, we check the flag before painting a paint phase and skip the tree walk if |
| +the flag is not set. |
| + |
| +It's hard to clear a `needsPaintPhaseXXX` flag when a layer no longer needs the paint phase, |
| +so we never clear the flags. |
| + |
| +When layer structure changes or a layer's self-painting status changes, we may not do paint |
| +invalidation and update the `needsPaintPhaseXXX` flags, so we need to manually update the flags |
| +according to the changed self-painting relationship. For example, if a layer becomes |
| +self-painting, we copy the flags from its containing self-painting layer to this layer, |
| +assuming that this layer needs all paint phases that its self-painting layer needs. |
| + |
| +We could update the `needsPaintPhaseXXX` flags in a separate tree walk, but that would regress |
| +performance of the first paint. For slimming paint v2, we can update the flags during the |
| +pre-painting tree walk to simplify the logics. |
|
pdr.
2016/04/08 04:19:00
Very well written comment.
|