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

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

Issue 1885353004: Add ComputedStyle constructor and getter to InterpolationEnvironment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_transformInterpolationType
Patch Set: Rebased Created 4 years, 4 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/CSSValueList.h" 10 #include "core/css/CSSValueList.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 }); 91 });
92 } 92 }
93 93
94 PairwiseInterpolationValue CSSShadowListInterpolationType::maybeMergeSingles(Int erpolationValue&& start, InterpolationValue&& end) const 94 PairwiseInterpolationValue CSSShadowListInterpolationType::maybeMergeSingles(Int erpolationValue&& start, InterpolationValue&& end) const
95 { 95 {
96 return ListInterpolationFunctions::maybeMergeSingles(std::move(start), std:: move(end), ShadowInterpolationFunctions::maybeMergeSingles); 96 return ListInterpolationFunctions::maybeMergeSingles(std::move(start), std:: move(end), ShadowInterpolationFunctions::maybeMergeSingles);
97 } 97 }
98 98
99 InterpolationValue CSSShadowListInterpolationType::maybeConvertUnderlyingValue(c onst InterpolationEnvironment& environment) const 99 InterpolationValue CSSShadowListInterpolationType::maybeConvertUnderlyingValue(c onst InterpolationEnvironment& environment) const
100 { 100 {
101 if (!environment.state().style()) 101 return convertShadowList(ShadowListPropertyFunctions::getShadowList(cssPrope rty(), environment.style()), environment.style().effectiveZoom());
102 return nullptr;
103 return convertShadowList(ShadowListPropertyFunctions::getShadowList(cssPrope rty(), *environment.state().style()), environment.state().style()->effectiveZoom ());
104 } 102 }
105 103
106 void CSSShadowListInterpolationType::composite(UnderlyingValueOwner& underlyingV alueOwner, double underlyingFraction, const InterpolationValue& value, double in terpolationFraction) const 104 void CSSShadowListInterpolationType::composite(UnderlyingValueOwner& underlyingV alueOwner, double underlyingFraction, const InterpolationValue& value, double in terpolationFraction) const
107 { 105 {
108 ListInterpolationFunctions::composite(underlyingValueOwner, underlyingFracti on, *this, value, 106 ListInterpolationFunctions::composite(underlyingValueOwner, underlyingFracti on, *this, value,
109 ShadowInterpolationFunctions::nonInterpolableValuesAreCompatible, 107 ShadowInterpolationFunctions::nonInterpolableValuesAreCompatible,
110 ShadowInterpolationFunctions::composite); 108 ShadowInterpolationFunctions::composite);
111 } 109 }
112 110
113 static PassRefPtr<ShadowList> createShadowList(const InterpolableValue& interpol ableValue, const NonInterpolableValue* nonInterpolableValue, const StyleResolver State& state) 111 static PassRefPtr<ShadowList> createShadowList(const InterpolableValue& interpol ableValue, const NonInterpolableValue* nonInterpolableValue, const StyleResolver State& state)
114 { 112 {
115 const InterpolableList& interpolableList = toInterpolableList(interpolableVa lue); 113 const InterpolableList& interpolableList = toInterpolableList(interpolableVa lue);
116 size_t length = interpolableList.length(); 114 size_t length = interpolableList.length();
117 if (length == 0) 115 if (length == 0)
118 return nullptr; 116 return nullptr;
119 const NonInterpolableList& nonInterpolableList = toNonInterpolableList(*nonI nterpolableValue); 117 const NonInterpolableList& nonInterpolableList = toNonInterpolableList(*nonI nterpolableValue);
120 ShadowDataVector shadows; 118 ShadowDataVector shadows;
121 for (size_t i = 0; i < length; i++) 119 for (size_t i = 0; i < length; i++)
122 shadows.append(ShadowInterpolationFunctions::createShadowData(*interpola bleList.get(i), nonInterpolableList.get(i), state)); 120 shadows.append(ShadowInterpolationFunctions::createShadowData(*interpola bleList.get(i), nonInterpolableList.get(i), state));
123 return ShadowList::adopt(shadows); 121 return ShadowList::adopt(shadows);
124 } 122 }
125 123
126 void CSSShadowListInterpolationType::apply(const InterpolableValue& interpolable Value, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironmen t& environment) const 124 void CSSShadowListInterpolationType::apply(const InterpolableValue& interpolable Value, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironmen t& environment) const
127 { 125 {
128 ShadowListPropertyFunctions::setShadowList(cssProperty(), *environment.state ().style(), createShadowList(interpolableValue, nonInterpolableValue, environmen t.state())); 126 ShadowListPropertyFunctions::setShadowList(cssProperty(), environment.style( ), createShadowList(interpolableValue, nonInterpolableValue, environment.state() ));
129 } 127 }
130 128
131 } // namespace blink 129 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698