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" | |
43 #include "wtf/text/StringHash.h" | 42 #include "wtf/text/StringHash.h" |
44 | 43 |
45 namespace blink { | 44 namespace blink { |
46 | 45 |
47 PropertyHandleSet KeyframeEffectModelBase::properties() const | 46 PropertyHandleSet KeyframeEffectModelBase::properties() const |
48 { | 47 { |
49 PropertyHandleSet result; | 48 PropertyHandleSet result; |
50 for (const auto& keyframe : m_keyframes) { | 49 for (const auto& keyframe : m_keyframes) { |
51 for (const auto& property : keyframe->properties()) | 50 for (const auto& property : keyframe->properties()) |
52 result.add(property); | 51 result.add(property); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 || affects(PropertyHandle(CSSPropertyRotate)) | 164 || affects(PropertyHandle(CSSPropertyRotate)) |
166 || affects(PropertyHandle(CSSPropertyScale)) | 165 || affects(PropertyHandle(CSSPropertyScale)) |
167 || affects(PropertyHandle(CSSPropertyTranslate)); | 166 || affects(PropertyHandle(CSSPropertyTranslate)); |
168 } | 167 } |
169 | 168 |
170 void KeyframeEffectModelBase::ensureKeyframeGroups() const | 169 void KeyframeEffectModelBase::ensureKeyframeGroups() const |
171 { | 170 { |
172 if (m_keyframeGroups) | 171 if (m_keyframeGroups) |
173 return; | 172 return; |
174 | 173 |
175 m_keyframeGroups = wrapUnique(new KeyframeGroupMap); | 174 m_keyframeGroups = adoptPtr(new KeyframeGroupMap); |
176 RefPtr<TimingFunction> zeroOffsetEasing = m_defaultKeyframeEasing; | 175 RefPtr<TimingFunction> zeroOffsetEasing = m_defaultKeyframeEasing; |
177 for (const auto& keyframe : normalizedKeyframes(getFrames())) { | 176 for (const auto& keyframe : normalizedKeyframes(getFrames())) { |
178 if (keyframe->offset() == 0) | 177 if (keyframe->offset() == 0) |
179 zeroOffsetEasing = &keyframe->easing(); | 178 zeroOffsetEasing = &keyframe->easing(); |
180 | 179 |
181 for (const PropertyHandle& property : keyframe->properties()) { | 180 for (const PropertyHandle& property : keyframe->properties()) { |
182 KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(proper
ty); | 181 KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(proper
ty); |
183 PropertySpecificKeyframeGroup* group; | 182 PropertySpecificKeyframeGroup* group; |
184 if (groupIter == m_keyframeGroups->end()) | 183 if (groupIter == m_keyframeGroups->end()) |
185 group = m_keyframeGroups->add(property, wrapUnique(new PropertyS
pecificKeyframeGroup)).storedValue->value.get(); | 184 group = m_keyframeGroups->add(property, adoptPtr(new PropertySpe
cificKeyframeGroup)).storedValue->value.get(); |
186 else | 185 else |
187 group = groupIter->value.get(); | 186 group = groupIter->value.get(); |
188 | 187 |
189 group->appendKeyframe(keyframe->createPropertySpecificKeyframe(prope
rty)); | 188 group->appendKeyframe(keyframe->createPropertySpecificKeyframe(prope
rty)); |
190 } | 189 } |
191 } | 190 } |
192 | 191 |
193 // Add synthetic keyframes. | 192 // Add synthetic keyframes. |
194 m_hasSyntheticKeyframes = false; | 193 m_hasSyntheticKeyframes = false; |
195 for (const auto& entry : *m_keyframeGroups) { | 194 for (const auto& entry : *m_keyframeGroups) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 } | 297 } |
299 if (m_keyframes.last()->offset() != 1.0) { | 298 if (m_keyframes.last()->offset() != 1.0) { |
300 appendKeyframe(m_keyframes.last()->neutralKeyframe(1, nullptr)); | 299 appendKeyframe(m_keyframes.last()->neutralKeyframe(1, nullptr)); |
301 addedSyntheticKeyframe = true; | 300 addedSyntheticKeyframe = true; |
302 } | 301 } |
303 | 302 |
304 return addedSyntheticKeyframe; | 303 return addedSyntheticKeyframe; |
305 } | 304 } |
306 | 305 |
307 } // namespace blink | 306 } // namespace blink |
OLD | NEW |