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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #ifndef AnimatableStrokeDasharrayList_h | 31 #ifndef AnimatableStrokeDasharrayList_h |
32 #define AnimatableStrokeDasharrayList_h | 32 #define AnimatableStrokeDasharrayList_h |
33 | 33 |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
35 #include "core/animation/animatable/AnimatableRepeatable.h" | 35 #include "core/animation/animatable/AnimatableRepeatable.h" |
36 #include "core/style/SVGComputedStyleDefs.h" | 36 #include "core/style/SVGComputedStyleDefs.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class CORE_EXPORT AnimatableStrokeDasharrayList final | 40 class AnimatableStrokeDasharrayList final : public AnimatableRepeatable { |
41 : public AnimatableRepeatable { | |
42 public: | 41 public: |
43 ~AnimatableStrokeDasharrayList() override {} | 42 ~AnimatableStrokeDasharrayList() override {} |
44 | 43 |
45 static PassRefPtr<AnimatableStrokeDasharrayList> create( | 44 static PassRefPtr<AnimatableStrokeDasharrayList> create( |
46 PassRefPtr<SVGDashArray> lengths, | 45 PassRefPtr<SVGDashArray> lengths, |
47 float zoom) { | 46 float zoom) { |
48 return adoptRef( | 47 return adoptRef( |
49 new AnimatableStrokeDasharrayList(std::move(lengths), zoom)); | 48 new AnimatableStrokeDasharrayList(std::move(lengths), zoom)); |
50 } | 49 } |
51 | 50 |
52 PassRefPtr<SVGDashArray> toSVGDashArray(float zoom) const; | |
53 | |
54 protected: | |
55 PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, | |
56 double fraction) const override; | |
57 bool usesDefaultInterpolationWith(const AnimatableValue*) const override; | |
58 | |
59 private: | 51 private: |
60 AnimatableStrokeDasharrayList(PassRefPtr<SVGDashArray>, float zoom); | 52 AnimatableStrokeDasharrayList(PassRefPtr<SVGDashArray> lengths, float zoom) { |
61 // This will consume the vector passed into it. | 53 for (const Length& dashLength : lengths->vector()) |
62 AnimatableStrokeDasharrayList(Vector<RefPtr<AnimatableValue>>& values) | 54 m_values.push_back(AnimatableLength::create(dashLength, zoom)); |
63 : AnimatableRepeatable(values) {} | 55 } |
64 | 56 |
65 AnimatableType type() const override { return TypeStrokeDasharrayList; } | 57 AnimatableType type() const override { return TypeStrokeDasharrayList; } |
66 }; | 58 }; |
67 | 59 |
68 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableStrokeDasharrayList, | 60 DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(AnimatableStrokeDasharrayList, |
69 isStrokeDasharrayList()); | 61 isStrokeDasharrayList()); |
70 | 62 |
71 } // namespace blink | 63 } // namespace blink |
72 | 64 |
73 #endif // AnimatableStrokeDasharrayList_h | 65 #endif // AnimatableStrokeDasharrayList_h |
OLD | NEW |