gecko-dev/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/getKeyframes.html
Majid Valipour 39cebccf28 Bug 1555486 [wpt PR 17083] - [web-animations] Make handling of keyframes more spec compliant, a=testonly
Automatic update from web-platform-tests
[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}

--

wpt-commits: 631824bf82ea23e59604b443ab62c9b123eb25d5
wpt-pr: 17083
2019-07-24 13:33:31 +01:00

25 lines
No EOL
822 B
HTML

<!DOCTYPE html>
<meta charset=utf-8>
<title>KeyframeEffect getKeyframes()</title>
<link rel="help"
href="https://drafts.csswg.org/web-animations/#dom-keyframeeffect-getkeyframes">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/keyframe-utils.js"></script>
<script src="../../resources/keyframe-tests.js"></script>
<body>
<div id="log"></div>
<div id="target"></div>
<script>
'use strict';
const target = document.getElementById('target');
for (const subtest of gKeyframeSerializationTests) {
test(t => {
const effect = new KeyframeEffect(target, subtest.input);
assert_frame_lists_equal(effect.getKeyframes(), subtest.output);
}, `getKeyframes() should serialize its css values with ${subtest.desc}`);
}
</script>