fune/testing/web-platform/tests/scroll-animations/css/scroll-timeline-frame-size-changed.html
Kevin Ellis a9df9dc7cd Bug 1797576 [wpt PR 36673] - Deflake tests in wpt/scroll-animations/css in virtual/threaded test environment, a=testonly
Automatic update from web-platform-tests
Deflake tests in wpt/scroll-animations/css in virtual/threaded test environment

These tests were failing as screenshots were being taken while
compositor commits were still being deferred for first contentful
paint.  Fixed by adding a wait on a composited time based animation.
As time based animations need to wait on a start time on the
compositor, these animations will block until compositor commits are
no longer being deferred.  Filed a bug, to fix screenshot timing.

Verified the fix with 100 runs of the tests.  Flakes are very
reproducible without the fix.

Bug: 1279648, 1378671, 1357917
Change-Id: Ib99df7822551deb4fa403e92c22f66807b98774b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3982699
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1064279}

--

wpt-commits: 6d3259cdf2f99c9abdc3594a2378b0356b1f2601
wpt-pr: 36673
2022-11-11 12:32:49 +00:00

67 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html class="reftest-wait">
<title>The default scroll() timeline when the frame size changed</title>
<link rel="help" href="https://drafts.csswg.org/scroll-animations-1/#scroll-notation">
<link rel="help" href="https://drafts.csswg.org/css-animations-2/#animation-timeline">
<meta name="assert" content="CSS animation correctly updates values when using
the default scroll() timeline and update the
frame size">
<link rel="match" href="scroll-timeline-frame-size-changed-ref.html">
<style>
@keyframes update {
from { transform: translateY(0px); }
to { transform: translateY(200px); }
}
html {
min-height: 100%;
padding-bottom: 100px;
}
#box {
width: 100px;
height: 100px;
background-color: green;
animation: update 1s linear;
animation-timeline: scroll();
}
#covered {
width: 100px;
height: 100px;
background-color: red;
}
* {
margin-top: 0px;
margin-bottom: 0px;
}
</style>
<div id="box"></div>
<div id="covered"></div>
<script src="/web-animations/testcommon.js"></script>
<script>
document.documentElement.addEventListener('TestRendered', async () => {
runTest();
}, { once: true });
async function runTest() {
const scroller = document.scrollingElement;
await waitForCompositorReady();
// Move the scroller to the 25% point.
const maxScroll = scroller.scrollHeight - scroller.clientHeight;
scroller.scrollTop = 0.25 * maxScroll;
await waitForNextFrame();
// Update scroll range to make the current position become 50% point.
scroller.style.paddingBottom = "50px";
await waitForNextFrame();
document.documentElement.classList.remove("reftest-wait");
}
</script>