Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: Source/core/animation/StringKeyframe.cpp

Issue 343563002: Web Animations API: Avoid style resolution when calling element.animate() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed FIXME Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/animation/EffectInputTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/css/CSSAnimations.h" 8 #include "core/animation/css/CSSAnimations.h"
9 #include "core/animation/interpolation/DefaultStyleInterpolation.h" 9 #include "core/animation/interpolation/DefaultStyleInterpolation.h"
10 #include "core/animation/interpolation/DeferredLegacyStyleInterpolation.h" 10 #include "core/animation/interpolation/DeferredLegacyStyleInterpolation.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const 68 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const
69 { 69 {
70 CSSValue* fromCSSValue = m_value.get(); 70 CSSValue* fromCSSValue = m_value.get();
71 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value(); 71 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value();
72 ValueRange range = ValueRangeAll; 72 ValueRange range = ValueRangeAll;
73 73
74 if (!CSSAnimations::isAnimatableProperty(property)) 74 if (!CSSAnimations::isAnimatableProperty(property))
75 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty); 75 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty);
76 76
77 // FIXME: add non-negative CSSPropertyFontSize and CSSPropertyOutlineWidth
78 switch (property) { 77 switch (property) {
79 case CSSPropertyBorderBottomWidth: 78 case CSSPropertyBorderBottomWidth:
80 case CSSPropertyBorderLeftWidth: 79 case CSSPropertyBorderLeftWidth:
81 case CSSPropertyBorderRightWidth: 80 case CSSPropertyBorderRightWidth:
82 case CSSPropertyBorderTopWidth: 81 case CSSPropertyBorderTopWidth:
82 case CSSPropertyFontSize:
83 case CSSPropertyHeight: 83 case CSSPropertyHeight:
84 case CSSPropertyLineHeight: 84 case CSSPropertyLineHeight:
85 case CSSPropertyMaxHeight: 85 case CSSPropertyMaxHeight:
86 case CSSPropertyMaxWidth: 86 case CSSPropertyMaxWidth:
87 case CSSPropertyMinHeight: 87 case CSSPropertyMinHeight:
88 case CSSPropertyMinWidth: 88 case CSSPropertyMinWidth:
89 case CSSPropertyOutlineWidth:
89 case CSSPropertyPaddingBottom: 90 case CSSPropertyPaddingBottom:
90 case CSSPropertyPaddingLeft: 91 case CSSPropertyPaddingLeft:
91 case CSSPropertyPaddingRight: 92 case CSSPropertyPaddingRight:
92 case CSSPropertyPaddingTop: 93 case CSSPropertyPaddingTop:
93 case CSSPropertyPerspective: 94 case CSSPropertyPerspective:
94 case CSSPropertyShapeMargin: 95 case CSSPropertyShapeMargin:
95 case CSSPropertyWidth: 96 case CSSPropertyWidth:
96 range = ValueRangeNonNegative; 97 range = ValueRangeNonNegative;
97 // Fall through 98 // Fall through
98 case CSSPropertyBottom: 99 case CSSPropertyBottom:
(...skipping 13 matching lines...) Expand all
112 break; 113 break;
113 default: 114 default:
114 break; 115 break;
115 } 116 }
116 117
117 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(*fro mCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolv e(*toCSSValue)) 118 if (DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(*fro mCSSValue) || DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolv e(*toCSSValue))
118 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue , property); 119 return DeferredLegacyStyleInterpolation::create(fromCSSValue, toCSSValue , property);
119 120
120 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here . 121 // FIXME: Remove the use of AnimatableValues, RenderStyles and Elements here .
121 // FIXME: Remove this cache 122 // FIXME: Remove this cache
123 ASSERT(element);
122 if (!m_animatableValueCache) 124 if (!m_animatableValueCache)
123 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*e lement, property, *fromCSSValue); 125 m_animatableValueCache = StyleResolver::createAnimatableValueSnapshot(*e lement, property, *fromCSSValue);
124 126
125 RefPtrWillBeRawPtr<AnimatableValue> to = StyleResolver::createAnimatableValu eSnapshot(*element, property, *toCSSValue); 127 RefPtrWillBeRawPtr<AnimatableValue> to = StyleResolver::createAnimatableValu eSnapshot(*element, property, *toCSSValue);
126 toStringPropertySpecificKeyframe(end)->m_animatableValueCache = to; 128 toStringPropertySpecificKeyframe(end)->m_animatableValueCache = to;
127 129
128 return LegacyStyleInterpolation::create(m_animatableValueCache.get(), to.rel ease(), property); 130 return LegacyStyleInterpolation::create(m_animatableValueCache.get(), to.rel ease(), property);
129 } 131 }
130 132
131 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope rtySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> e asing) const 133 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope rtySpecificKeyframe::neutralKeyframe(double offset, PassRefPtr<TimingFunction> e asing) const
132 { 134 {
133 return adoptPtrWillBeNoop(new PropertySpecificKeyframe(offset, easing, 0, An imationEffect::CompositeAdd)); 135 return adoptPtrWillBeNoop(new PropertySpecificKeyframe(offset, easing, 0, An imationEffect::CompositeAdd));
134 } 136 }
135 137
136 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope rtySpecificKeyframe::cloneWithOffset(double offset) const 138 PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> StringKeyframe::Prope rtySpecificKeyframe::cloneWithOffset(double offset) const
137 { 139 {
138 Keyframe::PropertySpecificKeyframe* theClone = new PropertySpecificKeyframe( offset, m_easing, m_value.get()); 140 Keyframe::PropertySpecificKeyframe* theClone = new PropertySpecificKeyframe( offset, m_easing, m_value.get());
139 toStringPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_anima tableValueCache; 141 toStringPropertySpecificKeyframe(theClone)->m_animatableValueCache = m_anima tableValueCache;
140 return adoptPtrWillBeNoop(theClone); 142 return adoptPtrWillBeNoop(theClone);
141 } 143 }
142 144
143 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) 145 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor)
144 { 146 {
145 visitor->trace(m_value); 147 visitor->trace(m_value);
146 visitor->trace(m_animatableValueCache); 148 visitor->trace(m_animatableValueCache);
147 Keyframe::PropertySpecificKeyframe::trace(visitor); 149 Keyframe::PropertySpecificKeyframe::trace(visitor);
148 } 150 }
149 151
150 } 152 }
OLDNEW
« no previous file with comments | « Source/core/animation/EffectInputTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698