| 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..645b76cb2ab3ffb31b823641368cf47b492652d4 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, and we are not invalidate paint of the changed subtree,
|
| +we need to manually update the `needsPaintPhaseXXX` flags. For example, if an object changes
|
| +style and creates a self-painting-layer, we copy the flags from its containing self-painting
|
| +layer to this layer, assuming that this layer needs all paint phases that its container
|
| +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.
|
|
|