| 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" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 ASSERT(property.isSVGAttribute()); | 99 ASSERT(property.isSVGAttribute()); |
| 100 return adoptPtrWillBeNoop(new SVGPropertySpecificKeyframe(offset(), &easing(
), svgPropertyValue(*property.svgAttribute()), composite())); | 100 return adoptPtrWillBeNoop(new SVGPropertySpecificKeyframe(offset(), &easing(
), svgPropertyValue(*property.svgAttribute()), composite())); |
| 101 } | 101 } |
| 102 | 102 |
| 103 DEFINE_TRACE(StringKeyframe) | 103 DEFINE_TRACE(StringKeyframe) |
| 104 { | 104 { |
| 105 visitor->trace(m_propertySet); | 105 visitor->trace(m_propertySet); |
| 106 Keyframe::trace(visitor); | 106 Keyframe::trace(visitor); |
| 107 } | 107 } |
| 108 | 108 |
| 109 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double
offset, PassRefPtr<TimingFunction> easing, NullableCSSValue value, EffectModel::
CompositeOperation op) | 109 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double
offset, PassRefPtr<TimingFunction> easing, const NullableCSSValue& value, Effect
Model::CompositeOperation op) |
| 110 : Keyframe::PropertySpecificKeyframe(offset, easing, op) | 110 : Keyframe::PropertySpecificKeyframe(offset, easing, op) |
| 111 , m_value(value) | 111 , m_value(value) |
| 112 { } | 112 { } |
| 113 | 113 |
| 114 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double
offset, PassRefPtr<TimingFunction> easing, NullableCSSValue value) | 114 StringKeyframe::CSSPropertySpecificKeyframe::CSSPropertySpecificKeyframe(double
offset, PassRefPtr<TimingFunction> easing, const NullableCSSValue& value) |
| 115 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR
eplace) | 115 : Keyframe::PropertySpecificKeyframe(offset, easing, EffectModel::CompositeR
eplace) |
| 116 , m_value(value) | 116 , m_value(value) |
| 117 { | 117 { |
| 118 ASSERT(!isNull(m_offset)); | 118 ASSERT(!isNull(m_offset)); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void StringKeyframe::CSSPropertySpecificKeyframe::populateAnimatableValue(CSSPro
pertyID property, Element& element, const ComputedStyle* baseStyle) const | 121 void StringKeyframe::CSSPropertySpecificKeyframe::populateAnimatableValue(CSSPro
pertyID property, Element& element, const ComputedStyle* baseStyle) const |
| 122 { | 122 { |
| 123 if (!m_animatableValueCache && (baseStyle || !DeferredLegacyStyleInterpolati
on::interpolationRequiresStyleResolve(*m_value))) | 123 if (!m_animatableValueCache && (baseStyle || !DeferredLegacyStyleInterpolati
on::interpolationRequiresStyleResolve(*m_value))) |
| 124 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(el
ement, baseStyle, property, m_value); | 124 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(el
ement, baseStyle, property, m_value); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 NullableCSSValue nullableToCSSValue = toCSSPropertySpecificKeyframe(end).val
ue(); | 187 NullableCSSValue nullableToCSSValue = toCSSPropertySpecificKeyframe(end).val
ue(); |
| 188 InterpolationRange range = RangeAll; | 188 InterpolationRange range = RangeAll; |
| 189 bool fallBackToLegacy = false; | 189 bool fallBackToLegacy = false; |
| 190 | 190 |
| 191 // FIXME: Remove this flag once we can rely on legacy's behaviour being corr
ect. | 191 // FIXME: Remove this flag once we can rely on legacy's behaviour being corr
ect. |
| 192 bool forceDefaultInterpolation = false; | 192 bool forceDefaultInterpolation = false; |
| 193 | 193 |
| 194 // FIXME: Remove this check once neutral keyframes are implemented in String
Keyframes. | 194 // FIXME: Remove this check once neutral keyframes are implemented in String
Keyframes. |
| 195 if (!nullableFromCSSValue || !nullableToCSSValue) | 195 if (!nullableFromCSSValue || !nullableToCSSValue) |
| 196 return DeferredLegacyStyleInterpolation::create(nullableFromCSSValue, nu
llableToCSSValue, property); | 196 return DeferredLegacyStyleInterpolation::create(nullableFromCSSValue, nu
llableToCSSValue, property); |
| 197 CSSValue& fromCSSValue = *nullableFromCSSValue; | 197 const CSSValue& fromCSSValue = *nullableFromCSSValue; |
| 198 CSSValue& toCSSValue = *nullableToCSSValue; | 198 const CSSValue& toCSSValue = *nullableToCSSValue; |
| 199 | 199 |
| 200 if (!CSSPropertyMetadata::isInterpolableProperty(property)) { | 200 if (!CSSPropertyMetadata::isInterpolableProperty(property)) { |
| 201 if (fromCSSValue.ptrEquals(toCSSValue)) | 201 if (fromCSSValue.ptrEquals(toCSSValue)) |
| 202 return ConstantStyleInterpolation::create(fromCSSValue, property); | 202 return ConstantStyleInterpolation::create(fromCSSValue, property); |
| 203 | 203 |
| 204 return nullptr; | 204 return nullptr; |
| 205 } | 205 } |
| 206 | 206 |
| 207 switch (property) { | 207 switch (property) { |
| 208 case CSSPropertyLineHeight: | 208 case CSSPropertyLineHeight: |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); | 598 RefPtrWillBeRawPtr<SVGPropertyBase> fromValue = attribute->currentValueBase(
)->cloneForAnimation(m_value); |
| 599 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); | 599 RefPtrWillBeRawPtr<SVGPropertyBase> toValue = attribute->currentValueBase()-
>cloneForAnimation(toSVGPropertySpecificKeyframe(end).value()); |
| 600 | 600 |
| 601 if (!fromValue || !toValue) | 601 if (!fromValue || !toValue) |
| 602 return nullptr; | 602 return nullptr; |
| 603 | 603 |
| 604 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); | 604 return createSVGInterpolation(fromValue.get(), toValue.get(), attribute.get(
)); |
| 605 } | 605 } |
| 606 | 606 |
| 607 } // namespace blink | 607 } // namespace blink |
| OLD | NEW |