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 "core/platform/animation/CSSAnimationData.h"
     24 
     25 namespace WebCore {
     26 
     27 CSSAnimationData::CSSAnimationData()
     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 
     51 CSSAnimationData::CSSAnimationData(const CSSAnimationData& o)
     52     : RefCounted<CSSAnimationData>()
     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 
     76 CSSAnimationData& CSSAnimationData::operator=(const CSSAnimationData& 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 
    103 CSSAnimationData::~CSSAnimationData()
    104 {
    105 }
    106 
    107 bool CSSAnimationData::animationsMatchForStyleRecalc(const CSSAnimationData* o) const
    108 {
    109     if (!o)
    110         return false;
    111 
    112     return m_name == o->m_name
    113         && m_playState == o->m_playState
    114         && m_property == o->m_property
    115         && m_mode == o->m_mode
    116         && m_nameSet == o->m_nameSet
    117         && m_playStateSet == o->m_playStateSet
    118         && m_propertySet == o->m_propertySet
    119         && m_isNone == o->m_isNone;
    120 }
    121 
    122 const AtomicString& CSSAnimationData::initialAnimationName()
    123 {
    124     DEFINE_STATIC_LOCAL(const AtomicString, initialValue, ("none"));
    125     return initialValue;
    126 }
    127 
    128 } // namespace WebCore
    129