1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/animation/css/CSSAnimationData.h"
7
8 #include "core/animation/Timing.h"
9
10 namespace blink {
11
CSSAnimationData()12 CSSAnimationData::CSSAnimationData()
13 {
14 m_nameList.append(initialName());
15 m_iterationCountList.append(initialIterationCount());
16 m_directionList.append(initialDirection());
17 m_fillModeList.append(initialFillMode());
18 m_playStateList.append(initialPlayState());
19 }
20
CSSAnimationData(const CSSAnimationData & other)21 CSSAnimationData::CSSAnimationData(const CSSAnimationData& other)
22 : CSSTimingData(other)
23 , m_nameList(other.m_nameList)
24 , m_iterationCountList(other.m_iterationCountList)
25 , m_directionList(other.m_directionList)
26 , m_fillModeList(other.m_fillModeList)
27 , m_playStateList(other.m_playStateList)
28 {
29 }
30
initialName()31 const AtomicString& CSSAnimationData::initialName()
32 {
33 DEFINE_STATIC_LOCAL(const AtomicString, name, ("none", AtomicString::ConstructFromLiteral));
34 return name;
35 }
36
animationsMatchForStyleRecalc(const CSSAnimationData & other) const37 bool CSSAnimationData::animationsMatchForStyleRecalc(const CSSAnimationData& other) const
38 {
39 return m_nameList == other.m_nameList && m_playStateList == other.m_playStateList;
40 }
41
convertToTiming(size_t index) const42 Timing CSSAnimationData::convertToTiming(size_t index) const
43 {
44 ASSERT(index < m_nameList.size());
45 Timing timing = CSSTimingData::convertToTiming(index);
46
47 timing.iterationCount = getRepeated(m_iterationCountList, index);
48 timing.direction = getRepeated(m_directionList, index);
49 timing.fillMode = getRepeated(m_fillModeList, index);
50 timing.assertValid();
51 return timing;
52 }
53
54 } // namespace blink
55