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

Side by Side Diff: third_party/WebKit/Source/core/animation/InterpolationEnvironment.h

Issue 2811253003: Make InterpolationEnvironment virutal (Closed)
Patch Set: Rebased Created 3 years, 6 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
OLDNEW
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"
10 #include "platform/heap/Handle.h"
11 #include "platform/wtf/Allocator.h" 9 #include "platform/wtf/Allocator.h"
12 10
13 namespace blink { 11 namespace blink {
14 12
15 class ComputedStyle;
16 class SVGPropertyBase;
17 class SVGElement;
18
19 class InterpolationEnvironment { 13 class InterpolationEnvironment {
20 STACK_ALLOCATED(); 14 STACK_ALLOCATED();
15 public:
16 virtual ~InterpolationEnvironment() {}
Eric Willigers 2017/05/26 01:37:03 Could be protected.
alancutter (OOO until 2018) 2017/05/26 01:42:09 Done.
21 17
22 public: 18 virtual bool IsCSS() const { return false; }
23 explicit InterpolationEnvironment(const InterpolationTypesMap& map, 19 virtual bool IsSVG() const { return false; }
24 StyleResolverState& state)
25 : interpolation_types_map_(map), state_(&state), style_(state.Style()) {}
26
27 explicit InterpolationEnvironment(const InterpolationTypesMap& map,
28 const ComputedStyle& style)
29 : interpolation_types_map_(map), style_(&style) {}
30
31 explicit InterpolationEnvironment(const InterpolationTypesMap& map,
32 SVGElement& svg_element,
33 const SVGPropertyBase& svg_base_value)
34 : interpolation_types_map_(map),
35 svg_element_(&svg_element),
36 svg_base_value_(&svg_base_value) {}
37 20
38 const InterpolationTypesMap& GetInterpolationTypesMap() const { 21 const InterpolationTypesMap& GetInterpolationTypesMap() const {
39 return interpolation_types_map_; 22 return interpolation_types_map_;
40 } 23 }
41 24
42 StyleResolverState& GetState() { 25 protected:
43 DCHECK(state_); 26 InterpolationEnvironment(const InterpolationTypesMap& map)
Eric Willigers 2017/05/26 01:34:17 explicit
alancutter (OOO until 2018) 2017/05/26 01:42:09 Done.
44 return *state_; 27 : interpolation_types_map_(map) {}
45 }
46 const StyleResolverState& GetState() const {
47 DCHECK(state_);
48 return *state_;
49 }
50
51 const ComputedStyle& Style() const {
52 DCHECK(style_);
53 return *style_;
54 }
55
56 SVGElement& SvgElement() {
57 DCHECK(svg_element_);
58 return *svg_element_;
59 }
60 const SVGElement& SvgElement() const {
61 DCHECK(svg_element_);
62 return *svg_element_;
63 }
64
65 const SVGPropertyBase& SvgBaseValue() const {
66 DCHECK(svg_base_value_);
67 return *svg_base_value_;
68 }
69 28
70 private: 29 private:
71 const InterpolationTypesMap& interpolation_types_map_; 30 const InterpolationTypesMap& interpolation_types_map_;
72
73 // CSSInterpolationType environment
74 StyleResolverState* state_ = nullptr;
75 const ComputedStyle* style_ = nullptr;
76
77 // SVGInterpolationType environment
78 Member<SVGElement> svg_element_ = nullptr;
79 Member<const SVGPropertyBase> svg_base_value_ = nullptr;
80 }; 31 };
81 32
82 } // namespace blink 33 } // namespace blink
83 34
84 #endif // InterpolationEnvironment_h 35 #endif // InterpolationEnvironment_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698