• Xida Chen's avatar
    Fix a crash by PaintWorklet + custom property animation · b1d6a66b
    Xida Chen authored
    https://chromium-review.googlesource.com/c/chromium/src/+/2359370
    The above CL made a custom property animation always composited if
    it is used by paint worklet, even if the element does not have
    "will-change: transform". The approach is that we give a special
    ElementId which is uint64_t::max() to the paint worklet element,
    and then on the CC side, once we see that element id, we know that
    it is an animation associated with paint worklet and we will always
    tick that animation.
    
    The problem comes when there are two paint worklet elements.
    
    The short version of the problem is:
    CC's animation system doesn't allow two layers with the same
    ElementId.
    
    Longer version:
    Then these two layers would have the same ElementId when
    we try to attach a composited layer with that animation. As a
    result, in the AnimationHost::RegisterAnimationForElement(), we
    will have two Animation with the same ElementId. Then, the actual
    crash happens at ElementAnimations::GetPropertyToElementIdMap(),
    at the first DCHECK.
    
    So the solution in this CL is to not DCHECK in certain cases.
    The DCHECK actually doesn't make sense in this case where
    there is no composited layer. In fact, the callers of the
    ElementAnimations::GetPropertyToElementIdMap gives the result
    to MutatorHostClient::ElementIsAnimatingChanged, and in there
    it only cares about 4 properties. So for the other properties
    that it doesn't care, we should not put it in the map.
    
    Bug: 1151755
    Change-Id: I5479ccae80f3c89db98d27518ef013dded527ece
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2553691
    Commit-Queue: Xida Chen <xidachen@chromium.org>
    Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
    Reviewed-by: default avatarKevin Ellis <kevers@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#831090}
    b1d6a66b
element_animations.cc 23.4 KB