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

Side by Side Diff: third_party/WebKit/Source/core/animation/CSSSizeListInterpolationType.h

Issue 2280553002: Allow interpolation of background-size values with keywords in CSS Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove DCHECK Created 4 years, 3 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 #ifndef CSSSizeListInterpolationType_h 5 #ifndef CSSSizeListInterpolationType_h
6 #define CSSSizeListInterpolationType_h 6 #define CSSSizeListInterpolationType_h
7 7
8 #include "core/animation/CSSLengthListInterpolationType.h" 8 #include "core/animation/CSSInterpolationType.h"
9 #include "core/animation/LengthInterpolationFunctions.h"
10 #include "core/animation/ListInterpolationFunctions.h"
11 #include "core/css/CSSValueList.h"
12 #include "core/css/CSSValuePair.h"
13 9
14 namespace blink { 10 namespace blink {
15 11
16 class CSSSizeListInterpolationType : public CSSLengthListInterpolationType { 12 class CSSSizeListInterpolationType : public CSSInterpolationType {
17 public: 13 public:
18 CSSSizeListInterpolationType(CSSPropertyID property) 14 CSSSizeListInterpolationType(CSSPropertyID property)
19 : CSSLengthListInterpolationType(property) 15 : CSSInterpolationType(property)
20 { } 16 { }
21 17
18 InterpolationValue maybeConvertUnderlyingValue(const InterpolationEnvironmen t&) const final;
19 void composite(UnderlyingValueOwner&, double underlyingFraction, const Inter polationValue&, double interpolationFraction) const final;
20 void apply(const InterpolableValue&, const NonInterpolableValue*, Interpolat ionEnvironment&) const final;
21
22 private: 22 private:
23 InterpolationValue maybeConvertValue(const CSSValue& value, const StyleResol verState&, ConversionCheckers&) const final 23 InterpolationValue maybeConvertNeutral(const InterpolationValue& underlying, ConversionCheckers&) const final;
24 { 24 InterpolationValue maybeConvertInitial(const StyleResolverState&, Conversion Checkers&) const final;
25 CSSValueList* tempList = nullptr; 25 InterpolationValue maybeConvertInherit(const StyleResolverState&, Conversion Checkers&) const final;
26 if (!value.isBaseValueList()) { 26 InterpolationValue maybeConvertValue(const CSSValue&, const StyleResolverSta te&, ConversionCheckers&) const final;
27 tempList = CSSValueList::createCommaSeparated();
28 tempList->append(value);
29 }
30 const CSSValueList& list = value.isBaseValueList() ? toCSSValueList(valu e) : *tempList;
31 27
32 // Only size lists without keywords may interpolate smoothly: 28 PairwiseInterpolationValue maybeMergeSingles(InterpolationValue&& start, Int erpolationValue&& end) const final;
33 // https://drafts.csswg.org/css-backgrounds-3/#the-background-size
34 return ListInterpolationFunctions::createList(list.length() * 2, [&list] (size_t index) -> InterpolationValue {
35 const CSSValue& item = list.item(index / 2);
36 if (!item.isValuePair())
37 return nullptr;
38 const CSSValuePair& pair = toCSSValuePair(item);
39 const CSSValue& side = index % 2 == 0 ? pair.first() : pair.second() ;
40 return LengthInterpolationFunctions::maybeConvertCSSValue(side);
41 });
42 }
43 }; 29 };
44 30
45 } // namespace blink 31 } // namespace blink
46 32
47 #endif // CSSSizeListInterpolationType_h 33 #endif // CSSSizeListInterpolationType_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698