| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/StringKeyframe.h" | 6 #include "core/animation/StringKeyframe.h" |
| 7 | 7 |
| 8 #include "core/animation/Interpolation.h" | 8 #include "core/animation/Interpolation.h" |
| 9 #include "core/animation/css/CSSAnimations.h" | 9 #include "core/animation/css/CSSAnimations.h" |
| 10 #include "core/css/resolver/StyleResolver.h" | 10 #include "core/css/resolver/StyleResolver.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 : Keyframe::PropertySpecificKeyframe(offset, easing, AnimationEffect::Compos
iteReplace) | 59 : Keyframe::PropertySpecificKeyframe(offset, easing, AnimationEffect::Compos
iteReplace) |
| 60 , m_value(value) | 60 , m_value(value) |
| 61 { | 61 { |
| 62 ASSERT(!isNull(m_offset)); | 62 ASSERT(!isNull(m_offset)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe::
createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe*
end, Element* element) const | 65 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe::
createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe*
end, Element* element) const |
| 66 { | 66 { |
| 67 CSSValue* fromCSSValue = m_value.get(); | 67 CSSValue* fromCSSValue = m_value.get(); |
| 68 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value(); | 68 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value(); |
| 69 ValueRange range = ValueRangeAll; |
| 69 | 70 |
| 70 if (!CSSAnimations::isAnimatableProperty(property)) | 71 if (!CSSAnimations::isAnimatableProperty(property)) |
| 71 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope
rty); | 72 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope
rty); |
| 72 | 73 |
| 74 // FIXME: add CSSPropertyVerticalAlign and non-negative CSSPropertyFontSize |
| 73 switch (property) { | 75 switch (property) { |
| 76 case CSSPropertyBorderBottomWidth: |
| 77 case CSSPropertyBorderLeftWidth: |
| 78 case CSSPropertyBorderRightWidth: |
| 79 case CSSPropertyBorderTopWidth: |
| 80 case CSSPropertyHeight: |
| 81 case CSSPropertyLineHeight: |
| 82 case CSSPropertyMaxHeight: |
| 83 case CSSPropertyMaxWidth: |
| 84 case CSSPropertyMinHeight: |
| 85 case CSSPropertyMinWidth: |
| 86 case CSSPropertyPaddingBottom: |
| 87 case CSSPropertyPaddingLeft: |
| 88 case CSSPropertyPaddingRight: |
| 89 case CSSPropertyPaddingTop: |
| 90 case CSSPropertyPerspective: |
| 91 case CSSPropertyShapeMargin: |
| 92 case CSSPropertyWidth: |
| 93 range = ValueRangeNonNegative; |
| 94 // Fall through |
| 95 case CSSPropertyBottom: |
| 74 case CSSPropertyLeft: | 96 case CSSPropertyLeft: |
| 97 case CSSPropertyLetterSpacing: |
| 98 case CSSPropertyMarginBottom: |
| 99 case CSSPropertyMarginLeft: |
| 100 case CSSPropertyMarginRight: |
| 101 case CSSPropertyMarginTop: |
| 102 case CSSPropertyOutlineOffset: |
| 75 case CSSPropertyRight: | 103 case CSSPropertyRight: |
| 76 case CSSPropertyWidth: | 104 case CSSPropertyTop: |
| 77 case CSSPropertyHeight: | 105 case CSSPropertyWordSpacing: |
| 78 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl
eInterpolation::canCreateFrom(*toCSSValue)) | 106 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl
eInterpolation::canCreateFrom(*toCSSValue)) |
| 79 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr
operty); | 107 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr
operty, range); |
| 80 break; | 108 break; |
| 81 default: | 109 default: |
| 82 break; | 110 break; |
| 83 } | 111 } |
| 84 | 112 |
| 85 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here
. | 113 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here
. |
| 86 // FIXME: Remove this cache | 114 // FIXME: Remove this cache |
| 87 if (!m_animatableValueCache) | 115 if (!m_animatableValueCache) |
| 88 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*e
lement, property, fromCSSValue); | 116 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*e
lement, property, fromCSSValue); |
| 89 | 117 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 106 } | 134 } |
| 107 | 135 |
| 108 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) | 136 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) |
| 109 { | 137 { |
| 110 visitor->trace(m_value); | 138 visitor->trace(m_value); |
| 111 visitor->trace(m_animatableValueCache); | 139 visitor->trace(m_animatableValueCache); |
| 112 Keyframe::PropertySpecificKeyframe::trace(visitor); | 140 Keyframe::PropertySpecificKeyframe::trace(visitor); |
| 113 } | 141 } |
| 114 | 142 |
| 115 } | 143 } |
| OLD | NEW |