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

Side by Side Diff: third_party/WebKit/Source/core/animation/CSSImageListInterpolationType.cpp

Issue 2346193002: Split CSSPrimitiveValue into CSSPrimitiveValue and CSSIdentifierValue (Closed)
Patch Set: Rebase please work Created 4 years, 2 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
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/CSSImageListInterpolationType.h" 5 #include "core/animation/CSSImageListInterpolationType.h"
6 6
7 #include "core/animation/CSSImageInterpolationType.h" 7 #include "core/animation/CSSImageInterpolationType.h"
8 #include "core/animation/ImageListPropertyFunctions.h" 8 #include "core/animation/ImageListPropertyFunctions.h"
9 #include "core/animation/ListInterpolationFunctions.h" 9 #include "core/animation/ListInterpolationFunctions.h"
10 #include "core/css/CSSPrimitiveValue.h" 10 #include "core/css/CSSIdentifierValue.h"
11 #include "core/css/CSSValueList.h" 11 #include "core/css/CSSValueList.h"
12 #include "core/css/resolver/StyleResolverState.h" 12 #include "core/css/resolver/StyleResolverState.h"
13 #include "wtf/PtrUtil.h" 13 #include "wtf/PtrUtil.h"
14 #include <memory> 14 #include <memory>
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class UnderlyingImageListChecker : public InterpolationType::ConversionChecker { 18 class UnderlyingImageListChecker : public InterpolationType::ConversionChecker {
19 public: 19 public:
20 ~UnderlyingImageListChecker() final {} 20 ~UnderlyingImageListChecker() final {}
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 return nullptr; 92 return nullptr;
93 93
94 StyleImageList inheritedImageList; 94 StyleImageList inheritedImageList;
95 ImageListPropertyFunctions::getImageList(cssProperty(), *state.parentStyle() , inheritedImageList); 95 ImageListPropertyFunctions::getImageList(cssProperty(), *state.parentStyle() , inheritedImageList);
96 conversionCheckers.append(ParentImageListChecker::create(cssProperty(), inhe ritedImageList)); 96 conversionCheckers.append(ParentImageListChecker::create(cssProperty(), inhe ritedImageList));
97 return maybeConvertStyleImageList(inheritedImageList); 97 return maybeConvertStyleImageList(inheritedImageList);
98 } 98 }
99 99
100 InterpolationValue CSSImageListInterpolationType::maybeConvertValue(const CSSVal ue& value, const StyleResolverState&, ConversionCheckers&) const 100 InterpolationValue CSSImageListInterpolationType::maybeConvertValue(const CSSVal ue& value, const StyleResolverState&, ConversionCheckers&) const
101 { 101 {
102 if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == C SSValueNone) 102 if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueNone)
103 return nullptr; 103 return nullptr;
104 104
105 CSSValueList* tempList = nullptr; 105 CSSValueList* tempList = nullptr;
106 if (!value.isBaseValueList()) { 106 if (!value.isBaseValueList()) {
107 tempList = CSSValueList::createCommaSeparated(); 107 tempList = CSSValueList::createCommaSeparated();
108 tempList->append(value); 108 tempList->append(value);
109 } 109 }
110 const CSSValueList& valueList = tempList ? *tempList : toCSSValueList(value) ; 110 const CSSValueList& valueList = tempList ? *tempList : toCSSValueList(value) ;
111 111
112 const size_t length = valueList.length(); 112 const size_t length = valueList.length();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 DCHECK_GT(length, 0U); 146 DCHECK_GT(length, 0U);
147 const NonInterpolableList& nonInterpolableList = toNonInterpolableList(*nonI nterpolableValue); 147 const NonInterpolableList& nonInterpolableList = toNonInterpolableList(*nonI nterpolableValue);
148 DCHECK_EQ(nonInterpolableList.length(), length); 148 DCHECK_EQ(nonInterpolableList.length(), length);
149 StyleImageList imageList(length); 149 StyleImageList imageList(length);
150 for (size_t i = 0; i < length; i++) 150 for (size_t i = 0; i < length; i++)
151 imageList[i] = CSSImageInterpolationType::resolveStyleImage(cssProperty( ), *interpolableList.get(i), nonInterpolableList.get(i), environment.state()); 151 imageList[i] = CSSImageInterpolationType::resolveStyleImage(cssProperty( ), *interpolableList.get(i), nonInterpolableList.get(i), environment.state());
152 ImageListPropertyFunctions::setImageList(cssProperty(), *environment.state() .style(), imageList); 152 ImageListPropertyFunctions::setImageList(cssProperty(), *environment.state() .style(), imageList);
153 } 153 }
154 154
155 } // namespace blink 155 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698