| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/animation/LengthInterpolationType.h" | 6 #include "core/animation/LengthInterpolationType.h" |
| 7 | 7 |
| 8 #include "core/animation/LengthPropertyFunctions.h" | 8 #include "core/animation/LengthPropertyFunctions.h" |
| 9 #include "core/animation/css/CSSAnimatableValueFactory.h" | 9 #include "core/animation/css/CSSAnimatableValueFactory.h" |
| 10 #include "core/css/CSSCalculationValue.h" | 10 #include "core/css/CSSCalculationValue.h" |
| 11 #include "core/css/resolver/StyleBuilder.h" | 11 #include "core/css/resolver/StyleBuilder.h" |
| 12 #include "core/css/resolver/StyleResolverState.h" | 12 #include "core/css/resolver/StyleResolverState.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 // This class is implemented as a singleton whose instance represents the presen
ce of percentages being used in a Length value | 16 // This class is implemented as a singleton whose instance represents the presen
ce of percentages being used in a Length value |
| 17 // while nullptr represents the absence of any percentages. | 17 // while nullptr represents the absence of any percentages. |
| 18 class LengthNonInterpolableValue : public NonInterpolableValue { | 18 class LengthNonInterpolableValue : public NonInterpolableValue { |
| 19 public: | 19 public: |
| 20 ~LengthNonInterpolableValue() override { ASSERT_NOT_REACHED(); } | 20 ~LengthNonInterpolableValue() override { ASSERT_NOT_REACHED(); } |
| 21 static PassRefPtr<LengthNonInterpolableValue> create(bool hasPercentage) | 21 static PassRefPtrWillBeRawPtr<LengthNonInterpolableValue> create(bool hasPer
centage) |
| 22 { | 22 { |
| 23 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(LengthNonInterpolableValue, singlet
on, adoptRef(new LengthNonInterpolableValue())); | 23 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(LengthNonInterpolableValue, singlet
on, adoptRefWillBeNoop(new LengthNonInterpolableValue())); |
| 24 ASSERT(singleton); | 24 ASSERT(singleton); |
| 25 return hasPercentage ? singleton : nullptr; | 25 return hasPercentage ? singleton : nullptr; |
| 26 } | 26 } |
| 27 static PassRefPtr<LengthNonInterpolableValue> merge(const NonInterpolableVal
ue* a, const NonInterpolableValue* b) | 27 static PassRefPtrWillBeRawPtr<LengthNonInterpolableValue> merge(const NonInt
erpolableValue* a, const NonInterpolableValue* b) |
| 28 { | 28 { |
| 29 return create(hasPercentage(a) || hasPercentage(b)); | 29 return create(hasPercentage(a) || hasPercentage(b)); |
| 30 } | 30 } |
| 31 static bool hasPercentage(const NonInterpolableValue* nonInterpolableValue) | 31 static bool hasPercentage(const NonInterpolableValue* nonInterpolableValue) |
| 32 { | 32 { |
| 33 ASSERT(!nonInterpolableValue || nonInterpolableValue->type() == LengthNo
nInterpolableValue::staticType); | 33 ASSERT(!nonInterpolableValue || nonInterpolableValue->type() == LengthNo
nInterpolableValue::staticType); |
| 34 return static_cast<bool>(nonInterpolableValue); | 34 return static_cast<bool>(nonInterpolableValue); |
| 35 } | 35 } |
| 36 DEFINE_INLINE_VIRTUAL_TRACE() { NonInterpolableValue::trace(visitor); } | 36 DEFINE_INLINE_VIRTUAL_TRACE() { NonInterpolableValue::trace(visitor); } |
| 37 DECLARE_NON_INTERPOLABLE_VALUE_TYPE(); | 37 DECLARE_NON_INTERPOLABLE_VALUE_TYPE(); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 RefPtr<AnimatableValue> after = CSSAnimatableValueFactory::create(m_
property, *state.style()); | 269 RefPtr<AnimatableValue> after = CSSAnimatableValueFactory::create(m_
property, *state.style()); |
| 270 ASSERT(before->equals(*after)); | 270 ASSERT(before->equals(*after)); |
| 271 #endif | 271 #endif |
| 272 return; | 272 return; |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 StyleBuilder::applyProperty(m_property, state, createCSSValue(values, hasPer
centage, m_valueRange).get()); | 275 StyleBuilder::applyProperty(m_property, state, createCSSValue(values, hasPer
centage, m_valueRange).get()); |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace blink | 278 } // namespace blink |
| OLD | NEW |