OLD | NEW |
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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 class AnimatableColorImpl { | 39 class AnimatableColorImpl { |
40 public: | 40 public: |
41 AnimatableColorImpl(float red, float green, float blue, float alpha); | 41 AnimatableColorImpl(float red, float green, float blue, float alpha); |
42 AnimatableColorImpl(Color); | 42 AnimatableColorImpl(Color); |
43 Color toColor() const; | 43 Color toColor() const; |
44 AnimatableColorImpl interpolateTo(const AnimatableColorImpl&, double fractio
n) const; | 44 AnimatableColorImpl interpolateTo(const AnimatableColorImpl&, double fractio
n) const; |
45 bool operator==(const AnimatableColorImpl&) const; | 45 bool operator==(const AnimatableColorImpl&) const; |
46 double distanceTo(const AnimatableColorImpl&) const; | |
47 | 46 |
48 private: | 47 private: |
49 float m_alpha; | 48 float m_alpha; |
50 float m_red; | 49 float m_red; |
51 float m_green; | 50 float m_green; |
52 float m_blue; | 51 float m_blue; |
53 }; | 52 }; |
54 | 53 |
55 // This class handles both the regular and 'visted link' colors for a given | 54 // This class handles both the regular and 'visted link' colors for a given |
56 // property. Currently it is used for all properties, even those which do not | 55 // property. Currently it is used for all properties, even those which do not |
(...skipping 11 matching lines...) Expand all Loading... |
68 virtual PassRefPtrWillBeRawPtr<AnimatableValue> interpolateTo(const Animatab
leValue*, double fraction) const override; | 67 virtual PassRefPtrWillBeRawPtr<AnimatableValue> interpolateTo(const Animatab
leValue*, double fraction) const override; |
69 | 68 |
70 private: | 69 private: |
71 AnimatableColor(const AnimatableColorImpl& color, const AnimatableColorImpl&
visitedLinkColor) | 70 AnimatableColor(const AnimatableColorImpl& color, const AnimatableColorImpl&
visitedLinkColor) |
72 : m_color(color) | 71 : m_color(color) |
73 , m_visitedLinkColor(visitedLinkColor) | 72 , m_visitedLinkColor(visitedLinkColor) |
74 { | 73 { |
75 } | 74 } |
76 virtual AnimatableType type() const override { return TypeColor; } | 75 virtual AnimatableType type() const override { return TypeColor; } |
77 virtual bool equalTo(const AnimatableValue*) const override; | 76 virtual bool equalTo(const AnimatableValue*) const override; |
78 virtual double distanceTo(const AnimatableValue*) const override; | |
79 const AnimatableColorImpl m_color; | 77 const AnimatableColorImpl m_color; |
80 const AnimatableColorImpl m_visitedLinkColor; | 78 const AnimatableColorImpl m_visitedLinkColor; |
81 }; | 79 }; |
82 | 80 |
83 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableColor, isColor()); | 81 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableColor, isColor()); |
84 | 82 |
85 } // namespace blink | 83 } // namespace blink |
86 | 84 |
87 #endif // AnimatableColor_h | 85 #endif // AnimatableColor_h |
OLD | NEW |