Chromium Code Reviews| 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/css/CSSAnimations.h" | 8 #include "core/animation/css/CSSAnimations.h" |
| 9 #include "core/animation/interpolation/DefaultStyleInterpolation.h" | 9 #include "core/animation/interpolation/DefaultStyleInterpolation.h" |
| 10 #include "core/animation/interpolation/DeferredLegacyStyleInterpolation.h" | 10 #include "core/animation/interpolation/DeferredLegacyStyleInterpolation.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 | 67 |
| 68 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const | 68 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const |
| 69 { | 69 { |
| 70 CSSValue* fromCSSValue = m_value.get(); | 70 CSSValue* fromCSSValue = m_value.get(); |
| 71 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value(); | 71 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value(); |
| 72 ValueRange range = ValueRangeAll; | 72 ValueRange range = ValueRangeAll; |
| 73 | 73 |
| 74 if (!CSSAnimations::isAnimatableProperty(property)) | 74 if (!CSSAnimations::isAnimatableProperty(property)) |
| 75 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty); | 75 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty); |
| 76 | 76 |
| 77 // FIXME: add non-negative CSSPropertyFontSize and CSSPropertyOutlineWidth | 77 // FIXME: add non-negative CSSPropertyFontSize and CSSPropertyOutlineWidth |
|
dstockwell
2014/06/19 00:12:20
Looks like you did this. Why was it a fixme in th
alancutter (OOO until 2018)
2014/06/19 03:05:30
These properties also accept keywords, this FIXME
| |
| 78 switch (property) { | 78 switch (property) { |
| 79 case CSSPropertyBorderBottomWidth: | 79 case CSSPropertyBorderBottomWidth: |
| 80 case CSSPropertyBorderLeftWidth: | 80 case CSSPropertyBorderLeftWidth: |
| 81 case CSSPropertyBorderRightWidth: | 81 case CSSPropertyBorderRightWidth: |
| 82 case CSSPropertyBorderTopWidth: | 82 case CSSPropertyBorderTopWidth: |
| 83 case CSSPropertyFontSize: | |
| 83 case CSSPropertyHeight: | 84 case CSSPropertyHeight: |
| 84 case CSSPropertyLineHeight: | 85 case CSSPropertyLineHeight: |
| 85 case CSSPropertyMaxHeight: | 86 case CSSPropertyMaxHeight: |
| 86 case CSSPropertyMaxWidth: | 87 case CSSPropertyMaxWidth: |
| 87 case CSSPropertyMinHeight: | 88 case CSSPropertyMinHeight: |
| 88 case CSSPropertyMinWidth: | 89 case CSSPropertyMinWidth: |
| 90 case CSSPropertyOutlineWidth: | |
| 89 case CSSPropertyPaddingBottom: | 91 case CSSPropertyPaddingBottom: |
| 90 case CSSPropertyPaddingLeft: | 92 case CSSPropertyPaddingLeft: |
| 91 case CSSPropertyPaddingRight: | 93 case CSSPropertyPaddingRight: |
| 92 case CSSPropertyPaddingTop: | 94 case CSSPropertyPaddingTop: |
| 93 case CSSPropertyPerspective: | 95 case CSSPropertyPerspective: |
| 94 case CSSPropertyShapeMargin: | 96 case CSSPropertyShapeMargin: |
| 95 case CSSPropertyWidth: | 97 case CSSPropertyWidth: |
| 96 range = ValueRangeNonNegative; | 98 range = ValueRangeNonNegative; |
| 97 // Fall through | 99 // Fall through |
| 98 case CSSPropertyBottom: | 100 case CSSPropertyBottom: |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 112 break; | 114 break; |
| 113 default: | 115 default: |
| 114 break; | 116 break; |
| 115 } | 117 } |
| 116 | 118 |
| 117 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(*fro mCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolv e(*toCSSValue)) | 119 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(*fro mCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolv e(*toCSSValue)) |
| 118 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue , property); | 120 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue , property); |
| 119 | 121 |
| 120 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here . | 122 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here . |
| 121 // FIXME: Remove this cache | 123 // FIXME: Remove this cache |
| 124 ASSERT(element); | |
| 122 if (!m_animatableValueCache) | 125 if (!m_animatableValueCache) |
| 123 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*e lement, property, *fromCSSValue); | 126 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*e lement, property, *fromCSSValue); |
| 124 | 127 |
| 125 RefPtrWillBeRawPtr<AnimatableValue> to = StyleResolver::createAnimatableValu eSnapshot(*element, property, *toCSSValue); | 128 RefPtrWillBeRawPtr<AnimatableValue> to = StyleResolver::createAnimatableValu eSnapshot(*element, property, *toCSSValue); |
| 126 toStringPropertySpecificKeyframe(end)->m_animatableValueCache = to; | 129 toStringPropertySpecificKeyframe(end)->m_animatableValueCache = to; |
| 127 | 130 |
| 128 return LegacyStyleInterpolation::create(m_animatableValueCache.get(), to.rel ease(), property); | 131 return LegacyStyleInterpolation::create(m_animatableValueCache.get(), to.rel ease(), property); |
| 129 } | 132 } |
| 130 | 133 |
| 131 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope rtySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> e asing) const | 134 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope rtySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> e asing) const |
| 132 { | 135 { |
| 133 return adoptPtrWillBeNoop(new PropertySpecificKeyframe(offset, easing, 0, An imationEffect::CompositeAdd)); | 136 return adoptPtrWillBeNoop(new PropertySpecificKeyframe(offset, easing, 0, An imationEffect::CompositeAdd)); |
| 134 } | 137 } |
| 135 | 138 |
| 136 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope rtySpecificKeyframe::cloneWithOffset(double offset) const | 139 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope rtySpecificKeyframe::cloneWithOffset(double offset) const |
| 137 { | 140 { |
| 138 Keyframe::PropertySpecificKeyframe* theClone = new PropertySpecificKeyframe( offset, m_easing, m_value.get()); | 141 Keyframe::PropertySpecificKeyframe* theClone = new PropertySpecificKeyframe( offset, m_easing, m_value.get()); |
| 139 toStringPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_anima tableValueCache; | 142 toStringPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_anima tableValueCache; |
| 140 return adoptPtrWillBeNoop(theClone); | 143 return adoptPtrWillBeNoop(theClone); |
| 141 } | 144 } |
| 142 | 145 |
| 143 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) | 146 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) |
| 144 { | 147 { |
| 145 visitor->trace(m_value); | 148 visitor->trace(m_value); |
| 146 visitor->trace(m_animatableValueCache); | 149 visitor->trace(m_animatableValueCache); |
| 147 Keyframe::PropertySpecificKeyframe::trace(visitor); | 150 Keyframe::PropertySpecificKeyframe::trace(visitor); |
| 148 } | 151 } |
| 149 | 152 |
| 150 } | 153 } |
| OLD | NEW |