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

Side by Side Diff: Source/core/frame/animation/CSSPropertyAnimation.cpp

Issue 139273007: Web Animations: Remove legacy animations engine. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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) 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 3 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "core/rendering/style/RenderStyle.h" 43 #include "core/rendering/style/RenderStyle.h"
44 #include "core/rendering/style/ShadowList.h" 44 #include "core/rendering/style/ShadowList.h"
45 #include "core/rendering/style/StyleFetchedImage.h" 45 #include "core/rendering/style/StyleFetchedImage.h"
46 #include "core/rendering/style/StyleGeneratedImage.h" 46 #include "core/rendering/style/StyleGeneratedImage.h"
47 #include "platform/FloatConversion.h" 47 #include "platform/FloatConversion.h"
48 #include "wtf/Noncopyable.h" 48 #include "wtf/Noncopyable.h"
49 49
50 namespace WebCore { 50 namespace WebCore {
51 51
52 template <typename T> 52 template <typename T>
53 static inline T blendFunc(const AnimationBase*, T from, T to, double progress)
54 {
55 return blend(from, to, progress);
56 }
57
58 static inline float blendFunc(const AnimationBase*, float from, float to, double progress)
59 {
60 return narrowPrecisionToFloat(from + (to - from) * progress);
61 }
62
63 static inline Color blendFunc(const AnimationBase*, const Color& from, const Col or& to, double progress)
64 {
65 return blend(from, to, progress);
66 }
67
68 static inline Length blendFunc(const AnimationBase*, const Length& from, const L ength& to, double progress)
69 {
70 return to.blend(from, progress, ValueRangeAll);
71 }
72
73 static inline BorderImageLength blendFunc(const AnimationBase* anim, const Borde rImageLength& from, const BorderImageLength& to, double progress)
74 {
75 if (from.isNumber() && to.isNumber())
76 return BorderImageLength(blendFunc(anim, from.number(), to.number(), pro gress));
77
78 if (from.isLength() && to.isLength())
79 return BorderImageLength(blendFunc(anim, from.length(), to.length(), pro gress));
80
81 // FIXME: Converting numbers to lengths using the computed border
82 // width would make it possible to interpolate between numbers and
83 // lengths.
84 // https://code.google.com/p/chromium/issues/detail?id=316164
85 return to;
86 }
87
88 static inline BorderImageLengthBox blendFunc(const AnimationBase* anim, const Bo rderImageLengthBox& from,
89 const BorderImageLengthBox& to, double progress)
90 {
91 return BorderImageLengthBox(blendFunc(anim, from.top(), to.top(), progress),
92 blendFunc(anim, from.right(), to.right(), progress),
93 blendFunc(anim, from.bottom(), to.bottom(), progress),
94 blendFunc(anim, from.left(), to.left(), progress));
95 }
96
97 static inline LengthSize blendFunc(const AnimationBase* anim, const LengthSize& from, const LengthSize& to, double progress)
98 {
99 return LengthSize(blendFunc(anim, from.width(), to.width(), progress),
100 blendFunc(anim, from.height(), to.height(), progress));
101 }
102
103 static inline LengthPoint blendFunc(const AnimationBase* anim, const LengthPoint & from, const LengthPoint& to, double progress)
104 {
105 return LengthPoint(blendFunc(anim, from.x(), to.x(), progress), blendFunc(an im, from.y(), to.y(), progress));
106 }
107
108 static inline TransformOperations blendFunc(const AnimationBase* anim, const Tra nsformOperations& from, const TransformOperations& to, double progress)
109 {
110 if (anim->isTransformFunctionListValid())
111 return to.blendByMatchingOperations(from, progress);
112 return to.blendByUsingMatrixInterpolation(from, progress);
113 }
114
115 static inline PassRefPtr<ClipPathOperation> blendFunc(const AnimationBase*, Clip PathOperation* from, ClipPathOperation* to, double progress)
116 {
117 // Other clip-path operations than BasicShapes can not be animated.
118 if (!from || !to || from->type() != ClipPathOperation::SHAPE || to->type() ! = ClipPathOperation::SHAPE)
119 return to;
120
121 const BasicShape* fromShape = toShapeClipPathOperation(from)->basicShape();
122 const BasicShape* toShape = toShapeClipPathOperation(to)->basicShape();
123
124 if (!fromShape->canBlend(toShape))
125 return to;
126
127 return ShapeClipPathOperation::create(toShape->blend(fromShape, progress));
128 }
129
130 static inline PassRefPtr<ShapeValue> blendFunc(const AnimationBase*, ShapeValue* from, ShapeValue* to, double progress)
131 {
132 // FIXME Bug 102723: Shape-inside should be able to animate a value of 'outs ide-shape' when shape-outside is set to a BasicShape
133 if (!from || !to || from->type() != ShapeValue::Shape || to->type() != Shape Value::Shape)
134 return to;
135
136 const BasicShape* fromShape = from->shape();
137 const BasicShape* toShape = to->shape();
138
139 if (!fromShape->canBlend(toShape))
140 return to;
141
142 return ShapeValue::createShapeValue(toShape->blend(fromShape, progress));
143 }
144
145 static inline FilterOperations blendFunc(const AnimationBase* anim, const Filter Operations& from, const FilterOperations& to, double progress)
146 {
147 FilterOperations result;
148
149 // If we have a filter function list, use that to do a per-function animatio n.
150 if (anim->filterFunctionListsMatch()) {
151 size_t fromSize = from.operations().size();
152 size_t toSize = to.operations().size();
153 size_t size = max(fromSize, toSize);
154 for (size_t i = 0; i < size; i++) {
155 const FilterOperation* fromOp = (i < fromSize) ? from.operations()[i ].get() : 0;
156 const FilterOperation* toOp = (i < toSize) ? to.operations()[i].get( ) : 0;
157 RefPtr<FilterOperation> blendedOp = FilterOperation::blend(fromOp, t oOp, progress);
158 if (blendedOp)
159 result.operations().append(blendedOp);
160 else
161 ASSERT_NOT_REACHED();
162 }
163 } else {
164 // If the filter function lists don't match, we could try to cross-fade, but don't yet have a way to represent that in CSS.
165 // For now we'll just fail to animate.
166 result = to;
167 }
168
169 return result;
170 }
171
172 static inline EVisibility blendFunc(const AnimationBase* anim, EVisibility from, EVisibility to, double progress)
173 {
174 // Any non-zero result means we consider the object to be visible. Only at 0 do we consider the object to be
175 // invisible. The invisible value we use (HIDDEN vs. COLLAPSE) depends on th e specified from/to values.
176 double fromVal = from == VISIBLE ? 1. : 0.;
177 double toVal = to == VISIBLE ? 1. : 0.;
178 if (fromVal == toVal)
179 return to;
180 double result = blendFunc(anim, fromVal, toVal, progress);
181 return result > 0. ? VISIBLE : (to != VISIBLE ? to : from);
182 }
183
184 static inline LengthBox blendFunc(const AnimationBase* anim, const LengthBox& fr om, const LengthBox& to, double progress)
185 {
186 // Length types have to match to animate
187 if (from.top().type() != to.top().type()
188 || from.right().type() != to.right().type()
189 || from.bottom().type() != to.bottom().type()
190 || from.left().type() != to.left().type())
191 return to;
192
193 LengthBox result(blendFunc(anim, from.top(), to.top(), progress),
194 blendFunc(anim, from.right(), to.right(), progress),
195 blendFunc(anim, from.bottom(), to.bottom(), progress),
196 blendFunc(anim, from.left(), to.left(), progress));
197 return result;
198 }
199
200 static inline PassRefPtr<SVGLength> blendFunc(const AnimationBase*, PassRefPtr<S VGLength> from, PassRefPtr<SVGLength> to, double progress)
201 {
202 return to->blend(from, narrowPrecisionToFloat(progress));
203 }
204
205 static inline PassRefPtr<SVGLengthList> blendFunc(const AnimationBase*, PassRefP tr<SVGLengthList> passFrom, PassRefPtr<SVGLengthList> passTo, double progress)
206 {
207 RefPtr<SVGLengthList> from = passFrom;
208 RefPtr<SVGLengthList> to = passTo;
209
210 size_t fromLength = from->numberOfItems();
211 size_t toLength = to->numberOfItems();
212 if (!fromLength)
213 return !progress ? from->clone() : to->clone();
214 if (!toLength)
215 return progress == 1 ? from->clone() : to->clone();
216
217 size_t resultLength = fromLength;
218 if (fromLength != toLength) {
219 if (!(fromLength % toLength))
220 resultLength = fromLength;
221 else if (!(toLength % fromLength))
222 resultLength = toLength;
223 else
224 resultLength = fromLength * toLength;
225 }
226 RefPtr<SVGLengthList> result = SVGLengthList::create();
227 for (size_t i = 0; i < resultLength; ++i)
228 result->append(to->at(i % toLength)->blend(from->at(i % fromLength), nar rowPrecisionToFloat(progress)));
229 return result;
230 }
231
232 static inline PassRefPtr<StyleImage> crossfadeBlend(const AnimationBase*, StyleF etchedImage* fromStyleImage, StyleFetchedImage* toStyleImage, double progress)
233 {
234 // If progress is at one of the extremes, we want getComputedStyle to show t he image,
235 // not a completed cross-fade, so we hand back one of the existing images.
236 if (!progress)
237 return fromStyleImage;
238 if (progress == 1)
239 return toStyleImage;
240
241 ImageResource* fromImageResource = static_cast<ImageResource*>(fromStyleImag e->data());
242 ImageResource* toImageResource = static_cast<ImageResource*>(toStyleImage->d ata());
243
244 RefPtr<CSSImageValue> fromImageValue = CSSImageValue::create(fromImageResour ce->url(), fromStyleImage);
245 RefPtr<CSSImageValue> toImageValue = CSSImageValue::create(toImageResource-> url(), toStyleImage);
246 RefPtr<CSSCrossfadeValue> crossfadeValue = CSSCrossfadeValue::create(fromIma geValue, toImageValue);
247
248 crossfadeValue->setPercentage(CSSPrimitiveValue::create(progress, CSSPrimiti veValue::CSS_NUMBER));
249
250 return StyleGeneratedImage::create(crossfadeValue.get());
251 }
252
253 static inline PassRefPtr<StyleImage> blendFunc(const AnimationBase* anim, StyleI mage* from, StyleImage* to, double progress)
254 {
255 if (!from || !to)
256 return to;
257
258 if (from->isImageResource() && to->isImageResource())
259 return crossfadeBlend(anim, toStyleFetchedImage(from), toStyleFetchedIma ge(to), progress);
260
261 // FIXME: Support transitioning generated images as well. (gradients, etc.)
262
263 return to;
264 }
265 53
266 class AnimationPropertyWrapperBase { 54 class AnimationPropertyWrapperBase {
267 WTF_MAKE_NONCOPYABLE(AnimationPropertyWrapperBase); 55 WTF_MAKE_NONCOPYABLE(AnimationPropertyWrapperBase);
268 WTF_MAKE_FAST_ALLOCATED; 56 WTF_MAKE_FAST_ALLOCATED;
269 public: 57 public:
270 AnimationPropertyWrapperBase(CSSPropertyID prop) 58 AnimationPropertyWrapperBase(CSSPropertyID prop)
271 : m_prop(prop) 59 : m_prop(prop)
272 { 60 {
273 } 61 }
274 62
275 virtual ~AnimationPropertyWrapperBase() { } 63 virtual ~AnimationPropertyWrapperBase() { }
276 64
277 virtual bool isShorthandWrapper() const { return false; } 65 virtual bool isShorthandWrapper() const { return false; }
278 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const = 0; 66 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const = 0;
279 virtual void blend(const AnimationBase*, RenderStyle*, const RenderStyle*, c onst RenderStyle*, double) const = 0;
280 67
281 CSSPropertyID property() const { return m_prop; } 68 CSSPropertyID property() const { return m_prop; }
282 69
283 virtual bool animationIsAccelerated() const { return false; }
284
285 private: 70 private:
286 CSSPropertyID m_prop; 71 CSSPropertyID m_prop;
287 }; 72 };
288 73
289 static int gPropertyWrapperMap[numCSSProperties]; 74 static int gPropertyWrapperMap[numCSSProperties];
290 static const int cInvalidPropertyWrapperIndex = -1; 75 static const int cInvalidPropertyWrapperIndex = -1;
291 static Vector<AnimationPropertyWrapperBase*>* gPropertyWrappers = 0; 76 static Vector<AnimationPropertyWrapperBase*>* gPropertyWrappers = 0;
292 77
293 static void addPropertyWrapper(CSSPropertyID propertyID, AnimationPropertyWrappe rBase* wrapper) 78 static void addPropertyWrapper(CSSPropertyID propertyID, AnimationPropertyWrappe rBase* wrapper)
294 { 79 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 return (a->*m_getter)() == (b->*m_getter)(); 117 return (a->*m_getter)() == (b->*m_getter)();
333 } 118 }
334 119
335 protected: 120 protected:
336 T (RenderStyle::*m_getter)() const; 121 T (RenderStyle::*m_getter)() const;
337 }; 122 };
338 123
339 template <typename T> 124 template <typename T>
340 class PropertyWrapper : public PropertyWrapperGetter<T> { 125 class PropertyWrapper : public PropertyWrapperGetter<T> {
341 public: 126 public:
342 PropertyWrapper(CSSPropertyID prop, T (RenderStyle::*getter)() const, void ( RenderStyle::*setter)(T)) 127 PropertyWrapper(CSSPropertyID prop, T (RenderStyle::*getter)() const)
343 : PropertyWrapperGetter<T>(prop, getter) 128 : PropertyWrapperGetter<T>(prop, getter)
344 , m_setter(setter)
345 { 129 {
346 } 130 }
347
348 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const
349 {
350 (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<T>::m_getter )(), (b->*PropertyWrapperGetter<T>::m_getter)(), progress));
351 }
352
353 protected:
354 void (RenderStyle::*m_setter)(T);
355 }; 131 };
356 132
357 class NonNegativeLengthWrapper FINAL : public PropertyWrapper<Length> { 133 class NonNegativeLengthWrapper FINAL : public PropertyWrapper<Length> {
358 public: 134 public:
359 NonNegativeLengthWrapper(CSSPropertyID prop, Length (RenderStyle::*getter)() const, void (RenderStyle::*setter)(Length)) 135 NonNegativeLengthWrapper(CSSPropertyID prop, Length (RenderStyle::*getter)() const)
360 : PropertyWrapper<Length>(prop, getter, setter) 136 : PropertyWrapper<Length>(prop, getter)
361 { 137 {
362 } 138 }
363
364 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const OVERRIDE
365 {
366 Length from = (a->*PropertyWrapperGetter<Length>::m_getter)();
367 Length to = (b->*PropertyWrapperGetter<Length>::m_getter)();
368 (dst->*PropertyWrapper<Length>::m_setter)(to.blend(from, progress, Value RangeNonNegative));
369 }
370 }; 139 };
371 140
372 template <typename T> 141 template <typename T>
373 class RefCountedPropertyWrapper : public PropertyWrapperGetter<T*> { 142 class RefCountedPropertyWrapper : public PropertyWrapperGetter<T*> {
374 public: 143 public:
375 RefCountedPropertyWrapper(CSSPropertyID prop, T* (RenderStyle::*getter)() co nst, void (RenderStyle::*setter)(PassRefPtr<T>)) 144 RefCountedPropertyWrapper(CSSPropertyID prop, T* (RenderStyle::*getter)() co nst)
376 : PropertyWrapperGetter<T*>(prop, getter) 145 : PropertyWrapperGetter<T*>(prop, getter)
377 , m_setter(setter)
378 { 146 {
379 } 147 }
380 148
381 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const
382 {
383 (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<T*>::m_gette r)(), (b->*PropertyWrapperGetter<T*>::m_getter)(), progress));
384 }
385
386 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 149 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
387 { 150 {
388 if (a == b) 151 if (a == b)
389 return true; 152 return true;
390 if (!a || !b) 153 if (!a || !b)
391 return false; 154 return false;
392 const T* aValue = (a->*this->m_getter)(); 155 const T* aValue = (a->*this->m_getter)();
393 const T* bValue = (b->*this->m_getter)(); 156 const T* bValue = (b->*this->m_getter)();
394 if (aValue == bValue) 157 if (aValue == bValue)
395 return true; 158 return true;
396 if (!aValue || !bValue) 159 if (!aValue || !bValue)
397 return false; 160 return false;
398 return *aValue == *bValue; 161 return *aValue == *bValue;
399 } 162 }
400
401 protected:
402 void (RenderStyle::*m_setter)(PassRefPtr<T>);
403 }; 163 };
404 164
405 165
406 class PropertyWrapperClipPath : public RefCountedPropertyWrapper<ClipPathOperati on> { 166 class PropertyWrapperClipPath : public RefCountedPropertyWrapper<ClipPathOperati on> {
407 public: 167 public:
408 PropertyWrapperClipPath(CSSPropertyID prop, ClipPathOperation* (RenderStyle: :*getter)() const, void (RenderStyle::*setter)(PassRefPtr<ClipPathOperation>)) 168 PropertyWrapperClipPath(CSSPropertyID prop, ClipPathOperation* (RenderStyle: :*getter)() const)
409 : RefCountedPropertyWrapper<ClipPathOperation>(prop, getter, setter) 169 : RefCountedPropertyWrapper<ClipPathOperation>(prop, getter)
410 { 170 {
411 } 171 }
412 }; 172 };
413 173
414 class PropertyWrapperShape : public RefCountedPropertyWrapper<ShapeValue> { 174 class PropertyWrapperShape : public RefCountedPropertyWrapper<ShapeValue> {
415 public: 175 public:
416 PropertyWrapperShape(CSSPropertyID prop, ShapeValue* (RenderStyle::*getter)( ) const, void (RenderStyle::*setter)(PassRefPtr<ShapeValue>)) 176 PropertyWrapperShape(CSSPropertyID prop, ShapeValue* (RenderStyle::*getter)( ) const)
417 : RefCountedPropertyWrapper<ShapeValue>(prop, getter, setter) 177 : RefCountedPropertyWrapper<ShapeValue>(prop, getter)
418 { 178 {
419 } 179 }
420 }; 180 };
421 181
422 class StyleImagePropertyWrapper FINAL : public RefCountedPropertyWrapper<StyleIm age> { 182 class StyleImagePropertyWrapper FINAL : public RefCountedPropertyWrapper<StyleIm age> {
423 public: 183 public:
424 StyleImagePropertyWrapper(CSSPropertyID prop, StyleImage* (RenderStyle::*get ter)() const, void (RenderStyle::*setter)(PassRefPtr<StyleImage>)) 184 StyleImagePropertyWrapper(CSSPropertyID prop, StyleImage* (RenderStyle::*get ter)() const)
425 : RefCountedPropertyWrapper<StyleImage>(prop, getter, setter) 185 : RefCountedPropertyWrapper<StyleImage>(prop, getter)
426 { 186 {
427 } 187 }
428 188
429 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 189 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
430 { 190 {
431 // If the style pointers are the same, don't bother doing the test. 191 // If the style pointers are the same, don't bother doing the test.
432 // If either is null, return false. If both are null, return true. 192 // If either is null, return false. If both are null, return true.
433 if (a == b) 193 if (a == b)
434 return true; 194 return true;
435 if (!a || !b) 195 if (!a || !b)
436 return false; 196 return false;
437 197
438 StyleImage* imageA = (a->*m_getter)(); 198 StyleImage* imageA = (a->*m_getter)();
439 StyleImage* imageB = (b->*m_getter)(); 199 StyleImage* imageB = (b->*m_getter)();
440 return StyleImage::imagesEquivalent(imageA, imageB); 200 return StyleImage::imagesEquivalent(imageA, imageB);
441 } 201 }
442 }; 202 };
443 203
444 class PropertyWrapperColor FINAL : public PropertyWrapperGetter<Color> { 204 class PropertyWrapperColor FINAL : public PropertyWrapperGetter<Color> {
445 public: 205 public:
446 PropertyWrapperColor(CSSPropertyID prop, Color (RenderStyle::*getter)() cons t, void (RenderStyle::*setter)(const Color&)) 206 PropertyWrapperColor(CSSPropertyID prop, Color (RenderStyle::*getter)() cons t)
447 : PropertyWrapperGetter<Color>(prop, getter) 207 : PropertyWrapperGetter<Color>(prop, getter)
448 , m_setter(setter)
449 { 208 {
450 } 209 }
451
452 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const OVERRIDE
453 {
454 (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<Color>::m_ge tter)(), (b->*PropertyWrapperGetter<Color>::m_getter)(), progress));
455 }
456
457 protected:
458 void (RenderStyle::*m_setter)(const Color&);
459 }; 210 };
460 211
461 class PropertyWrapperAcceleratedOpacity FINAL : public PropertyWrapper<float> { 212 class PropertyWrapperAcceleratedOpacity FINAL : public PropertyWrapper<float> {
462 public: 213 public:
463 PropertyWrapperAcceleratedOpacity() 214 PropertyWrapperAcceleratedOpacity()
464 : PropertyWrapper<float>(CSSPropertyOpacity, &RenderStyle::opacity, &Ren derStyle::setOpacity) 215 : PropertyWrapper<float>(CSSPropertyOpacity, &RenderStyle::opacity)
465 { 216 {
466 } 217 }
467
468 virtual bool animationIsAccelerated() const OVERRIDE { return true; }
469
470 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const OVERRIDE
471 {
472 float fromOpacity = a->opacity();
473
474 // This makes sure we put the object being animated into a RenderLayer d uring the animation
475 dst->setOpacity(blendFunc(anim, (fromOpacity == 1) ? 0.999999f : fromOpa city, b->opacity(), progress));
476 }
477 }; 218 };
478 219
479 class PropertyWrapperAcceleratedTransform FINAL : public PropertyWrapper<const T ransformOperations&> { 220 class PropertyWrapperAcceleratedTransform FINAL : public PropertyWrapper<const T ransformOperations&> {
480 public: 221 public:
481 PropertyWrapperAcceleratedTransform() 222 PropertyWrapperAcceleratedTransform()
482 : PropertyWrapper<const TransformOperations&>(CSSPropertyWebkitTransform , &RenderStyle::transform, &RenderStyle::setTransform) 223 : PropertyWrapper<const TransformOperations&>(CSSPropertyWebkitTransform , &RenderStyle::transform)
483 { 224 {
484 } 225 }
485
486 virtual bool animationIsAccelerated() const OVERRIDE { return true; }
487
488 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const OVERRIDE
489 {
490 dst->setTransform(blendFunc(anim, a->transform(), b->transform(), progre ss));
491 }
492 }; 226 };
493 227
494 class PropertyWrapperAcceleratedFilter FINAL : public PropertyWrapper<const Filt erOperations&> { 228 class PropertyWrapperAcceleratedFilter FINAL : public PropertyWrapper<const Filt erOperations&> {
495 public: 229 public:
496 PropertyWrapperAcceleratedFilter() 230 PropertyWrapperAcceleratedFilter()
497 : PropertyWrapper<const FilterOperations&>(CSSPropertyWebkitFilter, &Ren derStyle::filter, &RenderStyle::setFilter) 231 : PropertyWrapper<const FilterOperations&>(CSSPropertyWebkitFilter, &Ren derStyle::filter)
498 { 232 {
499 } 233 }
500
501 virtual bool animationIsAccelerated() const OVERRIDE { return true; }
502
503 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const OVERRIDE
504 {
505 dst->setFilter(blendFunc(anim, a->filter(), b->filter(), progress));
506 }
507 }; 234 };
508 235
509 class PropertyWrapperShadow FINAL : public AnimationPropertyWrapperBase { 236 class PropertyWrapperShadow FINAL : public AnimationPropertyWrapperBase {
510 public: 237 public:
511 PropertyWrapperShadow(CSSPropertyID prop, ShadowList* (RenderStyle::*getter) () const, void (RenderStyle::*setter)(PassRefPtr<ShadowList>)) 238 PropertyWrapperShadow(CSSPropertyID prop, ShadowList* (RenderStyle::*getter) () const)
512 : AnimationPropertyWrapperBase(prop) 239 : AnimationPropertyWrapperBase(prop)
513 , m_getter(getter) 240 , m_getter(getter)
514 , m_setter(setter)
515 { 241 {
516 } 242 }
517 243
518 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 244 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
519 { 245 {
520 const ShadowList* shadowA = (a->*m_getter)(); 246 const ShadowList* shadowA = (a->*m_getter)();
521 const ShadowList* shadowB = (b->*m_getter)(); 247 const ShadowList* shadowB = (b->*m_getter)();
522 if (shadowA == shadowB) 248 if (shadowA == shadowB)
523 return true; 249 return true;
524 if (shadowA && shadowB) 250 if (shadowA && shadowB)
525 return *shadowA == *shadowB; 251 return *shadowA == *shadowB;
526 return false; 252 return false;
527 } 253 }
528 254
529 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const OVERRIDE
530 {
531 (dst->*m_setter)(ShadowList::blend((a->*m_getter)(), (b->*m_getter)(), p rogress));
532 }
533
534 ShadowList* (RenderStyle::*m_getter)() const; 255 ShadowList* (RenderStyle::*m_getter)() const;
535 void (RenderStyle::*m_setter)(PassRefPtr<ShadowList>);
536 }; 256 };
537 257
538 class PropertyWrapperMaybeInvalidStyleColor FINAL : public AnimationPropertyWrap perBase { 258 class PropertyWrapperMaybeInvalidStyleColor FINAL : public AnimationPropertyWrap perBase {
539 public: 259 public:
540 PropertyWrapperMaybeInvalidStyleColor(CSSPropertyID prop, StyleColor (Render Style::*getter)() const, void (RenderStyle::*setter)(const StyleColor&)) 260 PropertyWrapperMaybeInvalidStyleColor(CSSPropertyID prop, StyleColor (Render Style::*getter)() const)
541 : AnimationPropertyWrapperBase(prop) 261 : AnimationPropertyWrapperBase(prop)
542 , m_getter(getter) 262 , m_getter(getter)
543 , m_setter(setter)
544 { 263 {
545 } 264 }
546 265
547 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 266 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
548 { 267 {
549 StyleColor fromColor = (a->*m_getter)(); 268 StyleColor fromColor = (a->*m_getter)();
550 StyleColor toColor = (b->*m_getter)(); 269 StyleColor toColor = (b->*m_getter)();
551 270
552 if (fromColor.isCurrentColor() && toColor.isCurrentColor()) 271 if (fromColor.isCurrentColor() && toColor.isCurrentColor())
553 return true; 272 return true;
554 273
555 return fromColor.resolve(a->color()) == toColor.resolve(b->color()); 274 return fromColor.resolve(a->color()) == toColor.resolve(b->color());
556 } 275 }
557 276
558 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const OVERRIDE
559 {
560 StyleColor fromColor = (a->*m_getter)();
561 StyleColor toColor = (b->*m_getter)();
562
563 if (fromColor.isCurrentColor() && toColor.isCurrentColor())
564 return;
565
566 (dst->*m_setter)(blendFunc(anim, fromColor.resolve(a->color()), toColor. resolve(b->color()), progress));
567 }
568
569 private: 277 private:
570 StyleColor (RenderStyle::*m_getter)() const; 278 StyleColor (RenderStyle::*m_getter)() const;
571 void (RenderStyle::*m_setter)(const StyleColor&);
572 }; 279 };
573 280
574 281
575 class PropertyWrapperVisitedAffectedColor FINAL : public AnimationPropertyWrappe rBase { 282 class PropertyWrapperVisitedAffectedColor FINAL : public AnimationPropertyWrappe rBase {
576 public: 283 public:
577 PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, Color (RenderStyle:: *getter)() const, void (RenderStyle::*setter)(const Color&), 284 PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, Color (RenderStyle:: *getter)() const, Color (RenderStyle::*visitedGetter)() const)
578 Color (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visited Setter)(const Color&))
579 : AnimationPropertyWrapperBase(prop) 285 : AnimationPropertyWrapperBase(prop)
580 , m_wrapper(adoptPtr(new PropertyWrapperColor(prop, getter, setter))) 286 , m_wrapper(adoptPtr(new PropertyWrapperColor(prop, getter)))
581 , m_visitedWrapper(adoptPtr(new PropertyWrapperColor(prop, visitedGetter , visitedSetter))) 287 , m_visitedWrapper(adoptPtr(new PropertyWrapperColor(prop, visitedGetter )))
582 { 288 {
583 } 289 }
584 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const 290 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
585 { 291 {
586 return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b); 292 return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b);
587 } 293 }
588 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const
589 {
590 m_wrapper->blend(anim, dst, a, b, progress);
591 m_visitedWrapper->blend(anim, dst, a, b, progress);
592 }
593 294
594 private: 295 private:
595 OwnPtr<AnimationPropertyWrapperBase> m_wrapper; 296 OwnPtr<AnimationPropertyWrapperBase> m_wrapper;
596 OwnPtr<AnimationPropertyWrapperBase> m_visitedWrapper; 297 OwnPtr<AnimationPropertyWrapperBase> m_visitedWrapper;
597 }; 298 };
598 299
599 class PropertyWrapperVisitedAffectedStyleColor FINAL : public AnimationPropertyW rapperBase { 300 class PropertyWrapperVisitedAffectedStyleColor FINAL : public AnimationPropertyW rapperBase {
600 public: 301 public:
601 PropertyWrapperVisitedAffectedStyleColor(CSSPropertyID prop, StyleColor (Ren derStyle::*getter)() const, void (RenderStyle::*setter)(const StyleColor&), 302 PropertyWrapperVisitedAffectedStyleColor(CSSPropertyID prop, StyleColor (Ren derStyle::*getter)() const, StyleColor (RenderStyle::*visitedGetter)() const)
602 StyleColor (RenderStyle::*visitedGetter)() const, void (RenderStyle::*vi sitedSetter)(const StyleColor&))
603 : AnimationPropertyWrapperBase(prop) 303 : AnimationPropertyWrapperBase(prop)
604 , m_wrapper(adoptPtr(new PropertyWrapperMaybeInvalidStyleColor(prop, get ter, setter))) 304 , m_wrapper(adoptPtr(new PropertyWrapperMaybeInvalidStyleColor(prop, get ter)))
605 , m_visitedWrapper(adoptPtr(new PropertyWrapperMaybeInvalidStyleColor(pr op, visitedGetter, visitedSetter))) 305 , m_visitedWrapper(adoptPtr(new PropertyWrapperMaybeInvalidStyleColor(pr op, visitedGetter)))
606 { 306 {
607 } 307 }
608 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 308 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
609 { 309 {
610 return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b); 310 return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b);
611 } 311 }
612 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const OVERRIDE
613 {
614 m_wrapper->blend(anim, dst, a, b, progress);
615 m_visitedWrapper->blend(anim, dst, a, b, progress);
616 }
617 312
618 private: 313 private:
619 OwnPtr<AnimationPropertyWrapperBase> m_wrapper; 314 OwnPtr<AnimationPropertyWrapperBase> m_wrapper;
620 OwnPtr<AnimationPropertyWrapperBase> m_visitedWrapper; 315 OwnPtr<AnimationPropertyWrapperBase> m_visitedWrapper;
621 }; 316 };
622 317
623 // Wrapper base class for an animatable property in a FillLayer 318 // Wrapper base class for an animatable property in a FillLayer
624 class FillLayerAnimationPropertyWrapperBase { 319 class FillLayerAnimationPropertyWrapperBase {
625 public: 320 public:
626 FillLayerAnimationPropertyWrapperBase() 321 FillLayerAnimationPropertyWrapperBase()
627 { 322 {
628 } 323 }
629 324
630 virtual ~FillLayerAnimationPropertyWrapperBase() { } 325 virtual ~FillLayerAnimationPropertyWrapperBase() { }
631 326
632 virtual bool equals(const FillLayer*, const FillLayer*) const = 0; 327 virtual bool equals(const FillLayer*, const FillLayer*) const = 0;
633 virtual void blend(const AnimationBase*, FillLayer*, const FillLayer*, const FillLayer*, double) const = 0;
634 }; 328 };
635 329
636 template <typename T> 330 template <typename T>
637 class FillLayerPropertyWrapperGetter : public FillLayerAnimationPropertyWrapperB ase { 331 class FillLayerPropertyWrapperGetter : public FillLayerAnimationPropertyWrapperB ase {
638 WTF_MAKE_NONCOPYABLE(FillLayerPropertyWrapperGetter); 332 WTF_MAKE_NONCOPYABLE(FillLayerPropertyWrapperGetter);
639 public: 333 public:
640 FillLayerPropertyWrapperGetter(T (FillLayer::*getter)() const) 334 FillLayerPropertyWrapperGetter(T (FillLayer::*getter)() const)
641 : m_getter(getter) 335 : m_getter(getter)
642 { 336 {
643 } 337 }
644 338
645 virtual bool equals(const FillLayer* a, const FillLayer* b) const 339 virtual bool equals(const FillLayer* a, const FillLayer* b) const
646 { 340 {
647 // If the style pointers are the same, don't bother doing the test. 341 // If the style pointers are the same, don't bother doing the test.
648 // If either is null, return false. If both are null, return true. 342 // If either is null, return false. If both are null, return true.
649 if ((!a && !b) || a == b) 343 if ((!a && !b) || a == b)
650 return true; 344 return true;
651 if (!a || !b) 345 if (!a || !b)
652 return false; 346 return false;
653 return (a->*m_getter)() == (b->*m_getter)(); 347 return (a->*m_getter)() == (b->*m_getter)();
654 } 348 }
655 349
656 protected: 350 protected:
657 T (FillLayer::*m_getter)() const; 351 T (FillLayer::*m_getter)() const;
658 }; 352 };
659 353
660 template <typename T> 354 template <typename T>
661 class FillLayerPropertyWrapper FINAL : public FillLayerPropertyWrapperGetter<T> { 355 class FillLayerPropertyWrapper FINAL : public FillLayerPropertyWrapperGetter<T> {
662 public: 356 public:
663 FillLayerPropertyWrapper(T (FillLayer::*getter)() const, void (FillLayer::*s etter)(T)) 357 FillLayerPropertyWrapper(T (FillLayer::*getter)() const)
664 : FillLayerPropertyWrapperGetter<T>(getter) 358 : FillLayerPropertyWrapperGetter<T>(getter)
665 , m_setter(setter)
666 { 359 {
667 } 360 }
668
669 virtual void blend(const AnimationBase* anim, FillLayer* dst, const FillLaye r* a, const FillLayer* b, double progress) const OVERRIDE
670 {
671 (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<T>: :m_getter)(), (b->*FillLayerPropertyWrapperGetter<T>::m_getter)(), progress));
672 }
673
674 protected:
675 void (FillLayer::*m_setter)(T);
676 }; 361 };
677 362
678 template <typename T> 363 template <typename T>
679 class FillLayerRefCountedPropertyWrapper : public FillLayerPropertyWrapperGetter <T*> { 364 class FillLayerRefCountedPropertyWrapper : public FillLayerPropertyWrapperGetter <T*> {
680 public: 365 public:
681 FillLayerRefCountedPropertyWrapper(T* (FillLayer::*getter)() const, void (Fi llLayer::*setter)(PassRefPtr<T>)) 366 FillLayerRefCountedPropertyWrapper(T* (FillLayer::*getter)() const)
682 : FillLayerPropertyWrapperGetter<T*>(getter) 367 : FillLayerPropertyWrapperGetter<T*>(getter)
683 , m_setter(setter)
684 { 368 {
685 } 369 }
686
687 virtual void blend(const AnimationBase* anim, FillLayer* dst, const FillLaye r* a, const FillLayer* b, double progress) const
688 {
689 (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<T*> ::m_getter)(), (b->*FillLayerPropertyWrapperGetter<T*>::m_getter)(), progress));
690 }
691
692 protected:
693 void (FillLayer::*m_setter)(PassRefPtr<T>);
694 }; 370 };
695 371
696 class FillLayerStyleImagePropertyWrapper FINAL : public FillLayerRefCountedPrope rtyWrapper<StyleImage> { 372 class FillLayerStyleImagePropertyWrapper FINAL : public FillLayerRefCountedPrope rtyWrapper<StyleImage> {
697 public: 373 public:
698 FillLayerStyleImagePropertyWrapper(StyleImage* (FillLayer::*getter)() const, void (FillLayer::*setter)(PassRefPtr<StyleImage>)) 374 FillLayerStyleImagePropertyWrapper(StyleImage* (FillLayer::*getter)() const)
699 : FillLayerRefCountedPropertyWrapper<StyleImage>(getter, setter) 375 : FillLayerRefCountedPropertyWrapper<StyleImage>(getter)
700 { 376 {
701 } 377 }
702 378
703 virtual bool equals(const FillLayer* a, const FillLayer* b) const OVERRIDE 379 virtual bool equals(const FillLayer* a, const FillLayer* b) const OVERRIDE
704 { 380 {
705 // If the style pointers are the same, don't bother doing the test. 381 // If the style pointers are the same, don't bother doing the test.
706 // If either is null, return false. If both are null, return true. 382 // If either is null, return false. If both are null, return true.
707 if (a == b) 383 if (a == b)
708 return true; 384 return true;
709 if (!a || !b) 385 if (!a || !b)
(...skipping 12 matching lines...) Expand all
722 typedef FillLayer* (RenderStyle::*LayersAccessor)(); 398 typedef FillLayer* (RenderStyle::*LayersAccessor)();
723 399
724 FillLayersPropertyWrapper(CSSPropertyID prop, LayersGetter getter, LayersAcc essor accessor) 400 FillLayersPropertyWrapper(CSSPropertyID prop, LayersGetter getter, LayersAcc essor accessor)
725 : AnimationPropertyWrapperBase(prop) 401 : AnimationPropertyWrapperBase(prop)
726 , m_layersGetter(getter) 402 , m_layersGetter(getter)
727 , m_layersAccessor(accessor) 403 , m_layersAccessor(accessor)
728 { 404 {
729 switch (prop) { 405 switch (prop) {
730 case CSSPropertyBackgroundPositionX: 406 case CSSPropertyBackgroundPositionX:
731 case CSSPropertyWebkitMaskPositionX: 407 case CSSPropertyWebkitMaskPositionX:
732 m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&F illLayer::xPosition, &FillLayer::setXPosition); 408 m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&F illLayer::xPosition);
733 break; 409 break;
734 case CSSPropertyBackgroundPositionY: 410 case CSSPropertyBackgroundPositionY:
735 case CSSPropertyWebkitMaskPositionY: 411 case CSSPropertyWebkitMaskPositionY:
736 m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&F illLayer::yPosition, &FillLayer::setYPosition); 412 m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&F illLayer::yPosition);
737 break; 413 break;
738 case CSSPropertyBackgroundSize: 414 case CSSPropertyBackgroundSize:
739 case CSSPropertyWebkitBackgroundSize: 415 case CSSPropertyWebkitBackgroundSize:
740 case CSSPropertyWebkitMaskSize: 416 case CSSPropertyWebkitMaskSize:
741 m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<LengthSize >(&FillLayer::sizeLength, &FillLayer::setSizeLength); 417 m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<LengthSize >(&FillLayer::sizeLength);
742 break; 418 break;
743 case CSSPropertyBackgroundImage: 419 case CSSPropertyBackgroundImage:
744 m_fillLayerPropertyWrapper = new FillLayerStyleImagePropertyWrapper( &FillLayer::image, &FillLayer::setImage); 420 m_fillLayerPropertyWrapper = new FillLayerStyleImagePropertyWrapper( &FillLayer::image);
745 break; 421 break;
746 default: 422 default:
747 break; 423 break;
748 } 424 }
749 } 425 }
750 426
751 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 427 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
752 { 428 {
753 const FillLayer* fromLayer = (a->*m_layersGetter)(); 429 const FillLayer* fromLayer = (a->*m_layersGetter)();
754 const FillLayer* toLayer = (b->*m_layersGetter)(); 430 const FillLayer* toLayer = (b->*m_layersGetter)();
755 431
756 while (fromLayer && toLayer) { 432 while (fromLayer && toLayer) {
757 if (!m_fillLayerPropertyWrapper->equals(fromLayer, toLayer)) 433 if (!m_fillLayerPropertyWrapper->equals(fromLayer, toLayer))
758 return false; 434 return false;
759 435
760 fromLayer = fromLayer->next(); 436 fromLayer = fromLayer->next();
761 toLayer = toLayer->next(); 437 toLayer = toLayer->next();
762 } 438 }
763 439
764 return true; 440 return true;
765 } 441 }
766 442
767 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const OVERRIDE
768 {
769 const FillLayer* aLayer = (a->*m_layersGetter)();
770 const FillLayer* bLayer = (b->*m_layersGetter)();
771 FillLayer* dstLayer = (dst->*m_layersAccessor)();
772
773 while (aLayer && bLayer && dstLayer) {
774 m_fillLayerPropertyWrapper->blend(anim, dstLayer, aLayer, bLayer, pr ogress);
775 aLayer = aLayer->next();
776 bLayer = bLayer->next();
777 dstLayer = dstLayer->next();
778 }
779 }
780
781 private: 443 private:
782 FillLayerAnimationPropertyWrapperBase* m_fillLayerPropertyWrapper; 444 FillLayerAnimationPropertyWrapperBase* m_fillLayerPropertyWrapper;
783 445
784 LayersGetter m_layersGetter; 446 LayersGetter m_layersGetter;
785 LayersAccessor m_layersAccessor; 447 LayersAccessor m_layersAccessor;
786 }; 448 };
787 449
788 class ShorthandPropertyWrapper FINAL : public AnimationPropertyWrapperBase { 450 class ShorthandPropertyWrapper FINAL : public AnimationPropertyWrapperBase {
789 public: 451 public:
790 ShorthandPropertyWrapper(CSSPropertyID property, const StylePropertyShorthan d& shorthand) 452 ShorthandPropertyWrapper(CSSPropertyID property, const StylePropertyShorthan d& shorthand)
(...skipping 11 matching lines...) Expand all
802 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 464 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
803 { 465 {
804 Vector<AnimationPropertyWrapperBase*>::const_iterator end = m_propertyWr appers.end(); 466 Vector<AnimationPropertyWrapperBase*>::const_iterator end = m_propertyWr appers.end();
805 for (Vector<AnimationPropertyWrapperBase*>::const_iterator it = m_proper tyWrappers.begin(); it != end; ++it) { 467 for (Vector<AnimationPropertyWrapperBase*>::const_iterator it = m_proper tyWrappers.begin(); it != end; ++it) {
806 if (!(*it)->equals(a, b)) 468 if (!(*it)->equals(a, b))
807 return false; 469 return false;
808 } 470 }
809 return true; 471 return true;
810 } 472 }
811 473
812 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const OVERRIDE
813 {
814 Vector<AnimationPropertyWrapperBase*>::const_iterator end = m_propertyWr appers.end();
815 for (Vector<AnimationPropertyWrapperBase*>::const_iterator it = m_proper tyWrappers.begin(); it != end; ++it)
816 (*it)->blend(anim, dst, a, b, progress);
817 }
818
819 const Vector<AnimationPropertyWrapperBase*> propertyWrappers() const { retur n m_propertyWrappers; } 474 const Vector<AnimationPropertyWrapperBase*> propertyWrappers() const { retur n m_propertyWrappers; }
820 475
821 private: 476 private:
822 Vector<AnimationPropertyWrapperBase*> m_propertyWrappers; 477 Vector<AnimationPropertyWrapperBase*> m_propertyWrappers;
823 }; 478 };
824 479
825 class PropertyWrapperFlex FINAL : public AnimationPropertyWrapperBase { 480 class PropertyWrapperFlex FINAL : public AnimationPropertyWrapperBase {
826 public: 481 public:
827 PropertyWrapperFlex() 482 PropertyWrapperFlex()
828 : AnimationPropertyWrapperBase(CSSPropertyFlex) 483 : AnimationPropertyWrapperBase(CSSPropertyFlex)
829 { 484 {
830 } 485 }
831 486
832 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 487 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
833 { 488 {
834 // If the style pointers are the same, don't bother doing the test. 489 // If the style pointers are the same, don't bother doing the test.
835 // If either is null, return false. If both are null, return true. 490 // If either is null, return false. If both are null, return true.
836 if ((!a && !b) || a == b) 491 if ((!a && !b) || a == b)
837 return true; 492 return true;
838 if (!a || !b) 493 if (!a || !b)
839 return false; 494 return false;
840 495
841 return a->flexBasis() == b->flexBasis() && a->flexGrow() == b->flexGrow( ) && a->flexShrink() == b->flexShrink(); 496 return a->flexBasis() == b->flexBasis() && a->flexGrow() == b->flexGrow( ) && a->flexShrink() == b->flexShrink();
842 } 497 }
843
844 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const OVERRIDE
845 {
846 dst->setFlexBasis(blendFunc(anim, a->flexBasis(), b->flexBasis(), progre ss));
847 dst->setFlexGrow(blendFunc(anim, a->flexGrow(), b->flexGrow(), progress) );
848 dst->setFlexShrink(blendFunc(anim, a->flexShrink(), b->flexShrink(), pro gress));
849 }
850 }; 498 };
851 499
852 class PropertyWrapperSVGPaint FINAL : public AnimationPropertyWrapperBase { 500 class PropertyWrapperSVGPaint FINAL : public AnimationPropertyWrapperBase {
853 public: 501 public:
854 PropertyWrapperSVGPaint(CSSPropertyID prop, const SVGPaint::SVGPaintType& (R enderStyle::*paintTypeGetter)() const, Color (RenderStyle::*getter)() const, voi d (RenderStyle::*setter)(const Color&)) 502 PropertyWrapperSVGPaint(CSSPropertyID prop, const SVGPaint::SVGPaintType& (R enderStyle::*paintTypeGetter)() const, Color (RenderStyle::*getter)() const)
855 : AnimationPropertyWrapperBase(prop) 503 : AnimationPropertyWrapperBase(prop)
856 , m_paintTypeGetter(paintTypeGetter) 504 , m_paintTypeGetter(paintTypeGetter)
857 , m_getter(getter) 505 , m_getter(getter)
858 , m_setter(setter)
859 { 506 {
860 } 507 }
861 508
862 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 509 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
863 { 510 {
864 if ((a->*m_paintTypeGetter)() != (b->*m_paintTypeGetter)()) 511 if ((a->*m_paintTypeGetter)() != (b->*m_paintTypeGetter)())
865 return false; 512 return false;
866 513
867 // We only support animations between SVGPaints that are pure Color valu es. 514 // We only support animations between SVGPaints that are pure Color valu es.
868 // For everything else we must return true for this method, otherwise 515 // For everything else we must return true for this method, otherwise
869 // we will try to animate between values forever. 516 // we will try to animate between values forever.
870 if ((a->*m_paintTypeGetter)() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR) { 517 if ((a->*m_paintTypeGetter)() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR) {
871 Color fromColor = (a->*m_getter)(); 518 Color fromColor = (a->*m_getter)();
872 Color toColor = (b->*m_getter)(); 519 Color toColor = (b->*m_getter)();
873 return fromColor == toColor; 520 return fromColor == toColor;
874 } 521 }
875 return true; 522 return true;
876 } 523 }
877 524
878 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const OVERRIDE
879 {
880 if ((a->*m_paintTypeGetter)() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR
881 || (b->*m_paintTypeGetter)() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR)
882 return;
883
884 Color fromColor = (a->*m_getter)();
885 Color toColor = (b->*m_getter)();
886
887 (dst->*m_setter)(blendFunc(anim, fromColor, toColor, progress));
888 }
889
890 private: 525 private:
891 const SVGPaint::SVGPaintType& (RenderStyle::*m_paintTypeGetter)() const; 526 const SVGPaint::SVGPaintType& (RenderStyle::*m_paintTypeGetter)() const;
892 Color (RenderStyle::*m_getter)() const; 527 Color (RenderStyle::*m_getter)() const;
893 void (RenderStyle::*m_setter)(const Color&);
894 }; 528 };
895 529
896 template <typename T> 530 template <typename T>
897 class RefCountedSVGPropertyWrapper : public AnimationPropertyWrapperBase { 531 class RefCountedSVGPropertyWrapper : public AnimationPropertyWrapperBase {
898 public: 532 public:
899 RefCountedSVGPropertyWrapper(CSSPropertyID prop, PassRefPtr<T> (RenderStyle: :*getter)() const, void (RenderStyle::*setter)(PassRefPtr<T>)) 533 RefCountedSVGPropertyWrapper(CSSPropertyID prop, PassRefPtr<T> (RenderStyle: :*getter)() const)
900 : AnimationPropertyWrapperBase(prop) 534 : AnimationPropertyWrapperBase(prop)
901 , m_getter(getter) 535 , m_getter(getter)
902 , m_setter(setter)
903 { 536 {
904 } 537 }
905 538
906 virtual void blend(const AnimationBase* anim, RenderStyle* dst, const Render Style* a, const RenderStyle* b, double progress) const
907 {
908 (dst->*m_setter)(blendFunc(anim, (a->*m_getter)(), (b->*m_getter)(), pro gress));
909 }
910
911 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 539 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
912 { 540 {
913 if (a == b) 541 if (a == b)
914 return true; 542 return true;
915 if (!a || !b) 543 if (!a || !b)
916 return false; 544 return false;
917 RefPtr<T> aValue = (a->*this->m_getter)(); 545 RefPtr<T> aValue = (a->*this->m_getter)();
918 RefPtr<T> bValue = (b->*this->m_getter)(); 546 RefPtr<T> bValue = (b->*this->m_getter)();
919 if (aValue == bValue) 547 if (aValue == bValue)
920 return true; 548 return true;
921 if (!aValue || !bValue) 549 if (!aValue || !bValue)
922 return false; 550 return false;
923 return *aValue == *bValue; 551 return *aValue == *bValue;
924 } 552 }
925 553
926 protected: 554 protected:
927 PassRefPtr<T> (RenderStyle::*m_getter)() const; 555 PassRefPtr<T> (RenderStyle::*m_getter)() const;
928 void (RenderStyle::*m_setter)(PassRefPtr<T>);
929 }; 556 };
930 557
931 static void addShorthandProperties() 558 static void addShorthandProperties()
932 { 559 {
933 static const CSSPropertyID animatableShorthandProperties[] = { 560 static const CSSPropertyID animatableShorthandProperties[] = {
934 CSSPropertyBackground, // for background-color, background-position, bac kground-image 561 CSSPropertyBackground, // for background-color, background-position, bac kground-image
935 CSSPropertyBackgroundPosition, 562 CSSPropertyBackgroundPosition,
936 CSSPropertyFont, // for font-size, font-weight 563 CSSPropertyFont, // for font-size, font-weight
937 CSSPropertyWebkitMask, // for mask-position 564 CSSPropertyWebkitMask, // for mask-position
938 CSSPropertyWebkitMaskPosition, 565 CSSPropertyWebkitMaskPosition,
(...skipping 24 matching lines...) Expand all
963 590
964 void CSSPropertyAnimation::ensurePropertyMap() 591 void CSSPropertyAnimation::ensurePropertyMap()
965 { 592 {
966 // FIXME: This data is never destroyed. Maybe we should ref count it and tos s it when the last AnimationController is destroyed? 593 // FIXME: This data is never destroyed. Maybe we should ref count it and tos s it when the last AnimationController is destroyed?
967 if (gPropertyWrappers) 594 if (gPropertyWrappers)
968 return; 595 return;
969 596
970 gPropertyWrappers = new Vector<AnimationPropertyWrapperBase*>(); 597 gPropertyWrappers = new Vector<AnimationPropertyWrapperBase*>();
971 598
972 // build the list of property wrappers to do the comparisons and blends 599 // build the list of property wrappers to do the comparisons and blends
973 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyLeft, &Rend erStyle::left, &RenderStyle::setLeft)); 600 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyLeft, &Rend erStyle::left);
974 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyRight, &Ren derStyle::right, &RenderStyle::setRight)); 601 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyRight, &Ren derStyle::right);
975 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyTop, &Rende rStyle::top, &RenderStyle::setTop)); 602 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyTop, &Rende rStyle::top);
976 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyBottom, &Re nderStyle::bottom, &RenderStyle::setBottom)); 603 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyBottom, &Re nderStyle::bottom);
977 604
978 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWidth, &Ren derStyle::width, &RenderStyle::setWidth)); 605 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWidth, &Ren derStyle::width);
979 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMinWidth, & RenderStyle::minWidth, &RenderStyle::setMinWidth)); 606 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMinWidth, & RenderStyle::minWidth);
980 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxWidth, & RenderStyle::maxWidth, &RenderStyle::setMaxWidth)); 607 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxWidth, & RenderStyle::maxWidth);
981 608
982 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyHeight, &Re nderStyle::height, &RenderStyle::setHeight)); 609 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyHeight, &Re nderStyle::height);
983 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMinHeight, &RenderStyle::minHeight, &RenderStyle::setMinHeight)); 610 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMinHeight, &RenderStyle::minHeight);
984 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxHeight, &RenderStyle::maxHeight, &RenderStyle::setMaxHeight)); 611 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxHeight, &RenderStyle::maxHeight);
985 612
986 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) 613 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled())
987 gPropertyWrappers->append(new PropertyWrapperFlex()); 614 gPropertyWrappers->append(new PropertyWrapperFlex());
988 615
989 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderLef tWidth, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth)); 616 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderLef tWidth, &RenderStyle::borderLeftWidth);
990 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderRig htWidth, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth)); 617 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderRig htWidth, &RenderStyle::borderRightWidth);
991 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderTop Width, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth)); 618 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderTop Width, &RenderStyle::borderTopWidth);
992 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderBot tomWidth, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth)); 619 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderBot tomWidth, &RenderStyle::borderBottomWidth);
993 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginLeft, &RenderStyle::marginLeft, &RenderStyle::setMarginLeft)); 620 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginLeft, &RenderStyle::marginLeft);
994 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginRight , &RenderStyle::marginRight, &RenderStyle::setMarginRight)); 621 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginRight , &RenderStyle::marginRight);
995 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginTop, &RenderStyle::marginTop, &RenderStyle::setMarginTop)); 622 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginTop, &RenderStyle::marginTop);
996 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginBotto m, &RenderStyle::marginBottom, &RenderStyle::setMarginBottom)); 623 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginBotto m, &RenderStyle::marginBottom);
997 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingLeft , &RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft)); 624 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingLeft , &RenderStyle::paddingLeft);
998 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingRigh t, &RenderStyle::paddingRight, &RenderStyle::setPaddingRight)); 625 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingRigh t, &RenderStyle::paddingRight);
999 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingTop, &RenderStyle::paddingTop, &RenderStyle::setPaddingTop)); 626 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingTop, &RenderStyle::paddingTop);
1000 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingBott om, &RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom)); 627 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingBott om, &RenderStyle::paddingBottom);
1001 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropert yColor, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::visitedLinkCo lor, &RenderStyle::setVisitedLinkColor)); 628 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropert yColor, &RenderStyle::color, &RenderStyle::visitedLinkColor));
1002 629
1003 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroun dColor, &RenderStyle::visitedLinkBackgroundColor, &RenderStyle::setVisitedLinkBa ckgroundColor)); 630 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::visitedLinkB ackgroundColor));
1004 631
1005 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dImage, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); 632 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dImage, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
1006 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyListStyle Image, &RenderStyle::listStyleImage, &RenderStyle::setListStyleImage)); 633 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyListStyle Image, &RenderStyle::listStyleImage);
1007 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMas kImage, &RenderStyle::maskImage, &RenderStyle::setMaskImage)); 634 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMas kImage, &RenderStyle::maskImage);
1008 635
1009 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyBorderIma geSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource)); 636 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyBorderIma geSource, &RenderStyle::borderImageSource);
1010 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderIm ageSlice, &RenderStyle::borderImageSlices, &RenderStyle::setBorderImageSlices)); 637 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderIm ageSlice, &RenderStyle::borderImageSlices);
1011 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyBorderImageWidth, &RenderStyle::borderImageWidth, &RenderStyle::setBor derImageWidth)); 638 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyBorderImageWidth;
1012 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyBorderImageOutset, &RenderStyle::borderImageOutset, &RenderStyle::setB orderImageOutset)); 639 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyBorderImageOutset, &RenderStyle::borderImageOutset));
1013 640
1014 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMas kBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImage Source)); 641 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMas kBoxImageSource, &RenderStyle::maskBoxImageSource));
1015 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyWebkitMa skBoxImageSlice, &RenderStyle::maskBoxImageSlices, &RenderStyle::setMaskBoxImage Slices)); 642 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyWebkitMa skBoxImageSlice, &RenderStyle::maskBoxImageSlices));
1016 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyWebkitMaskBoxImageWidth, &RenderStyle::maskBoxImageWidth, &RenderStyle ::setMaskBoxImageWidth)); 643 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyWebkitMaskBoxImageWidth, &RenderStyle::maskBoxImageWidth));
1017 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyWebkitMaskBoxImageOutset, &RenderStyle::maskBoxImageOutset, &RenderSty le::setMaskBoxImageOutset)); 644 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyWebkitMaskBoxImageOutset, &RenderStyle::maskBoxImageOutset));
1018 645
1019 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dPositionX, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers )); 646 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dPositionX, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers ));
1020 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dPositionY, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers )); 647 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dPositionY, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers ));
1021 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); 648 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers));
1022 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitBac kgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayer s)); 649 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitBac kgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayer s));
1023 650
1024 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kPositionX, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); 651 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kPositionX, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers));
1025 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kPositionY, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); 652 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kPositionY, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers));
1026 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kSize, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); 653 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kSize, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers));
1027 654
1028 gPropertyWrappers->append(new PropertyWrapper<LengthPoint>(CSSPropertyObject Position, &RenderStyle::objectPosition, &RenderStyle::setObjectPosition)); 655 gPropertyWrappers->append(new PropertyWrapper<LengthPoint>(CSSPropertyObject Position, &RenderStyle::objectPosition));
1029 656
1030 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFontSize, 657 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFontSize,
1031 // Must pass a specified size to setFontSize if Text Autosizing is enabl ed, but a computed size 658 // Must pass a specified size to setFontSize if Text Autosizing is enabl ed, but a computed size
1032 // if text zoom is enabled (if neither is enabled it's irrelevant as the y're probably the same). 659 // if text zoom is enabled (if neither is enabled it's irrelevant as the y're probably the same).
1033 // FIXME: Should we introduce an option to pass the computed font size h ere, allowing consumers to 660 // FIXME: Should we introduce an option to pass the computed font size h ere, allowing consumers to
1034 // enable text zoom rather than Text Autosizing? See http://crbug.com/22 7545. 661 // enable text zoom rather than Text Autosizing? See http://crbug.com/22 7545.
1035 &RenderStyle::specifiedFontSize, 662 &RenderStyle::specifiedFontSize));
1036 &RenderStyle::setFontSize)); 663 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWeb kitColumnRuleWidth, &RenderStyle::columnRuleWidth));
1037 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWeb kitColumnRuleWidth, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWi dth)); 664 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitColumn Gap, &RenderStyle::columnGap));
1038 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitColumn Gap, &RenderStyle::columnGap, &RenderStyle::setColumnGap)); 665 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWeb kitColumnCount, &RenderStyle::columnCount));
1039 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWeb kitColumnCount, &RenderStyle::columnCount, &RenderStyle::setColumnCount)); 666 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitColumn Width, &RenderStyle::columnWidth));
1040 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitColumn Width, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth)); 667 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWebkitBorder HorizontalSpacing, &RenderStyle::horizontalBorderSpacing));
1041 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWebkitBorder HorizontalSpacing, &RenderStyle::horizontalBorderSpacing, &RenderStyle::setHoriz ontalBorderSpacing)); 668 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWebkitBorder VerticalSpacing, &RenderStyle::verticalBorderSpacing));
1042 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWebkitBorder VerticalSpacing, &RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalB orderSpacing)); 669 gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyZIndex, &Rende rStyle::zIndex));
1043 gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyZIndex, &Rende rStyle::zIndex, &RenderStyle::setZIndex)); 670 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyOrphans, &Re nderStyle::orphans));
1044 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyOrphans, &Re nderStyle::orphans, &RenderStyle::setOrphans)); 671 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWidows, &Ren derStyle::widows));
1045 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWidows, &Ren derStyle::widows, &RenderStyle::setWidows)); 672 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyLineHeight, &RenderStyle::specifiedLineHeight));
1046 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyLineHeight, &RenderStyle::specifiedLineHeight, &RenderStyle::setLineHeight)); 673 gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyOutlineOffset, &RenderStyle::outlineOffset));
1047 gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyOutlineOffset, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset)); 674 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyOut lineWidth, &RenderStyle::outlineWidth));
1048 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyOut lineWidth, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth)); 675 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyLetterSpacin g, &RenderStyle::letterSpacing));
1049 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyLetterSpacin g, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing)); 676 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWordSpacing, &RenderStyle::wordSpacing));
1050 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWordSpacing, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing)); 677 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyTextIndent, &RenderStyle::textIndent));
1051 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyTextIndent, &RenderStyle::textIndent, &RenderStyle::setTextIndent));
1052 678
1053 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitPerspe ctive, &RenderStyle::perspective, &RenderStyle::setPerspective)); 679 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitPerspe ctive, &RenderStyle::perspective));
1054 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitPersp ectiveOriginX, &RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOri ginX)); 680 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitPersp ectiveOriginX, &RenderStyle::perspectiveOriginX));
1055 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitPersp ectiveOriginY, &RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOri ginY)); 681 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitPersp ectiveOriginY, &RenderStyle::perspectiveOriginY));
1056 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTrans formOriginX, &RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX)) ; 682 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTrans formOriginX, &RenderStyle::transformOriginX));
1057 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTrans formOriginY, &RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY)) ; 683 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTrans formOriginY, &RenderStyle::transformOriginY));
1058 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitTransf ormOriginZ, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ)); 684 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitTransf ormOriginZ, &RenderStyle::transformOriginZ));
1059 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderT opLeftRadius, &RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftR adius)); 685 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderT opLeftRadius, &RenderStyle::borderTopLeftRadius));
1060 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderT opRightRadius, &RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRig htRadius)); 686 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderT opRightRadius, &RenderStyle::borderTopRightRadius));
1061 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderB ottomLeftRadius, &RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBo ttomLeftRadius)); 687 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderB ottomLeftRadius, &RenderStyle::borderBottomLeftRadius));
1062 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderB ottomRightRadius, &RenderStyle::borderBottomRightRadius, &RenderStyle::setBorder BottomRightRadius)); 688 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderB ottomRightRadius, &RenderStyle::borderBottomRightRadius));
1063 gPropertyWrappers->append(new PropertyWrapper<EVisibility>(CSSPropertyVisibi lity, &RenderStyle::visibility, &RenderStyle::setVisibility)); 689 gPropertyWrappers->append(new PropertyWrapper<EVisibility>(CSSPropertyVisibi lity, &RenderStyle::visibility));
1064 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyZoom, &Rende rStyle::zoom, &RenderStyle::setZoomWithoutReturnValue)); 690 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyZoom, &Rende rStyle::zoom));
1065 691
1066 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyClip, &R enderStyle::clip, &RenderStyle::setClip)); 692 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyClip, &R enderStyle::clip));
1067 693
1068 gPropertyWrappers->append(new PropertyWrapperAcceleratedOpacity()); 694 gPropertyWrappers->append(new PropertyWrapperAcceleratedOpacity());
1069 gPropertyWrappers->append(new PropertyWrapperAcceleratedTransform()); 695 gPropertyWrappers->append(new PropertyWrapperAcceleratedTransform());
1070 gPropertyWrappers->append(new PropertyWrapperAcceleratedFilter()); 696 gPropertyWrappers->append(new PropertyWrapperAcceleratedFilter());
1071 697
1072 gPropertyWrappers->append(new PropertyWrapperClipPath(CSSPropertyWebkitClipP ath, &RenderStyle::clipPath, &RenderStyle::setClipPath)); 698 gPropertyWrappers->append(new PropertyWrapperClipPath(CSSPropertyWebkitClipP ath, &RenderStyle::clipPath));
1073 699
1074 gPropertyWrappers->append(new PropertyWrapperShape(CSSPropertyShapeInside, & RenderStyle::shapeInside, &RenderStyle::setShapeInside)); 700 gPropertyWrappers->append(new PropertyWrapperShape(CSSPropertyShapeInside, & RenderStyle::shapeInside));
1075 gPropertyWrappers->append(new PropertyWrapperShape(CSSPropertyShapeOutside, &RenderStyle::shapeOutside, &RenderStyle::setShapeOutside)); 701 gPropertyWrappers->append(new PropertyWrapperShape(CSSPropertyShapeOutside, &RenderStyle::shapeOutside));
1076 gPropertyWrappers->append(new NonNegativeLengthWrapper(CSSPropertyShapeMargi n, &RenderStyle::shapeMargin, &RenderStyle::setShapeMargin)); 702 gPropertyWrappers->append(new NonNegativeLengthWrapper(CSSPropertyShapeMargi n, &RenderStyle::shapeMargin));
1077 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyShapeImageTh reshold, &RenderStyle::shapeImageThreshold, &RenderStyle::setShapeImageThreshold )); 703 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyShapeImageTh reshold, &RenderStyle::shapeImageThreshold));
1078 704
1079 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyWebkitColumnRuleColor, &RenderStyle::columnRuleColor, &RenderStyle::setCol umnRuleColor, &RenderStyle::visitedLinkColumnRuleColor, &RenderStyle::setVisited LinkColumnRuleColor)); 705 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyWebkitColumnRuleColor, &RenderStyle::columnRuleColor, &RenderStyle::visite dLinkColumnRuleColor));
1080 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyWebkitTextStrokeColor, &RenderStyle::textStrokeColor, &RenderStyle::setTex tStrokeColor, &RenderStyle::visitedLinkTextStrokeColor, &RenderStyle::setVisited LinkTextStrokeColor)); 706 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyWebkitTextStrokeColor, &RenderStyle::textStrokeColor, &RenderStyle::visite dLinkTextStrokeColor));
1081 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyBorderLeftColor, &RenderStyle::borderLeftColor, &RenderStyle::setBorderLef tColor, &RenderStyle::visitedLinkBorderLeftColor, &RenderStyle::setVisitedLinkBo rderLeftColor)); 707 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyBorderLeftColor, &RenderStyle::borderLeftColor, &RenderStyle::visitedLinkB orderLeftColor));
1082 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyBorderRightColor, &RenderStyle::borderRightColor, &RenderStyle::setBorderR ightColor, &RenderStyle::visitedLinkBorderRightColor, &RenderStyle::setVisitedLi nkBorderRightColor)); 708 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyBorderRightColor, &RenderStyle::borderRightColor, &RenderStyle::visitedLin kBorderRightColor));
1083 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyBorderTopColor, &RenderStyle::borderTopColor, &RenderStyle::setBorderTopCo lor, &RenderStyle::visitedLinkBorderTopColor, &RenderStyle::setVisitedLinkBorder TopColor)); 709 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyBorderTopColor, &RenderStyle::borderTopColor, &RenderStyle::visitedLinkBor derTopColor));
1084 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyBorderBottomColor, &RenderStyle::borderBottomColor, &RenderStyle::setBorde rBottomColor, &RenderStyle::visitedLinkBorderBottomColor, &RenderStyle::setVisit edLinkBorderBottomColor)); 710 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyBorderBottomColor, &RenderStyle::borderBottomColor, &RenderStyle::visitedL inkBorderBottomColor));
1085 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyOutlineColor, &RenderStyle::outlineColor, &RenderStyle::setOutlineColor, & RenderStyle::visitedLinkOutlineColor, &RenderStyle::setVisitedLinkOutlineColor)) ; 711 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyOutlineColor, &RenderStyle::outlineColor, &RenderStyle::visitedLinkOutline Color));
1086 712
1087 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyBoxShadow, &R enderStyle::boxShadow, &RenderStyle::setBoxShadow)); 713 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyBoxShadow, &R enderStyle::boxShadow));
1088 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyWebkitBoxShad ow, &RenderStyle::boxShadow, &RenderStyle::setBoxShadow)); 714 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyWebkitBoxShad ow, &RenderStyle::boxShadow));
1089 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyTextShadow, & RenderStyle::textShadow, &RenderStyle::setTextShadow)); 715 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyTextShadow, & RenderStyle::textShadow));
1090 716
1091 gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyFill, &Rend erStyle::fillPaintType, &RenderStyle::fillPaintColor, &RenderStyle::setFillPaint Color)); 717 gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyFill, &Rend erStyle::fillPaintType, &RenderStyle::fillPaintColor));
1092 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFillOpacity, &RenderStyle::fillOpacity, &RenderStyle::setFillOpacity)); 718 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFillOpacity, &RenderStyle::fillOpacity));
1093 719
1094 gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyStroke, &Re nderStyle::strokePaintType, &RenderStyle::strokePaintColor, &RenderStyle::setStr okePaintColor)); 720 gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyStroke, &Re nderStyle::strokePaintType, &RenderStyle::strokePaintColor));
1095 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeOpacit y, &RenderStyle::strokeOpacity, &RenderStyle::setStrokeOpacity)); 721 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeOpacit y, &RenderStyle::strokeOpacity));
1096 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyStrokeWidth, &RenderStyle::strokeWidth, &RenderStyle::setStrokeWidth)); 722 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyStrokeWidth, &RenderStyle::strokeWidth));
1097 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLengthList>(CS SPropertyStrokeDasharray, &RenderStyle::strokeDashArray, &RenderStyle::setStroke DashArray)); 723 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLengthList>(CS SPropertyStrokeDasharray, &RenderStyle::strokeDashArray));
1098 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyStrokeDashoffset, &RenderStyle::strokeDashOffset, &RenderStyle::setStrokeDa shOffset)); 724 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyStrokeDashoffset, &RenderStyle::strokeDashOffset));
1099 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeMiterl imit, &RenderStyle::strokeMiterLimit, &RenderStyle::setStrokeMiterLimit)); 725 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeMiterl imit, &RenderStyle::strokeMiterLimit));
1100 726
1101 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFloodOpacity , &RenderStyle::floodOpacity, &RenderStyle::setFloodOpacity)); 727 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFloodOpacity , &RenderStyle::floodOpacity));
1102 gPropertyWrappers->append(new PropertyWrapperColor(CSSPropertyFloodColor, &R enderStyle::floodColor, &RenderStyle::setFloodColor)); 728 gPropertyWrappers->append(new PropertyWrapperColor(CSSPropertyFloodColor, &R enderStyle::floodColor));
1103 729
1104 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStopOpacity, &RenderStyle::stopOpacity, &RenderStyle::setStopOpacity)); 730 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStopOpacity, &RenderStyle::stopOpacity));
1105 gPropertyWrappers->append(new PropertyWrapperColor(CSSPropertyStopColor, &Re nderStyle::stopColor, &RenderStyle::setStopColor)); 731 gPropertyWrappers->append(new PropertyWrapperColor(CSSPropertyStopColor, &Re nderStyle::stopColor));
1106 732
1107 gPropertyWrappers->append(new PropertyWrapperColor(CSSPropertyLightingColor, &RenderStyle::lightingColor, &RenderStyle::setLightingColor)); 733 gPropertyWrappers->append(new PropertyWrapperColor(CSSPropertyLightingColor, &RenderStyle::lightingColor));
1108 734
1109 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyBaselineShift, &RenderStyle::baselineShiftValue, &RenderStyle::setBaselineS hiftValue)); 735 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyBaselineShift, &RenderStyle::baselineShiftValue));
1110 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyKerning, &RenderStyle::kerning, &RenderStyle::setKerning)); 736 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyKerning, &RenderStyle::kerning));
1111 737
1112 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) { 738 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) {
1113 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFlexGrow , &RenderStyle::flexGrow, &RenderStyle::setFlexGrow)); 739 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFlexGrow , &RenderStyle::flexGrow));
1114 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFlexShri nk, &RenderStyle::flexShrink, &RenderStyle::setFlexShrink)); 740 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFlexShri nk, &RenderStyle::flexShrink));
1115 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyFlexBas is, &RenderStyle::flexBasis, &RenderStyle::setFlexBasis)); 741 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyFlexBas is, &RenderStyle::flexBasis));
1116 } 742 }
1117 743
1118 // TODO: 744 // TODO:
1119 // 745 //
1120 // CSSPropertyVerticalAlign 746 // CSSPropertyVerticalAlign
1121 // 747 //
1122 // Compound properties that have components that should be animatable: 748 // Compound properties that have components that should be animatable:
1123 // 749 //
1124 // CSSPropertyWebkitColumns 750 // CSSPropertyWebkitColumns
1125 // CSSPropertyWebkitBoxReflect 751 // CSSPropertyWebkitBoxReflect
1126 752
1127 // Make sure unused slots have a value 753 // Make sure unused slots have a value
1128 for (unsigned int i = 0; i < static_cast<unsigned int>(numCSSProperties); ++ i) 754 for (unsigned int i = 0; i < static_cast<unsigned int>(numCSSProperties); ++ i)
1129 gPropertyWrapperMap[i] = cInvalidPropertyWrapperIndex; 755 gPropertyWrapperMap[i] = cInvalidPropertyWrapperIndex;
1130 756
1131 // First we put the non-shorthand property wrappers into the map, so the sho rthand-building 757 // First we put the non-shorthand property wrappers into the map, so the sho rthand-building
1132 // code can find them. 758 // code can find them.
1133 size_t n = gPropertyWrappers->size(); 759 size_t n = gPropertyWrappers->size();
1134 for (unsigned int i = 0; i < n; ++i) { 760 for (unsigned int i = 0; i < n; ++i) {
1135 CSSPropertyID property = (*gPropertyWrappers)[i]->property(); 761 CSSPropertyID property = (*gPropertyWrappers)[i]->property();
1136 ASSERT_WITH_MESSAGE(RuntimeEnabledFeatures::webAnimationsCSSEnabled() || CSSAnimations::isAnimatableProperty(property), "%s is not whitelisted for anima tion", getPropertyNameString(property).utf8().data()); 762 ASSERT_WITH_MESSAGE(RuntimeEnabledFeatures::webAnimationsCSSEnabled() || CSSAnimations::isAnimatableProperty(property), "%s is not whitelisted for anima tion", getPropertyNameString(property).utf8().data());
1137 ASSERT(property - firstCSSProperty < numCSSProperties); 763 ASSERT(property - firstCSSProperty < numCSSProperties);
1138 gPropertyWrapperMap[property - firstCSSProperty] = i; 764 gPropertyWrapperMap[property - firstCSSProperty] = i;
1139 } 765 }
1140 766
1141 // Now add the shorthand wrappers. 767 // Now add the shorthand wrappers.
1142 addShorthandProperties(); 768 addShorthandProperties();
1143 } 769 }
1144 770
1145 // Returns true if we need to start animation timers
1146 bool CSSPropertyAnimation::blendProperties(const AnimationBase* anim, CSSPropert yID prop, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double p rogress)
1147 {
1148 ASSERT(prop != CSSPropertyInvalid);
1149
1150 ensurePropertyMap();
1151
1152 AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop);
1153 if (wrapper) {
1154 wrapper->blend(anim, dst, a, b, progress);
1155 return !wrapper->animationIsAccelerated() || !anim->isAccelerated();
1156 }
1157
1158 return false;
1159 }
1160
1161 bool CSSPropertyAnimation::animationOfPropertyIsAccelerated(CSSPropertyID prop)
1162 {
1163 ensurePropertyMap();
1164 AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop);
1165 return wrapper ? wrapper->animationIsAccelerated() : false;
1166 }
1167
1168 bool CSSPropertyAnimation::propertiesEqual(CSSPropertyID prop, const RenderStyle * a, const RenderStyle* b) 771 bool CSSPropertyAnimation::propertiesEqual(CSSPropertyID prop, const RenderStyle * a, const RenderStyle* b)
1169 { 772 {
1170 ensurePropertyMap(); 773 ensurePropertyMap();
1171 774
1172 AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop); 775 AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop);
1173 if (wrapper) 776 if (wrapper)
1174 return wrapper->equals(a, b); 777 return wrapper->equals(a, b);
1175 return true; 778 return true;
1176 } 779 }
1177 780
1178 CSSPropertyID CSSPropertyAnimation::getPropertyAtIndex(int i, bool& isShorthand)
1179 {
1180 ensurePropertyMap();
1181
1182 if (i < 0 || i >= getNumProperties())
1183 return CSSPropertyInvalid;
1184
1185 AnimationPropertyWrapperBase* wrapper = (*gPropertyWrappers)[i];
1186 isShorthand = wrapper->isShorthandWrapper();
1187 return wrapper->property();
1188 }
1189
1190 int CSSPropertyAnimation::getNumProperties()
1191 {
1192 ensurePropertyMap();
1193
1194 return gPropertyWrappers->size();
1195 }
1196 781
1197 } 782 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698