blob: 21d5b8c04fe066c48640832653f2e7a735bef3c7 [file] [log] [blame]
<!DOCTYPE html>
<title>scroll-timeline and container queries</title>
<link rel="help" src="https://drafts.csswg.org/scroll-animations-1/#scroll-timeline-shorthand">
<link rel="help" src="https://drafts.csswg.org/css-contain-3/#container-queries">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/web-animations/testcommon.js"></script>
<style>
#scroller {
overflow: auto;
width: auto;
height: 100px;
}
#scroller > div {
height: 200px;
}
@keyframes anim {
from { background-color: rgb(100, 100, 100); }
to { background-color: rgb(200, 200, 200); }
}
#element {
height: 10px;
width: 10px;
animation: anim 10s linear timeline;
background-color: rgb(0, 0, 0);
}
</style>
<div>
<div id=scroller>
<div></div>
</div>
<div>
<div id=element></div>
</div>
</div>
<script>
promise_test(async (t) => {
element.offsetTop;
scroller.scrollTop = 50;
await waitForNextFrame();
// Unknown timeline, time held at zero.
assert_equals(getComputedStyle(element).backgroundColor, 'rgb(100, 100, 100)');
scroller.style.scrollTimeline = 'timeline';
assert_equals(getComputedStyle(element).backgroundColor, 'rgb(150, 150, 150)');
}, 'Timelines appearing on preceding siblings are visible to getComputedStyle');
</script>