| 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 "core/animation/StringKeyframe.h" | 5 #include "core/animation/StringKeyframe.h" |
| 6 | 6 |
| 7 #include "core/StylePropertyShorthand.h" | 7 #include "core/StylePropertyShorthand.h" |
| 8 #include "core/animation/DeferredLegacyStyleInterpolation.h" | |
| 9 #include "core/animation/css/CSSAnimations.h" | 8 #include "core/animation/css/CSSAnimations.h" |
| 10 #include "core/css/CSSPropertyMetadata.h" | 9 #include "core/css/CSSPropertyMetadata.h" |
| 11 #include "core/css/resolver/StyleResolver.h" | 10 #include "core/css/resolver/StyleResolver.h" |
| 12 #include "core/style/ComputedStyle.h" | 11 #include "core/style/ComputedStyle.h" |
| 13 #include "core/svg/SVGElement.h" | 12 #include "core/svg/SVGElement.h" |
| 14 #include "platform/RuntimeEnabledFeatures.h" | 13 #include "platform/RuntimeEnabledFeatures.h" |
| 15 | 14 |
| 16 namespace blink { | 15 namespace blink { |
| 17 | 16 |
| 18 StringKeyframe::StringKeyframe(const StringKeyframe& copyFrom) | 17 StringKeyframe::StringKeyframe(const StringKeyframe& copyFrom) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 if (property.isCSSProperty()) | 80 if (property.isCSSProperty()) |
| 82 return CSSPropertySpecificKeyframe::create(offset(), &easing(), cssPrope
rtyValue(property.cssProperty()), composite()); | 81 return CSSPropertySpecificKeyframe::create(offset(), &easing(), cssPrope
rtyValue(property.cssProperty()), composite()); |
| 83 | 82 |
| 84 if (property.isPresentationAttribute()) | 83 if (property.isPresentationAttribute()) |
| 85 return CSSPropertySpecificKeyframe::create(offset(), &easing(), presenta
tionAttributeValue(property.presentationAttribute()), composite()); | 84 return CSSPropertySpecificKeyframe::create(offset(), &easing(), presenta
tionAttributeValue(property.presentationAttribute()), composite()); |
| 86 | 85 |
| 87 ASSERT(property.isSVGAttribute()); | 86 ASSERT(property.isSVGAttribute()); |
| 88 return SVGPropertySpecificKeyframe::create(offset(), &easing(), svgPropertyV
alue(property.svgAttribute()), composite()); | 87 return SVGPropertySpecificKeyframe::create(offset(), &easing(), svgPropertyV
alue(property.svgAttribute()), composite()); |
| 89 } | 88 } |
| 90 | 89 |
| 91 bool StringKeyframe::CSSPropertySpecificKeyframe::populateAnimatableValue(CSSPro
pertyID property, Element& element, const ComputedStyle* baseStyle, bool force)
const | 90 bool StringKeyframe::CSSPropertySpecificKeyframe::populateAnimatableValue(CSSPro
pertyID property, Element& element, const ComputedStyle& baseStyle, const Comput
edStyle* parentStyle) const |
| 92 { | 91 { |
| 93 if (m_animatableValueCache && !force) | 92 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(elemen
t, baseStyle, parentStyle, property, m_value.get()); |
| 94 return false; | |
| 95 if (!baseStyle && (!m_value || DeferredLegacyStyleInterpolation::interpolati
onRequiresStyleResolve(*m_value))) | |
| 96 return false; | |
| 97 if (!element.document().frame()) | |
| 98 return false; | |
| 99 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(elemen
t, baseStyle, property, m_value.get()); | |
| 100 return true; | 93 return true; |
| 101 } | 94 } |
| 102 | 95 |
| 103 PassRefPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPropertySpecif
icKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) co
nst | 96 PassRefPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPropertySpecif
icKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> easing) co
nst |
| 104 { | 97 { |
| 105 return create(offset, easing, nullptr, EffectModel::CompositeAdd); | 98 return create(offset, easing, nullptr, EffectModel::CompositeAdd); |
| 106 } | 99 } |
| 107 | 100 |
| 108 PassRefPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPropertySpecif
icKeyframe::cloneWithOffset(double offset) const | 101 PassRefPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::CSSPropertySpecif
icKeyframe::cloneWithOffset(double offset) const |
| 109 { | 102 { |
| 110 RefPtr<CSSPropertySpecificKeyframe> clone = create(offset, m_easing, m_value
.get(), m_composite); | 103 RefPtr<CSSPropertySpecificKeyframe> clone = create(offset, m_easing, m_value
.get(), m_composite); |
| 111 clone->m_animatableValueCache = m_animatableValueCache; | 104 clone->m_animatableValueCache = m_animatableValueCache; |
| 112 return clone.release(); | 105 return clone.release(); |
| 113 } | 106 } |
| 114 | 107 |
| 115 PassRefPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::clon
eWithOffset(double offset) const | 108 PassRefPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::clon
eWithOffset(double offset) const |
| 116 { | 109 { |
| 117 return create(offset, m_easing, m_value, m_composite); | 110 return create(offset, m_easing, m_value, m_composite); |
| 118 } | 111 } |
| 119 | 112 |
| 120 PassRefPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::neut
ralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const | 113 PassRefPtr<Keyframe::PropertySpecificKeyframe> SVGPropertySpecificKeyframe::neut
ralKeyframe(double offset, PassRefPtr<TimingFunction> easing) const |
| 121 { | 114 { |
| 122 return create(offset, easing, String(), EffectModel::CompositeAdd); | 115 return create(offset, easing, String(), EffectModel::CompositeAdd); |
| 123 } | 116 } |
| 124 | 117 |
| 125 } // namespace blink | 118 } // namespace blink |
| OLD | NEW |