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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 float m_alpha; | 49 float m_alpha; |
50 float m_red; | 50 float m_red; |
51 float m_green; | 51 float m_green; |
52 float m_blue; | 52 float m_blue; |
53 }; | 53 }; |
54 | 54 |
55 // This class handles both the regular and 'visted link' colors for a given | 55 // 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 | 56 // property. Currently it is used for all properties, even those which do not |
57 // support a separate 'visited link' color (eg SVG properties). This is correct | 57 // support a separate 'visited link' color (eg SVG properties). This is correct |
58 // but inefficient. | 58 // but inefficient. |
59 class AnimatableColor : public AnimatableValue { | 59 class AnimatableColor FINAL : public AnimatableValue { |
60 public: | 60 public: |
61 static PassRefPtr<AnimatableColor> create(const AnimatableColorImpl&, const
AnimatableColorImpl& visitedLinkColor); | 61 static PassRefPtr<AnimatableColor> create(const AnimatableColorImpl&, const
AnimatableColorImpl& visitedLinkColor); |
62 Color color() const { return m_color.toColor(); } | 62 Color color() const { return m_color.toColor(); } |
63 Color visitedLinkColor() const { return m_visitedLinkColor.toColor(); } | 63 Color visitedLinkColor() const { return m_visitedLinkColor.toColor(); } |
64 | 64 |
65 protected: | 65 protected: |
66 virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, do
uble fraction) const OVERRIDE; | 66 virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, do
uble fraction) const OVERRIDE; |
67 virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OV
ERRIDE; | 67 virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OV
ERRIDE; |
68 | 68 |
69 private: | 69 private: |
70 AnimatableColor(const AnimatableColorImpl& color, const AnimatableColorImpl&
visitedLinkColor) | 70 AnimatableColor(const AnimatableColorImpl& color, const AnimatableColorImpl&
visitedLinkColor) |
71 : m_color(color) | 71 : m_color(color) |
72 , m_visitedLinkColor(visitedLinkColor) | 72 , m_visitedLinkColor(visitedLinkColor) |
73 { | 73 { |
74 } | 74 } |
75 virtual AnimatableType type() const OVERRIDE { return TypeColor; } | 75 virtual AnimatableType type() const OVERRIDE { return TypeColor; } |
76 virtual bool equalTo(const AnimatableValue*) const OVERRIDE; | 76 virtual bool equalTo(const AnimatableValue*) const OVERRIDE; |
77 const AnimatableColorImpl m_color; | 77 const AnimatableColorImpl m_color; |
78 const AnimatableColorImpl m_visitedLinkColor; | 78 const AnimatableColorImpl m_visitedLinkColor; |
79 }; | 79 }; |
80 | 80 |
81 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableColor, isColor()); | 81 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableColor, isColor()); |
82 | 82 |
83 } // namespace WebCore | 83 } // namespace WebCore |
84 | 84 |
85 #endif // AnimatableColor_h | 85 #endif // AnimatableColor_h |
OLD | NEW |