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

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

Issue 811993002: Animation: Implement DoubleStyleInterpolation in StringKeyframe (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Opacity runs on compositor Created 5 years, 11 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
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/ColorStyleInterpolation.h" 8 #include "core/animation/ColorStyleInterpolation.h"
9 #include "core/animation/DefaultStyleInterpolation.h" 9 #include "core/animation/DefaultStyleInterpolation.h"
10 #include "core/animation/DeferredLegacyStyleInterpolation.h" 10 #include "core/animation/DeferredLegacyStyleInterpolation.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 , m_value(value) 71 , m_value(value)
72 { 72 {
73 ASSERT(!isNull(m_offset)); 73 ASSERT(!isNull(m_offset));
74 } 74 }
75 75
76 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const 76 PassRefPtrWillBeRawPtr<Interpolation> StringKeyframe::PropertySpecificKeyframe:: createInterpolation(CSSPropertyID property, Keyframe::PropertySpecificKeyframe* end, Element* element) const
77 { 77 {
78 CSSValue* fromCSSValue = m_value.get(); 78 CSSValue* fromCSSValue = m_value.get();
79 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value(); 79 CSSValue* toCSSValue = toStringPropertySpecificKeyframe(end)->value();
80 ValueRange range = ValueRangeAll; 80 ValueRange range = ValueRangeAll;
81 ClampRange clamp = NoClamp;
81 82
82 if (!CSSPropertyMetadata::isAnimatableProperty(property)) 83 if (!CSSPropertyMetadata::isAnimatableProperty(property))
83 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty); 84 return DefaultStyleInterpolation::create(fromCSSValue, toCSSValue, prope rty);
84 85
85 bool useDefaultStyleInterpolation = true; 86 bool useDefaultStyleInterpolation = true;
86 87
87 switch (property) { 88 switch (property) {
88 case CSSPropertyLineHeight: 89 case CSSPropertyLineHeight:
89 // FIXME: Handle numbers. 90 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl eInterpolation::canCreateFrom(*toCSSValue))
90 useDefaultStyleInterpolation = false; 91 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, ClampZero);
91 // Fall through 92 // Fall through
92 case CSSPropertyBorderBottomWidth: 93 case CSSPropertyBorderBottomWidth:
93 case CSSPropertyBorderLeftWidth: 94 case CSSPropertyBorderLeftWidth:
94 case CSSPropertyBorderRightWidth: 95 case CSSPropertyBorderRightWidth:
95 case CSSPropertyBorderTopWidth: 96 case CSSPropertyBorderTopWidth:
97 case CSSPropertyFlexBasis:
96 case CSSPropertyFontSize: 98 case CSSPropertyFontSize:
97 case CSSPropertyHeight: 99 case CSSPropertyHeight:
98 case CSSPropertyMaxHeight: 100 case CSSPropertyMaxHeight:
99 case CSSPropertyMaxWidth: 101 case CSSPropertyMaxWidth:
100 case CSSPropertyMinHeight: 102 case CSSPropertyMinHeight:
101 case CSSPropertyMinWidth: 103 case CSSPropertyMinWidth:
102 case CSSPropertyMotionPosition: 104 case CSSPropertyMotionPosition:
103 case CSSPropertyOutlineWidth: 105 case CSSPropertyOutlineWidth:
104 case CSSPropertyPaddingBottom: 106 case CSSPropertyPaddingBottom:
105 case CSSPropertyPaddingLeft: 107 case CSSPropertyPaddingLeft:
106 case CSSPropertyPaddingRight: 108 case CSSPropertyPaddingRight:
107 case CSSPropertyPaddingTop: 109 case CSSPropertyPaddingTop:
108 case CSSPropertyPerspective: 110 case CSSPropertyPerspective:
109 case CSSPropertyShapeMargin: 111 case CSSPropertyShapeMargin:
112 case CSSPropertyWebkitBorderHorizontalSpacing:
113 case CSSPropertyWebkitBorderVerticalSpacing:
114 case CSSPropertyWebkitColumnGap:
115 case CSSPropertyWebkitColumnWidth:
110 case CSSPropertyWidth: 116 case CSSPropertyWidth:
111 range = ValueRangeNonNegative; 117 range = ValueRangeNonNegative;
112 // Fall through 118 // Fall through
113 case CSSPropertyBottom: 119 case CSSPropertyBottom:
114 case CSSPropertyLeft: 120 case CSSPropertyLeft:
115 case CSSPropertyLetterSpacing: 121 case CSSPropertyLetterSpacing:
116 case CSSPropertyMarginBottom: 122 case CSSPropertyMarginBottom:
117 case CSSPropertyMarginLeft: 123 case CSSPropertyMarginLeft:
118 case CSSPropertyMarginRight: 124 case CSSPropertyMarginRight:
119 case CSSPropertyMarginTop: 125 case CSSPropertyMarginTop:
120 case CSSPropertyOutlineOffset: 126 case CSSPropertyOutlineOffset:
121 case CSSPropertyRight: 127 case CSSPropertyRight:
122 case CSSPropertyTop: 128 case CSSPropertyTop:
123 case CSSPropertyVerticalAlign: 129 case CSSPropertyVerticalAlign:
124 case CSSPropertyWordSpacing: 130 case CSSPropertyWordSpacing:
125 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue)) 131 if (LengthStyleInterpolation::canCreateFrom(*fromCSSValue) && LengthStyl eInterpolation::canCreateFrom(*toCSSValue))
126 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, range); 132 return LengthStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, range);
127 // FIXME: Handle keywords e.g. 'none'. 133 // FIXME: Handle keywords e.g. 'none'.
128 if (property == CSSPropertyPerspective) 134 if (property == CSSPropertyPerspective)
129 useDefaultStyleInterpolation = false; 135 useDefaultStyleInterpolation = false;
130 break; 136 break;
137
138 case CSSPropertyOrphans:
139 if (clamp == NoClamp)
140 clamp = ClampOrphans;
141 // Fall through
142 case CSSPropertyWebkitColumnCount:
143 case CSSPropertyZIndex:
144 if (clamp == NoClamp)
145 clamp = ClampInteger;
146 // Fall through
147 case CSSPropertyFillOpacity:
148 case CSSPropertyFloodOpacity:
149 case CSSPropertyOpacity:
150 case CSSPropertyShapeImageThreshold:
151 case CSSPropertyStopOpacity:
152 case CSSPropertyStrokeOpacity:
153 if (clamp == NoClamp)
154 clamp = ClampOpacity;
155 // Fall through
156 case CSSPropertyStrokeMiterlimit:
157 case CSSPropertyWidows:
158 if (clamp == NoClamp)
159 clamp = ClampOne;
160 // Fall through
161 case CSSPropertyZoom:
162 if (clamp == NoClamp)
163 clamp = ClampZoom;
164 // Fall through
165 case CSSPropertyFlexGrow:
166 case CSSPropertyFlexShrink:
167 case CSSPropertyWebkitColumnRuleWidth:
168 if (DoubleStyleInterpolation::canCreateFrom(*fromCSSValue) && DoubleStyl eInterpolation::canCreateFrom(*toCSSValue)) {
169 if (property == CSSPropertyOpacity) {
170 m_animatableValueCache = StyleResolver::createAnimatableValueSna pshot(*element, property, *fromCSSValue);
171 RefPtrWillBeRawPtr<AnimatableValue> to = StyleResolver::createAn imatableValueSnapshot(*element, property, *toCSSValue);
172 toStringPropertySpecificKeyframe(end)->m_animatableValueCache = to;
alancutter (OOO until 2018) 2015/01/19 02:52:30 This code is identical to the code below. This sho
jadeg 2015/01/22 22:14:23 Done.
173 }
174 return DoubleStyleInterpolation::create(*fromCSSValue, *toCSSValue, property, clamp);
175 }
176 break;
177
131 case CSSPropertyMotionRotation: { 178 case CSSPropertyMotionRotation: {
132 RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolati on::maybeCreateFromMotionRotation(*fromCSSValue, *toCSSValue, property); 179 RefPtrWillBeRawPtr<Interpolation> interpolation = DoubleStyleInterpolati on::maybeCreateFromMotionRotation(*fromCSSValue, *toCSSValue, property);
133 if (interpolation) 180 if (interpolation)
134 return interpolation.release(); 181 return interpolation.release();
135 break; 182 break;
136 } 183 }
137 case CSSPropertyVisibility: 184 case CSSPropertyVisibility:
138 if (VisibilityStyleInterpolation::canCreateFrom(*fromCSSValue) && Visibi lityStyleInterpolation::canCreateFrom(*toCSSValue) && (VisibilityStyleInterpolat ion::isVisible(*fromCSSValue) || VisibilityStyleInterpolation::isVisible(*toCSSV alue))) { 185 if (VisibilityStyleInterpolation::canCreateFrom(*fromCSSValue) && Visibi lityStyleInterpolation::canCreateFrom(*toCSSValue) && (VisibilityStyleInterpolat ion::isVisible(*fromCSSValue) || VisibilityStyleInterpolation::isVisible(*toCSSV alue))) {
139 return VisibilityStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property); 186 return VisibilityStyleInterpolation::create(*fromCSSValue, *toCSSVal ue, property);
140 } 187 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 280 }
234 281
235 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor) 282 void StringKeyframe::PropertySpecificKeyframe::trace(Visitor* visitor)
236 { 283 {
237 visitor->trace(m_value); 284 visitor->trace(m_value);
238 visitor->trace(m_animatableValueCache); 285 visitor->trace(m_animatableValueCache);
239 Keyframe::PropertySpecificKeyframe::trace(visitor); 286 Keyframe::PropertySpecificKeyframe::trace(visitor);
240 } 287 }
241 288
242 } 289 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698