| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 if (value.isInheritedValue() && parentStyle->animations()) { | 106 if (value.isInheritedValue() && parentStyle->animations()) { |
| 107 timingFunction = parentStyle->animations()->timingFunctionList()[0]; | 107 timingFunction = parentStyle->animations()->timingFunctionList()[0]; |
| 108 } else if (value.isValueList()) { | 108 } else if (value.isValueList()) { |
| 109 timingFunction = CSSToStyleMap::mapAnimationTimingFunction( | 109 timingFunction = CSSToStyleMap::mapAnimationTimingFunction( |
| 110 toCSSValueList(value).item(0)); | 110 toCSSValueList(value).item(0)); |
| 111 } else { | 111 } else { |
| 112 DCHECK(value.isCSSWideKeyword()); | 112 DCHECK(value.isCSSWideKeyword()); |
| 113 timingFunction = CSSTimingData::initialTimingFunction(); | 113 timingFunction = CSSTimingData::initialTimingFunction(); |
| 114 } | 114 } |
| 115 keyframe->setEasing(timingFunction.release()); | 115 keyframe->setEasing(timingFunction.release()); |
| 116 } else if (CSSAnimations::isAnimatableProperty(property)) { | 116 } else if (!CSSAnimations::isAnimationAffectingProperty(property)) { |
| 117 keyframe->setCSSPropertyValue(property, | 117 keyframe->setCSSPropertyValue(property, |
| 118 properties.propertyAt(j).value()); | 118 properties.propertyAt(j).value()); |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 keyframes.append(keyframe); | 121 keyframes.append(keyframe); |
| 122 // The last keyframe specified at a given offset is used. | 122 // The last keyframe specified at a given offset is used. |
| 123 for (size_t j = 1; j < offsets.size(); ++j) { | 123 for (size_t j = 1; j < offsets.size(); ++j) { |
| 124 keyframes.append( | 124 keyframes.append( |
| 125 toStringKeyframe(keyframe->cloneWithOffset(offsets[j]).get())); | 125 toStringKeyframe(keyframe->cloneWithOffset(offsets[j]).get())); |
| 126 } | 126 } |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 properties.append(id); | 1041 properties.append(id); |
| 1042 } | 1042 } |
| 1043 propertyShorthand = StylePropertyShorthand( | 1043 propertyShorthand = StylePropertyShorthand( |
| 1044 CSSPropertyInvalid, properties.begin(), properties.size()); | 1044 CSSPropertyInvalid, properties.begin(), properties.size()); |
| 1045 } | 1045 } |
| 1046 return propertyShorthand; | 1046 return propertyShorthand; |
| 1047 } | 1047 } |
| 1048 | 1048 |
| 1049 // Properties that affect animations are not allowed to be affected by | 1049 // Properties that affect animations are not allowed to be affected by |
| 1050 // animations. http://w3c.github.io/web-animations/#not-animatable-section | 1050 // animations. http://w3c.github.io/web-animations/#not-animatable-section |
| 1051 bool CSSAnimations::isAnimatableProperty(CSSPropertyID property) { | 1051 bool CSSAnimations::isAnimationAffectingProperty(CSSPropertyID property) { |
| 1052 switch (property) { | 1052 switch (property) { |
| 1053 case CSSPropertyAnimation: | 1053 case CSSPropertyAnimation: |
| 1054 case CSSPropertyAnimationDelay: | 1054 case CSSPropertyAnimationDelay: |
| 1055 case CSSPropertyAnimationDirection: | 1055 case CSSPropertyAnimationDirection: |
| 1056 case CSSPropertyAnimationDuration: | 1056 case CSSPropertyAnimationDuration: |
| 1057 case CSSPropertyAnimationFillMode: | 1057 case CSSPropertyAnimationFillMode: |
| 1058 case CSSPropertyAnimationIterationCount: | 1058 case CSSPropertyAnimationIterationCount: |
| 1059 case CSSPropertyAnimationName: | 1059 case CSSPropertyAnimationName: |
| 1060 case CSSPropertyAnimationPlayState: | 1060 case CSSPropertyAnimationPlayState: |
| 1061 case CSSPropertyAnimationTimingFunction: | 1061 case CSSPropertyAnimationTimingFunction: |
| 1062 case CSSPropertyDisplay: | 1062 case CSSPropertyDisplay: |
| 1063 case CSSPropertyTransition: | 1063 case CSSPropertyTransition: |
| 1064 case CSSPropertyTransitionDelay: | 1064 case CSSPropertyTransitionDelay: |
| 1065 case CSSPropertyTransitionDuration: | 1065 case CSSPropertyTransitionDuration: |
| 1066 case CSSPropertyTransitionProperty: | 1066 case CSSPropertyTransitionProperty: |
| 1067 case CSSPropertyTransitionTimingFunction: | 1067 case CSSPropertyTransitionTimingFunction: |
| 1068 return true; |
| 1069 default: |
| 1068 return false; | 1070 return false; |
| 1069 default: | |
| 1070 return true; | |
| 1071 } | 1071 } |
| 1072 } | 1072 } |
| 1073 | 1073 |
| 1074 bool CSSAnimations::isAffectedByKeyframesFromScope(const Element& element, | 1074 bool CSSAnimations::isAffectedByKeyframesFromScope(const Element& element, |
| 1075 const TreeScope& treeScope) { | 1075 const TreeScope& treeScope) { |
| 1076 // Animated elements are affected by @keyframes rules from the same scope | 1076 // Animated elements are affected by @keyframes rules from the same scope |
| 1077 // and from their shadow sub-trees if they are shadow hosts. | 1077 // and from their shadow sub-trees if they are shadow hosts. |
| 1078 if (element.treeScope() == treeScope) | 1078 if (element.treeScope() == treeScope) |
| 1079 return true; | 1079 return true; |
| 1080 if (!isShadowHost(element)) | 1080 if (!isShadowHost(element)) |
| 1081 return false; | 1081 return false; |
| 1082 if (treeScope.rootNode() == treeScope.document()) | 1082 if (treeScope.rootNode() == treeScope.document()) |
| 1083 return false; | 1083 return false; |
| 1084 return toShadowRoot(treeScope.rootNode()).host() == element; | 1084 return toShadowRoot(treeScope.rootNode()).host() == element; |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 DEFINE_TRACE(CSSAnimations) { | 1087 DEFINE_TRACE(CSSAnimations) { |
| 1088 visitor->trace(m_transitions); | 1088 visitor->trace(m_transitions); |
| 1089 visitor->trace(m_pendingUpdate); | 1089 visitor->trace(m_pendingUpdate); |
| 1090 visitor->trace(m_runningAnimations); | 1090 visitor->trace(m_runningAnimations); |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 } // namespace blink | 1093 } // namespace blink |
| OLD | NEW |