Reduce the requirement for saving previousLocation
ObjectPaintInvalidator::previousLocationInBacking() accesses a global
map if location was different from visualRect.location() during the last
paint invalidation.
The percentage of LayoutObjects requiring to save previousLocation was
about 5% before SlimmingPaintInvalidation is enabled, but increased to
about 37% after.
The main reason was that we always called enclosingIntRect() when
computing visual rect, causing visualRect.location() was different from
location if location is not at whole pixels. Now call enclosingIntRect()
only when there is any transform.
A minor reason was about empty rects having different location. Location
of an empty visual rect actually has no actual functional effect on
paint invalidation. Now don't map empty rects, but force its location
to be the same as location in backing, so that we always don't need to
save previous location of empty visual rects.
BUG=
685179
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Review-Url:
https://codereview.chromium.org/2706063003
Cr-Commit-Position: refs/heads/master@{#451908}
Committed:
https://chromium.googlesource.com/chromium/src/+/8cc1739f3017dca5bc97d2721bcdfc903eaec6ec