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 290425340c63f49fbb1706b05f33605e5fcfc4bf..9eba12eb7488daa98a5b29ab0c1916f47b77ed95 100644 |
| --- a/third_party/WebKit/Source/core/paint/README.md |
| +++ b/third_party/WebKit/Source/core/paint/README.md |
| @@ -90,3 +90,24 @@ There are many conditions affecting |
| * whether we can use cached subsequence for a PaintLayer. |
| See `shouldCreateSubsequence()` and `shouldRepaintSubsequence()` in `PaintLayerPainter.cpp` for |
| the conditions. |
| + |
| +## Optimization for empty paint phases |
| + |
| +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 invaliidation, 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. Instead, we use another set of flags (`previousPaintPhaseXXXWasEmpty`) |
| +to record if a painting of a phase actually produced nothing. We'll skip the next |
| +painting of the phase if the flag is set, regardless of the corresponding |
| +`needsPaintPhaseXXX` flag. We will clear the `previousPaintPhaseXXXWasEmpty` flags when |
| +we paint with different clipping, scroll offset or interest rect from the previous paint. |
|
chrishtr
2016/03/10 17:05:44
..Or the PaintLayer is invalidated?
Xianzhu
2016/03/10 18:10:32
Added a paragraph here and comments in code to exp
|
| + |