OLD | NEW |
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 #ifndef InterpolationEnvironment_h | 5 #ifndef InterpolationEnvironment_h |
6 #define InterpolationEnvironment_h | 6 #define InterpolationEnvironment_h |
7 | 7 |
8 #include "core/animation/InterpolationTypesMap.h" | |
9 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
10 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
11 | 10 |
12 namespace blink { | 11 namespace blink { |
13 | 12 |
14 class StyleResolverState; | 13 class StyleResolverState; |
15 class SVGPropertyBase; | 14 class SVGPropertyBase; |
16 class SVGElement; | 15 class SVGElement; |
17 | 16 |
18 class InterpolationEnvironment { | 17 class InterpolationEnvironment { |
19 STACK_ALLOCATED(); | 18 STACK_ALLOCATED(); |
20 | 19 |
21 public: | 20 public: |
22 explicit InterpolationEnvironment(const InterpolationTypesMap& map, | 21 explicit InterpolationEnvironment(StyleResolverState& state) |
23 StyleResolverState& state) | 22 : m_state(&state), m_svgElement(nullptr), m_svgBaseValue(nullptr) {} |
24 : m_interpolationTypesMap(map), | |
25 m_state(&state), | |
26 m_svgElement(nullptr), | |
27 m_svgBaseValue(nullptr) {} | |
28 | 23 |
29 explicit InterpolationEnvironment(const InterpolationTypesMap& map, | 24 explicit InterpolationEnvironment(SVGElement& svgElement, |
30 SVGElement& svgElement, | |
31 const SVGPropertyBase& svgBaseValue) | 25 const SVGPropertyBase& svgBaseValue) |
32 : m_interpolationTypesMap(map), | 26 : m_state(nullptr), |
33 m_state(nullptr), | |
34 m_svgElement(&svgElement), | 27 m_svgElement(&svgElement), |
35 m_svgBaseValue(&svgBaseValue) {} | 28 m_svgBaseValue(&svgBaseValue) {} |
36 | 29 |
37 const InterpolationTypesMap& interpolationTypesMap() const { | |
38 return m_interpolationTypesMap; | |
39 } | |
40 | |
41 StyleResolverState& state() { | 30 StyleResolverState& state() { |
42 DCHECK(m_state); | 31 DCHECK(m_state); |
43 return *m_state; | 32 return *m_state; |
44 } | 33 } |
45 const StyleResolverState& state() const { | 34 const StyleResolverState& state() const { |
46 DCHECK(m_state); | 35 DCHECK(m_state); |
47 return *m_state; | 36 return *m_state; |
48 } | 37 } |
49 | 38 |
50 SVGElement& svgElement() { | 39 SVGElement& svgElement() { |
51 DCHECK(m_svgElement); | 40 DCHECK(m_svgElement); |
52 return *m_svgElement; | 41 return *m_svgElement; |
53 } | 42 } |
54 const SVGElement& svgElement() const { | 43 const SVGElement& svgElement() const { |
55 DCHECK(m_svgElement); | 44 DCHECK(m_svgElement); |
56 return *m_svgElement; | 45 return *m_svgElement; |
57 } | 46 } |
58 | 47 |
59 const SVGPropertyBase& svgBaseValue() const { | 48 const SVGPropertyBase& svgBaseValue() const { |
60 DCHECK(m_svgBaseValue); | 49 DCHECK(m_svgBaseValue); |
61 return *m_svgBaseValue; | 50 return *m_svgBaseValue; |
62 } | 51 } |
63 | 52 |
64 private: | 53 private: |
65 const InterpolationTypesMap& m_interpolationTypesMap; | |
66 StyleResolverState* m_state; | 54 StyleResolverState* m_state; |
67 Member<SVGElement> m_svgElement; | 55 Member<SVGElement> m_svgElement; |
68 Member<const SVGPropertyBase> m_svgBaseValue; | 56 Member<const SVGPropertyBase> m_svgBaseValue; |
69 }; | 57 }; |
70 | 58 |
71 } // namespace blink | 59 } // namespace blink |
72 | 60 |
73 #endif // InterpolationEnvironment_h | 61 #endif // InterpolationEnvironment_h |
OLD | NEW |