[CLS] Don't count layout shifts due to content-visibility:auto unskipping #26639
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.
content-visibility:auto elements have different sizing behavior when
near the viewport vs not. This sizing behavior is an intentional part
of the platform, and should not be considered a layout shift for the
the first time the elements' subtrees become unskipped (*).
There are two cases of "first time":
DOM, and in which the element is found in that frame to be near the
viewport.
found to be near the viewport, but was was found for at least one
frame previously not to be near it.
These two cases are handled in somewhat different ways in Blink - the
former is a synchronous relayout, whereas the second is async.
In both cases, CLS should not be impacted.
In the future, we could consider in the future whether layout shifts
for subsequent unskips should also not count for CLS.
Bug: 1151526
(*) https://drafts.csswg.org/css-contain-2/#skips-its-contents
Change-Id: I9421452430dd572ed87bb20b0bd20e9a7e3501a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2556211
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: Annie Sullivan <sullivan@chromium.org>
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830774}