Improve handling of no paint effect in paint invalidation #17261
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now we check DisplayItemClient::PaintedOutputHasNoEffect() before
computing the visual rect. If it's true, just use empty visual rect
because the DisplayItemClient will paint nothing.
Because PaintedOutputHasNoEffect() may depend on style and/or layout
result, it's cached and updated after SetStyle() and layout. When it
changes, we call SetShouldCheckForPaintInvalidation() to ensure we
update visual rect.
This reduces unnecessary paint invalidations, repaint of PaintLayers,
and raster invalidations when a DisplayItemClient paints nothing
before and after a change (which won't affect the visual effect of the
DisplayItemClient).
This doesn't change LayoutObject::LocalVisualRect() which is used to
get the visual bounding box of the LayoutObject, because some callers
may expect the rect to cover contents.
Change-Id: Ib56fe48dc6e7d60fd717a1dfb2336cfad2521d7f
Reviewed-on: https://chromium-review.googlesource.com/1649602
WPT-Export-Revision: acb43a0d8291e186c62741e9711c8a8abbcaf70a