| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/CSSLengthInterpolationType.h" | 5 #include "core/animation/CSSLengthInterpolationType.h" |
| 6 | 6 |
| 7 #include "core/animation/LengthPropertyFunctions.h" | 7 #include "core/animation/LengthPropertyFunctions.h" |
| 8 #include "core/animation/css/CSSAnimatableValueFactory.h" | 8 #include "core/animation/css/CSSAnimatableValueFactory.h" |
| 9 #include "core/css/CSSCalculationValue.h" | 9 #include "core/css/CSSCalculationValue.h" |
| 10 #include "core/css/resolver/StyleBuilder.h" | 10 #include "core/css/resolver/StyleBuilder.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 { | 285 { |
| 286 return static_cast<CSSPrimitiveValue::UnitType>(CSSPrimitiveValue::lengthUni
tTypeToUnitType(static_cast<CSSPrimitiveValue::LengthUnitType>(lengthUnitType)))
; | 286 return static_cast<CSSPrimitiveValue::UnitType>(CSSPrimitiveValue::lengthUni
tTypeToUnitType(static_cast<CSSPrimitiveValue::LengthUnitType>(lengthUnitType)))
; |
| 287 } | 287 } |
| 288 | 288 |
| 289 static CSSCalcExpressionNode* createCalcExpression(const InterpolableList& value
s, bool hasPercentage) | 289 static CSSCalcExpressionNode* createCalcExpression(const InterpolableList& value
s, bool hasPercentage) |
| 290 { | 290 { |
| 291 CSSCalcExpressionNode* result = nullptr; | 291 CSSCalcExpressionNode* result = nullptr; |
| 292 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { | 292 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { |
| 293 double value = toInterpolableNumber(values.get(i))->value(); | 293 double value = toInterpolableNumber(values.get(i))->value(); |
| 294 if (value || (i == CSSPrimitiveValue::UnitTypePercentage && hasPercentag
e)) { | 294 if (value || (i == CSSPrimitiveValue::UnitTypePercentage && hasPercentag
e)) { |
| 295 RawPtr<CSSCalcExpressionNode> node = CSSCalcValue::createExpressionN
ode(CSSPrimitiveValue::create(value, toUnitType(i))); | 295 CSSCalcExpressionNode* node = CSSCalcValue::createExpressionNode(CSS
PrimitiveValue::create(value, toUnitType(i))); |
| 296 result = result ? CSSCalcValue::createExpressionNode(result, node, C
alcAdd) : node; | 296 result = result ? CSSCalcValue::createExpressionNode(result, node, C
alcAdd) : node; |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 ASSERT(result); | 299 ASSERT(result); |
| 300 return result; | 300 return result; |
| 301 } | 301 } |
| 302 | 302 |
| 303 static CSSValue* createCSSValue(const InterpolableList& values, bool hasPercenta
ge, ValueRange range) | 303 static CSSValue* createCSSValue(const InterpolableList& values, bool hasPercenta
ge, ValueRange range) |
| 304 { | 304 { |
| 305 size_t firstUnitIndex = CSSPrimitiveValue::LengthUnitTypeCount; | 305 size_t firstUnitIndex = CSSPrimitiveValue::LengthUnitTypeCount; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 RefPtr<AnimatableValue> after = CSSAnimatableValueFactory::create(cs
sProperty(), *state.style()); | 338 RefPtr<AnimatableValue> after = CSSAnimatableValueFactory::create(cs
sProperty(), *state.style()); |
| 339 ASSERT(before->equals(*after)); | 339 ASSERT(before->equals(*after)); |
| 340 #endif | 340 #endif |
| 341 return; | 341 return; |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 StyleBuilder::applyProperty(cssProperty(), state, createCSSValue(values, has
Percentage, m_valueRange)); | 344 StyleBuilder::applyProperty(cssProperty(), state, createCSSValue(values, has
Percentage, m_valueRange)); |
| 345 } | 345 } |
| 346 | 346 |
| 347 } // namespace blink | 347 } // namespace blink |
| OLD | NEW |