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

Side by Side Diff: third_party/WebKit/Source/core/animation/CSSShadowListInterpolationType.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/CSSShadowListInterpolationType.h" 5 #include "core/animation/CSSShadowListInterpolationType.h"
6 6
7 #include "core/animation/ListInterpolationFunctions.h" 7 #include "core/animation/ListInterpolationFunctions.h"
8 #include "core/animation/ShadowInterpolationFunctions.h" 8 #include "core/animation/ShadowInterpolationFunctions.h"
9 #include "core/animation/ShadowListPropertyFunctions.h" 9 #include "core/animation/ShadowListPropertyFunctions.h"
10 #include "core/css/CSSIdentifierValue.h"
10 #include "core/css/CSSValueList.h" 11 #include "core/css/CSSValueList.h"
11 #include "core/css/resolver/StyleBuilder.h" 12 #include "core/css/resolver/StyleBuilder.h"
12 #include "core/css/resolver/StyleResolverState.h" 13 #include "core/css/resolver/StyleResolverState.h"
13 #include "core/style/ShadowList.h" 14 #include "core/style/ShadowList.h"
14 #include "wtf/PtrUtil.h" 15 #include "wtf/PtrUtil.h"
15 #include <memory> 16 #include <memory>
16 17
17 namespace blink { 18 namespace blink {
18 19
19 InterpolationValue CSSShadowListInterpolationType::convertShadowList(const Shado wList* shadowList, double zoom) const 20 InterpolationValue CSSShadowListInterpolationType::convertShadowList(const Shado wList* shadowList, double zoom) const
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 { 73 {
73 if (!state.parentStyle()) 74 if (!state.parentStyle())
74 return nullptr; 75 return nullptr;
75 const ShadowList* parentShadowList = ShadowListPropertyFunctions::getShadowL ist(cssProperty(), *state.parentStyle()); 76 const ShadowList* parentShadowList = ShadowListPropertyFunctions::getShadowL ist(cssProperty(), *state.parentStyle());
76 conversionCheckers.append(ParentShadowListChecker::create(cssProperty(), con st_cast<ShadowList*>(parentShadowList))); // Take ref. 77 conversionCheckers.append(ParentShadowListChecker::create(cssProperty(), con st_cast<ShadowList*>(parentShadowList))); // Take ref.
77 return convertShadowList(parentShadowList, state.parentStyle()->effectiveZoo m()); 78 return convertShadowList(parentShadowList, state.parentStyle()->effectiveZoo m());
78 } 79 }
79 80
80 InterpolationValue CSSShadowListInterpolationType::maybeConvertValue(const CSSVa lue& value, const StyleResolverState&, ConversionCheckers&) const 81 InterpolationValue CSSShadowListInterpolationType::maybeConvertValue(const CSSVa lue& value, const StyleResolverState&, ConversionCheckers&) const
81 { 82 {
82 if (value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() == C SSValueNone) 83 if (value.isIdentifierValue() && toCSSIdentifierValue(value).getValueID() == CSSValueNone)
83 return createNeutralValue(); 84 return createNeutralValue();
84 85
85 if (!value.isBaseValueList()) 86 if (!value.isBaseValueList())
86 return nullptr; 87 return nullptr;
87 88
88 const CSSValueList& valueList = toCSSValueList(value); 89 const CSSValueList& valueList = toCSSValueList(value);
89 return ListInterpolationFunctions::createList(valueList.length(), [&valueLis t](size_t index) { 90 return ListInterpolationFunctions::createList(valueList.length(), [&valueLis t](size_t index) {
90 return ShadowInterpolationFunctions::maybeConvertCSSValue(valueList.item (index)); 91 return ShadowInterpolationFunctions::maybeConvertCSSValue(valueList.item (index));
91 }); 92 });
92 } 93 }
(...skipping 29 matching lines...) Expand all
122 shadows.append(ShadowInterpolationFunctions::createShadowData(*interpola bleList.get(i), nonInterpolableList.get(i), state)); 123 shadows.append(ShadowInterpolationFunctions::createShadowData(*interpola bleList.get(i), nonInterpolableList.get(i), state));
123 return ShadowList::adopt(shadows); 124 return ShadowList::adopt(shadows);
124 } 125 }
125 126
126 void CSSShadowListInterpolationType::apply(const InterpolableValue& interpolable Value, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironmen t& environment) const 127 void CSSShadowListInterpolationType::apply(const InterpolableValue& interpolable Value, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironmen t& environment) const
127 { 128 {
128 ShadowListPropertyFunctions::setShadowList(cssProperty(), *environment.state ().style(), createShadowList(interpolableValue, nonInterpolableValue, environmen t.state())); 129 ShadowListPropertyFunctions::setShadowList(cssProperty(), *environment.state ().style(), createShadowList(interpolableValue, nonInterpolableValue, environmen t.state()));
129 } 130 }
130 131
131 } // namespace blink 132 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698