Chromium Code Reviews| 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 #ifndef ListInterpolationFunctions_h | 5 #ifndef ListInterpolationFunctions_h |
| 6 #define ListInterpolationFunctions_h | 6 #define ListInterpolationFunctions_h |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include "core/animation/InterpolationValue.h" | 9 #include "core/animation/InterpolationValue.h" |
| 10 #include "core/animation/PairwiseInterpolationValue.h" | 10 #include "core/animation/PairwiseInterpolationValue.h" |
| 11 #include "platform/wtf/Vector.h" | 11 #include "platform/wtf/Vector.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class UnderlyingValueOwner; | 15 class UnderlyingValueOwner; |
| 16 class InterpolationType; | 16 class InterpolationType; |
| 17 | 17 |
| 18 class ListInterpolationFunctions { | 18 class ListInterpolationFunctions { |
| 19 public: | 19 public: |
| 20 template <typename CreateItemCallback> | 20 template <typename CreateItemCallback> |
| 21 static InterpolationValue CreateList(size_t length, CreateItemCallback); | 21 static InterpolationValue CreateList(size_t length, CreateItemCallback); |
| 22 static InterpolationValue CreateEmptyList() { | 22 static InterpolationValue CreateEmptyList() { |
| 23 return InterpolationValue(InterpolableList::Create(0)); | 23 return InterpolationValue(InterpolableList::Create(0)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 enum LengthMatchingStrategy { kLowestCommonMultiple, kPadToLargest }; | |
|
shend
2017/04/27 06:07:49
Should the enum value name indicate that it's a st
alancutter (OOO until 2018)
2017/04/27 07:09:22
Made it an enum class.
| |
| 27 | |
| 26 using MergeSingleItemConversionsCallback = | 28 using MergeSingleItemConversionsCallback = |
| 27 PairwiseInterpolationValue (*)(InterpolationValue&& start, | 29 PairwiseInterpolationValue (*)(InterpolationValue&& start, |
| 28 InterpolationValue&& end); | 30 InterpolationValue&& end); |
| 29 static PairwiseInterpolationValue MaybeMergeSingles( | 31 static PairwiseInterpolationValue MaybeMergeSingles( |
| 30 InterpolationValue&& start, | 32 InterpolationValue&& start, |
| 31 InterpolationValue&& end, | 33 InterpolationValue&& end, |
| 34 LengthMatchingStrategy, | |
| 32 MergeSingleItemConversionsCallback); | 35 MergeSingleItemConversionsCallback); |
| 33 | 36 |
| 34 using EqualNonInterpolableValuesCallback = | 37 using EqualNonInterpolableValuesCallback = |
| 35 bool (*)(const NonInterpolableValue*, const NonInterpolableValue*); | 38 bool (*)(const NonInterpolableValue*, const NonInterpolableValue*); |
| 36 static bool EqualValues(const InterpolationValue&, | 39 static bool EqualValues(const InterpolationValue&, |
| 37 const InterpolationValue&, | 40 const InterpolationValue&, |
| 38 EqualNonInterpolableValuesCallback); | 41 EqualNonInterpolableValuesCallback); |
| 39 | 42 |
| 40 using NonInterpolableValuesAreCompatibleCallback = | 43 using NonInterpolableValuesAreCompatibleCallback = |
| 41 bool (*)(const NonInterpolableValue*, const NonInterpolableValue*); | 44 bool (*)(const NonInterpolableValue*, const NonInterpolableValue*); |
| 42 using CompositeItemCallback = void (*)(std::unique_ptr<InterpolableValue>&, | 45 using CompositeItemCallback = void (*)(std::unique_ptr<InterpolableValue>&, |
| 43 RefPtr<NonInterpolableValue>&, | 46 RefPtr<NonInterpolableValue>&, |
| 44 double underlying_fraction, | 47 double underlying_fraction, |
| 45 const InterpolableValue&, | 48 const InterpolableValue&, |
| 46 const NonInterpolableValue*); | 49 const NonInterpolableValue*); |
| 47 static void Composite(UnderlyingValueOwner&, | 50 static void Composite(UnderlyingValueOwner&, |
| 48 double underlying_fraction, | 51 double underlying_fraction, |
| 49 const InterpolationType&, | 52 const InterpolationType&, |
| 50 const InterpolationValue&, | 53 const InterpolationValue&, |
| 54 LengthMatchingStrategy, | |
| 51 NonInterpolableValuesAreCompatibleCallback, | 55 NonInterpolableValuesAreCompatibleCallback, |
| 52 CompositeItemCallback); | 56 CompositeItemCallback); |
| 53 }; | 57 }; |
| 54 | 58 |
| 55 class NonInterpolableList : public NonInterpolableValue { | 59 class NonInterpolableList : public NonInterpolableValue { |
| 56 public: | 60 public: |
| 57 ~NonInterpolableList() final {} | 61 ~NonInterpolableList() final {} |
| 58 | 62 |
| 59 static PassRefPtr<NonInterpolableList> Create() { | 63 static PassRefPtr<NonInterpolableList> Create() { |
| 60 return AdoptRef(new NonInterpolableList()); | 64 return AdoptRef(new NonInterpolableList()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 non_interpolable_values[i] = std::move(item.non_interpolable_value); | 106 non_interpolable_values[i] = std::move(item.non_interpolable_value); |
| 103 } | 107 } |
| 104 return InterpolationValue( | 108 return InterpolationValue( |
| 105 std::move(interpolable_list), | 109 std::move(interpolable_list), |
| 106 NonInterpolableList::Create(std::move(non_interpolable_values))); | 110 NonInterpolableList::Create(std::move(non_interpolable_values))); |
| 107 } | 111 } |
| 108 | 112 |
| 109 } // namespace blink | 113 } // namespace blink |
| 110 | 114 |
| 111 #endif // ListInterpolationFunctions_h | 115 #endif // ListInterpolationFunctions_h |
| OLD | NEW |