Changeset 228710 in webkit
- Timestamp:
- Feb 19, 2018 2:01:51 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r228709 r228710 1 2018-02-19 Antoine Quint <graouts@apple.com> 2 3 [Web Animations] Decouple parsing JS keyframes and computing blending keyframes 4 https://bugs.webkit.org/show_bug.cgi?id=182939 5 <rdar://problem/37678364> 6 7 Reviewed by Dean Jackson. 8 9 Move all the code used to create the KeyframeList into a dedicated updateBlendingKeyframes() method. 10 11 No new tests since this code change has no user-visible impact. 12 13 * animation/KeyframeEffectReadOnly.cpp: 14 (WebCore::KeyframeEffectReadOnly::processKeyframes): 15 (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes): 16 * animation/KeyframeEffectReadOnly.h: 17 1 18 2018-02-19 Jer Noble <jer.noble@apple.com> 2 19 -
trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp
r228702 r228710 556 556 computeMissingKeyframeOffsets(parsedKeyframes); 557 557 558 // 8. For each frame in processed keyframes, perform the following steps: 559 for (auto& keyframe : parsedKeyframes) { 560 // Let the timing function of frame be the result of parsing the “easing” property on frame using the CSS syntax 561 // defined for the easing property of the AnimationEffectTimingReadOnly interface. 562 // If parsing the “easing” property fails, throw a TypeError and abort this procedure. 563 auto timingFunctionResult = TimingFunction::createFromCSSText(keyframe.easing); 564 if (timingFunctionResult.hasException()) 565 return timingFunctionResult.releaseException(); 566 keyframe.timingFunction = timingFunctionResult.returnValue(); 567 } 568 569 // 9. Parse each of the values in unused easings using the CSS syntax defined for easing property of the 570 // AnimationEffectTimingReadOnly interface, and if any of the values fail to parse, throw a TypeError 571 // and abort this procedure. 572 for (auto& easing : unusedEasings) { 573 auto timingFunctionResult = TimingFunction::createFromCSSText(easing); 574 if (timingFunctionResult.hasException()) 575 return timingFunctionResult.releaseException(); 576 } 577 578 m_parsedKeyframes = WTFMove(parsedKeyframes); 579 580 updateBlendingKeyframes(); 581 582 return { }; 583 } 584 585 void KeyframeEffectReadOnly::updateBlendingKeyframes() 586 { 587 if (!m_target) 588 return; 589 558 590 KeyframeList keyframeList("keyframe-effect-" + createCanonicalUUIDString()); 559 591 StyleResolver& styleResolver = m_target->styleResolver(); 560 592 561 // 8. For each frame in processed keyframes, perform the following steps: 562 for (auto& keyframe : parsedKeyframes) { 563 // 1. For each property-value pair in frame, parse the property value using the syntax specified for that property. 564 // If the property value is invalid according to the syntax for the property, discard the property-value pair. 565 // User agents that provide support for diagnosing errors in content SHOULD produce an appropriate warning 566 // highlighting the invalid property value. 567 593 for (auto& keyframe : m_parsedKeyframes) { 568 594 KeyframeValue keyframeValue(keyframe.computedOffset, nullptr); 569 595 auto renderStyle = RenderStyle::createPtr(); 596 // We need to call update() on the FontCascade or we'll hit an ASSERT when parsing font-related properties. 597 renderStyle->fontCascade().update(nullptr); 598 570 599 auto& styleProperties = keyframe.style; 571 600 for (unsigned i = 0; i < styleProperties->propertyCount(); ++i) { … … 579 608 keyframeValue.setStyle(RenderStyle::clonePtr(*renderStyle)); 580 609 keyframeList.insert(WTFMove(keyframeValue)); 581 582 // 2. Let the timing function of frame be the result of parsing the “easing” property on frame using the CSS syntax583 // defined for the easing property of the AnimationEffectTimingReadOnly interface.584 // If parsing the “easing” property fails, throw a TypeError and abort this procedure.585 auto timingFunctionResult = TimingFunction::createFromCSSText(keyframe.easing);586 if (timingFunctionResult.hasException())587 return timingFunctionResult.releaseException();588 keyframe.timingFunction = timingFunctionResult.returnValue();589 }590 591 // 9. Parse each of the values in unused easings using the CSS syntax defined for easing property of the592 // AnimationEffectTimingReadOnly interface, and if any of the values fail to parse, throw a TypeError593 // and abort this procedure.594 for (auto& easing : unusedEasings) {595 auto timingFunctionResult = TimingFunction::createFromCSSText(easing);596 if (timingFunctionResult.hasException())597 return timingFunctionResult.releaseException();598 610 } 599 611 600 612 m_blendingKeyframes = WTFMove(keyframeList); 601 m_parsedKeyframes = WTFMove(parsedKeyframes);602 613 603 614 computeStackingContextImpact(); 604 605 return { };606 615 } 607 616 -
trunk/Source/WebCore/animation/KeyframeEffectReadOnly.h
r228702 r228710 120 120 void setAnimatedPropertiesInStyle(RenderStyle&, double); 121 121 void computeStackingContextImpact(); 122 void updateBlendingKeyframes(); 122 123 bool shouldRunAccelerated(); 123 124
Note: See TracChangeset
for help on using the changeset viewer.