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

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

Issue 38823002: Web Animations CSS: Support animation of {text,box,-webkit-box}-shadow and fix blur clamping (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: use 0 instead of PassRefPtr<..>() 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
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 bool isImage() const { return type() == TypeImage; } 61 bool isImage() const { return type() == TypeImage; }
62 bool isLength() const { return type() == TypeLength; } 62 bool isLength() const { return type() == TypeLength; }
63 bool isLengthBox() const { return type() == TypeLengthBox; } 63 bool isLengthBox() const { return type() == TypeLengthBox; }
64 bool isLengthBoxAndBool() const { return type() == TypeLengthBoxAndBool; } 64 bool isLengthBoxAndBool() const { return type() == TypeLengthBoxAndBool; }
65 bool isLengthPoint() const { return type() == TypeLengthPoint; } 65 bool isLengthPoint() const { return type() == TypeLengthPoint; }
66 bool isLengthSize() const { return type() == TypeLengthSize; } 66 bool isLengthSize() const { return type() == TypeLengthSize; }
67 bool isNeutral() const { return type() == TypeNeutral; } 67 bool isNeutral() const { return type() == TypeNeutral; }
68 bool isRepeatable() const { return type() == TypeRepeatable; } 68 bool isRepeatable() const { return type() == TypeRepeatable; }
69 bool isSVGLength() const { return type() == TypeSVGLength; } 69 bool isSVGLength() const { return type() == TypeSVGLength; }
70 bool isSVGPaint() const { return type() == TypeSVGPaint; } 70 bool isSVGPaint() const { return type() == TypeSVGPaint; }
71 bool isShadow() const { return type() == TypeShadow; }
71 bool isShapeValue() const { return type() == TypeShapeValue; } 72 bool isShapeValue() const { return type() == TypeShapeValue; }
72 bool isStrokeDasharrayList() const { return type() == TypeStrokeDasharrayLis t; } 73 bool isStrokeDasharrayList() const { return type() == TypeStrokeDasharrayLis t; }
73 bool isTransform() const { return type() == TypeTransform; } 74 bool isTransform() const { return type() == TypeTransform; }
74 bool isUnknown() const { return type() == TypeUnknown; } 75 bool isUnknown() const { return type() == TypeUnknown; }
75 bool isVisibility() const { return type() == TypeVisibility; } 76 bool isVisibility() const { return type() == TypeVisibility; }
76 77
77 bool isSameType(const AnimatableValue* value) const 78 bool isSameType(const AnimatableValue* value) const
78 { 79 {
79 ASSERT(value); 80 ASSERT(value);
80 return value->type() == type(); 81 return value->type() == type();
(...skipping 12 matching lines...) Expand all
93 TypeImage, 94 TypeImage,
94 TypeLength, 95 TypeLength,
95 TypeLengthBox, 96 TypeLengthBox,
96 TypeLengthBoxAndBool, 97 TypeLengthBoxAndBool,
97 TypeLengthPoint, 98 TypeLengthPoint,
98 TypeLengthSize, 99 TypeLengthSize,
99 TypeNeutral, 100 TypeNeutral,
100 TypeRepeatable, 101 TypeRepeatable,
101 TypeSVGLength, 102 TypeSVGLength,
102 TypeSVGPaint, 103 TypeSVGPaint,
104 TypeShadow,
103 TypeShapeValue, 105 TypeShapeValue,
104 TypeStrokeDasharrayList, 106 TypeStrokeDasharrayList,
105 TypeTransform, 107 TypeTransform,
106 TypeUnknown, 108 TypeUnknown,
107 TypeVisibility, 109 TypeVisibility,
108 }; 110 };
109 111
110 virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, do uble fraction) const = 0; 112 virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, do uble fraction) const = 0;
111 static PassRefPtr<AnimatableValue> defaultInterpolateTo(const AnimatableValu e* left, const AnimatableValue* right, double fraction) { return takeConstRef((f raction < 0.5) ? left : right); } 113 static PassRefPtr<AnimatableValue> defaultInterpolateTo(const AnimatableValu e* left, const AnimatableValue* right, double fraction) { return takeConstRef((f raction < 0.5) ? left : right); }
112 114
113 // For noncommutative values read A->addWith(B) to mean the value A with B c omposed onto it. 115 // For noncommutative values read A->addWith(B) to mean the value A with B c omposed onto it.
114 virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const; 116 virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const;
115 static PassRefPtr<AnimatableValue> defaultAddWith(const AnimatableValue* lef t, const AnimatableValue* right) { return takeConstRef(right); } 117 static PassRefPtr<AnimatableValue> defaultAddWith(const AnimatableValue* lef t, const AnimatableValue* right) { return takeConstRef(right); }
116 118
117 template <class T> 119 template <class T>
118 static PassRefPtr<T> takeConstRef(const T* value) { return PassRefPtr<T>(con st_cast<T*>(value)); } 120 static PassRefPtr<T> takeConstRef(const T* value) { return PassRefPtr<T>(con st_cast<T*>(value)); }
119 121
120 private: 122 private:
121 virtual AnimatableType type() const = 0; 123 virtual AnimatableType type() const = 0;
122 // Implementations can assume that the object being compared has the same ty pe as the object this is called on 124 // Implementations can assume that the object being compared has the same ty pe as the object this is called on
123 virtual bool equalTo(const AnimatableValue*) const = 0; 125 virtual bool equalTo(const AnimatableValue*) const = 0;
124 }; 126 };
125 127
126 #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \ 128 #define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \
127 DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, value. predicate) 129 DEFINE_TYPE_CASTS(thisType, AnimatableValue, value, value->predicate, value. predicate)
128 130
129 } // namespace WebCore 131 } // namespace WebCore
130 132
131 #endif // AnimatableValue_h 133 #endif // AnimatableValue_h
OLDNEW
« no previous file with comments | « Source/core/animation/AnimatableShadow.cpp ('k') | Source/core/animation/css/CSSAnimatableValueFactory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698