OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SVGInterpolationEnvironment_h |
| 6 #define SVGInterpolationEnvironment_h |
| 7 |
| 8 #include "core/animation/InterpolationEnvironment.h" |
| 9 #include "platform/wtf/Assertions.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 class SVGPropertyBase; |
| 14 class SVGElement; |
| 15 |
| 16 class SVGInterpolationEnvironment : public InterpolationEnvironment { |
| 17 public: |
| 18 explicit SVGInterpolationEnvironment(const InterpolationTypesMap& map, |
| 19 SVGElement& svg_element, |
| 20 const SVGPropertyBase& svg_base_value) |
| 21 : InterpolationEnvironment(map), |
| 22 svg_element_(&svg_element), |
| 23 svg_base_value_(&svg_base_value) {} |
| 24 |
| 25 bool IsSVG() const final { return true; } |
| 26 |
| 27 SVGElement& SvgElement() { |
| 28 DCHECK(svg_element_); |
| 29 return *svg_element_; |
| 30 } |
| 31 const SVGElement& SvgElement() const { |
| 32 DCHECK(svg_element_); |
| 33 return *svg_element_; |
| 34 } |
| 35 |
| 36 const SVGPropertyBase& SvgBaseValue() const { |
| 37 DCHECK(svg_base_value_); |
| 38 return *svg_base_value_; |
| 39 } |
| 40 |
| 41 private: |
| 42 Member<SVGElement> svg_element_ = nullptr; |
| 43 Member<const SVGPropertyBase> svg_base_value_ = nullptr; |
| 44 }; |
| 45 |
| 46 DEFINE_TYPE_CASTS(SVGInterpolationEnvironment, |
| 47 InterpolationEnvironment, |
| 48 value, |
| 49 value->IsSVG(), |
| 50 value.IsSVG()); |
| 51 |
| 52 } // namespace blink |
| 53 |
| 54 #endif // SVGInterpolationEnvironment_h |
OLD | NEW |