]> git.saurik.com Git - iphone-api.git/blob - WebCore/KeyframeList.h
Add support for new WinterBoard Settings features.
[iphone-api.git] / WebCore / KeyframeList.h
1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 *
23 */
24
25 #ifndef KeyframeList_h
26 #define KeyframeList_h
27
28 #include "AtomicString.h"
29 #include <wtf/Vector.h>
30 #include <wtf/HashSet.h>
31 #include <wtf/RefPtr.h>
32
33 namespace WebCore {
34
35 class RenderObject;
36 class RenderStyle;
37
38 class KeyframeValue {
39 public:
40 KeyframeValue()
41 : m_key(-1)
42 {
43 }
44
45 float key() const { return m_key; }
46 const RenderStyle* style() const { return m_style.get(); }
47
48 float m_key;
49 RefPtr<RenderStyle> m_style;
50 };
51
52 class KeyframeList {
53 public:
54 KeyframeList(RenderObject* renderer, const AtomicString& animationName)
55 : m_animationName(animationName)
56 , m_renderer(renderer)
57 {
58 insert(0, 0);
59 insert(1, 0);
60 }
61 ~KeyframeList();
62
63 bool operator==(const KeyframeList& o) const;
64 bool operator!=(const KeyframeList& o) const { return !(*this == o); }
65
66 const AtomicString& animationName() const { return m_animationName; }
67
68 void insert(float key, PassRefPtr<RenderStyle> style);
69
70 void addProperty(int prop) { m_properties.add(prop); }
71 bool containsProperty(int prop) const { return m_properties.contains(prop); }
72 HashSet<int>::const_iterator beginProperties() const { return m_properties.begin(); }
73 HashSet<int>::const_iterator endProperties() const { return m_properties.end(); }
74
75 void clear();
76 bool isEmpty() const { return m_keyframes.isEmpty(); }
77 size_t size() const { return m_keyframes.size(); }
78 Vector<KeyframeValue>::const_iterator beginKeyframes() const { return m_keyframes.begin(); }
79 Vector<KeyframeValue>::const_iterator endKeyframes() const { return m_keyframes.end(); }
80
81 private:
82 AtomicString m_animationName;
83 Vector<KeyframeValue> m_keyframes;
84 HashSet<int> m_properties; // the properties being animated
85 RenderObject* m_renderer;
86 };
87
88 } // namespace WebCore
89
90 #endif // KeyframeList_h