Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(687)

Side by Side Diff: Source/core/layout/style/KeyframeList.cpp

Issue 1045723009: Move core/layout/style to core/style (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/style/KeyframeList.h ('k') | Source/core/layout/style/LineClampValue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@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/layout/style/KeyframeList.h"
24
25 #include "core/animation/Animation.h"
26 #include "core/css/StylePropertySet.h"
27 #include "core/layout/LayoutObject.h"
28
29 namespace blink {
30
31 KeyframeList::~KeyframeList()
32 {
33 clear();
34 }
35
36 void KeyframeList::clear()
37 {
38 m_keyframes.clear();
39 m_properties.clear();
40 }
41
42 void KeyframeList::insert(const KeyframeValue& keyframe)
43 {
44 if (keyframe.key() < 0 || keyframe.key() > 1)
45 return;
46
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;
52 replaced = true;
53 break;
54 }
55
56 if (m_keyframes[i].key() > keyframe.key()) {
57 // insert before
58 m_keyframes.insert(i, keyframe);
59 inserted = true;
60 break;
61 }
62 }
63
64 if (!replaced && !inserted)
65 m_keyframes.append(keyframe);
66
67 if (replaced) {
68 // We have to rebuild the properties list from scratch.
69 m_properties.clear();
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.proper ties().begin(); it != currKeyframe.properties().end(); ++it)
73 m_properties.add(*it);
74 }
75 } else {
76 for (HashSet<CSSPropertyID>::const_iterator it = keyframe.properties().b egin(); it != keyframe.properties().end(); ++it)
77 m_properties.add(*it);
78 }
79 }
80
81 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/style/KeyframeList.h ('k') | Source/core/layout/style/LineClampValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698