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/LegacyStyleInterpolation.h" | |
9 #include "core/animation/css/CSSAnimations.h" | 10 #include "core/animation/css/CSSAnimations.h" |
10 #include "core/css/resolver/StyleResolver.h" | 11 #include "core/css/resolver/StyleResolver.h" |
11 #include "core/rendering/style/RenderStyle.h" | 12 #include "core/rendering/style/RenderStyle.h" |
12 | 13 |
13 namespace WebCore { | 14 namespace WebCore { |
14 | 15 |
15 StringKeyframe::StringKeyframe(const StringKeyframe& copyFrom) | 16 StringKeyframe::StringKeyframe(const StringKeyframe& copyFrom) |
16 : Keyframe(copyFrom.m_offset, copyFrom.m_composite, copyFrom.m_easing) | 17 : Keyframe(copyFrom.m_offset, copyFrom.m_composite, copyFrom.m_easing) |
17 , m_propertySet(copyFrom.m_propertySet->mutableCopy()) | 18 , m_propertySet(copyFrom.m_propertySet->mutableCopy()) |
18 { | 19 { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 | 65 |
65 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const | 66 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const |
66 { | 67 { |
67 CSSValue* fromCSSValue = m_value.get(); | 68 CSSValue* fromCSSValue = m_value.get(); |
68 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value(); | 69 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value(); |
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 |
73 switch (property) { | 74 switch (property) { |
75 case CSSPropertyBorderBottomWidth: | |
76 case CSSPropertyBorderLeftWidth: | |
77 case CSSPropertyBorderRightWidth: | |
78 case CSSPropertyBorderTopWidth: | |
alancutter (OOO until 2018)
2014/05/08 12:34:13
The border width properties can change value accor
| |
79 case CSSPropertyHeight: | |
74 case CSSPropertyLeft: | 80 case CSSPropertyLeft: |
75 case CSSPropertyRight: | 81 case CSSPropertyRight: |
76 case CSSPropertyWidth: | 82 case CSSPropertyWidth: |
77 case CSSPropertyHeight: | |
78 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue)) | 83 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue)) |
79 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr operty); | 84 return LengthStyleInterpolation::create(fromCSSValue, toCSSValue, pr operty); |
80 break; | 85 break; |
81 default: | 86 default: |
82 break; | 87 break; |
83 } | 88 } |
84 | 89 |
85 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here . | 90 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here . |
86 // FIXME: Remove this cache | 91 // FIXME: Remove this cache |
87 if (!m_animatableValueCache) | 92 if (!m_interpolableValuePromiseCache) |
88 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*e lement, property, fromCSSValue); | 93 m_interpolableValuePromiseCache = InterpolableValuePromise::create(*elem ent, property, fromCSSValue); |
89 | 94 |
90 RefPtrWillBeRawPtr<AnimatableValue> to = StyleResolver::createAnimatableValu eSnapshot(*element, property, toCSSValue); | 95 RefPtrWillBeRawPtr<InterpolableValuePromise> to = InterpolableValuePromise:: create(*element, property, toCSSValue); |
91 toStringPropertySpecificKeyframe(end)->m_animatableValueCache = to; | 96 toStringPropertySpecificKeyframe(end)->m_interpolableValuePromiseCache = to; |
92 | 97 |
93 return LegacyStyleInterpolation::create(m_animatableValueCache.get(), to.rel ease(), property); | 98 return LegacyStyleInterpolation::create(m_interpolableValuePromiseCache, to. release(), property); |
99 } | |
100 | |
101 const PassRefPtrWillBeRawPtr<AnimatableValue> StringKeyframe::PropertySpecificKe yframe::getAnimatableValue() const | |
102 { | |
103 if (m_interpolableValuePromiseCache) | |
104 return m_interpolableValuePromiseCache->extractAnimatableValue(); | |
105 return nullptr; | |
94 } | 106 } |
95 | 107 |
96 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope rtySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> e asing) const | 108 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope rtySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> e asing) const |
97 { | 109 { |
98 return adoptPtrWillBeNoop(new PropertySpecificKeyframe(offset, easing, 0, An imationEffect::CompositeAdd)); | 110 return adoptPtrWillBeNoop(new PropertySpecificKeyframe(offset, easing, 0, An imationEffect::CompositeAdd)); |
99 } | 111 } |
100 | 112 |
101 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope rtySpecificKeyframe::cloneWithOffset(double offset) const | 113 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope rtySpecificKeyframe::cloneWithOffset(double offset) const |
102 { | 114 { |
103 Keyframe::PropertySpecificKeyframe* theClone = new PropertySpecificKeyframe( offset, m_easing, m_value.get()); | 115 Keyframe::PropertySpecificKeyframe* theClone = new PropertySpecificKeyframe( offset, m_easing, m_value.get()); |
104 toStringPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_anima tableValueCache; | 116 toStringPropertySpecificKeyframe(theClone)->m_interpolableValuePromiseCache = m_interpolableValuePromiseCache; |
105 return adoptPtrWillBeNoop(theClone); | 117 return adoptPtrWillBeNoop(theClone); |
106 } | 118 } |
107 | 119 |
108 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) | 120 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) |
109 { | 121 { |
110 visitor->trace(m_value); | 122 visitor->trace(m_value); |
111 visitor->trace(m_animatableValueCache); | 123 visitor->trace(m_interpolableValuePromiseCache); |
112 Keyframe::PropertySpecificKeyframe::trace(visitor); | 124 Keyframe::PropertySpecificKeyframe::trace(visitor); |
113 } | 125 } |
114 | 126 |
115 } | 127 } |
OLD | NEW |