1/* 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public License 16 * along with this library; see the file COPYING.LIB. If not, write to 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 * 20 */ 21 22#include "config.h" 23#include "Animation.h" 24 25namespace WebCore { 26 27Animation::Animation() 28 : m_name(initialAnimationName()) 29 , m_property(CSSPropertyInvalid) 30 , m_mode(AnimateAll) 31 , m_iterationCount(initialAnimationIterationCount()) 32 , m_delay(initialAnimationDelay()) 33 , m_duration(initialAnimationDuration()) 34 , m_timingFunction(initialAnimationTimingFunction()) 35 , m_direction(initialAnimationDirection()) 36 , m_fillMode(initialAnimationFillMode()) 37 , m_playState(initialAnimationPlayState()) 38 , m_delaySet(false) 39 , m_directionSet(false) 40 , m_durationSet(false) 41 , m_fillModeSet(false) 42 , m_iterationCountSet(false) 43 , m_nameSet(false) 44 , m_playStateSet(false) 45 , m_propertySet(false) 46 , m_timingFunctionSet(false) 47 , m_isNone(false) 48{ 49} 50 51Animation::Animation(const Animation& o) 52 : RefCounted<Animation>() 53 , m_name(o.m_name) 54 , m_property(o.m_property) 55 , m_mode(o.m_mode) 56 , m_iterationCount(o.m_iterationCount) 57 , m_delay(o.m_delay) 58 , m_duration(o.m_duration) 59 , m_timingFunction(o.m_timingFunction) 60 , m_direction(o.m_direction) 61 , m_fillMode(o.m_fillMode) 62 , m_playState(o.m_playState) 63 , m_delaySet(o.m_delaySet) 64 , m_directionSet(o.m_directionSet) 65 , m_durationSet(o.m_durationSet) 66 , m_fillModeSet(o.m_fillModeSet) 67 , m_iterationCountSet(o.m_iterationCountSet) 68 , m_nameSet(o.m_nameSet) 69 , m_playStateSet(o.m_playStateSet) 70 , m_propertySet(o.m_propertySet) 71 , m_timingFunctionSet(o.m_timingFunctionSet) 72 , m_isNone(o.m_isNone) 73{ 74} 75 76Animation& Animation::operator=(const Animation& o) 77{ 78 m_name = o.m_name; 79 m_property = o.m_property; 80 m_mode = o.m_mode; 81 m_iterationCount = o.m_iterationCount; 82 m_delay = o.m_delay; 83 m_duration = o.m_duration; 84 m_timingFunction = o.m_timingFunction; 85 m_direction = o.m_direction; 86 m_fillMode = o.m_fillMode; 87 m_playState = o.m_playState; 88 89 m_delaySet = o.m_delaySet; 90 m_directionSet = o.m_directionSet; 91 m_durationSet = o.m_durationSet; 92 m_fillModeSet = o.m_fillModeSet; 93 m_iterationCountSet = o.m_iterationCountSet; 94 m_nameSet = o.m_nameSet; 95 m_playStateSet = o.m_playStateSet; 96 m_propertySet = o.m_propertySet; 97 m_timingFunctionSet = o.m_timingFunctionSet; 98 m_isNone = o.m_isNone; 99 100 return *this; 101} 102 103Animation::~Animation() 104{ 105} 106 107bool Animation::animationsMatch(const Animation* o, bool matchPlayStates) const 108{ 109 if (!o) 110 return false; 111 112 bool result = m_name == o->m_name 113 && m_property == o->m_property 114 && m_mode == o->m_mode 115 && m_iterationCount == o->m_iterationCount 116 && m_delay == o->m_delay 117 && m_duration == o->m_duration 118 && *(m_timingFunction.get()) == *(o->m_timingFunction.get()) 119 && m_direction == o->m_direction 120 && m_fillMode == o->m_fillMode 121 && m_delaySet == o->m_delaySet 122 && m_directionSet == o->m_directionSet 123 && m_durationSet == o->m_durationSet 124 && m_fillModeSet == o->m_fillModeSet 125 && m_iterationCountSet == o->m_iterationCountSet 126 && m_nameSet == o->m_nameSet 127 && m_propertySet == o->m_propertySet 128 && m_timingFunctionSet == o->m_timingFunctionSet 129 && m_isNone == o->m_isNone; 130 131 if (!result) 132 return false; 133 134 return !matchPlayStates || (m_playState == o->m_playState && m_playStateSet == o->m_playStateSet); 135} 136 137const String& Animation::initialAnimationName() 138{ 139 DEPRECATED_DEFINE_STATIC_LOCAL(String, initialValue, (ASCIILiteral("none"))); 140 return initialValue; 141} 142 143} // namespace WebCore 144