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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class CORE_EXPORT AnimatableLength final : public AnimatableValue { | 40 class CORE_EXPORT AnimatableLength final : public AnimatableValue { |
41 public: | 41 public: |
42 static PassRefPtr<AnimatableLength> create(const Length& length, float zoom) { | 42 static PassRefPtr<AnimatableLength> create(const Length& length, float zoom) { |
43 return adoptRef(new AnimatableLength(length, zoom)); | 43 return adoptRef(new AnimatableLength(length, zoom)); |
44 } | 44 } |
45 Length getLength(float zoom, ValueRange) const; | 45 Length getLength(float zoom, ValueRange) const; |
46 | 46 |
47 bool hasSameUnits(const AnimatableLength* other) const { | |
48 return m_hasPixels == other->m_hasPixels && | |
49 m_hasPercent == other->m_hasPercent; | |
50 } | |
51 | |
52 protected: | |
53 PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, | |
54 double fraction) const override; | |
55 | |
56 private: | 47 private: |
57 static PassRefPtr<AnimatableLength> create(double pixels, | |
58 double percent, | |
59 bool hasPixels, | |
60 bool hasPercent) { | |
61 return adoptRef( | |
62 new AnimatableLength(pixels, percent, hasPixels, hasPercent)); | |
63 } | |
64 AnimatableLength(const Length&, float zoom); | 48 AnimatableLength(const Length&, float zoom); |
65 AnimatableLength(double pixels, | |
66 double percent, | |
67 bool hasPixels, | |
68 bool hasPercent) | |
69 : m_pixels(pixels), | |
70 m_percent(percent), | |
71 m_hasPixels(hasPixels), | |
72 m_hasPercent(hasPercent) { | |
73 DCHECK(m_hasPixels || m_hasPercent); | |
74 } | |
75 AnimatableType type() const override { return TypeLength; } | 49 AnimatableType type() const override { return TypeLength; } |
76 bool equalTo(const AnimatableValue*) const override; | 50 bool equalTo(const AnimatableValue*) const override; |
77 | 51 |
78 double m_pixels; | 52 double m_pixels; |
79 double m_percent; | 53 double m_percent; |
80 bool m_hasPixels; | 54 bool m_hasPixels; |
81 bool m_hasPercent; | 55 bool m_hasPercent; |
82 }; | 56 }; |
83 | 57 |
84 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableLength, isLength()); | 58 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableLength, isLength()); |
85 | 59 |
86 } // namespace blink | 60 } // namespace blink |
87 | 61 |
88 #endif // AnimatableLength_h | 62 #endif // AnimatableLength_h |
OLD | NEW |