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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 ensureKeyframeGroups(); | 85 ensureKeyframeGroups(); |
86 for (CSSPropertyID id : CompositorAnimations::compositableProperties) { | 86 for (CSSPropertyID id : CompositorAnimations::compositableProperties) { |
87 PropertyHandle property = PropertyHandle(id); | 87 PropertyHandle property = PropertyHandle(id); |
88 if (!affects(property)) | 88 if (!affects(property)) |
89 continue; | 89 continue; |
90 for (auto& keyframe : m_keyframeGroups->get(property)->m_keyframes) | 90 for (auto& keyframe : m_keyframeGroups->get(property)->m_keyframes) |
91 keyframe->populateAnimatableValue(id, element, baseStyle); | 91 keyframe->populateAnimatableValue(id, element, baseStyle); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 bool KeyframeEffectModelBase::updateNeutralKeyframeAnimatableValues(CSSPropertyI
D property, PassRefPtrWillBeRawPtr<AnimatableValue> value) | 95 bool KeyframeEffectModelBase::updateNeutralKeyframeAnimatableValues(CSSPropertyI
D property, PassRefPtr<AnimatableValue> value) |
96 { | 96 { |
97 ASSERT(CompositorAnimations::isCompositableProperty(property)); | 97 ASSERT(CompositorAnimations::isCompositableProperty(property)); |
98 | 98 |
99 if (!value) | 99 if (!value) |
100 return false; | 100 return false; |
101 | 101 |
102 ensureKeyframeGroups(); | 102 ensureKeyframeGroups(); |
103 auto& keyframes = m_keyframeGroups->get(PropertyHandle(property))->m_keyfram
es; | 103 auto& keyframes = m_keyframeGroups->get(PropertyHandle(property))->m_keyfram
es; |
104 ASSERT(keyframes.size() >= 2); | 104 ASSERT(keyframes.size() >= 2); |
105 | 105 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 || affects(PropertyHandle(CSSPropertyRotate)) | 160 || affects(PropertyHandle(CSSPropertyRotate)) |
161 || affects(PropertyHandle(CSSPropertyScale)) | 161 || affects(PropertyHandle(CSSPropertyScale)) |
162 || affects(PropertyHandle(CSSPropertyTranslate)); | 162 || affects(PropertyHandle(CSSPropertyTranslate)); |
163 } | 163 } |
164 | 164 |
165 void KeyframeEffectModelBase::ensureKeyframeGroups() const | 165 void KeyframeEffectModelBase::ensureKeyframeGroups() const |
166 { | 166 { |
167 if (m_keyframeGroups) | 167 if (m_keyframeGroups) |
168 return; | 168 return; |
169 | 169 |
170 m_keyframeGroups = adoptPtrWillBeNoop(new KeyframeGroupMap); | 170 m_keyframeGroups = adoptPtr(new KeyframeGroupMap); |
171 for (const auto& keyframe : normalizedKeyframes(getFrames())) { | 171 for (const auto& keyframe : normalizedKeyframes(getFrames())) { |
172 for (const PropertyHandle& property : keyframe->properties()) { | 172 for (const PropertyHandle& property : keyframe->properties()) { |
173 if (property.isCSSProperty()) | 173 if (property.isCSSProperty()) |
174 ASSERT_WITH_MESSAGE(!isShorthandProperty(property.cssProperty())
, "Web Animations: Encountered shorthand CSS property (%d) in normalized keyfram
es.", property.cssProperty()); | 174 ASSERT_WITH_MESSAGE(!isShorthandProperty(property.cssProperty())
, "Web Animations: Encountered shorthand CSS property (%d) in normalized keyfram
es.", property.cssProperty()); |
175 KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(proper
ty); | 175 KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(proper
ty); |
176 PropertySpecificKeyframeGroup* group; | 176 PropertySpecificKeyframeGroup* group; |
177 if (groupIter == m_keyframeGroups->end()) | 177 if (groupIter == m_keyframeGroups->end()) |
178 group = m_keyframeGroups->add(property, adoptPtrWillBeNoop(new P
ropertySpecificKeyframeGroup)).storedValue->value.get(); | 178 group = m_keyframeGroups->add(property, adoptPtr(new PropertySpe
cificKeyframeGroup)).storedValue->value.get(); |
179 else | 179 else |
180 group = groupIter->value.get(); | 180 group = groupIter->value.get(); |
181 | 181 |
182 group->appendKeyframe(keyframe->createPropertySpecificKeyframe(prope
rty)); | 182 group->appendKeyframe(keyframe->createPropertySpecificKeyframe(prope
rty)); |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 // Add synthetic keyframes. | 186 // Add synthetic keyframes. |
187 m_hasSyntheticKeyframes = false; | 187 m_hasSyntheticKeyframes = false; |
188 for (const auto& entry : *m_keyframeGroups) { | 188 for (const auto& entry : *m_keyframeGroups) { |
(...skipping 30 matching lines...) Expand all Loading... |
219 for (const auto& keyframe : entry.value->keyframes()) { | 219 for (const auto& keyframe : entry.value->keyframes()) { |
220 if (keyframe->composite() != EffectModel::CompositeReplace) | 220 if (keyframe->composite() != EffectModel::CompositeReplace) |
221 return false; | 221 return false; |
222 } | 222 } |
223 } | 223 } |
224 return true; | 224 return true; |
225 } | 225 } |
226 | 226 |
227 DEFINE_TRACE(KeyframeEffectModelBase) | 227 DEFINE_TRACE(KeyframeEffectModelBase) |
228 { | 228 { |
229 visitor->trace(m_keyframes); | |
230 #if ENABLE(OILPAN) | |
231 visitor->trace(m_keyframeGroups); | |
232 #endif | |
233 visitor->trace(m_interpolationEffect); | 229 visitor->trace(m_interpolationEffect); |
234 EffectModel::trace(visitor); | 230 EffectModel::trace(visitor); |
235 } | 231 } |
236 | 232 |
237 Keyframe::PropertySpecificKeyframe::PropertySpecificKeyframe(double offset, Pass
RefPtr<TimingFunction> easing, EffectModel::CompositeOperation composite) | 233 Keyframe::PropertySpecificKeyframe::PropertySpecificKeyframe(double offset, Pass
RefPtr<TimingFunction> easing, EffectModel::CompositeOperation composite) |
238 : m_offset(offset) | 234 : m_offset(offset) |
239 , m_easing(easing) | 235 , m_easing(easing) |
240 , m_composite(composite) | 236 , m_composite(composite) |
241 { | 237 { |
242 } | 238 } |
243 | 239 |
244 void KeyframeEffectModelBase::PropertySpecificKeyframeGroup::appendKeyframe(Pass
OwnPtrWillBeRawPtr<Keyframe::PropertySpecificKeyframe> keyframe) | 240 void KeyframeEffectModelBase::PropertySpecificKeyframeGroup::appendKeyframe(Pass
OwnPtr<Keyframe::PropertySpecificKeyframe> keyframe) |
245 { | 241 { |
246 ASSERT(m_keyframes.isEmpty() || m_keyframes.last()->offset() <= keyframe->of
fset()); | 242 ASSERT(m_keyframes.isEmpty() || m_keyframes.last()->offset() <= keyframe->of
fset()); |
247 m_keyframes.append(keyframe); | 243 m_keyframes.append(keyframe); |
248 } | 244 } |
249 | 245 |
250 void KeyframeEffectModelBase::PropertySpecificKeyframeGroup::removeRedundantKeyf
rames() | 246 void KeyframeEffectModelBase::PropertySpecificKeyframeGroup::removeRedundantKeyf
rames() |
251 { | 247 { |
252 // As an optimization, removes keyframes in the following categories, as | 248 // As an optimization, removes keyframes in the following categories, as |
253 // they will never be used by sample(). | 249 // they will never be used by sample(). |
254 // - End keyframes with the same offset as their neighbor | 250 // - End keyframes with the same offset as their neighbor |
(...skipping 22 matching lines...) Expand all Loading... |
277 addedSyntheticKeyframe = true; | 273 addedSyntheticKeyframe = true; |
278 } | 274 } |
279 if (m_keyframes.last()->offset() != 1.0) { | 275 if (m_keyframes.last()->offset() != 1.0) { |
280 appendKeyframe(m_keyframes.last()->neutralKeyframe(1, easing)); | 276 appendKeyframe(m_keyframes.last()->neutralKeyframe(1, easing)); |
281 addedSyntheticKeyframe = true; | 277 addedSyntheticKeyframe = true; |
282 } | 278 } |
283 | 279 |
284 return addedSyntheticKeyframe; | 280 return addedSyntheticKeyframe; |
285 } | 281 } |
286 | 282 |
287 DEFINE_TRACE(KeyframeEffectModelBase::PropertySpecificKeyframeGroup) | |
288 { | |
289 #if ENABLE(OILPAN) | |
290 visitor->trace(m_keyframes); | |
291 #endif | |
292 } | |
293 | |
294 } // namespace | 283 } // namespace |
OLD | NEW |