| 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 21 matching lines...) Expand all Loading... |
| 32 #define AnimatableLength_h | 32 #define AnimatableLength_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/Length.h" | 36 #include "platform/Length.h" |
| 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 PassRefPtrWillBeRawPtr<AnimatableLength> create(const Length& length,
float zoom) | 42 static PassRefPtr<AnimatableLength> create(const Length& length, float zoom) |
| 43 { | 43 { |
| 44 return adoptRefWillBeNoop(new AnimatableLength(length, zoom)); | 44 return adoptRef(new AnimatableLength(length, zoom)); |
| 45 } | 45 } |
| 46 Length length(float zoom, ValueRange) const; | 46 Length length(float zoom, ValueRange) const; |
| 47 | 47 |
| 48 bool hasSameUnits(const AnimatableLength* other) const | 48 bool hasSameUnits(const AnimatableLength* other) const |
| 49 { | 49 { |
| 50 return m_hasPixels == other->m_hasPixels && m_hasPercent == other->m_has
Percent; | 50 return m_hasPixels == other->m_hasPixels && m_hasPercent == other->m_has
Percent; |
| 51 } | 51 } |
| 52 | 52 |
| 53 DEFINE_INLINE_VIRTUAL_TRACE() { AnimatableValue::trace(visitor); } | |
| 54 | |
| 55 protected: | 53 protected: |
| 56 PassRefPtrWillBeRawPtr<AnimatableValue> interpolateTo(const AnimatableValue*
, double fraction) const override; | 54 PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fra
ction) const override; |
| 57 | 55 |
| 58 private: | 56 private: |
| 59 static PassRefPtrWillBeRawPtr<AnimatableLength> create(double pixels, double
percent, bool hasPixels, bool hasPercent) | 57 static PassRefPtr<AnimatableLength> create(double pixels, double percent, bo
ol hasPixels, bool hasPercent) |
| 60 { | 58 { |
| 61 return adoptRefWillBeNoop(new AnimatableLength(pixels, percent, hasPixel
s, hasPercent)); | 59 return adoptRef(new AnimatableLength(pixels, percent, hasPixels, hasPerc
ent)); |
| 62 } | 60 } |
| 63 AnimatableLength(const Length&, float zoom); | 61 AnimatableLength(const Length&, float zoom); |
| 64 AnimatableLength(double pixels, double percent, bool hasPixels, bool hasPerc
ent) | 62 AnimatableLength(double pixels, double percent, bool hasPixels, bool hasPerc
ent) |
| 65 : m_pixels(pixels) | 63 : m_pixels(pixels) |
| 66 , m_percent(percent) | 64 , m_percent(percent) |
| 67 , m_hasPixels(hasPixels) | 65 , m_hasPixels(hasPixels) |
| 68 , m_hasPercent(hasPercent) | 66 , m_hasPercent(hasPercent) |
| 69 { | 67 { |
| 70 ASSERT(m_hasPixels || m_hasPercent); | 68 ASSERT(m_hasPixels || m_hasPercent); |
| 71 } | 69 } |
| 72 AnimatableType type() const override { return TypeLength; } | 70 AnimatableType type() const override { return TypeLength; } |
| 73 bool equalTo(const AnimatableValue*) const override; | 71 bool equalTo(const AnimatableValue*) const override; |
| 74 | 72 |
| 75 double m_pixels; | 73 double m_pixels; |
| 76 double m_percent; | 74 double m_percent; |
| 77 bool m_hasPixels; | 75 bool m_hasPixels; |
| 78 bool m_hasPercent; | 76 bool m_hasPercent; |
| 79 }; | 77 }; |
| 80 | 78 |
| 81 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableLength, isLength()); | 79 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableLength, isLength()); |
| 82 | 80 |
| 83 } // namespace blink | 81 } // namespace blink |
| 84 | 82 |
| 85 #endif // AnimatableLength_h | 83 #endif // AnimatableLength_h |
| OLD | NEW |