Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 && |
|
suzyh_UTC10 (ex-contributor)
2017/02/17 04:59:59
Although this is a tiny bug fix, I'd prefer to see
alancutter (OOO until 2018)
2017/02/19 23:38:58
This bug is unreachable without this change.
| |
| 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 |
| OLD | NEW |