[web-animations] Make handling of keyframes more spec compliant
WebAnimations spec has two keyframe concepts: A) keyframes [1] B) computed keyframes [2] A key difference is that in A property values remain unresolved while in B these properties are resolved (e.g., shorthands expand to long hands etc.) KeyframeEffect.getKeyframes() is expected to return (A) but our current implementation only keeps around (B). This CL introduces the following changes to bring us closer to the specified behavior: 1. Introduce a new map <property, value> in StringKeyframe representing (A) 2. CSS property pairs are added to this map as long as they parse correctly [3] 3. Use the new map to produce the result of getKeyframes() There is some additional special handling required for shorthand properties because Blink CSS parser does not really produce any shorthand values. As a shortcut this patch introduces a new type of css value (`CSSKeyframeShorthandValue`) which represents a shorthand by encapsulating all its relevant longhand property/value pairs. Note that we continue our old behavior for SVG and Presentation attrs which will be switch over in follow up patch. [1] https://drafts.csswg.org/web-animations/#keyframes-section [2] https://drafts.csswg.org/web-animations/#calculating-computed-keyframes [3] https://drafts.csswg.org/web-animations/#process-a-keyframes-argument step 8 TEST: - web-animations/interfaces/{Animatable, Keyframes} => PASS previously failing tests - Added two new test cases in above covering animated custom props - external/wpt/web-animations/interfaces/KeyframeEffect/getKeyframes.html => New test to cover serialization Bug: 816956 Change-Id: Icc8e0bc4a0ee3019ad7d2c566aacb9d3aee0ffe3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1634393 Commit-Queue: Majid Valipour <majidvp@chromium.org> Reviewed-by:Stephen McGruer <smcgruer@chromium.org> Reviewed-by:
Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/master@{#675665}
Showing
Please register or sign in to comment