Teams‎ > ‎Animations Team‎ > ‎Highlights Archive‎ > ‎

January 2021 - Code Health, New Features, Testing and Stability Fixes

January  2020

Chrome Interactions Highlights

Archives: go/interactions-team-highlights

Chapter I: New Features

Scroll timeline polyfill

Both kevers@ and flackr@ have been working extensively on this feature.

  • Over 93% pass rate on the scroll timeline tests.

  • Over 350 passing tests.

  • Recent areas of development:

    • Extended the scope of the polyfill:

      • EventTarget

      • Promises

      • Tasks

    • Support writing modes

Compositing percentage based transforms

menu.hidden { transform: translateX(-100%) }

kevers@ re-enabled this feature in M89:

  • The challenge is that size dependency could change while the animation is running. And we need to catch the change and restart the composited animation.

  • The feature is in common use. One can write CSS only animations without the need to resort to JS for size calculation, such as the above demo.

Aspect ratio interpolation

        Demo Before                      Demo After

flackr@ implemented aspect ratio interpolation, and enabled it by default in M90.

  • Recent spec discussion decided that aspect ratios should be interpolated by the log of their value, to preserve the same visual speed whether they are wide or narrow.

Composite background-color animation

The above background-color animation demo runs on the compositor thread with the experimental flag. xidachen@ has made great progress on this feature, including:

  • Setup infra for animating on the compositor thread.

  • Implement the interpolation logic.

  • Handle transition keyframes.

  • Handle multiple offsets in keyframes.

  • Implement main-thread fallback logic.

Click/Auxclick as pointer event

liviutinta@ and mustaq@ co-worked on this feature and shipped it to stable. Here is the major work:

  • Finch experiment: 50% on canary + dev + beta.

  • Intent to ship has been approved with 3 LGTMs.

  • Enabled for stable at 1% starting with M88.

  • Improvement of the feature is still on-going, such as the simulated clicks.

Capability delegation with payment request

mustaq@ built an initial prototype that allows PaymentRequest in subframe provided a token is passed into it. The PaymentRequest now consumes user activation.

Scroll unification

liviutinta@ kept working on this feature, and has made progress.

  • Landed scrolling the <select> popup.

  • Designed metrics for scroll unification and LGTMed by the metrics team.

  • Landed scroll bubbling from OOPIFs to ancestor frame

  • Schedule frames for popup widgets in tests using compositor thread.

Scroll to images (and videos)

flackr@ has created and uploaded the explainer for this feature.

Chapter II: Testing

Deflaking tests

kevers@ addressed some test flakes in animations and scroll-snap. These flakes were largely triggered  due to common gotchas like antialiasing, floating point precision, or test timing.  

Animation timing checks have been updated to accommodate 1 microsecond accuracy.  This fix was not a pure test change as there was a lurking issue with numerical precision and setting the finished state of an animation.  It is not just strict equality checks that are problematic when working with floating point numbers.

Several layout tests in animations make use of an internal pause for testing API, which predates and is largely deprecated by the web animations API (WAAPI).  One test flake was addressed simply by switching over to WAAPI. 

Several timing flakes were fixed in scroll-snap tests, by injecting a listener for scroll events.  Unlike web animations, scroll animations do not fire an event to indicate completion of the scroll operation, and the end is inferred based on an absence of position updates over time.  Unfortunately, this can lead to flakes when testing machines get bogged down and tests start running slower than expected. Simply waiting on an initial scroll event before starting the countdown, largely addresses this type of flake in scroll-snap tests.   Once scrolling starts, the number of animation frames (rAFs) required to complete the scroll  has a strict upper bound.

xidachen@ also fixed quite a few paint worklet flaky tests by using the standard animation API. 

Before: we are taking a screenshot at rAF, which doesn’t guarantee the start of the animation.

Now: with the animation ready API, we take a screenshot when the animation has started which prevents the flakiness.



WPT test coverage

kevers@ and girard@ measured test coverage in WPT for input/scroll/animation. The data can help us understand which category of tests needs more attention.

TestDriver Action API

lanwei@ kept improving the TestDriver action API and made more WPT tests automatic.

The following two pictures show the wpt dashboard for the TestDriver action API.


Chapter III: Stability Fixes

Animation security fix: use after poison

kevers@ fixed a crash in Animatable::Animation. The problem is that running user code (JS) can result in the destruction of an execution context. We cannot simply check and forget about the execution context. The solution is to double check if the context is used downstream of script execution.

Float-cast-overflow in MouseEvent::PageX

liviutinta@ fixes a float-cast-overflow bug that is caused by static_cast<int>(double value) when the value is out of range. The solution is to usd std::trunc and clampToInt instead.

Paint worklet regression


              Stable                                 Canary

xidachen@ fixed a regression due to a misuse of hashmap. In the above demo, the same animation is applied to both elements. In other words, the animations of the two elements should be in sync. However, the stable version is wrong. The canary version has the fix in it, and it is correct. 

Crash in PointerEventFactory

mustaq@ untangled a mixed-up crash report that becomes release-blocker-stable at the last moment. The effort of fixing the crash includes:

  • Determine the root cause, landed the fix on ToT.

  • Merged the fix back to M88 and M89.

Paint worklet crash

xidachen@ fixed a crash where the root cause is that our code path hits a DCHECK that is no longer applicable. The solution is to remove the outdated DCHECK.

Chapter IV: Code Health

Our team had a great start to the year by closing over 70 bugs in this sprint:

  • Specifically, we closed more bugs than opened in P1 and P2 categories.


girard@ collected our team bug data and generated graphs to visualize it.

  • Our P1 and P2 bugs are less than 40% of total bugs.

  • ~40% bugs have owners assigned.

girard@ re-enabled “MissedTOUCHEVENTF_UP” which tracks a hack in windows touch. We would like to tear out the hack/workaround once usage drops.

liviutinta@ removed the AzimuthAltitude flag since it has been turned on by default since M86.

lanwei@ and liviutinta@ fixed input failing tests on the new WPT bots.

mustaq@ landed Mouse/PointerEvent related code cleanup.

Chrome Interactions Highlights | January 2020