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 CSSInterpolationEnvironment_h |
| 6 #define CSSInterpolationEnvironment_h |
| 7 |
| 8 #include "core/animation/InterpolationEnvironment.h" |
| 9 #include "core/css/resolver/StyleResolverState.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 class ComputedStyle; |
| 14 |
| 15 class CSSInterpolationEnvironment : public InterpolationEnvironment { |
| 16 public: |
| 17 explicit CSSInterpolationEnvironment(const InterpolationTypesMap& map, |
| 18 StyleResolverState& state) |
| 19 : InterpolationEnvironment(map), state_(&state), style_(state.Style()) {} |
| 20 |
| 21 explicit CSSInterpolationEnvironment(const InterpolationTypesMap& map, |
| 22 const ComputedStyle& style) |
| 23 : InterpolationEnvironment(map), style_(&style) {} |
| 24 |
| 25 bool IsCSS() const final { return true; } |
| 26 |
| 27 StyleResolverState& GetState() { |
| 28 DCHECK(state_); |
| 29 return *state_; |
| 30 } |
| 31 const StyleResolverState& GetState() const { |
| 32 DCHECK(state_); |
| 33 return *state_; |
| 34 } |
| 35 |
| 36 const ComputedStyle& Style() const { |
| 37 DCHECK(style_); |
| 38 return *style_; |
| 39 } |
| 40 |
| 41 private: |
| 42 StyleResolverState* state_ = nullptr; |
| 43 const ComputedStyle* style_ = nullptr; |
| 44 }; |
| 45 |
| 46 DEFINE_TYPE_CASTS(CSSInterpolationEnvironment, |
| 47 InterpolationEnvironment, |
| 48 value, |
| 49 value->IsCSS(), |
| 50 value.IsCSS()); |
| 51 |
| 52 } // namespace blink |
| 53 |
| 54 #endif // CSSInterpolationEnvironment_h |
OLD | NEW |