OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 #include "core/animation/AnimationEffect.h" | 33 #include "core/animation/AnimationEffect.h" |
34 #include "core/animation/CompositorAnimations.h" | 34 #include "core/animation/CompositorAnimations.h" |
35 #include "core/animation/css/CSSAnimatableValueFactory.h" | 35 #include "core/animation/css/CSSAnimatableValueFactory.h" |
36 #include "core/css/CSSPropertyEquality.h" | 36 #include "core/css/CSSPropertyEquality.h" |
37 #include "core/css/resolver/StyleResolver.h" | 37 #include "core/css/resolver/StyleResolver.h" |
38 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
39 #include "platform/animation/AnimationUtilities.h" | 39 #include "platform/animation/AnimationUtilities.h" |
40 #include "platform/geometry/FloatBox.h" | 40 #include "platform/geometry/FloatBox.h" |
41 #include "platform/transforms/TransformationMatrix.h" | 41 #include "platform/transforms/TransformationMatrix.h" |
| 42 #include "wtf/PtrUtil.h" |
42 #include "wtf/text/StringHash.h" | 43 #include "wtf/text/StringHash.h" |
43 | 44 |
44 namespace blink { | 45 namespace blink { |
45 | 46 |
46 PropertyHandleSet KeyframeEffectModelBase::properties() const | 47 PropertyHandleSet KeyframeEffectModelBase::properties() const |
47 { | 48 { |
48 PropertyHandleSet result; | 49 PropertyHandleSet result; |
49 for (const auto& keyframe : m_keyframes) { | 50 for (const auto& keyframe : m_keyframes) { |
50 for (const auto& property : keyframe->properties()) | 51 for (const auto& property : keyframe->properties()) |
51 result.add(property); | 52 result.add(property); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 || affects(PropertyHandle(CSSPropertyRotate)) | 165 || affects(PropertyHandle(CSSPropertyRotate)) |
165 || affects(PropertyHandle(CSSPropertyScale)) | 166 || affects(PropertyHandle(CSSPropertyScale)) |
166 || affects(PropertyHandle(CSSPropertyTranslate)); | 167 || affects(PropertyHandle(CSSPropertyTranslate)); |
167 } | 168 } |
168 | 169 |
169 void KeyframeEffectModelBase::ensureKeyframeGroups() const | 170 void KeyframeEffectModelBase::ensureKeyframeGroups() const |
170 { | 171 { |
171 if (m_keyframeGroups) | 172 if (m_keyframeGroups) |
172 return; | 173 return; |
173 | 174 |
174 m_keyframeGroups = adoptPtr(new KeyframeGroupMap); | 175 m_keyframeGroups = wrapUnique(new KeyframeGroupMap); |
175 RefPtr<TimingFunction> zeroOffsetEasing = m_defaultKeyframeEasing; | 176 RefPtr<TimingFunction> zeroOffsetEasing = m_defaultKeyframeEasing; |
176 for (const auto& keyframe : normalizedKeyframes(getFrames())) { | 177 for (const auto& keyframe : normalizedKeyframes(getFrames())) { |
177 if (keyframe->offset() == 0) | 178 if (keyframe->offset() == 0) |
178 zeroOffsetEasing = &keyframe->easing(); | 179 zeroOffsetEasing = &keyframe->easing(); |
179 | 180 |
180 for (const PropertyHandle& property : keyframe->properties()) { | 181 for (const PropertyHandle& property : keyframe->properties()) { |
181 KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(proper
ty); | 182 KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(proper
ty); |
182 PropertySpecificKeyframeGroup* group; | 183 PropertySpecificKeyframeGroup* group; |
183 if (groupIter == m_keyframeGroups->end()) | 184 if (groupIter == m_keyframeGroups->end()) |
184 group = m_keyframeGroups->add(property, adoptPtr(new PropertySpe
cificKeyframeGroup)).storedValue->value.get(); | 185 group = m_keyframeGroups->add(property, wrapUnique(new PropertyS
pecificKeyframeGroup)).storedValue->value.get(); |
185 else | 186 else |
186 group = groupIter->value.get(); | 187 group = groupIter->value.get(); |
187 | 188 |
188 group->appendKeyframe(keyframe->createPropertySpecificKeyframe(prope
rty)); | 189 group->appendKeyframe(keyframe->createPropertySpecificKeyframe(prope
rty)); |
189 } | 190 } |
190 } | 191 } |
191 | 192 |
192 // Add synthetic keyframes. | 193 // Add synthetic keyframes. |
193 m_hasSyntheticKeyframes = false; | 194 m_hasSyntheticKeyframes = false; |
194 for (const auto& entry : *m_keyframeGroups) { | 195 for (const auto& entry : *m_keyframeGroups) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 298 } |
298 if (m_keyframes.last()->offset() != 1.0) { | 299 if (m_keyframes.last()->offset() != 1.0) { |
299 appendKeyframe(m_keyframes.last()->neutralKeyframe(1, nullptr)); | 300 appendKeyframe(m_keyframes.last()->neutralKeyframe(1, nullptr)); |
300 addedSyntheticKeyframe = true; | 301 addedSyntheticKeyframe = true; |
301 } | 302 } |
302 | 303 |
303 return addedSyntheticKeyframe; | 304 return addedSyntheticKeyframe; |
304 } | 305 } |
305 | 306 |
306 } // namespace blink | 307 } // namespace blink |
OLD | NEW |