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 "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
| 13 class ComputedStyle; |
13 class StyleResolverState; | 14 class StyleResolverState; |
14 class SVGPropertyBase; | 15 class SVGPropertyBase; |
15 class SVGElement; | 16 class SVGElement; |
16 | 17 |
17 class InterpolationEnvironment { | 18 class InterpolationEnvironment { |
18 STACK_ALLOCATED(); | 19 STACK_ALLOCATED(); |
19 public: | 20 public: |
20 explicit InterpolationEnvironment(StyleResolverState& state) | 21 explicit InterpolationEnvironment(const ComputedStyle& style) |
21 : m_state(&state) | 22 : m_state(nullptr) |
| 23 , m_style(&style) |
22 , m_svgElement(nullptr) | 24 , m_svgElement(nullptr) |
23 , m_svgBaseValue(nullptr) | 25 , m_svgBaseValue(nullptr) |
24 { } | 26 { } |
25 | 27 |
| 28 explicit InterpolationEnvironment(StyleResolverState&); |
| 29 |
26 explicit InterpolationEnvironment(SVGElement& svgElement, const SVGPropertyB
ase& svgBaseValue) | 30 explicit InterpolationEnvironment(SVGElement& svgElement, const SVGPropertyB
ase& svgBaseValue) |
27 : m_state(nullptr) | 31 : m_state(nullptr) |
| 32 , m_style(nullptr) |
28 , m_svgElement(&svgElement) | 33 , m_svgElement(&svgElement) |
29 , m_svgBaseValue(&svgBaseValue) | 34 , m_svgBaseValue(&svgBaseValue) |
30 { } | 35 { } |
31 | 36 |
32 StyleResolverState& state() { ASSERT(m_state); return *m_state; } | 37 StyleResolverState& state() { DCHECK(m_state); return *m_state; } |
33 const StyleResolverState& state() const { ASSERT(m_state); return *m_state;
} | 38 const StyleResolverState& state() const { DCHECK(m_state); return *m_state;
} |
34 | 39 |
35 SVGElement& svgElement() { ASSERT(m_svgElement); return *m_svgElement; } | 40 ComputedStyle& style(); |
36 const SVGElement& svgElement() const { ASSERT(m_svgElement); return *m_svgEl
ement; } | 41 const ComputedStyle& style() const { DCHECK(m_style); return *m_style; } |
37 | 42 |
38 const SVGPropertyBase& svgBaseValue() const { ASSERT(m_svgBaseValue); return
*m_svgBaseValue; } | 43 SVGElement& svgElement() { DCHECK(m_svgElement); return *m_svgElement; } |
| 44 const SVGElement& svgElement() const { DCHECK(m_svgElement); return *m_svgEl
ement; } |
| 45 |
| 46 const SVGPropertyBase& svgBaseValue() const { DCHECK(m_svgBaseValue); return
*m_svgBaseValue; } |
39 | 47 |
40 private: | 48 private: |
41 StyleResolverState* m_state; | 49 StyleResolverState* m_state; |
| 50 const ComputedStyle* m_style; |
42 Member<SVGElement> m_svgElement; | 51 Member<SVGElement> m_svgElement; |
43 Member<const SVGPropertyBase> m_svgBaseValue; | 52 Member<const SVGPropertyBase> m_svgBaseValue; |
44 }; | 53 }; |
45 | 54 |
46 } // namespace blink | 55 } // namespace blink |
47 | 56 |
48 #endif // InterpolationEnvironment_h | 57 #endif // InterpolationEnvironment_h |
OLD | NEW |