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

Side by Side Diff: Source/core/animation/LengthPoint3DStyleInterpolation.cpp

Issue 851633002: Animation: Add template for ListStyleInterpolation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add else to shadowToInterpolableValue Created 5 years, 10 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/animation/LengthPoint3DStyleInterpolation.h"
7
8 #include "core/animation/LengthStyleInterpolation.h"
9 #include "core/css/CSSCalculationValue.h"
10 #include "core/css/resolver/StyleBuilder.h"
11
12 namespace blink {
13
14 bool LengthPoint3DStyleInterpolation::canCreateFrom(const CSSValue& value)
15 {
16 if (!value.isValueList())
17 return false;
18 const CSSValueList& valueList = toCSSValueList(value);
19 if (valueList.length() == 2 || valueList.length() == 3) {
20 for (size_t i = 0; i < valueList.length(); i++) {
21 if (!LengthStyleInterpolation::canCreateFrom(*valueList.item(i)))
22 return false;
23 }
24 }
25 return true;
26 }
27
28 PassOwnPtrWillBeRawPtr<InterpolableValue> LengthPoint3DStyleInterpolation::lengt hPoint3DtoInterpolableValue(const CSSValue& value)
29 {
30 ASSERT(value.isValueList());
31 const CSSValueList& valueList = toCSSValueList(value);
32 const size_t sizeOfList = valueList.length();
33 OwnPtrWillBeRawPtr<InterpolableList> result = InterpolableList::create(sizeO fList);
34
35 for (size_t i = 0; i < sizeOfList; i ++) {
36 const CSSPrimitiveValue* length = toCSSPrimitiveValue(valueList.item(i)) ;
37 result->set(i, LengthStyleInterpolation::lengthToInterpolableValue(*leng th));
38 }
39 return result.release();
40 }
41
42 PassRefPtrWillBeRawPtr<CSSValue> LengthPoint3DStyleInterpolation::interpolableVa lueToLengthPoint3D(InterpolableValue* value, InterpolationRange range)
43 {
44 InterpolableList* lengthPoint3D = toInterpolableList(value);
45 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createCommaSeparated ();
46 const size_t sizeOfList = lengthPoint3D->length();
47
48 for (size_t i = 0; i < sizeOfList; i++)
49 result->append(LengthStyleInterpolation::interpolableValueToLength(lengt hPoint3D->get(i), RangeAll));
50
51 return result.release();
52 }
53
54 void LengthPoint3DStyleInterpolation::apply(StyleResolverState& state) const
55 {
56 StyleBuilder::applyProperty(m_id, state, interpolableValueToLengthPoint3D(m_ cachedValue.get()).get());
57 }
58
59 void LengthPoint3DStyleInterpolation::trace(Visitor* visitor)
60 {
61 StyleInterpolation::trace(visitor);
62 }
63
64 }
OLDNEW
« no previous file with comments | « Source/core/animation/LengthPoint3DStyleInterpolation.h ('k') | Source/core/animation/LengthPoint3DStyleInterpolationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698