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

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

Issue 2750293003: Delete unused AnimatableValue code (Closed)
Patch Set: Fix unit tests Created 3 years, 9 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 20 matching lines...) Expand all
31 #ifndef AnimatableColor_h 31 #ifndef AnimatableColor_h
32 #define AnimatableColor_h 32 #define AnimatableColor_h
33 33
34 #include "core/CoreExport.h" 34 #include "core/CoreExport.h"
35 #include "core/animation/animatable/AnimatableValue.h" 35 #include "core/animation/animatable/AnimatableValue.h"
36 #include "platform/graphics/Color.h" 36 #include "platform/graphics/Color.h"
37 #include "wtf/Allocator.h" 37 #include "wtf/Allocator.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 class CORE_EXPORT AnimatableColorImpl { 41 class AnimatableColorImpl {
42 DISALLOW_NEW(); 42 DISALLOW_NEW();
43 43
44 public: 44 public:
45 AnimatableColorImpl(float red, float green, float blue, float alpha); 45 AnimatableColorImpl(float red, float green, float blue, float alpha);
46 AnimatableColorImpl(Color); 46 AnimatableColorImpl(Color);
47 Color toColor() const;
48 AnimatableColorImpl interpolateTo(const AnimatableColorImpl&,
49 double fraction) const;
50 bool operator==(const AnimatableColorImpl&) const; 47 bool operator==(const AnimatableColorImpl&) const;
51 48
52 private: 49 private:
53 float m_alpha; 50 float m_alpha;
54 float m_red; 51 float m_red;
55 float m_green; 52 float m_green;
56 float m_blue; 53 float m_blue;
57 }; 54 };
58 55
59 // This class handles both the regular and 'visted link' colors for a given 56 // This class handles both the regular and 'visted link' colors for a given
60 // property. Currently it is used for all properties, even those which do not 57 // property. Currently it is used for all properties, even those which do not
61 // support a separate 'visited link' color (eg SVG properties). This is correct 58 // support a separate 'visited link' color (eg SVG properties). This is correct
62 // but inefficient. 59 // but inefficient.
63 class CORE_EXPORT AnimatableColor final : public AnimatableValue { 60 class AnimatableColor final : public AnimatableValue {
64 public: 61 public:
65 static PassRefPtr<AnimatableColor> create( 62 static PassRefPtr<AnimatableColor> create(
66 const AnimatableColorImpl&, 63 const AnimatableColorImpl&,
67 const AnimatableColorImpl& visitedLinkColor); 64 const AnimatableColorImpl& visitedLinkColor);
68 Color getColor() const { return m_color.toColor(); }
69 Color visitedLinkColor() const { return m_visitedLinkColor.toColor(); }
70
71 protected:
72 PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*,
73 double fraction) const override;
74 65
75 private: 66 private:
76 AnimatableColor(const AnimatableColorImpl& color, 67 AnimatableColor(const AnimatableColorImpl& color,
77 const AnimatableColorImpl& visitedLinkColor) 68 const AnimatableColorImpl& visitedLinkColor)
78 : m_color(color), m_visitedLinkColor(visitedLinkColor) {} 69 : m_color(color), m_visitedLinkColor(visitedLinkColor) {}
79 AnimatableType type() const override { return TypeColor; } 70 AnimatableType type() const override { return TypeColor; }
80 bool equalTo(const AnimatableValue*) const override; 71 bool equalTo(const AnimatableValue*) const override;
81 const AnimatableColorImpl m_color; 72 const AnimatableColorImpl m_color;
82 const AnimatableColorImpl m_visitedLinkColor; 73 const AnimatableColorImpl m_visitedLinkColor;
83 }; 74 };
84 75
85 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableColor, isColor()); 76 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableColor, isColor());
86 77
87 } // namespace blink 78 } // namespace blink
88 79
89 #endif // AnimatableColor_h 80 #endif // AnimatableColor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698