1 <html class=
"reftest-wait">
2 <title>Scroll timeline with WorkletAnimation and transition from display:none to display:block
</title>
3 <link rel=
"help" href=
"https://drafts.css-houdini.org/css-animationworklet/">
4 <meta name=
"assert" content=
"Scroll timeline should properly handle going from display:none to display:block">
5 <link rel=
"match" href=
"worklet-animation-with-scroll-timeline-ref.html">
7 <script src=
"/web-animations/testcommon.js"></script>
8 <script src=
"/common/reftest-wait.js"></script>
9 <script src=
"common.js"></script>
15 background-color: green;
21 background-color: red;
24 /* Hide scrollbars to avoid unnecessary visual issues related to them */
25 #scroller::-webkit-scrollbar {
30 scrollbar-width: none;
34 will-change: transform; /* force compositing */
48 <div id=
"covered"></div>
50 <div id=
"contents"></div>
54 registerPassthroughAnimator().then(()=>{
55 const box
= document
.getElementById('box');
56 const effect
= new KeyframeEffect(box
,
58 { transform
: 'translateY(0)', opacity
: 1 },
59 { transform
: 'translateY(200px)', opacity
: 0 }
65 const scroller
= document
.getElementById('scroller');
66 scroller
.classList
.add('removed');
67 const timeline
= new ScrollTimeline({ scrollSource
: scroller
, timeRange
: 1000, orientation
: 'block' });
68 const animation
= new WorkletAnimation('passthrough', effect
, timeline
);
71 // Ensure that the WorkletAnimation will have been started on the compositor.
72 waitForAsyncAnimationFrames(1).then(_
=> {
73 // Now return the scroller to the world, which will cause it to be composited
74 // and the animation should update on the compositor side.
75 scroller
.classList
.remove('removed');
76 const maxScroll
= scroller
.scrollHeight
- scroller
.clientHeight
;
77 scroller
.scrollTop
= 0.5 * maxScroll
;
79 waitForAsyncAnimationFrames(1).then(_
=> {