2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
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.
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.
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.
23 #include "core/rendering/style/KeyframeList.h"
25 #include "core/animation/Animation.h"
26 #include "core/css/StylePropertySet.h"
27 #include "core/rendering/RenderObject.h"
31 KeyframeList::~KeyframeList()
36 void KeyframeList::clear()
42 void KeyframeList::insert(const KeyframeValue& keyframe)
44 if (keyframe.key() < 0 || keyframe.key() > 1)
47 bool inserted = false;
48 bool replaced = false;
49 for (size_t i = 0; i < m_keyframes.size(); ++i) {
50 if (m_keyframes[i].key() == keyframe.key()) {
51 m_keyframes[i] = keyframe;
56 if (m_keyframes[i].key() > keyframe.key()) {
58 m_keyframes.insert(i, keyframe);
64 if (!replaced && !inserted)
65 m_keyframes.append(keyframe);
68 // We have to rebuild the properties list from scratch.
70 for (Vector<KeyframeValue>::const_iterator it = m_keyframes.begin(); it != m_keyframes.end(); ++it) {
71 const KeyframeValue& currKeyframe = *it;
72 for (HashSet<CSSPropertyID>::const_iterator it = currKeyframe.properties().begin(); it != currKeyframe.properties().end(); ++it)
73 m_properties.add(*it);
76 for (HashSet<CSSPropertyID>::const_iterator it = keyframe.properties().begin(); it != keyframe.properties().end(); ++it)
77 m_properties.add(*it);