1 // Copyright 2019 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 THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_CSS_COMPOSITOR_KEYFRAME_COLOR_H_
6 #define THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_CSS_COMPOSITOR_KEYFRAME_COLOR_H_
7 
8 #include "third_party/blink/renderer/core/animation/css/compositor_keyframe_value.h"
9 #include "third_party/blink/renderer/core/core_export.h"
10 #include "third_party/skia/include/core/SkColor.h"
11 
12 namespace blink {
13 
14 class CORE_EXPORT CompositorKeyframeColor final
15     : public CompositorKeyframeValue {
16  public:
CompositorKeyframeColor(SkColor color)17   CompositorKeyframeColor(SkColor color) : color_(color) {}
18   ~CompositorKeyframeColor() override = default;
19 
ToColor()20   SkColor ToColor() const { return color_; }
21 
22  private:
GetType()23   Type GetType() const override { return Type::kColor; }
24 
25   SkColor color_;
26 };
27 
28 template <>
29 struct DowncastTraits<CompositorKeyframeColor> {
30   static bool AllowFrom(const CompositorKeyframeValue& value) {
31     return value.IsColor();
32   }
33 };
34 
35 }  // namespace blink
36 
37 #endif  // THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_CSS_COMPOSITOR_KEYFRAME_COLOR_H_
38