void GraphicsLayerAnimations::add(const GraphicsLayerAnimation& animation) { // Remove the old state if we are resuming a paused animation. remove(animation.name()); m_animations.append(animation); }
void ArgumentCoder<GraphicsLayerAnimation>::encode(ArgumentEncoder& encoder, const GraphicsLayerAnimation& animation) { encoder << animation.name(); encoder << animation.boxSize(); encoder.encodeEnum(animation.state()); encoder << animation.startTime(); encoder << animation.pauseTime(); encoder << animation.listsMatch(); RefPtr<Animation> animationObject = animation.animation(); encoder.encodeEnum(animationObject->direction()); encoder << static_cast<uint32_t>(animationObject->fillMode()); encoder << animationObject->duration(); encoder << animationObject->iterationCount(); encodeTimingFunction(encoder, animationObject->timingFunction().get()); const KeyframeValueList& keyframes = animation.keyframes(); encoder.encodeEnum(keyframes.property()); encoder << static_cast<uint32_t>(keyframes.size()); for (size_t i = 0; i < keyframes.size(); ++i) { const AnimationValue* value = keyframes.at(i); encoder << value->keyTime(); encodeTimingFunction(encoder, value->timingFunction()); switch (keyframes.property()) { case AnimatedPropertyOpacity: encoder << static_cast<const FloatAnimationValue*>(value)->value(); break; case AnimatedPropertyWebkitTransform: encoder << *static_cast<const TransformAnimationValue*>(value)->value(); break; #if ENABLE(CSS_FILTERS) case AnimatedPropertyWebkitFilter: encoder << *static_cast<const FilterAnimationValue*>(value)->value(); break; #endif default: break; } } }