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