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 // TODO(alancutter): We should allow animation of non-interpolab
le properties as well. |
| 105 // https://lists.w3.org/Archives/Public/www-style/2012Nov/0261.h
tml |
104 keyframe->setPropertyValue(property, properties.propertyAt(j).va
lue()); | 106 keyframe->setPropertyValue(property, properties.propertyAt(j).va
lue()); |
105 } | 107 } |
106 } | 108 } |
107 keyframes.append(keyframe); | 109 keyframes.append(keyframe); |
108 // The last keyframe specified at a given offset is used. | 110 // The last keyframe specified at a given offset is used. |
109 for (size_t j = 1; j < offsets.size(); ++j) { | 111 for (size_t j = 1; j < offsets.size(); ++j) { |
110 keyframes.append(toStringKeyframe(keyframe->cloneWithOffset(offsets[
j]).get())); | 112 keyframes.append(toStringKeyframe(keyframe->cloneWithOffset(offsets[
j]).get())); |
111 } | 113 } |
112 } | 114 } |
113 | 115 |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 bool animateAll = mode == CSSTransitionData::TransitionAll; | 546 bool animateAll = mode == CSSTransitionData::TransitionAll; |
545 ASSERT(animateAll || mode == CSSTransitionData::TransitionSingleProp
erty); | 547 ASSERT(animateAll || mode == CSSTransitionData::TransitionSingleProp
erty); |
546 if (animateAll) | 548 if (animateAll) |
547 anyTransitionHadTransitionAll = true; | 549 anyTransitionHadTransitionAll = true; |
548 const StylePropertyShorthand& propertyList = animateAll ? CSSAnimati
ons::propertiesForTransitionAll() : shorthandForProperty(property); | 550 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. | 551 // 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) { | 552 for (unsigned j = 0; !j || j < propertyList.length(); ++j) { |
551 CSSPropertyID id = propertyList.length() ? propertyList.properti
es()[j] : property; | 553 CSSPropertyID id = propertyList.length() ? propertyList.properti
es()[j] : property; |
552 | 554 |
553 if (!animateAll) { | 555 if (!animateAll) { |
554 if (CSSPropertyMetadata::isAnimatableProperty(id)) | 556 if (CSSPropertyMetadata::isInterpolableProperty(id)) |
555 listedProperties.set(id); | 557 listedProperties.set(id); |
556 else | 558 else |
557 continue; | 559 continue; |
558 } | 560 } |
559 | 561 |
560 // FIXME: We should transition if an !important property changes
even when an animation is running, | 562 // 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. | 563 // but this is a bit hard to do with the current applyMatchedPro
perties system. |
562 PropertyHandle property = PropertyHandle(id); | 564 PropertyHandle property = PropertyHandle(id); |
563 if (!update->activeInterpolationsForAnimations().contains(proper
ty) | 565 if (!update->activeInterpolationsForAnimations().contains(proper
ty) |
564 && (!elementAnimations || !elementAnimations->cssAnimations(
).m_previousActiveInterpolationsForAnimations.contains(property))) { | 566 && (!elementAnimations || !elementAnimations->cssAnimations(
).m_previousActiveInterpolationsForAnimations.contains(property))) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 if (properties.isEmpty()) { | 746 if (properties.isEmpty()) { |
745 for (int i = firstCSSProperty; i < lastCSSProperty; ++i) { | 747 for (int i = firstCSSProperty; i < lastCSSProperty; ++i) { |
746 CSSPropertyID id = convertToCSSPropertyID(i); | 748 CSSPropertyID id = convertToCSSPropertyID(i); |
747 // Avoid creating overlapping transitions with perspective-origin an
d transition-origin. | 749 // Avoid creating overlapping transitions with perspective-origin an
d transition-origin. |
748 if (id == CSSPropertyWebkitPerspectiveOriginX | 750 if (id == CSSPropertyWebkitPerspectiveOriginX |
749 || id == CSSPropertyWebkitPerspectiveOriginY | 751 || id == CSSPropertyWebkitPerspectiveOriginY |
750 || id == CSSPropertyWebkitTransformOriginX | 752 || id == CSSPropertyWebkitTransformOriginX |
751 || id == CSSPropertyWebkitTransformOriginY | 753 || id == CSSPropertyWebkitTransformOriginY |
752 || id == CSSPropertyWebkitTransformOriginZ) | 754 || id == CSSPropertyWebkitTransformOriginZ) |
753 continue; | 755 continue; |
754 if (CSSPropertyMetadata::isAnimatableProperty(id)) | 756 if (CSSPropertyMetadata::isInterpolableProperty(id)) |
755 properties.append(id); | 757 properties.append(id); |
756 } | 758 } |
757 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie
s.begin(), properties.size()); | 759 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie
s.begin(), properties.size()); |
758 } | 760 } |
759 return propertyShorthand; | 761 return propertyShorthand; |
760 } | 762 } |
761 | 763 |
762 // KeyframeEffect properties are not allowed to be affected by Web Animations. | 764 // Properties that affect animations are not allowed to be affected by animation
s. |
763 // http://dev.w3.org/fxtf/web-animations/#not-animatable | 765 // http://w3c.github.io/web-animations/#not-animatable-section |
764 bool CSSAnimations::isAllowedAnimation(CSSPropertyID property) | 766 bool CSSAnimations::isAnimatableProperty(CSSPropertyID property) |
765 { | 767 { |
766 switch (property) { | 768 switch (property) { |
767 case CSSPropertyAnimation: | 769 case CSSPropertyAnimation: |
768 case CSSPropertyAnimationDelay: | 770 case CSSPropertyAnimationDelay: |
769 case CSSPropertyAnimationDirection: | 771 case CSSPropertyAnimationDirection: |
770 case CSSPropertyAnimationDuration: | 772 case CSSPropertyAnimationDuration: |
771 case CSSPropertyAnimationFillMode: | 773 case CSSPropertyAnimationFillMode: |
772 case CSSPropertyAnimationIterationCount: | 774 case CSSPropertyAnimationIterationCount: |
773 case CSSPropertyAnimationName: | 775 case CSSPropertyAnimationName: |
774 case CSSPropertyAnimationPlayState: | 776 case CSSPropertyAnimationPlayState: |
(...skipping 27 matching lines...) Expand all Loading... |
802 visitor->trace(m_activeInterpolationsForAnimations); | 804 visitor->trace(m_activeInterpolationsForAnimations); |
803 visitor->trace(m_activeInterpolationsForTransitions); | 805 visitor->trace(m_activeInterpolationsForTransitions); |
804 visitor->trace(m_newAnimations); | 806 visitor->trace(m_newAnimations); |
805 visitor->trace(m_suppressedAnimations); | 807 visitor->trace(m_suppressedAnimations); |
806 visitor->trace(m_animationsWithUpdates); | 808 visitor->trace(m_animationsWithUpdates); |
807 visitor->trace(m_animationsWithStyleUpdates); | 809 visitor->trace(m_animationsWithStyleUpdates); |
808 #endif | 810 #endif |
809 } | 811 } |
810 | 812 |
811 } // namespace blink | 813 } // namespace blink |
OLD | NEW |