Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: Source/core/animation/AnimatableValue.h

Issue 26292004: Web Animations CSS: Support animation of stroke-dasharray property (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 bool isClipPathOperation() const { return type() == TypeClipPathOperation; } 54 bool isClipPathOperation() const { return type() == TypeClipPathOperation; }
55 bool isColor() const { return type() == TypeColor; } 55 bool isColor() const { return type() == TypeColor; }
56 bool isDouble() const { return type() == TypeDouble; } 56 bool isDouble() const { return type() == TypeDouble; }
57 bool isImage() const { return type() == TypeImage; } 57 bool isImage() const { return type() == TypeImage; }
58 bool isLength() const { return type() == TypeLength; } 58 bool isLength() const { return type() == TypeLength; }
59 bool isLengthBox() const { return type() == TypeLengthBox; } 59 bool isLengthBox() const { return type() == TypeLengthBox; }
60 bool isLengthSize() const { return type() == TypeLengthSize; } 60 bool isLengthSize() const { return type() == TypeLengthSize; }
61 bool isNeutral() const { return type() == TypeNeutral; } 61 bool isNeutral() const { return type() == TypeNeutral; }
62 bool isRepeatable() const { return type() == TypeRepeatable; } 62 bool isRepeatable() const { return type() == TypeRepeatable; }
63 bool isSVGLength() const { return type() == TypeSVGLength; } 63 bool isSVGLength() const { return type() == TypeSVGLength; }
64 bool isSVGPaint() const { return type() == TypeSVGPaint; }
64 bool isShapeValue() const { return type() == TypeShapeValue; } 65 bool isShapeValue() const { return type() == TypeShapeValue; }
65 bool isSVGPaint() const { return type() == TypeSVGPaint; } 66 bool isStrokeDasharrayList() const { return type() == TypeStrokeDasharrayLis t; }
66 bool isTransform() const { return type() == TypeTransform; } 67 bool isTransform() const { return type() == TypeTransform; }
67 bool isUnknown() const { return type() == TypeUnknown; } 68 bool isUnknown() const { return type() == TypeUnknown; }
68 bool isVisibility() const { return type() == TypeVisibility; } 69 bool isVisibility() const { return type() == TypeVisibility; }
69 70
70 bool isSameType(const AnimatableValue* value) const 71 bool isSameType(const AnimatableValue* value) const
71 { 72 {
72 ASSERT(value); 73 ASSERT(value);
73 return value->type() == type(); 74 return value->type() == type();
74 } 75 }
75 76
76 protected: 77 protected:
77 enum AnimatableType { 78 enum AnimatableType {
78 TypeClipPathOperation, 79 TypeClipPathOperation,
79 TypeColor, 80 TypeColor,
80 TypeDouble, 81 TypeDouble,
81 TypeImage, 82 TypeImage,
82 TypeLength, 83 TypeLength,
83 TypeLengthBox, 84 TypeLengthBox,
84 TypeLengthSize, 85 TypeLengthSize,
85 TypeNeutral, 86 TypeNeutral,
86 TypeRepeatable, 87 TypeRepeatable,
87 TypeSVGLength, 88 TypeSVGLength,
89 TypeSVGPaint,
88 TypeShapeValue, 90 TypeShapeValue,
89 TypeSVGPaint, 91 TypeStrokeDasharrayList,
90 TypeTransform, 92 TypeTransform,
91 TypeUnknown, 93 TypeUnknown,
92 TypeVisibility, 94 TypeVisibility,
93 }; 95 };
94 96
95 virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, do uble fraction) const = 0; 97 virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, do uble fraction) const = 0;
96 static PassRefPtr<AnimatableValue> defaultInterpolateTo(const AnimatableValu e* left, const AnimatableValue* right, double fraction) { return takeConstRef((f raction < 0.5) ? left : right); } 98 static PassRefPtr<AnimatableValue> defaultInterpolateTo(const AnimatableValu e* left, const AnimatableValue* right, double fraction) { return takeConstRef((f raction < 0.5) ? left : right); }
97 99
98 // For noncommutative values read A->addWith(B) to mean the value A with B c omposed onto it. 100 // For noncommutative values read A->addWith(B) to mean the value A with B c omposed onto it.
99 virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const; 101 virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const;
100 static PassRefPtr<AnimatableValue> defaultAddWith(const AnimatableValue* lef t, const AnimatableValue* right) { return takeConstRef(right); } 102 static PassRefPtr<AnimatableValue> defaultAddWith(const AnimatableValue* lef t, const AnimatableValue* right) { return takeConstRef(right); }
101 103
102 template <class T> 104 template <class T>
103 static PassRefPtr<T> takeConstRef(const T* value) { return PassRefPtr<T>(con st_cast<T*>(value)); } 105 static PassRefPtr<T> takeConstRef(const T* value) { return PassRefPtr<T>(con st_cast<T*>(value)); }
104 106
105 private: 107 private:
106 virtual AnimatableType type() const = 0; 108 virtual AnimatableType type() const = 0;
107 // Implementations can assume that the object being compared has the same ty pe as the object this is called on 109 // Implementations can assume that the object being compared has the same ty pe as the object this is called on
108 virtual bool equalTo(const AnimatableValue*) const = 0; 110 virtual bool equalTo(const AnimatableValue*) const = 0;
109 }; 111 };
110 112
111 } // namespace WebCore 113 } // namespace WebCore
112 114
113 #endif // AnimatableValue_h 115 #endif // AnimatableValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698