[composite-bgcolor-animation] Tweak compositing logic [chromium/src : main]

115 views
Skip to first unread message

Xida Chen (Gerrit)

unread,
Apr 12, 2021, 8:48:44 AM4/12/21
to Robert Flack, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org

Attention is currently required from: Robert Flack.

Xida Chen would like Robert Flack to review this change.

View 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.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I00c504593ba04c4d1cb32543b3616089326f52d1
Gerrit-Change-Number: 2820669
Gerrit-PatchSet: 4
Gerrit-Owner: Xida Chen <xida...@chromium.org>
Gerrit-Reviewer: Robert Flack <fla...@chromium.org>
Gerrit-Reviewer: Xida Chen <xida...@chromium.org>
Gerrit-CC: Alexis Menard <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-Attention: Robert Flack <fla...@chromium.org>
Gerrit-MessageType: newchange

Xida Chen (Gerrit)

unread,
Apr 12, 2021, 8:48:55 AM4/12/21
to blink-revie...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Robert Flack, Chromium LUCI CQ, Alexis Menard, chromium...@chromium.org, Olga Gerchikov

Attention is currently required from: Robert Flack.

View Change

    To view, visit change 2820669. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I00c504593ba04c4d1cb32543b3616089326f52d1
    Gerrit-Change-Number: 2820669
    Gerrit-PatchSet: 4
    Gerrit-Owner: Xida Chen <xida...@chromium.org>
    Gerrit-Reviewer: Robert Flack <fla...@chromium.org>
    Gerrit-Reviewer: Xida Chen <xida...@chromium.org>
    Gerrit-CC: Alexis Menard <alexis...@intel.com>
    Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
    Gerrit-Attention: Robert Flack <fla...@chromium.org>
    Gerrit-Comment-Date: Mon, 12 Apr 2021 12:48:38 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Robert Flack (Gerrit)

    unread,
    Apr 13, 2021, 11:52:45 AM4/13/21
    to Xida Chen, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, Chromium LUCI CQ, Alexis Menard, chromium...@chromium.org, Olga Gerchikov

    Attention is currently required from: Xida Chen.

    View Change

    1 comment:

    • Patchset:

      • Patch Set #4:

        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.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I00c504593ba04c4d1cb32543b3616089326f52d1
    Gerrit-Change-Number: 2820669
    Gerrit-PatchSet: 4
    Gerrit-Owner: Xida Chen <xida...@chromium.org>
    Gerrit-Reviewer: Robert Flack <fla...@chromium.org>
    Gerrit-Reviewer: Xida Chen <xida...@chromium.org>
    Gerrit-CC: Alexis Menard <alexis...@intel.com>
    Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
    Gerrit-Attention: Xida Chen <xida...@chromium.org>
    Gerrit-Comment-Date: Tue, 13 Apr 2021 15:52:29 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment
    Reply all
    Reply to author
    Forward
    0 new messages