Home | History | Annotate | Download | only in animation
      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_playState(initialAnimationPlayState())
     36     , m_delaySet(false)
     37     , m_directionSet(false)
     38     , m_durationSet(false)
     39     , m_iterationCountSet(false)
     40     , m_nameSet(false)
     41     , m_playStateSet(false)
     42     , m_propertySet(false)
     43     , m_timingFunctionSet(false)
     44     , m_isNone(false)
     45 {
     46 }
     47 
     48 Animation::Animation(const Animation& o)
     49     : RefCounted<Animation>()
     50     , m_name(o.m_name)
     51     , m_property(o.m_property)
     52     , m_iterationCount(o.m_iterationCount)
     53     , m_delay(o.m_delay)
     54     , m_duration(o.m_duration)
     55     , m_timingFunction(o.m_timingFunction)
     56     , m_direction(o.m_direction)
     57     , m_playState(o.m_playState)
     58     , m_delaySet(o.m_delaySet)
     59     , m_directionSet(o.m_directionSet)
     60     , m_durationSet(o.m_durationSet)
     61     , m_iterationCountSet(o.m_iterationCountSet)
     62     , m_nameSet(o.m_nameSet)
     63     , m_playStateSet(o.m_playStateSet)
     64     , m_propertySet(o.m_propertySet)
     65     , m_timingFunctionSet(o.m_timingFunctionSet)
     66     , m_isNone(o.m_isNone)
     67 {
     68 }
     69 
     70 Animation& Animation::operator=(const Animation& o)
     71 {
     72     m_name = o.m_name;
     73     m_property = o.m_property;
     74     m_iterationCount = o.m_iterationCount;
     75     m_delay = o.m_delay;
     76     m_duration = o.m_duration;
     77     m_timingFunction = o.m_timingFunction;
     78     m_direction = o.m_direction;
     79     m_playState = o.m_playState;
     80 
     81     m_delaySet = o.m_delaySet;
     82     m_directionSet = o.m_directionSet;
     83     m_durationSet = o.m_durationSet;
     84     m_iterationCountSet = o.m_iterationCountSet;
     85     m_nameSet = o.m_nameSet;
     86     m_playStateSet = o.m_playStateSet;
     87     m_propertySet = o.m_propertySet;
     88     m_timingFunctionSet = o.m_timingFunctionSet;
     89     m_isNone = o.m_isNone;
     90 
     91     return *this;
     92 }
     93 
     94 Animation::~Animation()
     95 {
     96 }
     97 
     98 bool Animation::animationsMatch(const Animation* o, bool matchPlayStates) const
     99 {
    100     if (!o)
    101         return false;
    102 
    103     bool result = m_name == o->m_name &&
    104                   m_property == o->m_property &&
    105                   m_iterationCount == o->m_iterationCount &&
    106                   m_delay == o->m_delay &&
    107                   m_duration == o->m_duration &&
    108                   m_timingFunction == o->m_timingFunction &&
    109                   m_direction == o->m_direction &&
    110                   m_delaySet == o->m_delaySet &&
    111                   m_directionSet == o->m_directionSet &&
    112                   m_durationSet == o->m_durationSet &&
    113                   m_iterationCountSet == o->m_iterationCountSet &&
    114                   m_nameSet == o->m_nameSet &&
    115                   m_propertySet == o->m_propertySet &&
    116                   m_timingFunctionSet == o->m_timingFunctionSet &&
    117                   m_isNone == o->m_isNone;
    118 
    119     if (!result)
    120         return false;
    121 
    122     return !matchPlayStates || (m_playState == o->m_playState && m_playStateSet == o->m_playStateSet);
    123 }
    124 
    125 } // namespace WebCore
    126