| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 case CSSPropertyWebkitTransformOriginZ: | 79 case CSSPropertyWebkitTransformOriginZ: |
| 80 case CSSPropertyWebkitTransformOrigin: | 80 case CSSPropertyWebkitTransformOrigin: |
| 81 return CSSPropertyTransformOrigin; | 81 return CSSPropertyTransformOrigin; |
| 82 default: | 82 default: |
| 83 break; | 83 break; |
| 84 } | 84 } |
| 85 return property; | 85 return property; |
| 86 } | 86 } |
| 87 | 87 |
| 88 static void resolveKeyframes(StyleResolver* resolver, const Element* animatingEl
ement, Element& element, const RenderStyle& style, RenderStyle* parentStyle, con
st AtomicString& name, TimingFunction* defaultTimingFunction, | 88 static void resolveKeyframes(StyleResolver* resolver, const Element* animatingEl
ement, Element& element, const RenderStyle& style, RenderStyle* parentStyle, con
st AtomicString& name, TimingFunction* defaultTimingFunction, |
| 89 AnimatableValueKeyframeVector& keyframes) | 89 StringKeyframeVector& keyframes) |
| 90 { | 90 { |
| 91 // When the animating element is null, use its parent for scoping purposes. | 91 // When the animating element is null, use its parent for scoping purposes. |
| 92 const Element* elementForScoping = animatingElement ? animatingElement : &el
ement; | 92 const Element* elementForScoping = animatingElement ? animatingElement : &el
ement; |
| 93 const StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elemen
tForScoping, name); | 93 const StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elemen
tForScoping, name); |
| 94 if (!keyframesRule) | 94 if (!keyframesRule) |
| 95 return; | 95 return; |
| 96 | 96 |
| 97 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>& styleKeyframe
s = keyframesRule->keyframes(); | 97 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>& styleKeyframe
s = keyframesRule->keyframes(); |
| 98 | 98 |
| 99 // Construct and populate the style for each keyframe | 99 // Construct and populate the style for each keyframe |
| 100 PropertySet specifiedPropertiesForUseCounter; | 100 PropertySet specifiedPropertiesForUseCounter; |
| 101 for (size_t i = 0; i < styleKeyframes.size(); ++i) { | 101 for (size_t i = 0; i < styleKeyframes.size(); ++i) { |
| 102 const StyleRuleKeyframe* styleKeyframe = styleKeyframes[i].get(); | 102 const StyleRuleKeyframe* styleKeyframe = styleKeyframes[i].get(); |
| 103 RefPtr<RenderStyle> keyframeStyle = resolver->styleForKeyframe(element,
style, parentStyle, styleKeyframe, name); | 103 RefPtr<RenderStyle> keyframeStyle = resolver->styleForKeyframe(element,
style, parentStyle, styleKeyframe, name); |
| 104 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframe = AnimatableValueKe
yframe::create(); | 104 RefPtrWillBeRawPtr<StringKeyframe> keyframe = StringKeyframe::create(); |
| 105 const Vector<double>& offsets = styleKeyframe->keys(); | 105 const Vector<double>& offsets = styleKeyframe->keys(); |
| 106 ASSERT(!offsets.isEmpty()); | 106 ASSERT(!offsets.isEmpty()); |
| 107 keyframe->setOffset(offsets[0]); | 107 keyframe->setOffset(offsets[0]); |
| 108 keyframe->setEasing(defaultTimingFunction); | 108 keyframe->setEasing(defaultTimingFunction); |
| 109 const StylePropertySet& properties = styleKeyframe->properties(); | 109 const StylePropertySet& properties = styleKeyframe->properties(); |
| 110 for (unsigned j = 0; j < properties.propertyCount(); j++) { | 110 for (unsigned j = 0; j < properties.propertyCount(); j++) { |
| 111 specifiedPropertiesForUseCounter.add(properties.propertyAt(j).id()); | 111 specifiedPropertiesForUseCounter.add(properties.propertyAt(j).id()); |
| 112 CSSPropertyID property = propertyForAnimation(properties.propertyAt(
j).id()); | 112 CSSPropertyID property = propertyForAnimation(properties.propertyAt(
j).id()); |
| 113 if (property == CSSPropertyWebkitAnimationTimingFunction || property
== CSSPropertyAnimationTimingFunction) { | 113 if (property == CSSPropertyWebkitAnimationTimingFunction || property
== CSSPropertyAnimationTimingFunction) { |
| 114 CSSValue* value = properties.propertyAt(j).value(); | 114 CSSValue* value = properties.propertyAt(j).value(); |
| 115 RefPtr<TimingFunction> timingFunction; | 115 RefPtr<TimingFunction> timingFunction; |
| 116 if (value->isInheritedValue() && parentStyle->animations()) { | 116 if (value->isInheritedValue() && parentStyle->animations()) { |
| 117 timingFunction = parentStyle->animations()->timingFunctionLi
st()[0]; | 117 timingFunction = parentStyle->animations()->timingFunctionLi
st()[0]; |
| 118 } else if (value->isValueList()) { | 118 } else if (value->isValueList()) { |
| 119 timingFunction = CSSToStyleMap::mapAnimationTimingFunction(t
oCSSValueList(value)->item(0)); | 119 timingFunction = CSSToStyleMap::mapAnimationTimingFunction(t
oCSSValueList(value)->item(0)); |
| 120 } else { | 120 } else { |
| 121 ASSERT(value->isInheritedValue() || value->isInitialValue()
|| value->isUnsetValue()); | 121 ASSERT(value->isInheritedValue() || value->isInitialValue()
|| value->isUnsetValue()); |
| 122 timingFunction = CSSTimingData::initialTimingFunction(); | 122 timingFunction = CSSTimingData::initialTimingFunction(); |
| 123 } | 123 } |
| 124 keyframe->setEasing(timingFunction.release()); | 124 keyframe->setEasing(timingFunction.release()); |
| 125 } else if (CSSPropertyMetadata::isAnimatableProperty(property)) { | 125 } else if (CSSPropertyMetadata::isAnimatableProperty(property)) { |
| 126 keyframe->setPropertyValue(property, CSSAnimatableValueFactory::
create(property, *keyframeStyle).get()); | 126 keyframe->setPropertyValue(property, properties.propertyAt(j).va
lue()); |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 keyframes.append(keyframe); | 129 keyframes.append(keyframe); |
| 130 // The last keyframe specified at a given offset is used. | 130 // The last keyframe specified at a given offset is used. |
| 131 for (size_t j = 1; j < offsets.size(); ++j) { | 131 for (size_t j = 1; j < offsets.size(); ++j) { |
| 132 keyframes.append(toAnimatableValueKeyframe(keyframe->cloneWithOffset
(offsets[j]).get())); | 132 keyframes.append(toStringKeyframe(keyframe->cloneWithOffset(offsets[
j]).get())); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 for (CSSPropertyID property : specifiedPropertiesForUseCounter) { | 136 for (CSSPropertyID property : specifiedPropertiesForUseCounter) { |
| 137 ASSERT(property != CSSPropertyInvalid); | 137 ASSERT(property != CSSPropertyInvalid); |
| 138 blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProper
ties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property)); | 138 blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProper
ties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property)); |
| 139 } | 139 } |
| 140 | 140 |
| 141 // Merge duplicate keyframes. | 141 // Merge duplicate keyframes. |
| 142 std::stable_sort(keyframes.begin(), keyframes.end(), Keyframe::compareOffset
s); | 142 std::stable_sort(keyframes.begin(), keyframes.end(), Keyframe::compareOffset
s); |
| 143 size_t targetIndex = 0; | 143 size_t targetIndex = 0; |
| 144 for (size_t i = 1; i < keyframes.size(); i++) { | 144 for (size_t i = 1; i < keyframes.size(); i++) { |
| 145 if (keyframes[i]->offset() == keyframes[targetIndex]->offset()) { | 145 if (keyframes[i]->offset() == keyframes[targetIndex]->offset()) { |
| 146 for (CSSPropertyID property : keyframes[i]->properties()) | 146 for (CSSPropertyID property : keyframes[i]->properties()) |
| 147 keyframes[targetIndex]->setPropertyValue(property, keyframes[i]-
>propertyValue(property)); | 147 keyframes[targetIndex]->setPropertyValue(property, keyframes[i]-
>propertyValue(property)); |
| 148 } else { | 148 } else { |
| 149 targetIndex++; | 149 targetIndex++; |
| 150 keyframes[targetIndex] = keyframes[i]; | 150 keyframes[targetIndex] = keyframes[i]; |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 if (!keyframes.isEmpty()) | 153 if (!keyframes.isEmpty()) |
| 154 keyframes.shrink(targetIndex + 1); | 154 keyframes.shrink(targetIndex + 1); |
| 155 | 155 |
| 156 // Add 0% and 100% keyframes if absent. | 156 // Add 0% and 100% keyframes if absent. |
| 157 RefPtrWillBeRawPtr<AnimatableValueKeyframe> startKeyframe = keyframes.isEmpt
y() ? nullptr : keyframes[0]; | 157 RefPtrWillBeRawPtr<StringKeyframe> startKeyframe = keyframes.isEmpty() ? nul
lptr : keyframes[0]; |
| 158 if (!startKeyframe || keyframes[0]->offset() != 0) { | 158 if (!startKeyframe || keyframes[0]->offset() != 0) { |
| 159 startKeyframe = AnimatableValueKeyframe::create(); | 159 startKeyframe = StringKeyframe::create(); |
| 160 startKeyframe->setOffset(0); | 160 startKeyframe->setOffset(0); |
| 161 startKeyframe->setEasing(defaultTimingFunction); | 161 startKeyframe->setEasing(defaultTimingFunction); |
| 162 keyframes.prepend(startKeyframe); | 162 keyframes.prepend(startKeyframe); |
| 163 } | 163 } |
| 164 RefPtrWillBeRawPtr<AnimatableValueKeyframe> endKeyframe = keyframes[keyframe
s.size() - 1]; | 164 RefPtrWillBeRawPtr<StringKeyframe> endKeyframe = keyframes[keyframes.size()
- 1]; |
| 165 if (endKeyframe->offset() != 1) { | 165 if (endKeyframe->offset() != 1) { |
| 166 endKeyframe = AnimatableValueKeyframe::create(); | 166 endKeyframe = StringKeyframe::create(); |
| 167 endKeyframe->setOffset(1); | 167 endKeyframe->setOffset(1); |
| 168 endKeyframe->setEasing(defaultTimingFunction); | 168 endKeyframe->setEasing(defaultTimingFunction); |
| 169 keyframes.append(endKeyframe); | 169 keyframes.append(endKeyframe); |
| 170 } | 170 } |
| 171 ASSERT(keyframes.size() >= 2); | 171 ASSERT(keyframes.size() >= 2); |
| 172 ASSERT(!keyframes.first()->offset()); | 172 ASSERT(!keyframes.first()->offset()); |
| 173 ASSERT(keyframes.last()->offset() == 1); | 173 ASSERT(keyframes.last()->offset() == 1); |
| 174 | 174 |
| 175 // Snapshot current property values for 0% and 100% if missing. | 175 // FIXME: This is only used for use counting neutral keyframes running on th
e compositor. |
| 176 PropertySet allProperties; | 176 PropertySet allProperties; |
| 177 for (const auto& keyframe : keyframes) { | 177 for (const auto& keyframe : keyframes) { |
| 178 for (CSSPropertyID property : keyframe->properties()) | 178 for (CSSPropertyID property : keyframe->properties()) |
| 179 allProperties.add(property); | 179 allProperties.add(property); |
| 180 } | 180 } |
| 181 const PropertySet& startKeyframeProperties = startKeyframe->properties(); | 181 const PropertySet& startKeyframeProperties = startKeyframe->properties(); |
| 182 const PropertySet& endKeyframeProperties = endKeyframe->properties(); | 182 const PropertySet& endKeyframeProperties = endKeyframe->properties(); |
| 183 bool missingStartValues = startKeyframeProperties.size() < allProperties.siz
e(); | 183 bool missingStartValues = startKeyframeProperties.size() < allProperties.siz
e(); |
| 184 bool missingEndValues = endKeyframeProperties.size() < allProperties.size(); | 184 bool missingEndValues = endKeyframeProperties.size() < allProperties.size(); |
| 185 if (missingStartValues || missingEndValues) { | 185 if (missingStartValues || missingEndValues) { |
| 186 for (CSSPropertyID property : allProperties) { | 186 for (CSSPropertyID property : allProperties) { |
| 187 bool startNeedsValue = missingStartValues && !startKeyframePropertie
s.contains(property); | 187 bool startNeedsValue = missingStartValues && !startKeyframePropertie
s.contains(property); |
| 188 bool endNeedsValue = missingEndValues && !endKeyframeProperties.cont
ains(property); | 188 bool endNeedsValue = missingEndValues && !endKeyframeProperties.cont
ains(property); |
| 189 if (!startNeedsValue && !endNeedsValue) | 189 if (!startNeedsValue && !endNeedsValue) |
| 190 continue; | 190 continue; |
| 191 RefPtrWillBeRawPtr<AnimatableValue> snapshotValue = CSSAnimatableVal
ueFactory::create(property, style); | 191 if (CompositorAnimations::isCompositableProperty(property)) |
| 192 if (startNeedsValue) | |
| 193 startKeyframe->setPropertyValue(property, snapshotValue.get()); | |
| 194 if (endNeedsValue) | |
| 195 endKeyframe->setPropertyValue(property, snapshotValue.get()); | |
| 196 if (property == CSSPropertyOpacity || property == CSSPropertyTransfo
rm) | |
| 197 UseCounter::count(elementForScoping->document(), UseCounter::Syn
theticKeyframesInCompositedCSSAnimation); | 192 UseCounter::count(elementForScoping->document(), UseCounter::Syn
theticKeyframesInCompositedCSSAnimation); |
| 198 } | 193 } |
| 199 } | 194 } |
| 200 ASSERT(startKeyframe->properties().size() == allProperties.size()); | |
| 201 ASSERT(endKeyframe->properties().size() == allProperties.size()); | |
| 202 } | 195 } |
| 203 | 196 |
| 197 CSSAnimationUpdate::UpdatedAnimationStyle::CompositableStyleSnapshot snapshotCom
positableProperties(RenderObject *renderer, const RenderStyle &newStyle, const A
nimationEffect *effect) |
| 198 { |
| 199 CSSAnimationUpdate::UpdatedAnimationStyle::CompositableStyleSnapshot snapsho
t; |
| 200 if (!renderer) |
| 201 return snapshot; |
| 202 |
| 203 const RenderStyle& oldStyle = *renderer->style(); |
| 204 if (!CSSPropertyEquality::propertiesEqual(CSSPropertyOpacity, oldStyle, newS
tyle) && effect->affects(CSSPropertyOpacity)) |
| 205 snapshot.opacity = CSSAnimatableValueFactory::create(CSSPropertyOpacity,
newStyle); |
| 206 if (!CSSPropertyEquality::propertiesEqual(CSSPropertyTransform, oldStyle, ne
wStyle) && effect->affects(CSSPropertyTransform)) |
| 207 snapshot.transform = CSSAnimatableValueFactory::create(CSSPropertyTransf
orm, newStyle); |
| 208 if (!CSSPropertyEquality::propertiesEqual(CSSPropertyWebkitFilter, oldStyle,
newStyle) && effect->affects(CSSPropertyWebkitFilter)) |
| 209 snapshot.webkitFilter = CSSAnimatableValueFactory::create(CSSPropertyWeb
kitFilter, newStyle); |
| 210 |
| 211 return snapshot; |
| 212 } |
| 204 } // namespace | 213 } // namespace |
| 205 | 214 |
| 206 CSSAnimations::CSSAnimations() | 215 CSSAnimations::CSSAnimations() |
| 207 { | 216 { |
| 208 } | 217 } |
| 209 | 218 |
| 210 const AtomicString CSSAnimations::getAnimationNameForInspector(const AnimationPl
ayer& player) | 219 const AtomicString CSSAnimations::getAnimationNameForInspector(const AnimationPl
ayer& player) |
| 211 { | 220 { |
| 212 for (const auto& it : m_animations) { | 221 for (const auto& it : m_animations) { |
| 213 if (it.value->sequenceNumber() == player.sequenceNumber()) | 222 if (it.value->sequenceNumber() == player.sequenceNumber()) |
| 214 return it.key; | 223 return it.key; |
| 215 } | 224 } |
| 216 return nullAtom; | 225 return nullAtom; |
| 217 } | 226 } |
| 218 | 227 |
| 219 PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> CSSAnimations::calculateUpdate(const
Element* animatingElement, Element& element, const RenderStyle& style, RenderSty
le* parentStyle, StyleResolver* resolver) | 228 PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> CSSAnimations::calculateUpdate(const
Element* animatingElement, Element& element, const RenderStyle& style, RenderSty
le* parentStyle, StyleResolver* resolver) |
| 220 { | 229 { |
| 221 OwnPtrWillBeRawPtr<CSSAnimationUpdate> update = adoptPtrWillBeNoop(new CSSAn
imationUpdate()); | 230 OwnPtrWillBeRawPtr<CSSAnimationUpdate> update = adoptPtrWillBeNoop(new CSSAn
imationUpdate()); |
| 222 calculateAnimationUpdate(update.get(), animatingElement, element, style, par
entStyle, resolver); | 231 calculateAnimationUpdate(update.get(), animatingElement, element, style, par
entStyle, resolver); |
| 223 calculateAnimationActiveInterpolations(update.get(), animatingElement, eleme
nt.document().timeline().currentTimeInternal()); | 232 calculateAnimationActiveInterpolations(update.get(), animatingElement, eleme
nt.document().timeline().currentTimeInternal()); |
| 224 calculateTransitionUpdate(update.get(), animatingElement, style); | 233 calculateTransitionUpdate(update.get(), animatingElement, style); |
| 225 calculateTransitionActiveInterpolations(update.get(), animatingElement, elem
ent.document().timeline().currentTimeInternal()); | 234 calculateTransitionActiveInterpolations(update.get(), animatingElement, elem
ent.document().timeline().currentTimeInternal()); |
| 226 return update->isEmpty() ? nullptr : update.release(); | 235 return update->isEmpty() ? nullptr : update.release(); |
| 227 } | 236 } |
| 228 | 237 |
| 229 void CSSAnimations::calculateAnimationUpdate(CSSAnimationUpdate* update, const E
lement* animatingElement, Element& element, const RenderStyle& style, RenderStyl
e* parentStyle, StyleResolver* resolver) | 238 void CSSAnimations::calculateAnimationUpdate(CSSAnimationUpdate* update, const E
lement* animatingElement, Element& element, const RenderStyle& style, RenderStyl
e* parentStyle, StyleResolver* resolver) |
| 230 { | 239 { |
| 231 const ActiveAnimations* activeAnimations = animatingElement ? animatingEleme
nt->activeAnimations() : nullptr; | 240 const ActiveAnimations* activeAnimations = animatingElement ? animatingEleme
nt->activeAnimations() : nullptr; |
| 232 | 241 |
| 242 bool isAnimationStyleChange = activeAnimations && activeAnimations->isAnimat
ionStyleChange(); |
| 243 |
| 233 #if !ENABLE(ASSERT) | 244 #if !ENABLE(ASSERT) |
| 234 // If we're in an animation style change, no animations can have started, be
en cancelled or changed play state. | 245 // If we're in an animation style change, no animations can have started, be
en cancelled or changed play state. |
| 235 // When ASSERT is enabled, we verify this optimization. | 246 // When ASSERT is enabled, we verify this optimization. |
| 236 if (activeAnimations && activeAnimations->isAnimationStyleChange()) | 247 if (isAnimationStyleChange) |
| 237 return; | 248 return; |
| 238 #endif | 249 #endif |
| 239 | 250 |
| 240 const CSSAnimationData* animationData = style.animations(); | 251 const CSSAnimationData* animationData = style.animations(); |
| 241 const CSSAnimations* cssAnimations = activeAnimations ? &activeAnimations->c
ssAnimations() : nullptr; | 252 const CSSAnimations* cssAnimations = activeAnimations ? &activeAnimations->c
ssAnimations() : nullptr; |
| 242 | 253 |
| 243 HashSet<AtomicString> inactive; | 254 HashSet<AtomicString> inactive; |
| 244 if (cssAnimations) { | 255 if (cssAnimations) { |
| 245 for (const auto& entry : cssAnimations->m_animations) | 256 for (const auto& entry : cssAnimations->m_animations) |
| 246 inactive.add(entry.key); | 257 inactive.add(entry.key); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 258 RefPtr<TimingFunction> keyframeTimingFunction = timing.timingFunctio
n; | 269 RefPtr<TimingFunction> keyframeTimingFunction = timing.timingFunctio
n; |
| 259 timing.timingFunction = Timing::defaults().timingFunction; | 270 timing.timingFunction = Timing::defaults().timingFunction; |
| 260 | 271 |
| 261 if (cssAnimations) { | 272 if (cssAnimations) { |
| 262 AnimationMap::const_iterator existing(cssAnimations->m_animation
s.find(animationName)); | 273 AnimationMap::const_iterator existing(cssAnimations->m_animation
s.find(animationName)); |
| 263 if (existing != cssAnimations->m_animations.end()) { | 274 if (existing != cssAnimations->m_animations.end()) { |
| 264 inactive.remove(animationName); | 275 inactive.remove(animationName); |
| 265 | 276 |
| 266 AnimationPlayer* player = existing->value.get(); | 277 AnimationPlayer* player = existing->value.get(); |
| 267 | 278 |
| 279 if (!isAnimationStyleChange && player->source()->isAnimation
()) { |
| 280 AnimationEffect* effect = toAnimation(player->source())-
>effect(); |
| 281 if (effect && effect->isKeyframeEffectModel()) { |
| 282 KeyframeEffectModelBase* keyframeEffect = toKeyframe
EffectModelBase(effect); |
| 283 if (keyframeEffect->hasSyntheticKeyframes()) |
| 284 update->updateAnimationStyle(player, keyframeEff
ect, snapshotCompositableProperties(animatingElement->renderer(), style, effect)
); |
| 285 } |
| 286 } |
| 287 |
| 268 // FIXME: Should handle changes in the timing function. | 288 // FIXME: Should handle changes in the timing function. |
| 269 if (timing != player->source()->specifiedTiming()) { | 289 if (timing != player->source()->specifiedTiming()) { |
| 270 ASSERT(!activeAnimations || !activeAnimations->isAnimati
onStyleChange()); | 290 ASSERT(!isAnimationStyleChange); |
| 271 | 291 |
| 272 AnimatableValueKeyframeVector resolvedKeyframes; | 292 StringKeyframeVector resolvedKeyframes; |
| 273 resolveKeyframes(resolver, animatingElement, element, st
yle, parentStyle, animationName, keyframeTimingFunction.get(), resolvedKeyframes
); | 293 resolveKeyframes(resolver, animatingElement, element, st
yle, parentStyle, animationName, keyframeTimingFunction.get(), resolvedKeyframes
); |
| 274 | 294 |
| 275 update->updateAnimationTiming(player, InertAnimation::cr
eate(AnimatableValueKeyframeEffectModel::create(resolvedKeyframes), | 295 auto effect = StringKeyframeEffectModel::create(resolved
Keyframes); |
| 276 timing, isPaused, player->currentTimeInternal()), ti
ming); | 296 effect->setNeutralKeyframeEasings(keyframeTimingFunction
); |
| 297 effect->forceConversionsToAnimatableValues(&element); //
FIXME: remove this once LegacyStyleInterpolation is removed from StringKeyframe |
| 298 effect->snapshotCompositableProperties(animatingElement,
style); |
| 299 update->updateAnimationTiming(player, InertAnimation::cr
eate(effect, timing, isPaused, player->currentTimeInternal()), timing); |
| 277 } | 300 } |
| 278 | 301 |
| 279 if (isPaused != player->paused()) { | 302 if (isPaused != player->paused()) { |
| 280 ASSERT(!activeAnimations || !activeAnimations->isAnimati
onStyleChange()); | 303 ASSERT(!isAnimationStyleChange); |
| 281 update->toggleAnimationPaused(animationName); | 304 update->toggleAnimationPaused(animationName); |
| 282 } | 305 } |
| 283 | 306 |
| 284 continue; | 307 continue; |
| 285 } | 308 } |
| 286 } | 309 } |
| 287 | 310 |
| 288 AnimatableValueKeyframeVector resolvedKeyframes; | 311 StringKeyframeVector resolvedKeyframes; |
| 289 resolveKeyframes(resolver, animatingElement, element, style, parentS
tyle, animationName, keyframeTimingFunction.get(), resolvedKeyframes); | 312 resolveKeyframes(resolver, animatingElement, element, style, parentS
tyle, animationName, keyframeTimingFunction.get(), resolvedKeyframes); |
| 290 if (!resolvedKeyframes.isEmpty()) { | 313 if (!resolvedKeyframes.isEmpty()) { |
| 291 ASSERT(!activeAnimations || !activeAnimations->isAnimationStyleC
hange()); | 314 ASSERT(!isAnimationStyleChange); |
| 292 update->startAnimation(animationName, InertAnimation::create(Ani
matableValueKeyframeEffectModel::create(resolvedKeyframes), timing, isPaused, 0)
); | 315 auto effect = StringKeyframeEffectModel::create(resolvedKeyframe
s); |
| 316 effect->setNeutralKeyframeEasings(keyframeTimingFunction); |
| 317 effect->forceConversionsToAnimatableValues(&element); // FIXME:
remove this once LegacyStyleInterpolation is removed from StringKeyframe |
| 318 effect->snapshotCompositableProperties(animatingElement, style); |
| 319 update->startAnimation(animationName, InertAnimation::create(eff
ect, timing, isPaused, 0)); |
| 293 } | 320 } |
| 294 } | 321 } |
| 295 } | 322 } |
| 296 | 323 |
| 297 ASSERT(inactive.isEmpty() || cssAnimations); | 324 ASSERT(inactive.isEmpty() || cssAnimations); |
| 298 for (const AtomicString& animationName : inactive) { | 325 for (const AtomicString& animationName : inactive) { |
| 299 ASSERT(!activeAnimations || !activeAnimations->isAnimationStyleChange())
; | 326 ASSERT(!isAnimationStyleChange); |
| 300 update->cancelAnimation(animationName, *cssAnimations->m_animations.get(
animationName)); | 327 update->cancelAnimation(animationName, *cssAnimations->m_animations.get(
animationName)); |
| 301 } | 328 } |
| 302 } | 329 } |
| 303 | 330 |
| 304 void CSSAnimations::maybeApplyPendingUpdate(Element* element) | 331 void CSSAnimations::maybeApplyPendingUpdate(Element* element) |
| 305 { | 332 { |
| 306 if (!m_pendingUpdate) { | 333 if (!m_pendingUpdate) { |
| 307 m_previousActiveInterpolationsForAnimations.clear(); | 334 m_previousActiveInterpolationsForAnimations.clear(); |
| 308 return; | 335 return; |
| 309 } | 336 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 331 player->pause(); | 358 player->pause(); |
| 332 if (player->outdated()) | 359 if (player->outdated()) |
| 333 player->update(TimingUpdateOnDemand); | 360 player->update(TimingUpdateOnDemand); |
| 334 } | 361 } |
| 335 | 362 |
| 336 for (const auto& timingUpdate : update->animationsWithTimingUpdates()) { | 363 for (const auto& timingUpdate : update->animationsWithTimingUpdates()) { |
| 337 timingUpdate.player->source()->updateSpecifiedTiming(timingUpdate.newTim
ing); | 364 timingUpdate.player->source()->updateSpecifiedTiming(timingUpdate.newTim
ing); |
| 338 timingUpdate.player->update(TimingUpdateOnDemand); | 365 timingUpdate.player->update(TimingUpdateOnDemand); |
| 339 } | 366 } |
| 340 | 367 |
| 368 for (const auto& styleUpdate : update->animationsWithStyleUpdates()) { |
| 369 styleUpdate.effect->setDeferredInterpolationsOutdated(); |
| 370 if (styleUpdate.snapshot.opacity || styleUpdate.snapshot.transform || st
yleUpdate.snapshot.webkitFilter) { |
| 371 styleUpdate.effect->updateNeutralKeyframeAnimatableValues(CSSPropert
yOpacity, styleUpdate.snapshot.opacity); |
| 372 styleUpdate.effect->updateNeutralKeyframeAnimatableValues(CSSPropert
yTransform, styleUpdate.snapshot.transform); |
| 373 styleUpdate.effect->updateNeutralKeyframeAnimatableValues(CSSPropert
yWebkitFilter, styleUpdate.snapshot.webkitFilter); |
| 374 styleUpdate.player->setOutdated(); |
| 375 styleUpdate.player->setCompositorPending(true); |
| 376 } |
| 377 } |
| 378 |
| 341 for (const auto& entry : update->newAnimations()) { | 379 for (const auto& entry : update->newAnimations()) { |
| 342 const InertAnimation* inertAnimation = entry.animation.get(); | 380 const InertAnimation* inertAnimation = entry.animation.get(); |
| 343 OwnPtrWillBeRawPtr<AnimationEventDelegate> eventDelegate = adoptPtrWillB
eNoop(new AnimationEventDelegate(element, entry.name)); | 381 OwnPtrWillBeRawPtr<AnimationEventDelegate> eventDelegate = adoptPtrWillB
eNoop(new AnimationEventDelegate(element, entry.name)); |
| 344 RefPtrWillBeRawPtr<Animation> animation = Animation::create(element, ine
rtAnimation->effect(), inertAnimation->specifiedTiming(), Animation::DefaultPrio
rity, eventDelegate.release()); | 382 RefPtrWillBeRawPtr<Animation> animation = Animation::create(element, ine
rtAnimation->effect(), inertAnimation->specifiedTiming(), Animation::DefaultPrio
rity, eventDelegate.release()); |
| 345 animation->setName(inertAnimation->name()); | 383 animation->setName(inertAnimation->name()); |
| 346 RefPtrWillBeRawPtr<AnimationPlayer> player = element->document().timelin
e().play(animation.get()); | 384 RefPtrWillBeRawPtr<AnimationPlayer> player = element->document().timelin
e().play(animation.get()); |
| 347 if (inertAnimation->paused()) | 385 if (inertAnimation->paused()) |
| 348 player->pause(); | 386 player->pause(); |
| 349 player->update(TimingUpdateOnDemand); | 387 player->update(TimingUpdateOnDemand); |
| 350 m_animations.set(entry.name, player.get()); | 388 m_animations.set(entry.name, player.get()); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 visitor->trace(m_newTransitions); | 805 visitor->trace(m_newTransitions); |
| 768 visitor->trace(m_activeInterpolationsForAnimations); | 806 visitor->trace(m_activeInterpolationsForAnimations); |
| 769 visitor->trace(m_activeInterpolationsForTransitions); | 807 visitor->trace(m_activeInterpolationsForTransitions); |
| 770 visitor->trace(m_newAnimations); | 808 visitor->trace(m_newAnimations); |
| 771 visitor->trace(m_suppressedAnimationPlayers); | 809 visitor->trace(m_suppressedAnimationPlayers); |
| 772 visitor->trace(m_animationsWithTimingUpdates); | 810 visitor->trace(m_animationsWithTimingUpdates); |
| 773 #endif | 811 #endif |
| 774 } | 812 } |
| 775 | 813 |
| 776 } // namespace blink | 814 } // namespace blink |
| OLD | NEW |