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

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

Issue 2844213002: Fix behaviour of shadow interpolation with mismatched list lengths (Closed)
Patch Set: Revert transition test to old behaviour Created 3 years, 7 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/CSSLengthListInterpolationType.h" 5 #include "core/animation/CSSLengthListInterpolationType.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "core/animation/LengthInterpolationFunctions.h" 8 #include "core/animation/LengthInterpolationFunctions.h"
9 #include "core/animation/LengthListPropertyFunctions.h" 9 #include "core/animation/LengthListPropertyFunctions.h"
10 #include "core/animation/ListInterpolationFunctions.h" 10 #include "core/animation/ListInterpolationFunctions.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 return LengthInterpolationFunctions::MaybeConvertCSSValue( 117 return LengthInterpolationFunctions::MaybeConvertCSSValue(
118 list.Item(index)); 118 list.Item(index));
119 }); 119 });
120 } 120 }
121 121
122 PairwiseInterpolationValue CSSLengthListInterpolationType::MaybeMergeSingles( 122 PairwiseInterpolationValue CSSLengthListInterpolationType::MaybeMergeSingles(
123 InterpolationValue&& start, 123 InterpolationValue&& start,
124 InterpolationValue&& end) const { 124 InterpolationValue&& end) const {
125 return ListInterpolationFunctions::MaybeMergeSingles( 125 return ListInterpolationFunctions::MaybeMergeSingles(
126 std::move(start), std::move(end), 126 std::move(start), std::move(end),
127 ListInterpolationFunctions::LengthMatchingStrategy::kLowestCommonMultiple,
127 LengthInterpolationFunctions::MergeSingles); 128 LengthInterpolationFunctions::MergeSingles);
128 } 129 }
129 130
130 InterpolationValue 131 InterpolationValue
131 CSSLengthListInterpolationType::MaybeConvertStandardPropertyUnderlyingValue( 132 CSSLengthListInterpolationType::MaybeConvertStandardPropertyUnderlyingValue(
132 const ComputedStyle& style) const { 133 const ComputedStyle& style) const {
133 Vector<Length> underlying_length_list; 134 Vector<Length> underlying_length_list;
134 if (!LengthListPropertyFunctions::GetLengthList(CssProperty(), style, 135 if (!LengthListPropertyFunctions::GetLengthList(CssProperty(), style,
135 underlying_length_list)) 136 underlying_length_list))
136 return nullptr; 137 return nullptr;
137 return MaybeConvertLengthList(underlying_length_list, style.EffectiveZoom()); 138 return MaybeConvertLengthList(underlying_length_list, style.EffectiveZoom());
138 } 139 }
139 140
140 void CSSLengthListInterpolationType::Composite( 141 void CSSLengthListInterpolationType::Composite(
141 UnderlyingValueOwner& underlying_value_owner, 142 UnderlyingValueOwner& underlying_value_owner,
142 double underlying_fraction, 143 double underlying_fraction,
143 const InterpolationValue& value, 144 const InterpolationValue& value,
144 double interpolation_fraction) const { 145 double interpolation_fraction) const {
145 ListInterpolationFunctions::Composite( 146 ListInterpolationFunctions::Composite(
146 underlying_value_owner, underlying_fraction, *this, value, 147 underlying_value_owner, underlying_fraction, *this, value,
148 ListInterpolationFunctions::LengthMatchingStrategy::kLowestCommonMultiple,
147 LengthInterpolationFunctions::NonInterpolableValuesAreCompatible, 149 LengthInterpolationFunctions::NonInterpolableValuesAreCompatible,
148 LengthInterpolationFunctions::Composite); 150 LengthInterpolationFunctions::Composite);
149 } 151 }
150 152
151 void CSSLengthListInterpolationType::ApplyStandardPropertyValue( 153 void CSSLengthListInterpolationType::ApplyStandardPropertyValue(
152 const InterpolableValue& interpolable_value, 154 const InterpolableValue& interpolable_value,
153 const NonInterpolableValue* non_interpolable_value, 155 const NonInterpolableValue* non_interpolable_value,
154 StyleResolverState& state) const { 156 StyleResolverState& state) const {
155 const InterpolableList& interpolable_list = 157 const InterpolableList& interpolable_list =
156 ToInterpolableList(interpolable_value); 158 ToInterpolableList(interpolable_value);
157 const size_t length = interpolable_list.length(); 159 const size_t length = interpolable_list.length();
158 DCHECK_GT(length, 0U); 160 DCHECK_GT(length, 0U);
159 const NonInterpolableList& non_interpolable_list = 161 const NonInterpolableList& non_interpolable_list =
160 ToNonInterpolableList(*non_interpolable_value); 162 ToNonInterpolableList(*non_interpolable_value);
161 DCHECK_EQ(non_interpolable_list.length(), length); 163 DCHECK_EQ(non_interpolable_list.length(), length);
162 Vector<Length> result(length); 164 Vector<Length> result(length);
163 for (size_t i = 0; i < length; i++) { 165 for (size_t i = 0; i < length; i++) {
164 result[i] = LengthInterpolationFunctions::CreateLength( 166 result[i] = LengthInterpolationFunctions::CreateLength(
165 *interpolable_list.Get(i), non_interpolable_list.Get(i), 167 *interpolable_list.Get(i), non_interpolable_list.Get(i),
166 state.CssToLengthConversionData(), value_range_); 168 state.CssToLengthConversionData(), value_range_);
167 } 169 }
168 LengthListPropertyFunctions::SetLengthList(CssProperty(), *state.Style(), 170 LengthListPropertyFunctions::SetLengthList(CssProperty(), *state.Style(),
169 std::move(result)); 171 std::move(result));
170 } 172 }
171 173
172 } // namespace blink 174 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698