Chromium Code Reviews| 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/ColorStyleInterpolation.h" | 8 #include "core/animation/ColorStyleInterpolation.h" |
| 9 #include "core/animation/ConstantStyleInterpolation.h" | 9 #include "core/animation/ConstantStyleInterpolation.h" |
| 10 #include "core/animation/DefaultStyleInterpolation.h" | 10 #include "core/animation/DefaultStyleInterpolation.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 { | 30 { |
| 31 } | 31 } |
| 32 | 32 |
| 33 void StringKeyframe::setPropertyValue(CSSPropertyID property, const String& valu e, StyleSheetContents* styleSheetContents) | 33 void StringKeyframe::setPropertyValue(CSSPropertyID property, const String& valu e, StyleSheetContents* styleSheetContents) |
| 34 { | 34 { |
| 35 ASSERT(property != CSSPropertyInvalid); | 35 ASSERT(property != CSSPropertyInvalid); |
| 36 if (CSSAnimations::isAllowedAnimation(property)) | 36 if (CSSAnimations::isAllowedAnimation(property)) |
| 37 m_propertySet->setProperty(property, value, false, styleSheetContents); | 37 m_propertySet->setProperty(property, value, false, styleSheetContents); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void StringKeyframe::setPropertyValue(CSSPropertyID property, PassRefPtr<CSSValu e> value) | |
| 41 { | |
| 42 ASSERT(property != CSSPropertyInvalid); | |
| 43 if (CSSAnimations::isAllowedAnimation(property)) | |
| 44 m_propertySet->setProperty(property, value, false); | |
| 45 } | |
| 46 | |
| 40 PropertySet StringKeyframe::properties() const | 47 PropertySet StringKeyframe::properties() const |
| 41 { | 48 { |
| 42 // This is not used in time-critical code, so we probably don't need to | 49 // This is not used in time-critical code, so we probably don't need to |
| 43 // worry about caching this result. | 50 // worry about caching this result. |
| 44 PropertySet properties; | 51 PropertySet properties; |
| 45 for (unsigned i = 0; i < m_propertySet->propertyCount(); ++i) | 52 for (unsigned i = 0; i < m_propertySet->propertyCount(); ++i) |
| 46 properties.add(m_propertySet->propertyAt(i).id()); | 53 properties.add(m_propertySet->propertyAt(i).id()); |
| 47 return properties; | 54 return properties; |
| 48 } | 55 } |
| 49 | 56 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 67 , m_value(value) | 74 , m_value(value) |
| 68 { } | 75 { } |
| 69 | 76 |
| 70 StringKeyframe::PropertySpecificKeyframe::PropertySpecificKeyframe(double offset , PassRefPtr<TimingFunction> easing, CSSValue* value) | 77 StringKeyframe::PropertySpecificKeyframe::PropertySpecificKeyframe(double offset , PassRefPtr<TimingFunction> easing, CSSValue* value) |
| 71 : Keyframe::PropertySpecificKeyframe(offset, easing, AnimationEffect::Compos iteReplace) | 78 : Keyframe::PropertySpecificKeyframe(offset, easing, AnimationEffect::Compos iteReplace) |
| 72 , m_value(value) | 79 , m_value(value) |
| 73 { | 80 { |
| 74 ASSERT(!isNull(m_offset)); | 81 ASSERT(!isNull(m_offset)); |
| 75 } | 82 } |
| 76 | 83 |
| 84 void StringKeyframe::PropertySpecificKeyframe::setAnimatableValue(PassRefPtr<Ani matableValue> value) | |
| 85 { | |
| 86 m_animatableValueCache = value; | |
|
Timothy Loh
2015/02/04 05:31:45
assert we're a compositable property?
shend
2015/02/04 22:51:34
Oops, PropertySpecificKeyframes don't actually hav
| |
| 87 } | |
| 88 | |
| 77 // FIXME: Refactor this into a generic piece that lives in InterpolationEffect, and a template parameter specific converter. | 89 // FIXME: Refactor this into a generic piece that lives in InterpolationEffect, and a template parameter specific converter. |
| 78 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: maybeCreateInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyfr ame& end, Element* element) const | 90 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: maybeCreateInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyfr ame& end, Element* element) const |
| 79 { | 91 { |
| 80 CSSValue* fromCSSValue = m_value.get(); | 92 CSSValue* fromCSSValue = m_value.get(); |
| 81 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end).value(); | 93 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end).value(); |
| 82 InterpolationRange range = RangeAll; | 94 InterpolationRange range = RangeAll; |
| 83 bool fallBackToLegacy = false; | 95 bool fallBackToLegacy = false; |
| 84 | 96 |
| 97 // FIXME: Remove this check once neutral keyframes are implemented in String Keyframes. | |
| 98 if (!fromCSSValue || !toCSSValue) | |
| 99 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue , property); | |
| 100 | |
| 101 ASSERT(fromCSSValue && toCSSValue); | |
| 102 | |
| 85 if (!CSSPropertyMetadata::isAnimatableProperty(property)) { | 103 if (!CSSPropertyMetadata::isAnimatableProperty(property)) { |
| 86 // FIXME: Remove this once TimingFunction partitioning is implemented fo r all types. | 104 // FIXME: Remove this once TimingFunction partitioning is implemented fo r all types. |
| 87 if (!RuntimeEnabledFeatures::webAnimationsAPITimingFunctionPartitioningE nabled()) | 105 if (!RuntimeEnabledFeatures::webAnimationsAPITimingFunctionPartitioningE nabled()) |
| 88 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, p roperty); | 106 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, p roperty); |
| 89 | 107 |
| 90 if (fromCSSValue == toCSSValue) | 108 if (fromCSSValue == toCSSValue) |
| 91 return ConstantStyleInterpolation::create(fromCSSValue, property); | 109 return ConstantStyleInterpolation::create(fromCSSValue, property); |
| 92 | 110 |
| 93 return nullptr; | 111 return nullptr; |
| 94 } | 112 } |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 } | 305 } |
| 288 | 306 |
| 289 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) | 307 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) |
| 290 { | 308 { |
| 291 visitor->trace(m_value); | 309 visitor->trace(m_value); |
| 292 visitor->trace(m_animatableValueCache); | 310 visitor->trace(m_animatableValueCache); |
| 293 Keyframe::PropertySpecificKeyframe::trace(visitor); | 311 Keyframe::PropertySpecificKeyframe::trace(visitor); |
| 294 } | 312 } |
| 295 | 313 |
| 296 } | 314 } |
| OLD | NEW |