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

Side by Side Diff: Source/core/animation/LengthStyleInterpolation.h

Issue 1243313002: Migrate the remaining CSS properties interpolable as Lengths to LengthInterpolationType (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add composition tests Created 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 LengthStyleInterpolation_h 5 #ifndef LengthStyleInterpolation_h
6 #define LengthStyleInterpolation_h 6 #define LengthStyleInterpolation_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/animation/StyleInterpolation.h" 9 #include "core/animation/StyleInterpolation.h"
10 #include "core/css/CSSPrimitiveValue.h" 10 #include "core/css/CSSPrimitiveValue.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class ComputedStyle; 14 class ComputedStyle;
15 class Length; 15 class Length;
16 16
17 class CORE_EXPORT LengthStyleInterpolation : public StyleInterpolation { 17 class CORE_EXPORT LengthStyleInterpolation : public StyleInterpolation {
18 public: 18 public:
19 typedef void (ComputedStyle::*LengthSetter)(const Length&);
20 typedef void NonInterpolableType; 19 typedef void NonInterpolableType;
21 20
22 static PassRefPtr<LengthStyleInterpolation> create(const CSSValue& start, co nst CSSValue& end, CSSPropertyID id, InterpolationRange range) 21 static PassRefPtr<LengthStyleInterpolation> create(const CSSValue& start, co nst CSSValue& end, CSSPropertyID id, InterpolationRange range)
23 { 22 {
24 return adoptRef(new LengthStyleInterpolation(toInterpolableValue(start, id), toInterpolableValue(end, id), id, range)); 23 return adoptRef(new LengthStyleInterpolation(toInterpolableValue(start, id), toInterpolableValue(end, id), id, range));
25 } 24 }
26 25
27 static bool canCreateFrom(const CSSValue&, CSSPropertyID = CSSPropertyInvali d); 26 static bool canCreateFrom(const CSSValue&, CSSPropertyID = CSSPropertyInvali d);
28 27
29 void apply(StyleResolverState&) const override; 28 void apply(StyleResolverState&) const override;
30 29
31 static PassOwnPtr<InterpolableValue> toInterpolableValue(const CSSValue&, CS SPropertyID = CSSPropertyInvalid); 30 static PassOwnPtr<InterpolableValue> toInterpolableValue(const CSSValue&, CS SPropertyID = CSSPropertyInvalid);
32 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> fromInterpolableValue(const InterpolableValue&, InterpolationRange); 31 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> fromInterpolableValue(const InterpolableValue&, InterpolationRange);
33 static void applyInterpolableValue(CSSPropertyID, const InterpolableValue&, InterpolationRange, StyleResolverState&, LengthSetter); 32 static void applyInterpolableValue(CSSPropertyID, const InterpolableValue&, InterpolationRange, StyleResolverState&);
34 33
35 private: 34 private:
36 LengthStyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Int erpolableValue> end, CSSPropertyID id, InterpolationRange range) 35 LengthStyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Int erpolableValue> end, CSSPropertyID id, InterpolationRange range)
37 : StyleInterpolation(start, end, id) 36 : StyleInterpolation(start, end, id)
38 , m_range(range) 37 , m_range(range)
39 , m_lengthSetter(nullptr)
40 { 38 {
41 if (isPixelsOrPercentOnly(*m_start) && isPixelsOrPercentOnly(*m_end))
42 m_lengthSetter = lengthSetterForProperty(id);
43 } 39 }
44 40
45 static bool isPixelsOrPercentOnly(const InterpolableValue&);
46 static LengthSetter lengthSetterForProperty(CSSPropertyID);
47
48 InterpolationRange m_range; 41 InterpolationRange m_range;
49 LengthSetter m_lengthSetter;
50 }; 42 };
51 43
52 } 44 }
53 45
54 #endif 46 #endif
OLDNEW
« no previous file with comments | « Source/core/animation/LengthPropertyFunctions.cpp ('k') | Source/core/animation/LengthStyleInterpolation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698