Changeset 289454 in webkit
- Timestamp:
- Feb 8, 2022 10:25:57 PM (5 months ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/combining-effects/effect-composition-expected.txt (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/combining-effects/effect-composition.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/animation/KeyframeEffect.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r289453 r289454 1 2022-02-08 Antoine Quint <graouts@webkit.org> 2 3 [web-animations] additive and accumulation interpolation does not work correctly with implicit 0% and 100% keyframes 4 https://bugs.webkit.org/show_bug.cgi?id=236314 5 6 Reviewed by Dean Jackson. 7 8 Add some new WPT tests and mark our PASS results for the "add" case (we still fail for "accumulate"). 9 10 * web-platform-tests/web-animations/animation-model/combining-effects/effect-composition-expected.txt: 11 * web-platform-tests/web-animations/animation-model/combining-effects/effect-composition.html: 12 1 13 2022-02-08 Antoine Quint <graouts@webkit.org> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/combining-effects/effect-composition-expected.txt
r285397 r289454 2 2 PASS accumulate onto the base value 3 3 PASS accumulate onto an underlying animation value 4 FAIL accumulate onto an underlying animation value with implicit from values assert_equals: Animated style at 50% expected "matrix(1, 0, 0, 1, 50, 50)" but got "matrix(1, 0, 0, 1, 25, 50)" 5 FAIL accumulate onto an underlying animation value with implicit to values assert_equals: Animated style at 50% expected "matrix(1, 0, 0, 1, 50, 50)" but got "matrix(1, 0, 0, 1, 25, 50)" 4 6 PASS Composite when mixing accumulate and replace 5 7 PASS accumulate specified on a keyframe overrides the composite mode of the effect … … 7 9 PASS add onto the base value 8 10 PASS add onto an underlying animation value 11 PASS add onto an underlying animation value with implicit from values 12 PASS add onto an underlying animation value with implicit to values 9 13 PASS Composite when mixing add and replace 10 14 PASS add specified on a keyframe overrides the composite mode of the effect -
trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/combining-effects/effect-composition.html
r250263 r289454 39 39 'Animated style at 50%'); 40 40 }, `${composite} onto an underlying animation value`); 41 42 test(t => { 43 const div = createDiv(t); 44 const anims = []; 45 anims.push(div.animate({ transform: 'translateX(100px)' }, { duration: 100, composite: 'replace' })); 46 anims.push(div.animate({ transform: 'translateY(100px)' }, { duration: 100, composite })); 47 48 for (const anim of anims) { 49 anim.currentTime = 50; 50 } 51 52 assert_equals(getComputedStyle(div).transform, 'matrix(1, 0, 0, 1, 50, 50)', 53 'Animated style at 50%'); 54 }, `${composite} onto an underlying animation value with implicit from values`); 55 56 test(t => { 57 const div = createDiv(t); 58 const anims = []; 59 anims.push(div.animate([{ offset: 1, transform: 'translateX(100px)' }], { duration: 100, composite: 'replace' })); 60 anims.push(div.animate([{ offset: 1, transform: 'translateY(100px)' }], { duration: 100, composite })); 61 62 for (const anim of anims) { 63 anim.currentTime = 50; 64 } 65 66 assert_equals(getComputedStyle(div).transform, 'matrix(1, 0, 0, 1, 50, 50)', 67 'Animated style at 50%'); 68 }, `${composite} onto an underlying animation value with implicit to values`); 41 69 42 70 test(t => { -
trunk/Source/WebCore/ChangeLog
r289453 r289454 1 2022-02-08 Antoine Quint <graouts@webkit.org> 2 3 [web-animations] additive and accumulation interpolation does not work correctly with implicit 0% and 100% keyframes 4 https://bugs.webkit.org/show_bug.cgi?id=236314 5 6 Reviewed by Dean Jackson. 7 8 We incorrectly handled implicit keyframes for the additive and accumulate cases. 9 10 The spec says that for implicit 0% and 100% keyframes, a keyframe should be generated with a "neutral" keyframe which, 11 when added or accumulated with another keyframe, would yield the same style as the keyframe it's composed with. We sort 12 of did the right thing by cloning the underlying style for those keyframes, but then we would blame them anyway in the 13 composition case, whereas we should just use the underlying style as-is. 14 15 * animation/KeyframeEffect.cpp: 16 (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): 17 1 18 2022-02-08 Antoine Quint <graouts@webkit.org> 2 19 -
trunk/Source/WebCore/animation/KeyframeEffect.cpp
r289426 r289454 1469 1469 continue; 1470 1470 1471 auto hasImplicitZeroKeyframe = !numberOfKeyframesWithZeroOffset; 1472 auto hasImplicitOneKeyframe = !numberOfKeyframesWithOneOffset; 1473 1471 1474 // 8. If there is no keyframe in property-specific keyframes with a computed keyframe offset of 0, create a new keyframe with a computed keyframe 1472 1475 // offset of 0, a property value set to the neutral value for composition, and a composite operation of add, and prepend it to the beginning of 1473 1476 // property-specific keyframes. 1474 if ( !numberOfKeyframesWithZeroOffset) {1477 if (hasImplicitZeroKeyframe) { 1475 1478 propertySpecificKeyframes.insert(0, &propertySpecificKeyframeWithZeroOffset); 1476 1479 numberOfKeyframesWithZeroOffset = 1; … … 1480 1483 // keyframe offset of 1, a property value set to the neutral value for composition, and a composite operation of add, and append it to the end of 1481 1484 // property-specific keyframes. 1482 if ( !numberOfKeyframesWithOneOffset) {1485 if (hasImplicitOneKeyframe) { 1483 1486 propertySpecificKeyframes.append(&propertySpecificKeyframeWithOneOffset); 1484 1487 numberOfKeyframesWithOneOffset = 1; … … 1541 1544 // target property’s animation type. 1542 1545 if (CSSPropertyAnimation::isPropertyAdditiveOrCumulative(cssPropertyId)) { 1543 auto startKeyframeCompositeOperation = startKeyframe.compositeOperation().value_or(m_compositeOperation); 1544 if (startKeyframeCompositeOperation != CompositeOperation::Replace) 1545 CSSPropertyAnimation::blendProperties(this, cssPropertyId, startKeyframeStyle, targetStyle, *startKeyframe.style(), 1, startKeyframeCompositeOperation); 1546 1547 auto endKeyframeCompositeOperation = endKeyframe.compositeOperation().value_or(m_compositeOperation); 1548 if (endKeyframeCompositeOperation != CompositeOperation::Replace) 1549 CSSPropertyAnimation::blendProperties(this, cssPropertyId, endKeyframeStyle, targetStyle, *endKeyframe.style(), 1, endKeyframeCompositeOperation); 1546 // Only do this for the 0 keyframe if it was provided explicitly, since otherwise we want to use the "neutral value 1547 // for composition" which really means we don't want to do anything but rather just use the underlying style which 1548 // is already set on startKeyframe. 1549 if (!startKeyframe.key() && !hasImplicitZeroKeyframe) { 1550 auto startKeyframeCompositeOperation = startKeyframe.compositeOperation().value_or(m_compositeOperation); 1551 if (startKeyframeCompositeOperation != CompositeOperation::Replace) 1552 CSSPropertyAnimation::blendProperties(this, cssPropertyId, startKeyframeStyle, targetStyle, *startKeyframe.style(), 1, startKeyframeCompositeOperation); 1553 } 1554 1555 // Only do this for the 1 keyframe if it was provided explicitly, since otherwise we want to use the "neutral value 1556 // for composition" which really means we don't want to do anything but rather just use the underlying style which 1557 // is already set on endKeyframe. 1558 if (endKeyframe.key() == 1 && !hasImplicitOneKeyframe) { 1559 auto endKeyframeCompositeOperation = endKeyframe.compositeOperation().value_or(m_compositeOperation); 1560 if (endKeyframeCompositeOperation != CompositeOperation::Replace) 1561 CSSPropertyAnimation::blendProperties(this, cssPropertyId, endKeyframeStyle, targetStyle, *endKeyframe.style(), 1, endKeyframeCompositeOperation); 1562 } 1550 1563 } 1551 1564
Note: See TracChangeset
for help on using the changeset viewer.