| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 RefPtr<TimingFunction> timingFunction; | 93 RefPtr<TimingFunction> timingFunction; |
| 94 if (value->isInheritedValue() && parentStyle->animations()) { | 94 if (value->isInheritedValue() && parentStyle->animations()) { |
| 95 timingFunction = parentStyle->animations()->timingFunctionLi
st()[0]; | 95 timingFunction = parentStyle->animations()->timingFunctionLi
st()[0]; |
| 96 } else if (value->isValueList()) { | 96 } else if (value->isValueList()) { |
| 97 timingFunction = CSSToStyleMap::mapAnimationTimingFunction(t
oCSSValueList(value)->item(0)); | 97 timingFunction = CSSToStyleMap::mapAnimationTimingFunction(t
oCSSValueList(value)->item(0)); |
| 98 } else { | 98 } else { |
| 99 ASSERT(value->isCSSWideKeyword()); | 99 ASSERT(value->isCSSWideKeyword()); |
| 100 timingFunction = CSSTimingData::initialTimingFunction(); | 100 timingFunction = CSSTimingData::initialTimingFunction(); |
| 101 } | 101 } |
| 102 keyframe->setEasing(timingFunction.release()); | 102 keyframe->setEasing(timingFunction.release()); |
| 103 } else if (CSSPropertyMetadata::isAnimatableProperty(property)) { | 103 } else if (CSSPropertyMetadata::isInterpolableProperty(property)) { |
| 104 keyframe->setPropertyValue(property, properties.propertyAt(j).va
lue()); | 104 keyframe->setPropertyValue(property, properties.propertyAt(j).va
lue()); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 keyframes.append(keyframe); | 107 keyframes.append(keyframe); |
| 108 // The last keyframe specified at a given offset is used. | 108 // The last keyframe specified at a given offset is used. |
| 109 for (size_t j = 1; j < offsets.size(); ++j) { | 109 for (size_t j = 1; j < offsets.size(); ++j) { |
| 110 keyframes.append(toStringKeyframe(keyframe->cloneWithOffset(offsets[
j]).get())); | 110 keyframes.append(toStringKeyframe(keyframe->cloneWithOffset(offsets[
j]).get())); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 bool animateAll = mode == CSSTransitionData::TransitionAll; | 544 bool animateAll = mode == CSSTransitionData::TransitionAll; |
| 545 ASSERT(animateAll || mode == CSSTransitionData::TransitionSingleProp
erty); | 545 ASSERT(animateAll || mode == CSSTransitionData::TransitionSingleProp
erty); |
| 546 if (animateAll) | 546 if (animateAll) |
| 547 anyTransitionHadTransitionAll = true; | 547 anyTransitionHadTransitionAll = true; |
| 548 const StylePropertyShorthand& propertyList = animateAll ? CSSAnimati
ons::propertiesForTransitionAll() : shorthandForProperty(property); | 548 const StylePropertyShorthand& propertyList = animateAll ? CSSAnimati
ons::propertiesForTransitionAll() : shorthandForProperty(property); |
| 549 // If not a shorthand we only execute one iteration of this loop, an
d refer to the property directly. | 549 // If not a shorthand we only execute one iteration of this loop, an
d refer to the property directly. |
| 550 for (unsigned j = 0; !j || j < propertyList.length(); ++j) { | 550 for (unsigned j = 0; !j || j < propertyList.length(); ++j) { |
| 551 CSSPropertyID id = propertyList.length() ? propertyList.properti
es()[j] : property; | 551 CSSPropertyID id = propertyList.length() ? propertyList.properti
es()[j] : property; |
| 552 | 552 |
| 553 if (!animateAll) { | 553 if (!animateAll) { |
| 554 if (CSSPropertyMetadata::isAnimatableProperty(id)) | 554 if (CSSPropertyMetadata::isInterpolableProperty(id)) |
| 555 listedProperties.set(id); | 555 listedProperties.set(id); |
| 556 else | 556 else |
| 557 continue; | 557 continue; |
| 558 } | 558 } |
| 559 | 559 |
| 560 // FIXME: We should transition if an !important property changes
even when an animation is running, | 560 // FIXME: We should transition if an !important property changes
even when an animation is running, |
| 561 // but this is a bit hard to do with the current applyMatchedPro
perties system. | 561 // but this is a bit hard to do with the current applyMatchedPro
perties system. |
| 562 PropertyHandle property = PropertyHandle(id); | 562 PropertyHandle property = PropertyHandle(id); |
| 563 if (!update->activeInterpolationsForAnimations().contains(proper
ty) | 563 if (!update->activeInterpolationsForAnimations().contains(proper
ty) |
| 564 && (!elementAnimations || !elementAnimations->cssAnimations(
).m_previousActiveInterpolationsForAnimations.contains(property))) { | 564 && (!elementAnimations || !elementAnimations->cssAnimations(
).m_previousActiveInterpolationsForAnimations.contains(property))) { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 if (properties.isEmpty()) { | 744 if (properties.isEmpty()) { |
| 745 for (int i = firstCSSProperty; i < lastCSSProperty; ++i) { | 745 for (int i = firstCSSProperty; i < lastCSSProperty; ++i) { |
| 746 CSSPropertyID id = convertToCSSPropertyID(i); | 746 CSSPropertyID id = convertToCSSPropertyID(i); |
| 747 // Avoid creating overlapping transitions with perspective-origin an
d transition-origin. | 747 // Avoid creating overlapping transitions with perspective-origin an
d transition-origin. |
| 748 if (id == CSSPropertyWebkitPerspectiveOriginX | 748 if (id == CSSPropertyWebkitPerspectiveOriginX |
| 749 || id == CSSPropertyWebkitPerspectiveOriginY | 749 || id == CSSPropertyWebkitPerspectiveOriginY |
| 750 || id == CSSPropertyWebkitTransformOriginX | 750 || id == CSSPropertyWebkitTransformOriginX |
| 751 || id == CSSPropertyWebkitTransformOriginY | 751 || id == CSSPropertyWebkitTransformOriginY |
| 752 || id == CSSPropertyWebkitTransformOriginZ) | 752 || id == CSSPropertyWebkitTransformOriginZ) |
| 753 continue; | 753 continue; |
| 754 if (CSSPropertyMetadata::isAnimatableProperty(id)) | 754 if (CSSPropertyMetadata::isInterpolableProperty(id)) |
| 755 properties.append(id); | 755 properties.append(id); |
| 756 } | 756 } |
| 757 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie
s.begin(), properties.size()); | 757 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie
s.begin(), properties.size()); |
| 758 } | 758 } |
| 759 return propertyShorthand; | 759 return propertyShorthand; |
| 760 } | 760 } |
| 761 | 761 |
| 762 // KeyframeEffect properties are not allowed to be affected by Web Animations. | 762 // Properties that affect animations are not allowed to be affected by animation
s. |
| 763 // http://dev.w3.org/fxtf/web-animations/#not-animatable | 763 // http://w3c.github.io/web-animations/#not-animatable-section |
| 764 bool CSSAnimations::isAllowedAnimation(CSSPropertyID property) | 764 bool CSSAnimations::isAnimatableProperty(CSSPropertyID property) |
| 765 { | 765 { |
| 766 switch (property) { | 766 switch (property) { |
| 767 case CSSPropertyAnimation: | 767 case CSSPropertyAnimation: |
| 768 case CSSPropertyAnimationDelay: | 768 case CSSPropertyAnimationDelay: |
| 769 case CSSPropertyAnimationDirection: | 769 case CSSPropertyAnimationDirection: |
| 770 case CSSPropertyAnimationDuration: | 770 case CSSPropertyAnimationDuration: |
| 771 case CSSPropertyAnimationFillMode: | 771 case CSSPropertyAnimationFillMode: |
| 772 case CSSPropertyAnimationIterationCount: | 772 case CSSPropertyAnimationIterationCount: |
| 773 case CSSPropertyAnimationName: | 773 case CSSPropertyAnimationName: |
| 774 case CSSPropertyAnimationPlayState: | 774 case CSSPropertyAnimationPlayState: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 802 visitor->trace(m_activeInterpolationsForAnimations); | 802 visitor->trace(m_activeInterpolationsForAnimations); |
| 803 visitor->trace(m_activeInterpolationsForTransitions); | 803 visitor->trace(m_activeInterpolationsForTransitions); |
| 804 visitor->trace(m_newAnimations); | 804 visitor->trace(m_newAnimations); |
| 805 visitor->trace(m_suppressedAnimations); | 805 visitor->trace(m_suppressedAnimations); |
| 806 visitor->trace(m_animationsWithUpdates); | 806 visitor->trace(m_animationsWithUpdates); |
| 807 visitor->trace(m_animationsWithStyleUpdates); | 807 visitor->trace(m_animationsWithStyleUpdates); |
| 808 #endif | 808 #endif |
| 809 } | 809 } |
| 810 | 810 |
| 811 } // namespace blink | 811 } // namespace blink |
| OLD | NEW |