1 /* 2 * Copyright (C) 1999 Antti Koivisto (koivisto (at) 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 25 namespace WebCore { 26 27 Animation::Animation() 28 : m_name(initialAnimationName()) 29 , m_property(initialAnimationProperty()) 30 , m_iterationCount(initialAnimationIterationCount()) 31 , m_delay(initialAnimationDelay()) 32 , m_duration(initialAnimationDuration()) 33 , m_timingFunction(initialAnimationTimingFunction()) 34 , m_direction(initialAnimationDirection()) 35 , m_fillMode(initialAnimationFillMode()) 36 , m_playState(initialAnimationPlayState()) 37 , m_delaySet(false) 38 , m_directionSet(false) 39 , m_durationSet(false) 40 , m_fillModeSet(false) 41 , m_iterationCountSet(false) 42 , m_nameSet(false) 43 , m_playStateSet(false) 44 , m_propertySet(false) 45 , m_timingFunctionSet(false) 46 , m_isNone(false) 47 { 48 } 49 50 Animation::Animation(const Animation& o) 51 : RefCounted<Animation>() 52 , m_name(o.m_name) 53 , m_property(o.m_property) 54 , m_iterationCount(o.m_iterationCount) 55 , m_delay(o.m_delay) 56 , m_duration(o.m_duration) 57 , m_timingFunction(o.m_timingFunction) 58 , m_direction(o.m_direction) 59 , m_fillMode(o.m_fillMode) 60 , m_playState(o.m_playState) 61 , m_delaySet(o.m_delaySet) 62 , m_directionSet(o.m_directionSet) 63 , m_durationSet(o.m_durationSet) 64 , m_fillModeSet(o.m_fillModeSet) 65 , m_iterationCountSet(o.m_iterationCountSet) 66 , m_nameSet(o.m_nameSet) 67 , m_playStateSet(o.m_playStateSet) 68 , m_propertySet(o.m_propertySet) 69 , m_timingFunctionSet(o.m_timingFunctionSet) 70 , m_isNone(o.m_isNone) 71 { 72 } 73 74 Animation& Animation::operator=(const Animation& o) 75 { 76 m_name = o.m_name; 77 m_property = o.m_property; 78 m_iterationCount = o.m_iterationCount; 79 m_delay = o.m_delay; 80 m_duration = o.m_duration; 81 m_timingFunction = o.m_timingFunction; 82 m_direction = o.m_direction; 83 m_fillMode = o.m_fillMode; 84 m_playState = o.m_playState; 85 86 m_delaySet = o.m_delaySet; 87 m_directionSet = o.m_directionSet; 88 m_durationSet = o.m_durationSet; 89 m_fillModeSet = o.m_fillModeSet; 90 m_iterationCountSet = o.m_iterationCountSet; 91 m_nameSet = o.m_nameSet; 92 m_playStateSet = o.m_playStateSet; 93 m_propertySet = o.m_propertySet; 94 m_timingFunctionSet = o.m_timingFunctionSet; 95 m_isNone = o.m_isNone; 96 97 return *this; 98 } 99 100 Animation::~Animation() 101 { 102 } 103 104 bool Animation::animationsMatch(const Animation* o, bool matchPlayStates) const 105 { 106 if (!o) 107 return false; 108 109 bool result = m_name == o->m_name 110 && m_property == o->m_property 111 && m_iterationCount == o->m_iterationCount 112 && m_delay == o->m_delay 113 && m_duration == o->m_duration 114 && *(m_timingFunction.get()) == *(o->m_timingFunction.get()) 115 && m_direction == o->m_direction 116 && m_fillMode == o->m_fillMode 117 && m_delaySet == o->m_delaySet 118 && m_directionSet == o->m_directionSet 119 && m_durationSet == o->m_durationSet 120 && m_fillModeSet == o->m_fillModeSet 121 && m_iterationCountSet == o->m_iterationCountSet 122 && m_nameSet == o->m_nameSet 123 && m_propertySet == o->m_propertySet 124 && m_timingFunctionSet == o->m_timingFunctionSet 125 && m_isNone == o->m_isNone; 126 127 if (!result) 128 return false; 129 130 return !matchPlayStates || (m_playState == o->m_playState && m_playStateSet == o->m_playStateSet); 131 } 132 133 } // namespace WebCore 134