Attention is currently required from: Robert Flack.
Xida Chen would like Robert Flack to review this change.
[composite-bgcolor-animation] Tweak compositing logic
This CL tweaks the logic of CheckCanStartAnimationOnCompositor for
background-color animation.
Currently, there is a base::Optional variable in blink::Animation
called |supplemental_failure_reasons_|. This variable is set only
when it is animating background-color and also painted by using
BackgroundColorPaintWorklet. The way to use it right now is to do a
bit OR operation on the result of CheckCanStartAnimationOnCompositor
and that variable.
We can actually do this better. When we call the
CheckCanStartAnimationOnCompositor, for a background-color
animation, if the |supplemental_failure_reasons_| has no value,
then the element is not painted by BackgroundColorPaintWorklet,
and we should let the animation fallback to run on the main
thread.
The approach here actually solves a potential crash systematically.
That is, if an element is not painted by BackgroundColorPaintWorklet,
then the background-color animation on that element should fallback
to the main thread.
Bug: 1193757
Change-Id: I00c504593ba04c4d1cb32543b3616089326f52d1
---
M third_party/blink/renderer/core/animation/animation.cc
M third_party/blink/renderer/core/animation/animation.h
M third_party/blink/renderer/core/animation/animation_test.cc
M third_party/blink/renderer/core/animation/compositor_animations.cc
A third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-color-animation-on-zero-size-element1-ref.html
A third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-color-animation-on-zero-size-element1.html
A third_party/blink/web_tests/external/wpt/css/css-backgrounds/animations/background-color-animation-on-zero-size-element2.html
7 files changed, 74 insertions(+), 21 deletions(-)
To view, visit change 2820669. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Robert Flack.
Attention is currently required from: Xida Chen.
1 comment:
Patchset:
I do not think that writing data back to the animation's member variables during style/paint to be used by a later phase is a good idea. While slightly inefficient, can we simply call the same function to check whether BackgroundPaintColorWorklet was capable of painting the animation? Setting additional failure reasons in multiple locations is extremely brittle (may overwrite values, use stale values, or fail to set values) and may lead to additional errors unless done very carefully. If we do need to cache the value for efficiency, it should probably become part of compositor_state_.
To view, visit change 2820669. To unsubscribe, or for help writing mail filters, visit settings.