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

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

Issue 2809063002: WIP Support var() references in registered custom property keyframes (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 2017 The Chromium Authors. All rights reserved. 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 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 CSSInterpolationEnvironment_h 5 #ifndef CSSInterpolationEnvironment_h
6 #define CSSInterpolationEnvironment_h 6 #define CSSInterpolationEnvironment_h
7 7
8 #include "core/animation/InterpolationEnvironment.h" 8 #include "core/animation/InterpolationEnvironment.h"
9 #include "core/css/resolver/StyleResolverState.h" 9 #include "core/css/resolver/StyleResolverState.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 class ComputedStyle; 13 class ComputedStyle;
14 class CSSVariableResolver;
14 15
15 class CSSInterpolationEnvironment : public InterpolationEnvironment { 16 class CSSInterpolationEnvironment : public InterpolationEnvironment {
16 public: 17 public:
17 explicit CSSInterpolationEnvironment(const InterpolationTypesMap& map, 18 explicit CSSInterpolationEnvironment(
18 StyleResolverState& state) 19 const InterpolationTypesMap& map,
19 : InterpolationEnvironment(map), state_(&state), style_(state.Style()) {} 20 StyleResolverState& state,
21 CSSVariableResolver* variable_resolver = nullptr)
22 : InterpolationEnvironment(map),
23 state_(&state),
24 style_(state.Style()),
25 variable_resolver_(variable_resolver) {}
20 26
21 explicit CSSInterpolationEnvironment(const InterpolationTypesMap& map, 27 explicit CSSInterpolationEnvironment(const InterpolationTypesMap& map,
22 const ComputedStyle& style) 28 const ComputedStyle& style)
23 : InterpolationEnvironment(map), style_(&style) {} 29 : InterpolationEnvironment(map), style_(&style) {}
24 30
25 bool IsCSS() const final { return true; } 31 bool IsCSS() const final { return true; }
26 32
27 StyleResolverState& GetState() { 33 StyleResolverState& GetState() {
28 DCHECK(state_); 34 DCHECK(state_);
29 return *state_; 35 return *state_;
30 } 36 }
31 const StyleResolverState& GetState() const { 37 const StyleResolverState& GetState() const {
32 DCHECK(state_); 38 DCHECK(state_);
33 return *state_; 39 return *state_;
34 } 40 }
35 41
36 const ComputedStyle& Style() const { 42 const ComputedStyle& Style() const {
37 DCHECK(style_); 43 DCHECK(style_);
38 return *style_; 44 return *style_;
39 } 45 }
40 46
47 CSSVariableResolver& VariableResolver() const {
48 DCHECK(variable_resolver_);
49 return *variable_resolver_;
50 }
51
41 private: 52 private:
42 StyleResolverState* state_ = nullptr; 53 StyleResolverState* state_ = nullptr;
43 const ComputedStyle* style_ = nullptr; 54 const ComputedStyle* style_ = nullptr;
55 CSSVariableResolver* variable_resolver_ = nullptr;
44 }; 56 };
45 57
46 DEFINE_TYPE_CASTS(CSSInterpolationEnvironment, 58 DEFINE_TYPE_CASTS(CSSInterpolationEnvironment,
47 InterpolationEnvironment, 59 InterpolationEnvironment,
48 value, 60 value,
49 value->IsCSS(), 61 value->IsCSS(),
50 value.IsCSS()); 62 value.IsCSS());
51 63
52 } // namespace blink 64 } // namespace blink
53 65
54 #endif // CSSInterpolationEnvironment_h 66 #endif // CSSInterpolationEnvironment_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698