| OLD | NEW |
| (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 "sky/engine/core/rendering/style/KeyframeList.h" | |
| 23 | |
| 24 #include "sky/engine/core/animation/Animation.h" | |
| 25 #include "sky/engine/core/css/StylePropertySet.h" | |
| 26 #include "sky/engine/core/rendering/RenderObject.h" | |
| 27 | |
| 28 namespace blink { | |
| 29 | |
| 30 KeyframeList::~KeyframeList() | |
| 31 { | |
| 32 clear(); | |
| 33 } | |
| 34 | |
| 35 void KeyframeList::clear() | |
| 36 { | |
| 37 m_keyframes.clear(); | |
| 38 m_properties.clear(); | |
| 39 } | |
| 40 | |
| 41 void KeyframeList::insert(const KeyframeValue& keyframe) | |
| 42 { | |
| 43 if (keyframe.key() < 0 || keyframe.key() > 1) | |
| 44 return; | |
| 45 | |
| 46 bool inserted = false; | |
| 47 bool replaced = false; | |
| 48 for (size_t i = 0; i < m_keyframes.size(); ++i) { | |
| 49 if (m_keyframes[i].key() == keyframe.key()) { | |
| 50 m_keyframes[i] = keyframe; | |
| 51 replaced = true; | |
| 52 break; | |
| 53 } | |
| 54 | |
| 55 if (m_keyframes[i].key() > keyframe.key()) { | |
| 56 // insert before | |
| 57 m_keyframes.insert(i, keyframe); | |
| 58 inserted = true; | |
| 59 break; | |
| 60 } | |
| 61 } | |
| 62 | |
| 63 if (!replaced && !inserted) | |
| 64 m_keyframes.append(keyframe); | |
| 65 | |
| 66 if (replaced) { | |
| 67 // We have to rebuild the properties list from scratch. | |
| 68 m_properties.clear(); | |
| 69 for (Vector<KeyframeValue>::const_iterator it = m_keyframes.begin(); it
!= m_keyframes.end(); ++it) { | |
| 70 const KeyframeValue& currKeyframe = *it; | |
| 71 for (HashSet<CSSPropertyID>::const_iterator it = currKeyframe.proper
ties().begin(); it != currKeyframe.properties().end(); ++it) | |
| 72 m_properties.add(*it); | |
| 73 } | |
| 74 } else { | |
| 75 for (HashSet<CSSPropertyID>::const_iterator it = keyframe.properties().b
egin(); it != keyframe.properties().end(); ++it) | |
| 76 m_properties.add(*it); | |
| 77 } | |
| 78 } | |
| 79 | |
| 80 } // namespace blink | |
| OLD | NEW |