flackr / scroll-timeline

A polyfill of ScrollTimeline.
Apache License 2.0
951 stars 94 forks source link

Schedule tasks for timeline updates #192

Closed johannesodland closed 8 months ago

johannesodland commented 9 months ago

Scheduling a task to update timelines, instead of waiting for the next animation frame.

Some tests only wait for one animation frame. If we wait for the next animation frame before ticking animations, it might result in assertions running right before the animations are ticked.

Tests that that use waitForNextFrame() from web-animations/testcommon.js such as the last test in the scroll-animation-inactive-timeline. are affected by this issue.

This test should now pass.

johannesodland commented 9 months ago

Fixing this causes the first subtest in /scroll-animations/scroll-timelines/scroll-timeline-invalidation.html to pass every now and then, depending on timing.

This subtest sets the height of the first child element as part of the test. To pass this subtest property I think we need to observe the children of the source element.

@flackr You were originally opposed to observing the children, but without it some tests will be flaky. Are you ok with observing the children, or should we add other measures such as polyfill options to activate/deactivate observers first?

flackr commented 8 months ago

You were originally opposed to observing the children, but without it some tests will be flaky. Are you ok with observing the children, or should we add other measures such as polyfill options to activate/deactivate observers first?

I'm okay with observing all the direct children. It's a bit unfortunate that we have to do this but seems like an okay tradeoff.