Files
tubestation/testing/web-platform/tests/layout-instability/child-shift-with-parent-overflow-hidden.html
Xianzhu Wang d5122c70db Bug 1669377 [wpt PR 26000] - Fix layout shift tracker when overflow is clipped along one axis, a=testonly
Automatic update from web-platform-tests
Fix layout shift tracker when overflow is clipped along one axis

We should include layout overflow of the non-clipped axis.

Bug: 1087667
Change-Id: Icd68f42a2d2db431b094367180a66ee4e0efaf44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2451391
Reviewed-by: Steve Kobes <skobes@chromium.org>
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814827}

--

wpt-commits: 8d622e8bce9a69c9098baef93d40831068115629
wpt-pr: 26000
2020-10-09 12:43:19 +00:00

33 lines
1.1 KiB
HTML

<!DOCTYPE html>
<title>Layout Instability: parent (with overflow:hidden) and child moved together</title>
<link rel="help" href="https://wicg.github.io/layout-instability/" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/util.js"></script>
<div id="parent" style="position: relative; width: 200px; height: 200px;
border: 50px solid blue; overflow: hidden">
<div id="child" style="width: 400px; height: 400px"></div>
</div>
<script>
promise_test(async () => {
const watcher = new ScoreWatcher;
// Wait for the initial render to complete.
await waitForAnimationFrames(2);
// Modify the position of the div.
const parent = document.querySelector("#parent");
parent.style.top = '100px';
// Only the parent area should be reported.
const expectedScore = computeExpectedScore(300 * (300 + 100), 100);
// Observer fires after the frame is painted.
assert_equals(watcher.score, 0);
await watcher.promise;
assert_equals(watcher.score, expectedScore);
}, 'Parent (with overflow:hidden) and child moved together.');
</script>