• Xida Chen's avatar
    Keep offset for composite background color animation · b4b6e3ec
    Xida Chen authored
    At this moment, our implementation only keeps the first and the
    last keyframes for composite background color animation. This is
    wrong, for example, we can having multiple keyframes like:
    0%: { background-color: red }
    10%: { background-color: green}
    100% { background-color: blue}
    
    This CL fixes the issue. The idea is to keep the offset which
    we stored in CompositorKeyframeValues. In the above case, the
    offsets would be [0, 0.1, 1].
    
    Once we have that, here is how we do interpolation. Say that
    the current progress is 0.4, then we know that it falls in to
    the range of [0.1, 1], which means we need to interpolate from
    green to blue. We need to adjust the progress (0.4) based on the
    offsets. Basically scale [0.1, 1] to [0, 1], then the adjusted
    progress should be (0.4-0.1) / (1-0.1). Layout tests are added
    to ensure correctness.
    
    Bug: 1153671
    Change-Id: I6dffc82b5821fdf418f2b94331f567a239079730
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2597844
    Commit-Queue: Xida Chen <xidachen@chromium.org>
    Reviewed-by: default avatarKevin Ellis <kevers@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#841476}
    b4b6e3ec
composite-after-paint 4.45 KB