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/AngleSVGInterpolation.h" | 8 #include "core/animation/AngleSVGInterpolation.h" |
9 #include "core/animation/CSSValueInterpolationType.h" | 9 #include "core/animation/CSSValueInterpolationType.h" |
10 #include "core/animation/ColorStyleInterpolation.h" | 10 #include "core/animation/ColorStyleInterpolation.h" |
11 #include "core/animation/CompositorAnimations.h" | 11 #include "core/animation/CompositorAnimations.h" |
12 #include "core/animation/ConstantStyleInterpolation.h" | 12 #include "core/animation/ConstantStyleInterpolation.h" |
13 #include "core/animation/DefaultSVGInterpolation.h" | 13 #include "core/animation/DefaultSVGInterpolation.h" |
14 #include "core/animation/DeferredLegacyStyleInterpolation.h" | 14 #include "core/animation/DeferredLegacyStyleInterpolation.h" |
15 #include "core/animation/DoubleStyleInterpolation.h" | 15 #include "core/animation/DoubleStyleInterpolation.h" |
16 #include "core/animation/FilterStyleInterpolation.h" | 16 #include "core/animation/FilterStyleInterpolation.h" |
17 #include "core/animation/ImageSliceStyleInterpolation.h" | 17 #include "core/animation/ImageSliceStyleInterpolation.h" |
18 #include "core/animation/ImageStyleInterpolation.h" | 18 #include "core/animation/ImageStyleInterpolation.h" |
19 #include "core/animation/IntegerOptionalIntegerSVGInterpolation.h" | 19 #include "core/animation/IntegerOptionalIntegerSVGInterpolation.h" |
20 #include "core/animation/IntegerSVGInterpolation.h" | 20 #include "core/animation/IntegerSVGInterpolation.h" |
21 #include "core/animation/InterpolationType.h" | 21 #include "core/animation/InterpolationType.h" |
22 #include "core/animation/InvalidatableStyleInterpolation.h" | 22 #include "core/animation/InvalidatableStyleInterpolation.h" |
23 #include "core/animation/LegacyStyleInterpolation.h" | 23 #include "core/animation/LegacyStyleInterpolation.h" |
24 #include "core/animation/LengthBoxStyleInterpolation.h" | 24 #include "core/animation/LengthBoxStyleInterpolation.h" |
| 25 #include "core/animation/LengthInterpolationType.h" |
25 #include "core/animation/LengthPairStyleInterpolation.h" | 26 #include "core/animation/LengthPairStyleInterpolation.h" |
26 #include "core/animation/LengthSVGInterpolation.h" | 27 #include "core/animation/LengthSVGInterpolation.h" |
27 #include "core/animation/LengthStyleInterpolation.h" | 28 #include "core/animation/LengthStyleInterpolation.h" |
28 #include "core/animation/ListSVGInterpolation.h" | 29 #include "core/animation/ListSVGInterpolation.h" |
29 #include "core/animation/ListStyleInterpolation.h" | 30 #include "core/animation/ListStyleInterpolation.h" |
30 #include "core/animation/NumberOptionalNumberSVGInterpolation.h" | 31 #include "core/animation/NumberOptionalNumberSVGInterpolation.h" |
31 #include "core/animation/NumberSVGInterpolation.h" | 32 #include "core/animation/NumberSVGInterpolation.h" |
32 #include "core/animation/PathSVGInterpolation.h" | 33 #include "core/animation/PathSVGInterpolation.h" |
33 #include "core/animation/PointSVGInterpolation.h" | 34 #include "core/animation/PointSVGInterpolation.h" |
34 #include "core/animation/RectSVGInterpolation.h" | 35 #include "core/animation/RectSVGInterpolation.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 155 } |
155 | 156 |
156 const Vector<const InterpolationType*>* applicableTypesForProperty(CSSPropertyID
property) | 157 const Vector<const InterpolationType*>* applicableTypesForProperty(CSSPropertyID
property) |
157 { | 158 { |
158 using ApplicableTypesMap = HashMap<CSSPropertyID, const Vector<const Interpo
lationType*>*>; | 159 using ApplicableTypesMap = HashMap<CSSPropertyID, const Vector<const Interpo
lationType*>*>; |
159 DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicableTypesMap, ()); | 160 DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicableTypesMap, ()); |
160 auto entry = applicableTypesMap.find(property); | 161 auto entry = applicableTypesMap.find(property); |
161 if (entry != applicableTypesMap.end()) | 162 if (entry != applicableTypesMap.end()) |
162 return entry->value; | 163 return entry->value; |
163 | 164 |
164 // TODO(alancutter): Support all interpolable CSS properties here so we can
stop falling back to the old StyleInterpolation implementation. | |
165 if (CSSPropertyMetadata::isInterpolableProperty(property)) | |
166 return nullptr; | |
167 | |
168 auto applicableTypes = new Vector<const InterpolationType*>(); | 165 auto applicableTypes = new Vector<const InterpolationType*>(); |
| 166 switch (property) { |
| 167 case CSSPropertyLeft: |
| 168 applicableTypes->append(new LengthInterpolationType(property)); |
| 169 break; |
| 170 default: |
| 171 // TODO(alancutter): Support all interpolable CSS properties here so we
can stop falling back to the old StyleInterpolation implementation. |
| 172 if (CSSPropertyMetadata::isInterpolableProperty(property)) { |
| 173 delete applicableTypes; |
| 174 applicableTypesMap.add(property, nullptr); |
| 175 return nullptr; |
| 176 } |
| 177 break; |
| 178 } |
169 applicableTypes->append(new CSSValueInterpolationType(property)); | 179 applicableTypes->append(new CSSValueInterpolationType(property)); |
170 applicableTypesMap.add(property, applicableTypes); | 180 applicableTypesMap.add(property, applicableTypes); |
171 return applicableTypes; | 181 return applicableTypes; |
172 } | 182 } |
173 | 183 |
174 } // namespace | 184 } // namespace |
175 | 185 |
176 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
e::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpe
cificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const | 186 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
e::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpe
cificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const |
177 { | 187 { |
178 CSSPropertyID property = propertyHandle.cssProperty(); | 188 CSSPropertyID property = propertyHandle.cssProperty(); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); | 604 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); |
595 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | 605 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); |
596 | 606 |
597 if (!fromValue || !toValue) | 607 if (!fromValue || !toValue) |
598 return nullptr; | 608 return nullptr; |
599 | 609 |
600 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); | 610 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); |
601 } | 611 } |
602 | 612 |
603 } // namespace blink | 613 } // namespace blink |
OLD | NEW |