| 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/AnimationType.h" | 9 #include "core/animation/CSSValueInterpolationType.h" |
| 10 #include "core/animation/CSSValueAnimationType.h" | |
| 11 #include "core/animation/ColorStyleInterpolation.h" | 10 #include "core/animation/ColorStyleInterpolation.h" |
| 12 #include "core/animation/CompositorAnimations.h" | 11 #include "core/animation/CompositorAnimations.h" |
| 13 #include "core/animation/ConstantStyleInterpolation.h" | 12 #include "core/animation/ConstantStyleInterpolation.h" |
| 14 #include "core/animation/DefaultSVGInterpolation.h" | 13 #include "core/animation/DefaultSVGInterpolation.h" |
| 15 #include "core/animation/DeferredLegacyStyleInterpolation.h" | 14 #include "core/animation/DeferredLegacyStyleInterpolation.h" |
| 16 #include "core/animation/DoubleStyleInterpolation.h" | 15 #include "core/animation/DoubleStyleInterpolation.h" |
| 17 #include "core/animation/FilterStyleInterpolation.h" | 16 #include "core/animation/FilterStyleInterpolation.h" |
| 18 #include "core/animation/ImageSliceStyleInterpolation.h" | 17 #include "core/animation/ImageSliceStyleInterpolation.h" |
| 19 #include "core/animation/ImageStyleInterpolation.h" | 18 #include "core/animation/ImageStyleInterpolation.h" |
| 20 #include "core/animation/IntegerOptionalIntegerSVGInterpolation.h" | 19 #include "core/animation/IntegerOptionalIntegerSVGInterpolation.h" |
| 21 #include "core/animation/IntegerSVGInterpolation.h" | 20 #include "core/animation/IntegerSVGInterpolation.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/LengthPairStyleInterpolation.h" | 25 #include "core/animation/LengthPairStyleInterpolation.h" |
| 26 #include "core/animation/LengthSVGInterpolation.h" | 26 #include "core/animation/LengthSVGInterpolation.h" |
| 27 #include "core/animation/LengthStyleInterpolation.h" | 27 #include "core/animation/LengthStyleInterpolation.h" |
| 28 #include "core/animation/ListSVGInterpolation.h" | 28 #include "core/animation/ListSVGInterpolation.h" |
| 29 #include "core/animation/ListStyleInterpolation.h" | 29 #include "core/animation/ListStyleInterpolation.h" |
| 30 #include "core/animation/NumberOptionalNumberSVGInterpolation.h" | 30 #include "core/animation/NumberOptionalNumberSVGInterpolation.h" |
| 31 #include "core/animation/NumberSVGInterpolation.h" | 31 #include "core/animation/NumberSVGInterpolation.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 case CSSPropertyStrokeMiterlimit: | 146 case CSSPropertyStrokeMiterlimit: |
| 147 return RangeGreaterThanOrEqualToOne; | 147 return RangeGreaterThanOrEqualToOne; |
| 148 case CSSPropertyFontSizeAdjust: | 148 case CSSPropertyFontSizeAdjust: |
| 149 return RangeNonNegative; | 149 return RangeNonNegative; |
| 150 default: | 150 default: |
| 151 ASSERT_NOT_REACHED(); | 151 ASSERT_NOT_REACHED(); |
| 152 return RangeAll; | 152 return RangeAll; |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 const Vector<const AnimationType*>* applicableTypesForProperty(CSSPropertyID pro
perty) | 156 const Vector<const InterpolationType*>* applicableTypesForProperty(CSSPropertyID
property) |
| 157 { | 157 { |
| 158 using ApplicableTypesMap = HashMap<CSSPropertyID, const Vector<const Animati
onType*>*>; | 158 using ApplicableTypesMap = HashMap<CSSPropertyID, const Vector<const Interpo
lationType*>*>; |
| 159 DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicableTypesMap, ()); | 159 DEFINE_STATIC_LOCAL(ApplicableTypesMap, applicableTypesMap, ()); |
| 160 auto entry = applicableTypesMap.find(property); | 160 auto entry = applicableTypesMap.find(property); |
| 161 if (entry != applicableTypesMap.end()) | 161 if (entry != applicableTypesMap.end()) |
| 162 return entry->value; | 162 return entry->value; |
| 163 | 163 |
| 164 // TODO(alancutter): Support all animatable CSS properties here so we can st
op falling back to the old StyleInterpolation implementation. | 164 // TODO(alancutter): Support all animatable CSS properties here so we can st
op falling back to the old StyleInterpolation implementation. |
| 165 if (CSSPropertyMetadata::isAnimatableProperty(property)) | 165 if (CSSPropertyMetadata::isAnimatableProperty(property)) |
| 166 return nullptr; | 166 return nullptr; |
| 167 | 167 |
| 168 auto applicableTypes = new Vector<const AnimationType*>(); | 168 auto applicableTypes = new Vector<const InterpolationType*>(); |
| 169 applicableTypes->append(new CSSValueAnimationType(property)); | 169 applicableTypes->append(new CSSValueInterpolationType(property)); |
| 170 applicableTypesMap.add(property, applicableTypes); | 170 applicableTypesMap.add(property, applicableTypes); |
| 171 return applicableTypes; | 171 return applicableTypes; |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace | 174 } // namespace |
| 175 | 175 |
| 176 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
e::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpe
cificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const | 176 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::CSSPropertySpecificKeyfram
e::maybeCreateInterpolation(PropertyHandle propertyHandle, Keyframe::PropertySpe
cificKeyframe& end, Element* element, const ComputedStyle* baseStyle) const |
| 177 { | 177 { |
| 178 CSSPropertyID property = propertyHandle.cssProperty(); | 178 CSSPropertyID property = propertyHandle.cssProperty(); |
| 179 const Vector<const AnimationType*>* applicableTypes = applicableTypesForProp
erty(property); | 179 const Vector<const InterpolationType*>* applicableTypes = applicableTypesFor
Property(property); |
| 180 if (applicableTypes) | 180 if (applicableTypes) |
| 181 return InvalidatableStyleInterpolation::create(*applicableTypes, *this,
toCSSPropertySpecificKeyframe(end)); | 181 return InvalidatableStyleInterpolation::create(*applicableTypes, *this,
toCSSPropertySpecificKeyframe(end)); |
| 182 | 182 |
| 183 // TODO(alancutter): Remove the remainder of this function. | 183 // TODO(alancutter): Remove the remainder of this function. |
| 184 | 184 |
| 185 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe
ct, and a template parameter specific converter. | 185 // FIXME: Refactor this into a generic piece that lives in InterpolationEffe
ct, and a template parameter specific converter. |
| 186 CSSValue* fromCSSValue = m_value.get(); | 186 CSSValue* fromCSSValue = m_value.get(); |
| 187 CSSValue* toCSSValue = toCSSPropertySpecificKeyframe(end).value(); | 187 CSSValue* toCSSValue = toCSSPropertySpecificKeyframe(end).value(); |
| 188 InterpolationRange range = RangeAll; | 188 InterpolationRange range = RangeAll; |
| 189 bool fallBackToLegacy = false; | 189 bool fallBackToLegacy = false; |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); | 594 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); |
| 595 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | 595 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); |
| 596 | 596 |
| 597 if (!fromValue || !toValue) | 597 if (!fromValue || !toValue) |
| 598 return nullptr; | 598 return nullptr; |
| 599 | 599 |
| 600 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); | 600 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); |
| 601 } | 601 } |
| 602 | 602 |
| 603 } // namespace blink | 603 } // namespace blink |
| OLD | NEW |