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

Side by Side Diff: third_party/WebKit/Source/core/animation/LengthInterpolationFunctions.cpp

Issue 2701533005: Support animating <percentage> and <length-percentage> custom properties (Closed)
Patch Set: update expectations Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/animation/CSSInterpolationTypesMap.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/LengthInterpolationFunctions.h" 5 #include "core/animation/LengthInterpolationFunctions.h"
6 6
7 #include "core/css/CSSCalculationValue.h" 7 #include "core/css/CSSCalculationValue.h"
8 #include "core/css/CSSPrimitiveValue.h" 8 #include "core/css/CSSPrimitiveValue.h"
9 #include "core/css/CSSToLengthConversionData.h" 9 #include "core/css/CSSToLengthConversionData.h"
10 #include "platform/CalculationValue.h" 10 #include "platform/CalculationValue.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 const InterpolableList& interpolableList = 206 const InterpolableList& interpolableList =
207 toInterpolableList(interpolableValue); 207 toInterpolableList(interpolableValue);
208 bool hasPercentage = 208 bool hasPercentage =
209 CSSLengthNonInterpolableValue::hasPercentage(nonInterpolableValue); 209 CSSLengthNonInterpolableValue::hasPercentage(nonInterpolableValue);
210 210
211 CSSCalcExpressionNode* rootNode = nullptr; 211 CSSCalcExpressionNode* rootNode = nullptr;
212 CSSPrimitiveValue* firstValue = nullptr; 212 CSSPrimitiveValue* firstValue = nullptr;
213 213
214 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { 214 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) {
215 double value = toInterpolableNumber(*interpolableList.get(i)).value(); 215 double value = toInterpolableNumber(*interpolableList.get(i)).value();
216 if (value == 0 || 216 if (value == 0 &&
217 (i == CSSPrimitiveValue::UnitTypePercentage && !hasPercentage)) { 217 (i != CSSPrimitiveValue::UnitTypePercentage || !hasPercentage)) {
218 continue; 218 continue;
219 } 219 }
220 CSSPrimitiveValue* currentValue = 220 CSSPrimitiveValue* currentValue =
221 CSSPrimitiveValue::create(value, indexToUnitType(i)); 221 CSSPrimitiveValue::create(value, indexToUnitType(i));
222 222
223 if (!firstValue) { 223 if (!firstValue) {
224 DCHECK(!rootNode); 224 DCHECK(!rootNode);
225 firstValue = currentValue; 225 firstValue = currentValue;
226 continue; 226 continue;
227 } 227 }
228 CSSCalcExpressionNode* currentNode = 228 CSSCalcExpressionNode* currentNode =
229 CSSCalcValue::createExpressionNode(currentValue); 229 CSSCalcValue::createExpressionNode(currentValue);
230 if (!rootNode) { 230 if (!rootNode) {
231 rootNode = CSSCalcValue::createExpressionNode(firstValue); 231 rootNode = CSSCalcValue::createExpressionNode(firstValue);
232 } 232 }
233 rootNode = 233 rootNode =
234 CSSCalcValue::createExpressionNode(rootNode, currentNode, CalcAdd); 234 CSSCalcValue::createExpressionNode(rootNode, currentNode, CalcAdd);
235 } 235 }
236 236
237 if (rootNode) { 237 if (rootNode) {
238 return CSSPrimitiveValue::create(CSSCalcValue::create(rootNode)); 238 return CSSPrimitiveValue::create(CSSCalcValue::create(rootNode));
239 } 239 }
240 if (firstValue) { 240 if (firstValue) {
241 return firstValue; 241 return firstValue;
242 } 242 }
243 return CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Pixels); 243 return CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType::Pixels);
244 } 244 }
245 245
246 } // namespace blink 246 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/CSSInterpolationTypesMap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698