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

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: Fix TestExpectations. 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 19 matching lines...) Expand all
30 #include "config.h" 30 #include "config.h"
31 #include "core/frame/animation/CSSPropertyAnimation.h" 31 #include "core/frame/animation/CSSPropertyAnimation.h"
32 32
33 #include <algorithm> 33 #include <algorithm>
34 #include "StylePropertyShorthand.h" 34 #include "StylePropertyShorthand.h"
35 #include "core/animation/css/CSSAnimations.h" 35 #include "core/animation/css/CSSAnimations.h"
36 #include "core/css/CSSCrossfadeValue.h" 36 #include "core/css/CSSCrossfadeValue.h"
37 #include "core/css/CSSImageValue.h" 37 #include "core/css/CSSImageValue.h"
38 #include "core/css/CSSPrimitiveValue.h" 38 #include "core/css/CSSPrimitiveValue.h"
39 #include "core/fetch/ImageResource.h" 39 #include "core/fetch/ImageResource.h"
40 #include "core/frame/animation/AnimationBase.h"
41 #include "core/rendering/ClipPathOperation.h" 40 #include "core/rendering/ClipPathOperation.h"
42 #include "core/rendering/RenderBox.h" 41 #include "core/rendering/RenderBox.h"
43 #include "core/rendering/style/RenderStyle.h" 42 #include "core/rendering/style/RenderStyle.h"
44 #include "core/rendering/style/ShadowList.h" 43 #include "core/rendering/style/ShadowList.h"
45 #include "core/rendering/style/StyleFetchedImage.h" 44 #include "core/rendering/style/StyleFetchedImage.h"
46 #include "core/rendering/style/StyleGeneratedImage.h" 45 #include "core/rendering/style/StyleGeneratedImage.h"
47 #include "platform/FloatConversion.h" 46 #include "platform/FloatConversion.h"
48 #include "wtf/Noncopyable.h" 47 #include "wtf/Noncopyable.h"
49 48
50 namespace WebCore { 49 namespace WebCore {
51 50
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
266 class AnimationPropertyWrapperBase { 51 class AnimationPropertyWrapperBase {
267 WTF_MAKE_NONCOPYABLE(AnimationPropertyWrapperBase); 52 WTF_MAKE_NONCOPYABLE(AnimationPropertyWrapperBase);
268 WTF_MAKE_FAST_ALLOCATED; 53 WTF_MAKE_FAST_ALLOCATED;
269 public: 54 public:
270 AnimationPropertyWrapperBase(CSSPropertyID prop) 55 AnimationPropertyWrapperBase(CSSPropertyID prop)
271 : m_prop(prop) 56 : m_prop(prop)
272 { 57 {
273 } 58 }
274 59
275 virtual ~AnimationPropertyWrapperBase() { } 60 virtual ~AnimationPropertyWrapperBase() { }
276 61
277 virtual bool isShorthandWrapper() const { return false; }
278 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const = 0; 62 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 63
281 CSSPropertyID property() const { return m_prop; } 64 CSSPropertyID property() const { return m_prop; }
282 65
283 virtual bool animationIsAccelerated() const { return false; }
284
285 private: 66 private:
286 CSSPropertyID m_prop; 67 CSSPropertyID m_prop;
287 }; 68 };
288 69
289 static int gPropertyWrapperMap[numCSSProperties]; 70 static int gPropertyWrapperMap[numCSSProperties];
290 static const int cInvalidPropertyWrapperIndex = -1; 71 static const int cInvalidPropertyWrapperIndex = -1;
291 static Vector<AnimationPropertyWrapperBase*>* gPropertyWrappers = 0; 72 static Vector<AnimationPropertyWrapperBase*>* gPropertyWrappers = 0;
292 73
293 static void addPropertyWrapper(CSSPropertyID propertyID, AnimationPropertyWrappe rBase* wrapper)
294 {
295 int propIndex = propertyID - firstCSSProperty;
296
297 ASSERT(gPropertyWrapperMap[propIndex] == cInvalidPropertyWrapperIndex);
298
299 unsigned wrapperIndex = gPropertyWrappers->size();
300 gPropertyWrappers->append(wrapper);
301 gPropertyWrapperMap[propIndex] = wrapperIndex;
302 }
303
304 static AnimationPropertyWrapperBase* wrapperForProperty(CSSPropertyID propertyID ) 74 static AnimationPropertyWrapperBase* wrapperForProperty(CSSPropertyID propertyID )
305 { 75 {
306 int propIndex = propertyID - firstCSSProperty; 76 int propIndex = propertyID - firstCSSProperty;
307 if (propIndex >= 0 && propIndex < numCSSProperties) { 77 if (propIndex >= 0 && propIndex < numCSSProperties) {
308 int wrapperIndex = gPropertyWrapperMap[propIndex]; 78 int wrapperIndex = gPropertyWrapperMap[propIndex];
309 if (wrapperIndex >= 0) 79 if (wrapperIndex >= 0)
310 return (*gPropertyWrappers)[wrapperIndex]; 80 return (*gPropertyWrappers)[wrapperIndex];
311 } 81 }
312 return 0; 82 return 0;
313 } 83 }
(...skipping 18 matching lines...) Expand all
332 return (a->*m_getter)() == (b->*m_getter)(); 102 return (a->*m_getter)() == (b->*m_getter)();
333 } 103 }
334 104
335 protected: 105 protected:
336 T (RenderStyle::*m_getter)() const; 106 T (RenderStyle::*m_getter)() const;
337 }; 107 };
338 108
339 template <typename T> 109 template <typename T>
340 class PropertyWrapper : public PropertyWrapperGetter<T> { 110 class PropertyWrapper : public PropertyWrapperGetter<T> {
341 public: 111 public:
342 PropertyWrapper(CSSPropertyID prop, T (RenderStyle::*getter)() const, void ( RenderStyle::*setter)(T)) 112 PropertyWrapper(CSSPropertyID prop, T (RenderStyle::*getter)() const)
343 : PropertyWrapperGetter<T>(prop, getter) 113 : PropertyWrapperGetter<T>(prop, getter)
344 , m_setter(setter)
345 { 114 {
346 } 115 }
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 };
356
357 class NonNegativeLengthWrapper FINAL : public PropertyWrapper<Length> {
358 public:
359 NonNegativeLengthWrapper(CSSPropertyID prop, Length (RenderStyle::*getter)() const, void (RenderStyle::*setter)(Length))
360 : PropertyWrapper<Length>(prop, getter, setter)
361 {
362 }
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 }; 116 };
371 117
372 template <typename T> 118 template <typename T>
373 class RefCountedPropertyWrapper : public PropertyWrapperGetter<T*> { 119 class RefCountedPropertyWrapper : public PropertyWrapperGetter<T*> {
374 public: 120 public:
375 RefCountedPropertyWrapper(CSSPropertyID prop, T* (RenderStyle::*getter)() co nst, void (RenderStyle::*setter)(PassRefPtr<T>)) 121 RefCountedPropertyWrapper(CSSPropertyID prop, T* (RenderStyle::*getter)() co nst)
376 : PropertyWrapperGetter<T*>(prop, getter) 122 : PropertyWrapperGetter<T*>(prop, getter)
377 , m_setter(setter)
378 { 123 {
379 } 124 }
380 125
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 126 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
387 { 127 {
388 if (a == b) 128 if (a == b)
389 return true; 129 return true;
390 if (!a || !b) 130 if (!a || !b)
391 return false; 131 return false;
392 const T* aValue = (a->*this->m_getter)(); 132 const T* aValue = (a->*this->m_getter)();
393 const T* bValue = (b->*this->m_getter)(); 133 const T* bValue = (b->*this->m_getter)();
394 if (aValue == bValue) 134 if (aValue == bValue)
395 return true; 135 return true;
396 if (!aValue || !bValue) 136 if (!aValue || !bValue)
397 return false; 137 return false;
398 return *aValue == *bValue; 138 return *aValue == *bValue;
399 } 139 }
400
401 protected:
402 void (RenderStyle::*m_setter)(PassRefPtr<T>);
403 }; 140 };
404 141
405 142
406 class PropertyWrapperClipPath : public RefCountedPropertyWrapper<ClipPathOperati on> {
407 public:
408 PropertyWrapperClipPath(CSSPropertyID prop, ClipPathOperation* (RenderStyle: :*getter)() const, void (RenderStyle::*setter)(PassRefPtr<ClipPathOperation>))
409 : RefCountedPropertyWrapper<ClipPathOperation>(prop, getter, setter)
410 {
411 }
412 };
413
414 class PropertyWrapperShape : public RefCountedPropertyWrapper<ShapeValue> {
415 public:
416 PropertyWrapperShape(CSSPropertyID prop, ShapeValue* (RenderStyle::*getter)( ) const, void (RenderStyle::*setter)(PassRefPtr<ShapeValue>))
417 : RefCountedPropertyWrapper<ShapeValue>(prop, getter, setter)
418 {
419 }
420 };
421
422 class StyleImagePropertyWrapper FINAL : public RefCountedPropertyWrapper<StyleIm age> { 143 class StyleImagePropertyWrapper FINAL : public RefCountedPropertyWrapper<StyleIm age> {
423 public: 144 public:
424 StyleImagePropertyWrapper(CSSPropertyID prop, StyleImage* (RenderStyle::*get ter)() const, void (RenderStyle::*setter)(PassRefPtr<StyleImage>)) 145 StyleImagePropertyWrapper(CSSPropertyID prop, StyleImage* (RenderStyle::*get ter)() const)
425 : RefCountedPropertyWrapper<StyleImage>(prop, getter, setter) 146 : RefCountedPropertyWrapper<StyleImage>(prop, getter)
426 { 147 {
427 } 148 }
428 149
429 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 150 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
430 { 151 {
431 // If the style pointers are the same, don't bother doing the test. 152 // 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. 153 // If either is null, return false. If both are null, return true.
433 if (a == b) 154 if (a == b)
434 return true; 155 return true;
435 if (!a || !b) 156 if (!a || !b)
436 return false; 157 return false;
437 158
438 StyleImage* imageA = (a->*m_getter)(); 159 StyleImage* imageA = (a->*m_getter)();
439 StyleImage* imageB = (b->*m_getter)(); 160 StyleImage* imageB = (b->*m_getter)();
440 return StyleImage::imagesEquivalent(imageA, imageB); 161 return StyleImage::imagesEquivalent(imageA, imageB);
441 } 162 }
442 }; 163 };
443 164
444 class PropertyWrapperColor FINAL : public PropertyWrapperGetter<Color> {
445 public:
446 PropertyWrapperColor(CSSPropertyID prop, Color (RenderStyle::*getter)() cons t, void (RenderStyle::*setter)(const Color&))
447 : PropertyWrapperGetter<Color>(prop, getter)
448 , m_setter(setter)
449 {
450 }
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 };
460
461 class PropertyWrapperAcceleratedOpacity FINAL : public PropertyWrapper<float> {
462 public:
463 PropertyWrapperAcceleratedOpacity()
464 : PropertyWrapper<float>(CSSPropertyOpacity, &RenderStyle::opacity, &Ren derStyle::setOpacity)
465 {
466 }
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 };
478
479 class PropertyWrapperAcceleratedTransform FINAL : public PropertyWrapper<const T ransformOperations&> {
480 public:
481 PropertyWrapperAcceleratedTransform()
482 : PropertyWrapper<const TransformOperations&>(CSSPropertyWebkitTransform , &RenderStyle::transform, &RenderStyle::setTransform)
483 {
484 }
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 };
493
494 class PropertyWrapperAcceleratedFilter FINAL : public PropertyWrapper<const Filt erOperations&> {
495 public:
496 PropertyWrapperAcceleratedFilter()
497 : PropertyWrapper<const FilterOperations&>(CSSPropertyWebkitFilter, &Ren derStyle::filter, &RenderStyle::setFilter)
498 {
499 }
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 };
508
509 class PropertyWrapperShadow FINAL : public AnimationPropertyWrapperBase { 165 class PropertyWrapperShadow FINAL : public AnimationPropertyWrapperBase {
510 public: 166 public:
511 PropertyWrapperShadow(CSSPropertyID prop, ShadowList* (RenderStyle::*getter) () const, void (RenderStyle::*setter)(PassRefPtr<ShadowList>)) 167 PropertyWrapperShadow(CSSPropertyID prop, ShadowList* (RenderStyle::*getter) () const)
512 : AnimationPropertyWrapperBase(prop) 168 : AnimationPropertyWrapperBase(prop)
513 , m_getter(getter) 169 , m_getter(getter)
514 , m_setter(setter)
515 { 170 {
516 } 171 }
517 172
518 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 173 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
519 { 174 {
520 const ShadowList* shadowA = (a->*m_getter)(); 175 const ShadowList* shadowA = (a->*m_getter)();
521 const ShadowList* shadowB = (b->*m_getter)(); 176 const ShadowList* shadowB = (b->*m_getter)();
522 if (shadowA == shadowB) 177 if (shadowA == shadowB)
523 return true; 178 return true;
524 if (shadowA && shadowB) 179 if (shadowA && shadowB)
525 return *shadowA == *shadowB; 180 return *shadowA == *shadowB;
526 return false; 181 return false;
527 } 182 }
528 183
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; 184 ShadowList* (RenderStyle::*m_getter)() const;
535 void (RenderStyle::*m_setter)(PassRefPtr<ShadowList>);
536 }; 185 };
537 186
538 class PropertyWrapperMaybeInvalidStyleColor FINAL : public AnimationPropertyWrap perBase { 187 class PropertyWrapperMaybeInvalidStyleColor FINAL : public AnimationPropertyWrap perBase {
539 public: 188 public:
540 PropertyWrapperMaybeInvalidStyleColor(CSSPropertyID prop, StyleColor (Render Style::*getter)() const, void (RenderStyle::*setter)(const StyleColor&)) 189 PropertyWrapperMaybeInvalidStyleColor(CSSPropertyID prop, StyleColor (Render Style::*getter)() const)
541 : AnimationPropertyWrapperBase(prop) 190 : AnimationPropertyWrapperBase(prop)
542 , m_getter(getter) 191 , m_getter(getter)
543 , m_setter(setter)
544 { 192 {
545 } 193 }
546 194
547 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 195 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
548 { 196 {
549 StyleColor fromColor = (a->*m_getter)(); 197 StyleColor fromColor = (a->*m_getter)();
550 StyleColor toColor = (b->*m_getter)(); 198 StyleColor toColor = (b->*m_getter)();
551 199
552 if (fromColor.isCurrentColor() && toColor.isCurrentColor()) 200 if (fromColor.isCurrentColor() && toColor.isCurrentColor())
553 return true; 201 return true;
554 202
555 return fromColor.resolve(a->color()) == toColor.resolve(b->color()); 203 return fromColor.resolve(a->color()) == toColor.resolve(b->color());
556 } 204 }
557 205
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: 206 private:
570 StyleColor (RenderStyle::*m_getter)() const; 207 StyleColor (RenderStyle::*m_getter)() const;
571 void (RenderStyle::*m_setter)(const StyleColor&);
572 }; 208 };
573 209
574 210
575 class PropertyWrapperVisitedAffectedColor FINAL : public AnimationPropertyWrappe rBase { 211 class PropertyWrapperVisitedAffectedColor FINAL : public AnimationPropertyWrappe rBase {
576 public: 212 public:
577 PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, Color (RenderStyle:: *getter)() const, void (RenderStyle::*setter)(const Color&), 213 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) 214 : AnimationPropertyWrapperBase(prop)
580 , m_wrapper(adoptPtr(new PropertyWrapperColor(prop, getter, setter))) 215 , m_wrapper(adoptPtr(new PropertyWrapper<Color>(prop, getter)))
581 , m_visitedWrapper(adoptPtr(new PropertyWrapperColor(prop, visitedGetter , visitedSetter))) 216 , m_visitedWrapper(adoptPtr(new PropertyWrapper<Color>(prop, visitedGett er)))
582 { 217 {
583 } 218 }
584 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const 219 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const
585 { 220 {
586 return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b); 221 return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b);
587 } 222 }
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 223
594 private: 224 private:
595 OwnPtr<AnimationPropertyWrapperBase> m_wrapper; 225 OwnPtr<AnimationPropertyWrapperBase> m_wrapper;
596 OwnPtr<AnimationPropertyWrapperBase> m_visitedWrapper; 226 OwnPtr<AnimationPropertyWrapperBase> m_visitedWrapper;
597 }; 227 };
598 228
599 class PropertyWrapperVisitedAffectedStyleColor FINAL : public AnimationPropertyW rapperBase { 229 class PropertyWrapperVisitedAffectedStyleColor FINAL : public AnimationPropertyW rapperBase {
600 public: 230 public:
601 PropertyWrapperVisitedAffectedStyleColor(CSSPropertyID prop, StyleColor (Ren derStyle::*getter)() const, void (RenderStyle::*setter)(const StyleColor&), 231 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) 232 : AnimationPropertyWrapperBase(prop)
604 , m_wrapper(adoptPtr(new PropertyWrapperMaybeInvalidStyleColor(prop, get ter, setter))) 233 , m_wrapper(adoptPtr(new PropertyWrapperMaybeInvalidStyleColor(prop, get ter)))
605 , m_visitedWrapper(adoptPtr(new PropertyWrapperMaybeInvalidStyleColor(pr op, visitedGetter, visitedSetter))) 234 , m_visitedWrapper(adoptPtr(new PropertyWrapperMaybeInvalidStyleColor(pr op, visitedGetter)))
606 { 235 {
607 } 236 }
608 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 237 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
609 { 238 {
610 return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b); 239 return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b);
611 } 240 }
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 241
618 private: 242 private:
619 OwnPtr<AnimationPropertyWrapperBase> m_wrapper; 243 OwnPtr<AnimationPropertyWrapperBase> m_wrapper;
620 OwnPtr<AnimationPropertyWrapperBase> m_visitedWrapper; 244 OwnPtr<AnimationPropertyWrapperBase> m_visitedWrapper;
621 }; 245 };
622 246
623 // Wrapper base class for an animatable property in a FillLayer 247 // Wrapper base class for an animatable property in a FillLayer
624 class FillLayerAnimationPropertyWrapperBase { 248 class FillLayerAnimationPropertyWrapperBase {
625 public: 249 public:
626 FillLayerAnimationPropertyWrapperBase() 250 FillLayerAnimationPropertyWrapperBase()
627 { 251 {
628 } 252 }
629 253
630 virtual ~FillLayerAnimationPropertyWrapperBase() { } 254 virtual ~FillLayerAnimationPropertyWrapperBase() { }
631 255
632 virtual bool equals(const FillLayer*, const FillLayer*) const = 0; 256 virtual bool equals(const FillLayer*, const FillLayer*) const = 0;
633 virtual void blend(const AnimationBase*, FillLayer*, const FillLayer*, const FillLayer*, double) const = 0;
634 }; 257 };
635 258
636 template <typename T> 259 template <typename T>
637 class FillLayerPropertyWrapperGetter : public FillLayerAnimationPropertyWrapperB ase { 260 class FillLayerPropertyWrapperGetter : public FillLayerAnimationPropertyWrapperB ase {
638 WTF_MAKE_NONCOPYABLE(FillLayerPropertyWrapperGetter); 261 WTF_MAKE_NONCOPYABLE(FillLayerPropertyWrapperGetter);
639 public: 262 public:
640 FillLayerPropertyWrapperGetter(T (FillLayer::*getter)() const) 263 FillLayerPropertyWrapperGetter(T (FillLayer::*getter)() const)
641 : m_getter(getter) 264 : m_getter(getter)
642 { 265 {
643 } 266 }
644 267
645 virtual bool equals(const FillLayer* a, const FillLayer* b) const 268 virtual bool equals(const FillLayer* a, const FillLayer* b) const
646 { 269 {
647 // If the style pointers are the same, don't bother doing the test. 270 // 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. 271 // If either is null, return false. If both are null, return true.
649 if ((!a && !b) || a == b) 272 if ((!a && !b) || a == b)
650 return true; 273 return true;
651 if (!a || !b) 274 if (!a || !b)
652 return false; 275 return false;
653 return (a->*m_getter)() == (b->*m_getter)(); 276 return (a->*m_getter)() == (b->*m_getter)();
654 } 277 }
655 278
656 protected: 279 protected:
657 T (FillLayer::*m_getter)() const; 280 T (FillLayer::*m_getter)() const;
658 }; 281 };
659 282
660 template <typename T> 283 template <typename T>
661 class FillLayerPropertyWrapper FINAL : public FillLayerPropertyWrapperGetter<T> { 284 class FillLayerPropertyWrapper FINAL : public FillLayerPropertyWrapperGetter<T> {
662 public: 285 public:
663 FillLayerPropertyWrapper(T (FillLayer::*getter)() const, void (FillLayer::*s etter)(T)) 286 FillLayerPropertyWrapper(T (FillLayer::*getter)() const)
664 : FillLayerPropertyWrapperGetter<T>(getter) 287 : FillLayerPropertyWrapperGetter<T>(getter)
665 , m_setter(setter)
666 { 288 {
667 } 289 }
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 }; 290 };
677 291
678 template <typename T> 292 template <typename T>
679 class FillLayerRefCountedPropertyWrapper : public FillLayerPropertyWrapperGetter <T*> { 293 class FillLayerRefCountedPropertyWrapper : public FillLayerPropertyWrapperGetter <T*> {
680 public: 294 public:
681 FillLayerRefCountedPropertyWrapper(T* (FillLayer::*getter)() const, void (Fi llLayer::*setter)(PassRefPtr<T>)) 295 FillLayerRefCountedPropertyWrapper(T* (FillLayer::*getter)() const)
682 : FillLayerPropertyWrapperGetter<T*>(getter) 296 : FillLayerPropertyWrapperGetter<T*>(getter)
683 , m_setter(setter)
684 { 297 {
685 } 298 }
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 }; 299 };
695 300
696 class FillLayerStyleImagePropertyWrapper FINAL : public FillLayerRefCountedPrope rtyWrapper<StyleImage> { 301 class FillLayerStyleImagePropertyWrapper FINAL : public FillLayerRefCountedPrope rtyWrapper<StyleImage> {
697 public: 302 public:
698 FillLayerStyleImagePropertyWrapper(StyleImage* (FillLayer::*getter)() const, void (FillLayer::*setter)(PassRefPtr<StyleImage>)) 303 FillLayerStyleImagePropertyWrapper(StyleImage* (FillLayer::*getter)() const)
699 : FillLayerRefCountedPropertyWrapper<StyleImage>(getter, setter) 304 : FillLayerRefCountedPropertyWrapper<StyleImage>(getter)
700 { 305 {
701 } 306 }
702 307
703 virtual bool equals(const FillLayer* a, const FillLayer* b) const OVERRIDE 308 virtual bool equals(const FillLayer* a, const FillLayer* b) const OVERRIDE
704 { 309 {
705 // If the style pointers are the same, don't bother doing the test. 310 // 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. 311 // If either is null, return false. If both are null, return true.
707 if (a == b) 312 if (a == b)
708 return true; 313 return true;
709 if (!a || !b) 314 if (!a || !b)
710 return false; 315 return false;
711 316
712 StyleImage* imageA = (a->*m_getter)(); 317 StyleImage* imageA = (a->*m_getter)();
713 StyleImage* imageB = (b->*m_getter)(); 318 StyleImage* imageB = (b->*m_getter)();
714 return StyleImage::imagesEquivalent(imageA, imageB); 319 return StyleImage::imagesEquivalent(imageA, imageB);
715 } 320 }
716 }; 321 };
717 322
718 323
719 class FillLayersPropertyWrapper FINAL : public AnimationPropertyWrapperBase { 324 class FillLayersPropertyWrapper FINAL : public AnimationPropertyWrapperBase {
720 public: 325 public:
721 typedef const FillLayer* (RenderStyle::*LayersGetter)() const; 326 typedef const FillLayer* (RenderStyle::*LayersGetter)() const;
722 typedef FillLayer* (RenderStyle::*LayersAccessor)();
723 327
724 FillLayersPropertyWrapper(CSSPropertyID prop, LayersGetter getter, LayersAcc essor accessor) 328 FillLayersPropertyWrapper(CSSPropertyID prop, LayersGetter getter)
725 : AnimationPropertyWrapperBase(prop) 329 : AnimationPropertyWrapperBase(prop)
726 , m_layersGetter(getter) 330 , m_layersGetter(getter)
727 , m_layersAccessor(accessor)
728 { 331 {
729 switch (prop) { 332 switch (prop) {
730 case CSSPropertyBackgroundPositionX: 333 case CSSPropertyBackgroundPositionX:
731 case CSSPropertyWebkitMaskPositionX: 334 case CSSPropertyWebkitMaskPositionX:
732 m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&F illLayer::xPosition, &FillLayer::setXPosition); 335 m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&F illLayer::xPosition);
733 break; 336 break;
734 case CSSPropertyBackgroundPositionY: 337 case CSSPropertyBackgroundPositionY:
735 case CSSPropertyWebkitMaskPositionY: 338 case CSSPropertyWebkitMaskPositionY:
736 m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&F illLayer::yPosition, &FillLayer::setYPosition); 339 m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&F illLayer::yPosition);
737 break; 340 break;
738 case CSSPropertyBackgroundSize: 341 case CSSPropertyBackgroundSize:
739 case CSSPropertyWebkitBackgroundSize: 342 case CSSPropertyWebkitBackgroundSize:
740 case CSSPropertyWebkitMaskSize: 343 case CSSPropertyWebkitMaskSize:
741 m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<LengthSize >(&FillLayer::sizeLength, &FillLayer::setSizeLength); 344 m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<LengthSize >(&FillLayer::sizeLength);
742 break; 345 break;
743 case CSSPropertyBackgroundImage: 346 case CSSPropertyBackgroundImage:
744 m_fillLayerPropertyWrapper = new FillLayerStyleImagePropertyWrapper( &FillLayer::image, &FillLayer::setImage); 347 m_fillLayerPropertyWrapper = new FillLayerStyleImagePropertyWrapper( &FillLayer::image);
745 break; 348 break;
746 default: 349 default:
747 break; 350 break;
748 } 351 }
749 } 352 }
750 353
751 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 354 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
752 { 355 {
753 const FillLayer* fromLayer = (a->*m_layersGetter)(); 356 const FillLayer* fromLayer = (a->*m_layersGetter)();
754 const FillLayer* toLayer = (b->*m_layersGetter)(); 357 const FillLayer* toLayer = (b->*m_layersGetter)();
755 358
756 while (fromLayer && toLayer) { 359 while (fromLayer && toLayer) {
757 if (!m_fillLayerPropertyWrapper->equals(fromLayer, toLayer)) 360 if (!m_fillLayerPropertyWrapper->equals(fromLayer, toLayer))
758 return false; 361 return false;
759 362
760 fromLayer = fromLayer->next(); 363 fromLayer = fromLayer->next();
761 toLayer = toLayer->next(); 364 toLayer = toLayer->next();
762 } 365 }
763 366
764 return true; 367 return true;
765 } 368 }
766 369
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: 370 private:
782 FillLayerAnimationPropertyWrapperBase* m_fillLayerPropertyWrapper; 371 FillLayerAnimationPropertyWrapperBase* m_fillLayerPropertyWrapper;
783 372
784 LayersGetter m_layersGetter; 373 LayersGetter m_layersGetter;
785 LayersAccessor m_layersAccessor;
786 };
787
788 class ShorthandPropertyWrapper FINAL : public AnimationPropertyWrapperBase {
789 public:
790 ShorthandPropertyWrapper(CSSPropertyID property, const StylePropertyShorthan d& shorthand)
791 : AnimationPropertyWrapperBase(property)
792 {
793 for (unsigned i = 0; i < shorthand.length(); ++i) {
794 AnimationPropertyWrapperBase* wrapper = wrapperForProperty(shorthand .properties()[i]);
795 if (wrapper)
796 m_propertyWrappers.append(wrapper);
797 }
798 }
799
800 virtual bool isShorthandWrapper() const OVERRIDE { return true; }
801
802 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
803 {
804 Vector<AnimationPropertyWrapperBase*>::const_iterator end = m_propertyWr appers.end();
805 for (Vector<AnimationPropertyWrapperBase*>::const_iterator it = m_proper tyWrappers.begin(); it != end; ++it) {
806 if (!(*it)->equals(a, b))
807 return false;
808 }
809 return true;
810 }
811
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; }
820
821 private:
822 Vector<AnimationPropertyWrapperBase*> m_propertyWrappers;
823 };
824
825 class PropertyWrapperFlex FINAL : public AnimationPropertyWrapperBase {
826 public:
827 PropertyWrapperFlex()
828 : AnimationPropertyWrapperBase(CSSPropertyFlex)
829 {
830 }
831
832 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
833 {
834 // 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.
836 if ((!a && !b) || a == b)
837 return true;
838 if (!a || !b)
839 return false;
840
841 return a->flexBasis() == b->flexBasis() && a->flexGrow() == b->flexGrow( ) && a->flexShrink() == b->flexShrink();
842 }
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 }; 374 };
851 375
852 class PropertyWrapperSVGPaint FINAL : public AnimationPropertyWrapperBase { 376 class PropertyWrapperSVGPaint FINAL : public AnimationPropertyWrapperBase {
853 public: 377 public:
854 PropertyWrapperSVGPaint(CSSPropertyID prop, const SVGPaint::SVGPaintType& (R enderStyle::*paintTypeGetter)() const, Color (RenderStyle::*getter)() const, voi d (RenderStyle::*setter)(const Color&)) 378 PropertyWrapperSVGPaint(CSSPropertyID prop, const SVGPaint::SVGPaintType& (R enderStyle::*paintTypeGetter)() const, Color (RenderStyle::*getter)() const)
855 : AnimationPropertyWrapperBase(prop) 379 : AnimationPropertyWrapperBase(prop)
856 , m_paintTypeGetter(paintTypeGetter) 380 , m_paintTypeGetter(paintTypeGetter)
857 , m_getter(getter) 381 , m_getter(getter)
858 , m_setter(setter)
859 { 382 {
860 } 383 }
861 384
862 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE 385 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
863 { 386 {
864 if ((a->*m_paintTypeGetter)() != (b->*m_paintTypeGetter)()) 387 if ((a->*m_paintTypeGetter)() != (b->*m_paintTypeGetter)())
865 return false; 388 return false;
866 389
867 // We only support animations between SVGPaints that are pure Color valu es. 390 // We only support animations between SVGPaints that are pure Color valu es.
868 // For everything else we must return true for this method, otherwise 391 // For everything else we must return true for this method, otherwise
869 // we will try to animate between values forever. 392 // we will try to animate between values forever.
870 if ((a->*m_paintTypeGetter)() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR) { 393 if ((a->*m_paintTypeGetter)() == SVGPaint::SVG_PAINTTYPE_RGBCOLOR) {
871 Color fromColor = (a->*m_getter)(); 394 Color fromColor = (a->*m_getter)();
872 Color toColor = (b->*m_getter)(); 395 Color toColor = (b->*m_getter)();
873 return fromColor == toColor; 396 return fromColor == toColor;
874 } 397 }
875 return true; 398 return true;
876 } 399 }
877 400
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: 401 private:
891 const SVGPaint::SVGPaintType& (RenderStyle::*m_paintTypeGetter)() const; 402 const SVGPaint::SVGPaintType& (RenderStyle::*m_paintTypeGetter)() const;
892 Color (RenderStyle::*m_getter)() const; 403 Color (RenderStyle::*m_getter)() const;
893 void (RenderStyle::*m_setter)(const Color&);
894 }; 404 };
895 405
896 template <typename T> 406 template <typename T>
897 class RefCountedSVGPropertyWrapper : public AnimationPropertyWrapperBase { 407 class RefCountedSVGPropertyWrapper : public AnimationPropertyWrapperBase {
898 public: 408 public:
899 RefCountedSVGPropertyWrapper(CSSPropertyID prop, PassRefPtr<T> (RenderStyle: :*getter)() const, void (RenderStyle::*setter)(PassRefPtr<T>)) 409 RefCountedSVGPropertyWrapper(CSSPropertyID prop, PassRefPtr<T> (RenderStyle: :*getter)() const)
900 : AnimationPropertyWrapperBase(prop) 410 : AnimationPropertyWrapperBase(prop)
901 , m_getter(getter) 411 , m_getter(getter)
902 , m_setter(setter)
903 { 412 {
904 } 413 }
905 414
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 415 virtual bool equals(const RenderStyle* a, const RenderStyle* b) const OVERRI DE
912 { 416 {
913 if (a == b) 417 if (a == b)
914 return true; 418 return true;
915 if (!a || !b) 419 if (!a || !b)
916 return false; 420 return false;
917 RefPtr<T> aValue = (a->*this->m_getter)(); 421 RefPtr<T> aValue = (a->*this->m_getter)();
918 RefPtr<T> bValue = (b->*this->m_getter)(); 422 RefPtr<T> bValue = (b->*this->m_getter)();
919 if (aValue == bValue) 423 if (aValue == bValue)
920 return true; 424 return true;
921 if (!aValue || !bValue) 425 if (!aValue || !bValue)
922 return false; 426 return false;
923 return *aValue == *bValue; 427 return *aValue == *bValue;
924 } 428 }
925 429
926 protected: 430 protected:
927 PassRefPtr<T> (RenderStyle::*m_getter)() const; 431 PassRefPtr<T> (RenderStyle::*m_getter)() const;
928 void (RenderStyle::*m_setter)(PassRefPtr<T>);
929 }; 432 };
930 433
931 static void addShorthandProperties()
932 {
933 static const CSSPropertyID animatableShorthandProperties[] = {
934 CSSPropertyBackground, // for background-color, background-position, bac kground-image
935 CSSPropertyBackgroundPosition,
936 CSSPropertyFont, // for font-size, font-weight
937 CSSPropertyWebkitMask, // for mask-position
938 CSSPropertyWebkitMaskPosition,
939 CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, C SSPropertyBorderLeft,
940 CSSPropertyBorderColor,
941 CSSPropertyBorderRadius,
942 CSSPropertyBorderWidth,
943 CSSPropertyBorder,
944 CSSPropertyBorderImage,
945 CSSPropertyBorderSpacing,
946 CSSPropertyListStyle, // for list-style-image
947 CSSPropertyMargin,
948 CSSPropertyOutline,
949 CSSPropertyPadding,
950 CSSPropertyWebkitTextStroke,
951 CSSPropertyWebkitColumnRule,
952 CSSPropertyWebkitBorderRadius,
953 CSSPropertyWebkitTransformOrigin
954 };
955
956 for (size_t i = 0; i < WTF_ARRAY_LENGTH(animatableShorthandProperties); ++i) {
957 CSSPropertyID propertyID = animatableShorthandProperties[i];
958 StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
959 if (shorthand.length() > 0)
960 addPropertyWrapper(propertyID, new ShorthandPropertyWrapper(property ID, shorthand));
961 }
962 }
963
964 void CSSPropertyAnimation::ensurePropertyMap() 434 void CSSPropertyAnimation::ensurePropertyMap()
965 { 435 {
966 // FIXME: This data is never destroyed. Maybe we should ref count it and tos s it when the last AnimationController is destroyed? 436 // 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) 437 if (gPropertyWrappers)
968 return; 438 return;
969 439
970 gPropertyWrappers = new Vector<AnimationPropertyWrapperBase*>(); 440 gPropertyWrappers = new Vector<AnimationPropertyWrapperBase*>();
971 441
972 // build the list of property wrappers to do the comparisons and blends 442 // build the list of property wrappers to do the comparisons and blends
973 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyLeft, &Rend erStyle::left, &RenderStyle::setLeft)); 443 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyLeft, &Rend erStyle::left));
974 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyRight, &Ren derStyle::right, &RenderStyle::setRight)); 444 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyRight, &Ren derStyle::right));
975 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyTop, &Rende rStyle::top, &RenderStyle::setTop)); 445 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyTop, &Rende rStyle::top));
976 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyBottom, &Re nderStyle::bottom, &RenderStyle::setBottom)); 446 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyBottom, &Re nderStyle::bottom));
977 447
978 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWidth, &Ren derStyle::width, &RenderStyle::setWidth)); 448 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWidth, &Ren derStyle::width));
979 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMinWidth, & RenderStyle::minWidth, &RenderStyle::setMinWidth)); 449 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMinWidth, & RenderStyle::minWidth));
980 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxWidth, & RenderStyle::maxWidth, &RenderStyle::setMaxWidth)); 450 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxWidth, & RenderStyle::maxWidth));
981 451
982 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyHeight, &Re nderStyle::height, &RenderStyle::setHeight)); 452 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyHeight, &Re nderStyle::height));
983 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMinHeight, &RenderStyle::minHeight, &RenderStyle::setMinHeight)); 453 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMinHeight, &RenderStyle::minHeight));
984 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxHeight, &RenderStyle::maxHeight, &RenderStyle::setMaxHeight)); 454 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxHeight, &RenderStyle::maxHeight));
985 455
986 if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) 456 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderLef tWidth, &RenderStyle::borderLeftWidth));
987 gPropertyWrappers->append(new PropertyWrapperFlex()); 457 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderRig htWidth, &RenderStyle::borderRightWidth));
458 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderTop Width, &RenderStyle::borderTopWidth));
459 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderBot tomWidth, &RenderStyle::borderBottomWidth));
460 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginLeft, &RenderStyle::marginLeft));
461 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginRight , &RenderStyle::marginRight));
462 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginTop, &RenderStyle::marginTop));
463 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginBotto m, &RenderStyle::marginBottom));
464 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingLeft , &RenderStyle::paddingLeft));
465 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingRigh t, &RenderStyle::paddingRight));
466 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingTop, &RenderStyle::paddingTop));
467 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingBott om, &RenderStyle::paddingBottom));
468 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropert yColor, &RenderStyle::color, &RenderStyle::visitedLinkColor));
988 469
989 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderLef tWidth, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth)); 470 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::visitedLinkB ackgroundColor));
990 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderRig htWidth, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth));
991 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderTop Width, &RenderStyle::borderTopWidth, &RenderStyle::setBorderTopWidth));
992 gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderBot tomWidth, &RenderStyle::borderBottomWidth, &RenderStyle::setBorderBottomWidth));
993 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginLeft, &RenderStyle::marginLeft, &RenderStyle::setMarginLeft));
994 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginRight , &RenderStyle::marginRight, &RenderStyle::setMarginRight));
995 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginTop, &RenderStyle::marginTop, &RenderStyle::setMarginTop));
996 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMarginBotto m, &RenderStyle::marginBottom, &RenderStyle::setMarginBottom));
997 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingLeft , &RenderStyle::paddingLeft, &RenderStyle::setPaddingLeft));
998 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingRigh t, &RenderStyle::paddingRight, &RenderStyle::setPaddingRight));
999 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingTop, &RenderStyle::paddingTop, &RenderStyle::setPaddingTop));
1000 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyPaddingBott om, &RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom));
1001 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedColor(CSSPropert yColor, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::visitedLinkCo lor, &RenderStyle::setVisitedLinkColor));
1002 471
1003 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroun dColor, &RenderStyle::visitedLinkBackgroundColor, &RenderStyle::setVisitedLinkBa ckgroundColor)); 472 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dImage, &RenderStyle::backgroundLayers));
473 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyListStyle Image, &RenderStyle::listStyleImage));
474 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMas kImage, &RenderStyle::maskImage));
1004 475
1005 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dImage, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); 476 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyBorderIma geSource, &RenderStyle::borderImageSource));
1006 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyListStyle Image, &RenderStyle::listStyleImage, &RenderStyle::setListStyleImage)); 477 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderIm ageSlice, &RenderStyle::borderImageSlices));
1007 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMas kImage, &RenderStyle::maskImage, &RenderStyle::setMaskImage)); 478 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyBorderImageWidth, &RenderStyle::borderImageWidth));
479 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyBorderImageOutset, &RenderStyle::borderImageOutset));
1008 480
1009 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyBorderIma geSource, &RenderStyle::borderImageSource, &RenderStyle::setBorderImageSource)); 481 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMas kBoxImageSource, &RenderStyle::maskBoxImageSource));
1010 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyBorderIm ageSlice, &RenderStyle::borderImageSlices, &RenderStyle::setBorderImageSlices)); 482 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyWebkitMa skBoxImageSlice, &RenderStyle::maskBoxImageSlices));
1011 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyBorderImageWidth, &RenderStyle::borderImageWidth, &RenderStyle::setBor derImageWidth)); 483 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyWebkitMaskBoxImageWidth, &RenderStyle::maskBoxImageWidth));
1012 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyBorderImageOutset, &RenderStyle::borderImageOutset, &RenderStyle::setB orderImageOutset)); 484 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyWebkitMaskBoxImageOutset, &RenderStyle::maskBoxImageOutset));
1013 485
1014 gPropertyWrappers->append(new StyleImagePropertyWrapper(CSSPropertyWebkitMas kBoxImageSource, &RenderStyle::maskBoxImageSource, &RenderStyle::setMaskBoxImage Source)); 486 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dPositionX, &RenderStyle::backgroundLayers));
1015 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyWebkitMa skBoxImageSlice, &RenderStyle::maskBoxImageSlices, &RenderStyle::setMaskBoxImage Slices)); 487 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dPositionY, &RenderStyle::backgroundLayers));
1016 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyWebkitMaskBoxImageWidth, &RenderStyle::maskBoxImageWidth, &RenderStyle ::setMaskBoxImageWidth)); 488 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dSize, &RenderStyle::backgroundLayers));
1017 gPropertyWrappers->append(new PropertyWrapper<const BorderImageLengthBox&>(C SSPropertyWebkitMaskBoxImageOutset, &RenderStyle::maskBoxImageOutset, &RenderSty le::setMaskBoxImageOutset)); 489 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitBac kgroundSize, &RenderStyle::backgroundLayers));
1018 490
1019 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dPositionX, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers )); 491 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kPositionX, &RenderStyle::maskLayers));
1020 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dPositionY, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers )); 492 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kPositionY, &RenderStyle::maskLayers));
1021 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroun dSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); 493 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kSize, &RenderStyle::maskLayers));
1022 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitBac kgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayer s));
1023 494
1024 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kPositionX, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); 495 gPropertyWrappers->append(new PropertyWrapper<LengthPoint>(CSSPropertyObject Position, &RenderStyle::objectPosition));
1025 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kPositionY, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers));
1026 gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMas kSize, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers));
1027
1028 gPropertyWrappers->append(new PropertyWrapper<LengthPoint>(CSSPropertyObject Position, &RenderStyle::objectPosition, &RenderStyle::setObjectPosition));
1029 496
1030 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFontSize, 497 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFontSize,
1031 // Must pass a specified size to setFontSize if Text Autosizing is enabl ed, but a computed size 498 // 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). 499 // 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 500 // 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. 501 // enable text zoom rather than Text Autosizing? See http://crbug.com/22 7545.
1035 &RenderStyle::specifiedFontSize, 502 &RenderStyle::specifiedFontSize));
1036 &RenderStyle::setFontSize)); 503 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWeb kitColumnRuleWidth, &RenderStyle::columnRuleWidth));
1037 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWeb kitColumnRuleWidth, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWi dth)); 504 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitColumn Gap, &RenderStyle::columnGap));
1038 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitColumn Gap, &RenderStyle::columnGap, &RenderStyle::setColumnGap)); 505 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWeb kitColumnCount, &RenderStyle::columnCount));
1039 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWeb kitColumnCount, &RenderStyle::columnCount, &RenderStyle::setColumnCount)); 506 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitColumn Width, &RenderStyle::columnWidth));
1040 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitColumn Width, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth)); 507 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWebkitBorder HorizontalSpacing, &RenderStyle::horizontalBorderSpacing));
1041 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWebkitBorder HorizontalSpacing, &RenderStyle::horizontalBorderSpacing, &RenderStyle::setHoriz ontalBorderSpacing)); 508 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWebkitBorder VerticalSpacing, &RenderStyle::verticalBorderSpacing));
1042 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWebkitBorder VerticalSpacing, &RenderStyle::verticalBorderSpacing, &RenderStyle::setVerticalB orderSpacing)); 509 gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyZIndex, &Rende rStyle::zIndex));
1043 gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyZIndex, &Rende rStyle::zIndex, &RenderStyle::setZIndex)); 510 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyOrphans, &Re nderStyle::orphans));
1044 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyOrphans, &Re nderStyle::orphans, &RenderStyle::setOrphans)); 511 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWidows, &Ren derStyle::widows));
1045 gPropertyWrappers->append(new PropertyWrapper<short>(CSSPropertyWidows, &Ren derStyle::widows, &RenderStyle::setWidows)); 512 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyLineHeight, &RenderStyle::specifiedLineHeight));
1046 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyLineHeight, &RenderStyle::specifiedLineHeight, &RenderStyle::setLineHeight)); 513 gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyOutlineOffset, &RenderStyle::outlineOffset));
1047 gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyOutlineOffset, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset)); 514 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyOut lineWidth, &RenderStyle::outlineWidth));
1048 gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyOut lineWidth, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth)); 515 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyLetterSpacin g, &RenderStyle::letterSpacing));
1049 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyLetterSpacin g, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing)); 516 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWordSpacing, &RenderStyle::wordSpacing));
1050 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWordSpacing, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing)); 517 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyTextIndent, &RenderStyle::textIndent));
1051 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyTextIndent, &RenderStyle::textIndent, &RenderStyle::setTextIndent));
1052 518
1053 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitPerspe ctive, &RenderStyle::perspective, &RenderStyle::setPerspective)); 519 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitPerspe ctive, &RenderStyle::perspective));
1054 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitPersp ectiveOriginX, &RenderStyle::perspectiveOriginX, &RenderStyle::setPerspectiveOri ginX)); 520 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitPersp ectiveOriginX, &RenderStyle::perspectiveOriginX));
1055 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitPersp ectiveOriginY, &RenderStyle::perspectiveOriginY, &RenderStyle::setPerspectiveOri ginY)); 521 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitPersp ectiveOriginY, &RenderStyle::perspectiveOriginY));
1056 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTrans formOriginX, &RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX)) ; 522 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTrans formOriginX, &RenderStyle::transformOriginX));
1057 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTrans formOriginY, &RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY)) ; 523 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTrans formOriginY, &RenderStyle::transformOriginY));
1058 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitTransf ormOriginZ, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ)); 524 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitTransf ormOriginZ, &RenderStyle::transformOriginZ));
1059 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderT opLeftRadius, &RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftR adius)); 525 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderT opLeftRadius, &RenderStyle::borderTopLeftRadius));
1060 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderT opRightRadius, &RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRig htRadius)); 526 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderT opRightRadius, &RenderStyle::borderTopRightRadius));
1061 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderB ottomLeftRadius, &RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBo ttomLeftRadius)); 527 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderB ottomLeftRadius, &RenderStyle::borderBottomLeftRadius));
1062 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderB ottomRightRadius, &RenderStyle::borderBottomRightRadius, &RenderStyle::setBorder BottomRightRadius)); 528 gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyBorderB ottomRightRadius, &RenderStyle::borderBottomRightRadius));
1063 gPropertyWrappers->append(new PropertyWrapper<EVisibility>(CSSPropertyVisibi lity, &RenderStyle::visibility, &RenderStyle::setVisibility)); 529 gPropertyWrappers->append(new PropertyWrapper<EVisibility>(CSSPropertyVisibi lity, &RenderStyle::visibility));
1064 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyZoom, &Rende rStyle::zoom, &RenderStyle::setZoomWithoutReturnValue)); 530 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyZoom, &Rende rStyle::zoom));
1065 531
1066 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyClip, &R enderStyle::clip, &RenderStyle::setClip)); 532 gPropertyWrappers->append(new PropertyWrapper<LengthBox>(CSSPropertyClip, &R enderStyle::clip));
1067 533
1068 gPropertyWrappers->append(new PropertyWrapperAcceleratedOpacity()); 534 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyOpacity, &Re nderStyle::opacity));
1069 gPropertyWrappers->append(new PropertyWrapperAcceleratedTransform()); 535 gPropertyWrappers->append(new PropertyWrapper<const TransformOperations&>(CS SPropertyWebkitTransform, &RenderStyle::transform));
1070 gPropertyWrappers->append(new PropertyWrapperAcceleratedFilter()); 536 gPropertyWrappers->append(new PropertyWrapper<const FilterOperations&>(CSSPr opertyWebkitFilter, &RenderStyle::filter));
1071 537
1072 gPropertyWrappers->append(new PropertyWrapperClipPath(CSSPropertyWebkitClipP ath, &RenderStyle::clipPath, &RenderStyle::setClipPath)); 538 gPropertyWrappers->append(new RefCountedPropertyWrapper<ClipPathOperation>(C SSPropertyWebkitClipPath, &RenderStyle::clipPath));
1073 539
1074 gPropertyWrappers->append(new PropertyWrapperShape(CSSPropertyShapeInside, & RenderStyle::shapeInside, &RenderStyle::setShapeInside)); 540 gPropertyWrappers->append(new RefCountedPropertyWrapper<ShapeValue>(CSSPrope rtyShapeInside, &RenderStyle::shapeInside));
1075 gPropertyWrappers->append(new PropertyWrapperShape(CSSPropertyShapeOutside, &RenderStyle::shapeOutside, &RenderStyle::setShapeOutside)); 541 gPropertyWrappers->append(new RefCountedPropertyWrapper<ShapeValue>(CSSPrope rtyShapeOutside, &RenderStyle::shapeOutside));
1076 gPropertyWrappers->append(new NonNegativeLengthWrapper(CSSPropertyShapeMargi n, &RenderStyle::shapeMargin, &RenderStyle::setShapeMargin)); 542 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyShapeMargin , &RenderStyle::shapeMargin));
1077 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyShapeImageTh reshold, &RenderStyle::shapeImageThreshold, &RenderStyle::setShapeImageThreshold )); 543 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyShapeImageTh reshold, &RenderStyle::shapeImageThreshold));
1078 544
1079 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyWebkitColumnRuleColor, &RenderStyle::columnRuleColor, &RenderStyle::setCol umnRuleColor, &RenderStyle::visitedLinkColumnRuleColor, &RenderStyle::setVisited LinkColumnRuleColor)); 545 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)); 546 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)); 547 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)); 548 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)); 549 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)); 550 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)) ; 551 gPropertyWrappers->append(new PropertyWrapperVisitedAffectedStyleColor(CSSPr opertyOutlineColor, &RenderStyle::outlineColor, &RenderStyle::visitedLinkOutline Color));
1086 552
1087 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyBoxShadow, &R enderStyle::boxShadow, &RenderStyle::setBoxShadow)); 553 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyBoxShadow, &R enderStyle::boxShadow));
1088 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyWebkitBoxShad ow, &RenderStyle::boxShadow, &RenderStyle::setBoxShadow)); 554 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyWebkitBoxShad ow, &RenderStyle::boxShadow));
1089 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyTextShadow, & RenderStyle::textShadow, &RenderStyle::setTextShadow)); 555 gPropertyWrappers->append(new PropertyWrapperShadow(CSSPropertyTextShadow, & RenderStyle::textShadow));
1090 556
1091 gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyFill, &Rend erStyle::fillPaintType, &RenderStyle::fillPaintColor, &RenderStyle::setFillPaint Color)); 557 gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyFill, &Rend erStyle::fillPaintType, &RenderStyle::fillPaintColor));
1092 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFillOpacity, &RenderStyle::fillOpacity, &RenderStyle::setFillOpacity)); 558 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFillOpacity, &RenderStyle::fillOpacity));
1093 559
1094 gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyStroke, &Re nderStyle::strokePaintType, &RenderStyle::strokePaintColor, &RenderStyle::setStr okePaintColor)); 560 gPropertyWrappers->append(new PropertyWrapperSVGPaint(CSSPropertyStroke, &Re nderStyle::strokePaintType, &RenderStyle::strokePaintColor));
1095 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeOpacit y, &RenderStyle::strokeOpacity, &RenderStyle::setStrokeOpacity)); 561 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeOpacit y, &RenderStyle::strokeOpacity));
1096 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyStrokeWidth, &RenderStyle::strokeWidth, &RenderStyle::setStrokeWidth)); 562 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyStrokeWidth, &RenderStyle::strokeWidth));
1097 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLengthList>(CS SPropertyStrokeDasharray, &RenderStyle::strokeDashArray, &RenderStyle::setStroke DashArray)); 563 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLengthList>(CS SPropertyStrokeDasharray, &RenderStyle::strokeDashArray));
1098 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyStrokeDashoffset, &RenderStyle::strokeDashOffset, &RenderStyle::setStrokeDa shOffset)); 564 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyStrokeDashoffset, &RenderStyle::strokeDashOffset));
1099 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeMiterl imit, &RenderStyle::strokeMiterLimit, &RenderStyle::setStrokeMiterLimit)); 565 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStrokeMiterl imit, &RenderStyle::strokeMiterLimit));
1100 566
1101 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFloodOpacity , &RenderStyle::floodOpacity, &RenderStyle::setFloodOpacity)); 567 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFloodOpacity , &RenderStyle::floodOpacity));
1102 gPropertyWrappers->append(new PropertyWrapperColor(CSSPropertyFloodColor, &R enderStyle::floodColor, &RenderStyle::setFloodColor)); 568 gPropertyWrappers->append(new PropertyWrapper<Color>(CSSPropertyFloodColor, &RenderStyle::floodColor));
1103 569
1104 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStopOpacity, &RenderStyle::stopOpacity, &RenderStyle::setStopOpacity)); 570 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyStopOpacity, &RenderStyle::stopOpacity));
1105 gPropertyWrappers->append(new PropertyWrapperColor(CSSPropertyStopColor, &Re nderStyle::stopColor, &RenderStyle::setStopColor)); 571 gPropertyWrappers->append(new PropertyWrapper<Color>(CSSPropertyStopColor, & RenderStyle::stopColor));
1106 572
1107 gPropertyWrappers->append(new PropertyWrapperColor(CSSPropertyLightingColor, &RenderStyle::lightingColor, &RenderStyle::setLightingColor)); 573 gPropertyWrappers->append(new PropertyWrapper<Color>(CSSPropertyLightingColo r, &RenderStyle::lightingColor));
1108 574
1109 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyBaselineShift, &RenderStyle::baselineShiftValue, &RenderStyle::setBaselineS hiftValue)); 575 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyBaselineShift, &RenderStyle::baselineShiftValue));
1110 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyKerning, &RenderStyle::kerning, &RenderStyle::setKerning)); 576 gPropertyWrappers->append(new RefCountedSVGPropertyWrapper<SVGLength>(CSSPro pertyKerning, &RenderStyle::kerning));
1111 577
1112 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) { 578 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFlexGrow, &R enderStyle::flexGrow));
1113 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFlexGrow , &RenderStyle::flexGrow, &RenderStyle::setFlexGrow)); 579 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFlexShrink, &RenderStyle::flexShrink));
1114 gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyFlexShri nk, &RenderStyle::flexShrink, &RenderStyle::setFlexShrink)); 580 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyFlexBasis, &RenderStyle::flexBasis));
1115 gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyFlexBas is, &RenderStyle::flexBasis, &RenderStyle::setFlexBasis));
1116 }
1117 581
1118 // TODO: 582 // TODO:
1119 // 583 //
1120 // CSSPropertyVerticalAlign 584 // CSSPropertyVerticalAlign
1121 //
1122 // Compound properties that have components that should be animatable:
1123 //
1124 // CSSPropertyWebkitColumns
1125 // CSSPropertyWebkitBoxReflect
1126 585
1127 // Make sure unused slots have a value 586 // Make sure unused slots have a value
1128 for (unsigned int i = 0; i < static_cast<unsigned int>(numCSSProperties); ++ i) 587 for (unsigned int i = 0; i < static_cast<unsigned int>(numCSSProperties); ++ i)
1129 gPropertyWrapperMap[i] = cInvalidPropertyWrapperIndex; 588 gPropertyWrapperMap[i] = cInvalidPropertyWrapperIndex;
1130 589
1131 // First we put the non-shorthand property wrappers into the map, so the sho rthand-building
1132 // code can find them.
1133 size_t n = gPropertyWrappers->size(); 590 size_t n = gPropertyWrappers->size();
1134 for (unsigned int i = 0; i < n; ++i) { 591 for (unsigned int i = 0; i < n; ++i) {
1135 CSSPropertyID property = (*gPropertyWrappers)[i]->property(); 592 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()); 593 ASSERT_WITH_MESSAGE(CSSAnimations::isAnimatableProperty(property), "%s i s not whitelisted for animation", getPropertyNameString(property).utf8().data()) ;
1137 ASSERT(property - firstCSSProperty < numCSSProperties); 594 ASSERT(property - firstCSSProperty < numCSSProperties);
1138 gPropertyWrapperMap[property - firstCSSProperty] = i; 595 gPropertyWrapperMap[property - firstCSSProperty] = i;
1139 } 596 }
1140
1141 // Now add the shorthand wrappers.
1142 addShorthandProperties();
1143 }
1144
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 } 597 }
1167 598
1168 bool CSSPropertyAnimation::propertiesEqual(CSSPropertyID prop, const RenderStyle * a, const RenderStyle* b) 599 bool CSSPropertyAnimation::propertiesEqual(CSSPropertyID prop, const RenderStyle * a, const RenderStyle* b)
1169 { 600 {
601 // FIXME: transitions of text-decoration-color are broken
602 if (prop == CSSPropertyTextDecorationColor)
603 return true;
604
1170 ensurePropertyMap(); 605 ensurePropertyMap();
1171 606 return wrapperForProperty(prop)->equals(a, b);
1172 AnimationPropertyWrapperBase* wrapper = wrapperForProperty(prop);
1173 if (wrapper)
1174 return wrapper->equals(a, b);
1175 return true;
1176 } 607 }
1177 608
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 609
1197 } 610 }
OLDNEW
« no previous file with comments | « Source/core/frame/animation/CSSPropertyAnimation.h ('k') | Source/core/frame/animation/CompositeAnimation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698