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

Side by Side Diff: third_party/WebKit/Source/core/animation/CSSSizeListInterpolationType.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/CSSSizeListInterpolationType.h" 5 #include "core/animation/CSSSizeListInterpolationType.h"
6 6
7 #include "core/animation/ListInterpolationFunctions.h" 7 #include "core/animation/ListInterpolationFunctions.h"
8 #include "core/animation/SizeInterpolationFunctions.h" 8 #include "core/animation/SizeInterpolationFunctions.h"
9 #include "core/animation/SizeListPropertyFunctions.h" 9 #include "core/animation/SizeListPropertyFunctions.h"
10 #include "core/css/CSSValueList.h" 10 #include "core/css/CSSValueList.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const StyleResolverState*, 143 const StyleResolverState*,
144 ConversionCheckers&) const { 144 ConversionCheckers&) const {
145 return MaybeConvertCSSSizeList(value); 145 return MaybeConvertCSSSizeList(value);
146 } 146 }
147 147
148 PairwiseInterpolationValue CSSSizeListInterpolationType::MaybeMergeSingles( 148 PairwiseInterpolationValue CSSSizeListInterpolationType::MaybeMergeSingles(
149 InterpolationValue&& start, 149 InterpolationValue&& start,
150 InterpolationValue&& end) const { 150 InterpolationValue&& end) const {
151 return ListInterpolationFunctions::MaybeMergeSingles( 151 return ListInterpolationFunctions::MaybeMergeSingles(
152 std::move(start), std::move(end), 152 std::move(start), std::move(end),
153 ListInterpolationFunctions::LengthMatchingStrategy::kLowestCommonMultiple,
153 SizeInterpolationFunctions::MaybeMergeSingles); 154 SizeInterpolationFunctions::MaybeMergeSingles);
154 } 155 }
155 156
156 InterpolationValue 157 InterpolationValue
157 CSSSizeListInterpolationType::MaybeConvertStandardPropertyUnderlyingValue( 158 CSSSizeListInterpolationType::MaybeConvertStandardPropertyUnderlyingValue(
158 const ComputedStyle& style) const { 159 const ComputedStyle& style) const {
159 return ConvertSizeList( 160 return ConvertSizeList(
160 SizeListPropertyFunctions::GetSizeList(CssProperty(), style), 161 SizeListPropertyFunctions::GetSizeList(CssProperty(), style),
161 style.EffectiveZoom()); 162 style.EffectiveZoom());
162 } 163 }
163 164
164 void CSSSizeListInterpolationType::Composite( 165 void CSSSizeListInterpolationType::Composite(
165 UnderlyingValueOwner& underlying_value_owner, 166 UnderlyingValueOwner& underlying_value_owner,
166 double underlying_fraction, 167 double underlying_fraction,
167 const InterpolationValue& value, 168 const InterpolationValue& value,
168 double interpolation_fraction) const { 169 double interpolation_fraction) const {
169 ListInterpolationFunctions::Composite( 170 ListInterpolationFunctions::Composite(
170 underlying_value_owner, underlying_fraction, *this, value, 171 underlying_value_owner, underlying_fraction, *this, value,
172 ListInterpolationFunctions::LengthMatchingStrategy::kLowestCommonMultiple,
173
171 SizeInterpolationFunctions::NonInterpolableValuesAreCompatible, 174 SizeInterpolationFunctions::NonInterpolableValuesAreCompatible,
172 SizeInterpolationFunctions::Composite); 175 SizeInterpolationFunctions::Composite);
173 } 176 }
174 177
175 void CSSSizeListInterpolationType::ApplyStandardPropertyValue( 178 void CSSSizeListInterpolationType::ApplyStandardPropertyValue(
176 const InterpolableValue& interpolable_value, 179 const InterpolableValue& interpolable_value,
177 const NonInterpolableValue* non_interpolable_value, 180 const NonInterpolableValue* non_interpolable_value,
178 StyleResolverState& state) const { 181 StyleResolverState& state) const {
179 const auto& interpolable_list = ToInterpolableList(interpolable_value); 182 const auto& interpolable_list = ToInterpolableList(interpolable_value);
180 const auto& non_interpolable_list = 183 const auto& non_interpolable_list =
181 ToNonInterpolableList(*non_interpolable_value); 184 ToNonInterpolableList(*non_interpolable_value);
182 size_t length = interpolable_list.length(); 185 size_t length = interpolable_list.length();
183 DCHECK_EQ(length, non_interpolable_list.length()); 186 DCHECK_EQ(length, non_interpolable_list.length());
184 DCHECK_EQ(length % 2, 0ul); 187 DCHECK_EQ(length % 2, 0ul);
185 size_t size_list_length = length / 2; 188 size_t size_list_length = length / 2;
186 SizeList size_list(size_list_length); 189 SizeList size_list(size_list_length);
187 for (size_t i = 0; i < size_list_length; i++) { 190 for (size_t i = 0; i < size_list_length; i++) {
188 size_list[i] = SizeInterpolationFunctions::CreateFillSize( 191 size_list[i] = SizeInterpolationFunctions::CreateFillSize(
189 *interpolable_list.Get(i * 2), non_interpolable_list.Get(i * 2), 192 *interpolable_list.Get(i * 2), non_interpolable_list.Get(i * 2),
190 *interpolable_list.Get(i * 2 + 1), non_interpolable_list.Get(i * 2 + 1), 193 *interpolable_list.Get(i * 2 + 1), non_interpolable_list.Get(i * 2 + 1),
191 state.CssToLengthConversionData()); 194 state.CssToLengthConversionData());
192 } 195 }
193 SizeListPropertyFunctions::SetSizeList(CssProperty(), *state.Style(), 196 SizeListPropertyFunctions::SetSizeList(CssProperty(), *state.Style(),
194 size_list); 197 size_list);
195 } 198 }
196 199
197 } // namespace blink 200 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698