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

Side by Side Diff: Source/core/animation/ListStyleInterpolation.h

Issue 1303173007: Oilpan: Unship Oilpan from CSSValues Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
OLDNEW
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 ListStyleInterpolation_h 5 #ifndef ListStyleInterpolation_h
6 #define ListStyleInterpolation_h 6 #define ListStyleInterpolation_h
7 7
8 #include "core/animation/StyleInterpolation.h" 8 #include "core/animation/StyleInterpolation.h"
9 #include "core/css/CSSPrimitiveValue.h" 9 #include "core/css/CSSPrimitiveValue.h"
10 #include "core/css/CSSValueList.h" 10 #include "core/css/CSSValueList.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(l istValue.length()); 63 OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(l istValue.length());
64 typename InterpolationType::NonInterpolableType elementData = typename I nterpolationType::NonInterpolableType(); 64 typename InterpolationType::NonInterpolableType elementData = typename I nterpolationType::NonInterpolableType();
65 for (size_t i = 0; i < listValue.length(); i++) { 65 for (size_t i = 0; i < listValue.length(); i++) {
66 result->set(i, InterpolationType::toInterpolableValue(*listValue.ite m(i), elementData)); 66 result->set(i, InterpolationType::toInterpolableValue(*listValue.ite m(i), elementData));
67 if (nonInterpolableData) 67 if (nonInterpolableData)
68 nonInterpolableData->append(elementData); 68 nonInterpolableData->append(elementData);
69 } 69 }
70 return result.release(); 70 return result.release();
71 } 71 }
72 72
73 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToList(Interpolable Value* value, const Vector<typename InterpolationType::NonInterpolableType>& non InterpolableData, InterpolationRange range = RangeAll) 73 static PassRefPtr<CSSValue> interpolableValueToList(InterpolableValue* value , const Vector<typename InterpolationType::NonInterpolableType>& nonInterpolable Data, InterpolationRange range = RangeAll)
74 { 74 {
75 InterpolableList* listValue = toInterpolableList(value); 75 InterpolableList* listValue = toInterpolableList(value);
76 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createCommaSepar ated(); 76 RefPtr<CSSValueList> result = CSSValueList::createCommaSeparated();
77 77
78 ASSERT(nonInterpolableData.size() == listValue->length()); 78 ASSERT(nonInterpolableData.size() == listValue->length());
79 79
80 for (size_t i = 0; i < listValue->length(); i++) 80 for (size_t i = 0; i < listValue->length(); i++)
81 result->append(InterpolationType::fromInterpolableValue(*(listValue- >get(i)), nonInterpolableData[i], range)); 81 result->append(InterpolationType::fromInterpolableValue(*(listValue- >get(i)), nonInterpolableData[i], range));
82 return result.release(); 82 return result.release();
83 } 83 }
84 84
85 friend class ListStyleInterpolationTest; 85 friend class ListStyleInterpolationTest;
86 }; 86 };
(...skipping 30 matching lines...) Expand all
117 117
118 static PassOwnPtrWillBeRawPtr<InterpolableValue> listToInterpolableValue(con st CSSValue& value) 118 static PassOwnPtrWillBeRawPtr<InterpolableValue> listToInterpolableValue(con st CSSValue& value)
119 { 119 {
120 const CSSValueList& listValue = toCSSValueList(value); 120 const CSSValueList& listValue = toCSSValueList(value);
121 OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(l istValue.length()); 121 OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(l istValue.length());
122 for (size_t i = 0; i < listValue.length(); i++) 122 for (size_t i = 0; i < listValue.length(); i++)
123 result->set(i, InterpolationType::toInterpolableValue(*listValue.ite m(i))); 123 result->set(i, InterpolationType::toInterpolableValue(*listValue.ite m(i)));
124 return result.release(); 124 return result.release();
125 } 125 }
126 126
127 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToList(Interpolable Value* value, InterpolationRange range = RangeAll) 127 static PassRefPtr<CSSValue> interpolableValueToList(InterpolableValue* value , InterpolationRange range = RangeAll)
128 { 128 {
129 InterpolableList* listValue = toInterpolableList(value); 129 InterpolableList* listValue = toInterpolableList(value);
130 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createCommaSepar ated(); 130 RefPtr<CSSValueList> result = CSSValueList::createCommaSeparated();
131 131
132 for (size_t i = 0; i < listValue->length(); i++) 132 for (size_t i = 0; i < listValue->length(); i++)
133 result->append(InterpolationType::fromInterpolableValue(*(listValue- >get(i)), range)); 133 result->append(InterpolationType::fromInterpolableValue(*(listValue- >get(i)), range));
134 return result.release(); 134 return result.release();
135 } 135 }
136 136
137 void apply(StyleResolverState& state) const override 137 void apply(StyleResolverState& state) const override
138 { 138 {
139 StyleBuilder::applyProperty(m_id, state, interpolableValueToList(m_cache dValue.get(), m_range).get()); 139 StyleBuilder::applyProperty(m_id, state, interpolableValueToList(m_cache dValue.get(), m_range).get());
140 } 140 }
141 141
142 friend class ListStyleInterpolationTest; 142 friend class ListStyleInterpolationTest;
143 143
144 }; 144 };
145 145
146 template<typename InterpolationType> 146 template<typename InterpolationType>
147 class ListStyleInterpolation { 147 class ListStyleInterpolation {
148 public: 148 public:
149 static PassRefPtrWillBeRawPtr<ListStyleInterpolationImpl<InterpolationType, typename InterpolationType::NonInterpolableType>> maybeCreateFromList(const CSS Value& start, const CSSValue& end, CSSPropertyID id, InterpolationRange range = RangeAll) 149 static PassRefPtrWillBeRawPtr<ListStyleInterpolationImpl<InterpolationType, typename InterpolationType::NonInterpolableType>> maybeCreateFromList(const CSS Value& start, const CSSValue& end, CSSPropertyID id, InterpolationRange range = RangeAll)
150 { 150 {
151 return ListStyleInterpolationImpl<InterpolationType, typename Interpolat ionType::NonInterpolableType>::maybeCreateFromList(start, end, id, range); 151 return ListStyleInterpolationImpl<InterpolationType, typename Interpolat ionType::NonInterpolableType>::maybeCreateFromList(start, end, id, range);
152 } 152 }
153 }; 153 };
154 154
155 } // namespace blink 155 } // namespace blink
156 156
157 #endif // ListStyleInterpolation_h 157 #endif // ListStyleInterpolation_h
OLDNEW
« no previous file with comments | « Source/core/animation/LengthStyleInterpolationTest.cpp ('k') | Source/core/animation/ListStyleInterpolationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698