For now raster invalidation has two levels:
1. chunk level: issues raster invalidation for display items within each paint chunk, for
- full/incremental invalidation marked before painting;
- display item recorders;
- appearing and disappearing display items.
The code is in PaintController.
2. layer level: issues raster invalidation for paint chunks within each composited layer, for
- paint property changes of paint chunks;
- paint chunk recorders;
- appearing and disappearing paint chunks.
The code is in CompositedLayerRasterInvalidator
The design is suitable for the current paint and compositing phase separation, but it has additional requirement for chunk ids to match old and new chunks for both levels. This sometimes needs us to create additional paint chunks to keep chunk ids stable across document cycles, to avoid unnecessary whole chunk raster invalidation just because of change of chunk ids. https://chromium-review.googlesource.com/c/chromium/src/+/1040876 shows examples of the cases that we need more paint chunks.
Discussed with pdr in the patch, and we propose the following refactoring method:
- Move level 1 raster invalidation code into CompositedLayerRasterInvalidator (which will be renamed to RasterInvalidator). This requires us to also refactor PaintController::CommitNewDisplayItems() and PaintController::FinishCycle() to keep both the new and old paint artifacts until FinishCycle().
- Do level 1 raster invalidation for a chunk only if level 2 won't invalidate the chunk. This avoids unnecessary level 1 work.
- For appearing and disappearing paint chunks, search for their display items across paint chunks to find out the real appearing and disappearing display items and issue raster invalidations, to avoid unnecessary full chunk raster invalidation on chunk id changes.
Comment 1 by bugdroid1@chromium.org
, Jun 12 2018