Skip to content

Commit

Permalink
[LayoutShiftTracker] Fix contain:paint
Browse files Browse the repository at this point in the history
We should check ShouldClipOverflow() instead of IsScrollContainer()
(which was renamed from HasOverflowClip() recently -- this CL shows how
the new name improved code readability) for inclusion of layout overflow
for layout shift tracking.

Bug: 1127474
Change-Id: Id85b292b65dae837d1e366d548939b85c9cd5d5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2417061
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808087}
  • Loading branch information
wangxianzhu authored and chromium-wpt-export-bot committed Sep 17, 2020
1 parent 80c4b6a commit fb7851d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions layout-instability/contain-paint-fully-clipped.html
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<title>Layout Instability: fully clipped by contain:paint</title>
<link rel="help" href="https://wicg.github.io/layout-instability/" />
<div style="contain: paint; height: 0; position: relative">
<div id="target" style="position: absolute; top: 0; width: 400px; height: 400px"></div>
</div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/util.js"></script>
<script>

promise_test(async () => {
const watcher = new ScoreWatcher;

// Wait for the initial render to complete.
await waitForAnimationFrames(2);

// Shift target, for which no shift should be reported because it's hidden.
document.querySelector("#target").style.top = '200px';

await waitForAnimationFrames(2);
// No shift should be reported.
assert_equals(watcher.score, 0);
}, 'fully clipped by contain:paint');

</script>

0 comments on commit fb7851d

Please sign in to comment.