| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool isLaterPhase(TimedItem::Phase target, TimedItem::Phase reference) | 68 bool isLaterPhase(TimedItem::Phase target, TimedItem::Phase reference) |
| 69 { | 69 { |
| 70 ASSERT(target != TimedItem::PhaseNone); | 70 ASSERT(target != TimedItem::PhaseNone); |
| 71 ASSERT(reference != TimedItem::PhaseNone); | 71 ASSERT(reference != TimedItem::PhaseNone); |
| 72 return target > reference; | 72 return target > reference; |
| 73 } | 73 } |
| 74 | 74 |
| 75 static void resolveKeyframes(StyleResolver* resolver, Element* element, const El
ement& parentElement, const RenderStyle& style, RenderStyle* parentStyle, const
AtomicString& name, TimingFunction* defaultTimingFunction, | 75 static void resolveKeyframes(StyleResolver* resolver, Element* element, const El
ement& parentElement, const RenderStyle& style, RenderStyle* parentStyle, const
AtomicString& name, TimingFunction* defaultTimingFunction, |
| 76 WillBeHeapVector<KeyframeEffectModel::KeyframeVector>& resolvedKeyframes) | 76 WillBeHeapVector<AnimatableValueKeyframeVector>& resolvedKeyframes) |
| 77 { | 77 { |
| 78 // When the element is null, use its parent for scoping purposes. | 78 // When the element is null, use its parent for scoping purposes. |
| 79 const Element* elementForScoping = element ? element : &parentElement; | 79 const Element* elementForScoping = element ? element : &parentElement; |
| 80 const StyleRuleKeyframes* keyframesRule = CSSAnimations::matchScopedKeyframe
sRule(resolver, elementForScoping, name.impl()); | 80 const StyleRuleKeyframes* keyframesRule = CSSAnimations::matchScopedKeyframe
sRule(resolver, elementForScoping, name.impl()); |
| 81 if (!keyframesRule) | 81 if (!keyframesRule) |
| 82 return; | 82 return; |
| 83 | 83 |
| 84 const WillBeHeapVector<RefPtrWillBeMember<StyleKeyframe> >& styleKeyframes =
keyframesRule->keyframes(); | 84 const WillBeHeapVector<RefPtrWillBeMember<StyleKeyframe> >& styleKeyframes =
keyframesRule->keyframes(); |
| 85 if (styleKeyframes.isEmpty()) | 85 if (styleKeyframes.isEmpty()) |
| 86 return; | 86 return; |
| 87 | 87 |
| 88 // Construct and populate the style for each keyframe | 88 // Construct and populate the style for each keyframe |
| 89 PropertySet specifiedProperties; | 89 PropertySet specifiedProperties; |
| 90 KeyframeEffectModel::KeyframeVector keyframes; | 90 AnimatableValueKeyframeVector keyframes; |
| 91 for (size_t i = 0; i < styleKeyframes.size(); ++i) { | 91 for (size_t i = 0; i < styleKeyframes.size(); ++i) { |
| 92 const StyleKeyframe* styleKeyframe = styleKeyframes[i].get(); | 92 const StyleKeyframe* styleKeyframe = styleKeyframes[i].get(); |
| 93 // It's OK to pass a null element here. | 93 // It's OK to pass a null element here. |
| 94 RefPtr<RenderStyle> keyframeStyle = resolver->styleForKeyframe(element,
style, parentStyle, styleKeyframe, name); | 94 RefPtr<RenderStyle> keyframeStyle = resolver->styleForKeyframe(element,
style, parentStyle, styleKeyframe, name); |
| 95 RefPtrWillBeRawPtr<Keyframe> keyframe = Keyframe::create(); | 95 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframe = AnimatableValueKe
yframe::create(); |
| 96 const Vector<double>& offsets = styleKeyframe->keys(); | 96 const Vector<double>& offsets = styleKeyframe->keys(); |
| 97 ASSERT(!offsets.isEmpty()); | 97 ASSERT(!offsets.isEmpty()); |
| 98 keyframe->setOffset(offsets[0]); | 98 keyframe->setOffset(offsets[0]); |
| 99 keyframe->setEasing(defaultTimingFunction); | 99 keyframe->setEasing(defaultTimingFunction); |
| 100 const StylePropertySet& properties = styleKeyframe->properties(); | 100 const StylePropertySet& properties = styleKeyframe->properties(); |
| 101 for (unsigned j = 0; j < properties.propertyCount(); j++) { | 101 for (unsigned j = 0; j < properties.propertyCount(); j++) { |
| 102 CSSPropertyID property = properties.propertyAt(j).id(); | 102 CSSPropertyID property = properties.propertyAt(j).id(); |
| 103 specifiedProperties.add(property); | 103 specifiedProperties.add(property); |
| 104 if (property == CSSPropertyWebkitAnimationTimingFunction || property
== CSSPropertyAnimationTimingFunction) | 104 if (property == CSSPropertyWebkitAnimationTimingFunction || property
== CSSPropertyAnimationTimingFunction) |
| 105 keyframe->setEasing(KeyframeValue::timingFunction(*keyframeStyle
)); | 105 keyframe->setEasing(KeyframeValue::timingFunction(*keyframeStyle
)); |
| 106 else if (CSSAnimations::isAnimatableProperty(property)) | 106 else if (CSSAnimations::isAnimatableProperty(property)) |
| 107 keyframe->setPropertyValue(property, CSSAnimatableValueFactory::
create(property, *keyframeStyle).get()); | 107 keyframe->setPropertyValue(property, CSSAnimatableValueFactory::
create(property, *keyframeStyle).get()); |
| 108 } | 108 } |
| 109 keyframes.append(keyframe); | 109 keyframes.append(keyframe); |
| 110 // The last keyframe specified at a given offset is used. | 110 // The last keyframe specified at a given offset is used. |
| 111 for (size_t j = 1; j < offsets.size(); ++j) { | 111 for (size_t j = 1; j < offsets.size(); ++j) { |
| 112 keyframes.append(keyframe->cloneWithOffset(offsets[j])); | 112 keyframes.append(toAnimatableValueKeyframe(keyframe->cloneWithOffset
(offsets[j]).get())); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 ASSERT(!keyframes.isEmpty()); | 115 ASSERT(!keyframes.isEmpty()); |
| 116 | 116 |
| 117 for (PropertySet::const_iterator iter = specifiedProperties.begin(); iter !=
specifiedProperties.end(); ++iter) { | 117 for (PropertySet::const_iterator iter = specifiedProperties.begin(); iter !=
specifiedProperties.end(); ++iter) { |
| 118 const CSSPropertyID property = *iter; | 118 const CSSPropertyID property = *iter; |
| 119 ASSERT(property != CSSPropertyInvalid); | 119 ASSERT(property != CSSPropertyInvalid); |
| 120 blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProper
ties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property)); | 120 blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProper
ties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(property)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 // Remove duplicate keyframes. In CSS the last keyframe at a given offset ta
kes priority. | 123 // Remove duplicate keyframes. In CSS the last keyframe at a given offset ta
kes priority. |
| 124 std::stable_sort(keyframes.begin(), keyframes.end(), Keyframe::compareOffset
s); | 124 std::stable_sort(keyframes.begin(), keyframes.end(), Keyframe::compareOffset
s); |
| 125 size_t targetIndex = 0; | 125 size_t targetIndex = 0; |
| 126 for (size_t i = 1; i < keyframes.size(); i++) { | 126 for (size_t i = 1; i < keyframes.size(); i++) { |
| 127 if (keyframes[i]->offset() != keyframes[targetIndex]->offset()) | 127 if (keyframes[i]->offset() != keyframes[targetIndex]->offset()) |
| 128 targetIndex++; | 128 targetIndex++; |
| 129 if (targetIndex != i) | 129 if (targetIndex != i) |
| 130 keyframes[targetIndex] = keyframes[i]; | 130 keyframes[targetIndex] = keyframes[i]; |
| 131 } | 131 } |
| 132 keyframes.shrink(targetIndex + 1); | 132 keyframes.shrink(targetIndex + 1); |
| 133 | 133 |
| 134 // Add 0% and 100% keyframes if absent. | 134 // Add 0% and 100% keyframes if absent. |
| 135 RefPtrWillBeRawPtr<Keyframe> startKeyframe = keyframes[0]; | 135 RefPtrWillBeRawPtr<AnimatableValueKeyframe> startKeyframe = keyframes[0]; |
| 136 if (startKeyframe->offset()) { | 136 if (startKeyframe->offset()) { |
| 137 startKeyframe = Keyframe::create(); | 137 startKeyframe = AnimatableValueKeyframe::create(); |
| 138 startKeyframe->setOffset(0); | 138 startKeyframe->setOffset(0); |
| 139 keyframes.prepend(startKeyframe); | 139 keyframes.prepend(startKeyframe); |
| 140 } | 140 } |
| 141 RefPtrWillBeRawPtr<Keyframe> endKeyframe = keyframes[keyframes.size() - 1]; | 141 RefPtrWillBeRawPtr<AnimatableValueKeyframe> endKeyframe = keyframes[keyframe
s.size() - 1]; |
| 142 if (endKeyframe->offset() != 1) { | 142 if (endKeyframe->offset() != 1) { |
| 143 endKeyframe = Keyframe::create(); | 143 endKeyframe = AnimatableValueKeyframe::create(); |
| 144 endKeyframe->setOffset(1); | 144 endKeyframe->setOffset(1); |
| 145 keyframes.append(endKeyframe); | 145 keyframes.append(endKeyframe); |
| 146 } | 146 } |
| 147 ASSERT(keyframes.size() >= 2); | 147 ASSERT(keyframes.size() >= 2); |
| 148 ASSERT(!keyframes.first()->offset()); | 148 ASSERT(!keyframes.first()->offset()); |
| 149 ASSERT(keyframes.last()->offset() == 1); | 149 ASSERT(keyframes.last()->offset() == 1); |
| 150 | 150 |
| 151 // Snapshot current property values for 0% and 100% if missing. | 151 // Snapshot current property values for 0% and 100% if missing. |
| 152 PropertySet allProperties; | 152 PropertySet allProperties; |
| 153 size_t numKeyframes = keyframes.size(); | 153 size_t numKeyframes = keyframes.size(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // Split keyframes into groups, where each group contains only keyframes | 190 // Split keyframes into groups, where each group contains only keyframes |
| 191 // which specify all properties used in that group. Each group is animated | 191 // which specify all properties used in that group. Each group is animated |
| 192 // in a separate animation, to allow per-keyframe timing functions to be | 192 // in a separate animation, to allow per-keyframe timing functions to be |
| 193 // applied correctly. | 193 // applied correctly. |
| 194 for (PropertyCountedSet::const_iterator iter = propertyCounts.begin(); iter
!= propertyCounts.end(); ++iter) { | 194 for (PropertyCountedSet::const_iterator iter = propertyCounts.begin(); iter
!= propertyCounts.end(); ++iter) { |
| 195 const CSSPropertyID property = iter->key; | 195 const CSSPropertyID property = iter->key; |
| 196 const size_t count = iter->value; | 196 const size_t count = iter->value; |
| 197 ASSERT(count <= numKeyframes); | 197 ASSERT(count <= numKeyframes); |
| 198 if (count == numKeyframes) | 198 if (count == numKeyframes) |
| 199 continue; | 199 continue; |
| 200 KeyframeEffectModel::KeyframeVector splitOutKeyframes; | 200 AnimatableValueKeyframeVector splitOutKeyframes; |
| 201 for (size_t i = 0; i < numKeyframes; i++) { | 201 for (size_t i = 0; i < numKeyframes; i++) { |
| 202 Keyframe* keyframe = keyframes[i].get(); | 202 AnimatableValueKeyframe* keyframe = keyframes[i].get(); |
| 203 if (!keyframe->properties().contains(property)) { | 203 if (!keyframe->properties().contains(property)) { |
| 204 ASSERT(i && i != numKeyframes - 1); | 204 ASSERT(i && i != numKeyframes - 1); |
| 205 continue; | 205 continue; |
| 206 } | 206 } |
| 207 RefPtrWillBeRawPtr<Keyframe> clonedKeyframe = Keyframe::create(); | 207 RefPtrWillBeRawPtr<AnimatableValueKeyframe> clonedKeyframe = Animata
bleValueKeyframe::create(); |
| 208 clonedKeyframe->setOffset(keyframe->offset()); | 208 clonedKeyframe->setOffset(keyframe->offset()); |
| 209 clonedKeyframe->setEasing(keyframe->easing()); | 209 clonedKeyframe->setEasing(keyframe->easing()); |
| 210 clonedKeyframe->setComposite(keyframe->composite()); | 210 clonedKeyframe->setComposite(keyframe->composite()); |
| 211 clonedKeyframe->setPropertyValue(property, keyframe->propertyValue(p
roperty)); | 211 clonedKeyframe->setPropertyValue(property, keyframe->propertyValue(p
roperty)); |
| 212 splitOutKeyframes.append(clonedKeyframe); | 212 splitOutKeyframes.append(clonedKeyframe); |
| 213 // Note that it's OK if this keyframe ends up having no | 213 // Note that it's OK if this keyframe ends up having no |
| 214 // properties. This can only happen when none of the properties | 214 // properties. This can only happen when none of the properties |
| 215 // are specified in all keyframes, in which case we won't animate | 215 // are specified in all keyframes, in which case we won't animate |
| 216 // anything with these keyframes. | 216 // anything with these keyframes. |
| 217 keyframe->clearPropertyValue(property); | 217 keyframe->clearPropertyValue(property); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 ASSERT(!activeAnimations || !activeAnimations->isAnimati
onStyleChange()); | 374 ASSERT(!activeAnimations || !activeAnimations->isAnimati
onStyleChange()); |
| 375 update->toggleAnimationPaused(animationName); | 375 update->toggleAnimationPaused(animationName); |
| 376 } | 376 } |
| 377 continue; | 377 continue; |
| 378 } | 378 } |
| 379 } | 379 } |
| 380 | 380 |
| 381 Timing timing; | 381 Timing timing; |
| 382 bool isPaused; | 382 bool isPaused; |
| 383 RefPtr<TimingFunction> defaultTimingFunction = timingFromAnimationDa
ta(animationData, timing, isPaused); | 383 RefPtr<TimingFunction> defaultTimingFunction = timingFromAnimationDa
ta(animationData, timing, isPaused); |
| 384 WillBeHeapVector<KeyframeEffectModel::KeyframeVector> resolvedKeyfra
mes; | 384 WillBeHeapVector<AnimatableValueKeyframeVector> resolvedKeyframes; |
| 385 resolveKeyframes(resolver, element, parentElement, style, parentStyl
e, animationName, defaultTimingFunction.get(), resolvedKeyframes); | 385 resolveKeyframes(resolver, element, parentElement, style, parentStyl
e, animationName, defaultTimingFunction.get(), resolvedKeyframes); |
| 386 if (!resolvedKeyframes.isEmpty()) { | 386 if (!resolvedKeyframes.isEmpty()) { |
| 387 HashSet<RefPtr<InertAnimation> > animations; | 387 HashSet<RefPtr<InertAnimation> > animations; |
| 388 for (size_t j = 0; j < resolvedKeyframes.size(); ++j) { | 388 for (size_t j = 0; j < resolvedKeyframes.size(); ++j) { |
| 389 ASSERT(!resolvedKeyframes[j].isEmpty()); | 389 ASSERT(!resolvedKeyframes[j].isEmpty()); |
| 390 timing.timingFunction = LinearTimingFunction::preset(); | 390 timing.timingFunction = LinearTimingFunction::preset(); |
| 391 // FIXME: crbug.com/268791 - Keyframes are already normalize
d, perhaps there should be a flag on KeyframeEffectModel to skip normalization. | 391 // FIXME: crbug.com/268791 - Keyframes are already normalize
d, perhaps there should be a flag on KeyframeEffectModel to skip normalization. |
| 392 animations.add(InertAnimation::create(KeyframeEffectModel::c
reate(resolvedKeyframes[j]), timing, isPaused)); | 392 animations.add(InertAnimation::create(AnimatableValueKeyfram
eEffectModel::create(resolvedKeyframes[j]), timing, isPaused)); |
| 393 } | 393 } |
| 394 ASSERT(!activeAnimations || !activeAnimations->isAnimationStyleC
hange()); | 394 ASSERT(!activeAnimations || !activeAnimations->isAnimationStyleC
hange()); |
| 395 update->startAnimation(animationName, animations); | 395 update->startAnimation(animationName, animations); |
| 396 } | 396 } |
| 397 } | 397 } |
| 398 } | 398 } |
| 399 | 399 |
| 400 ASSERT(inactive.isEmpty() || cssAnimations); | 400 ASSERT(inactive.isEmpty() || cssAnimations); |
| 401 for (HashSet<AtomicString>::const_iterator iter = inactive.begin(); iter !=
inactive.end(); ++iter) { | 401 for (HashSet<AtomicString>::const_iterator iter = inactive.begin(); iter !=
inactive.end(); ++iter) { |
| 402 ASSERT(!activeAnimations || !activeAnimations->isAnimationStyleChange())
; | 402 ASSERT(!activeAnimations || !activeAnimations->isAnimationStyleChange())
; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 OwnPtr<TransitionEventDelegate> eventDelegate = adoptPtr(new TransitionE
ventDelegate(element, id)); | 486 OwnPtr<TransitionEventDelegate> eventDelegate = adoptPtr(new TransitionE
ventDelegate(element, id)); |
| 487 | 487 |
| 488 RefPtrWillBeRawPtr<AnimationEffect> effect = inertAnimation->effect(); | 488 RefPtrWillBeRawPtr<AnimationEffect> effect = inertAnimation->effect(); |
| 489 | 489 |
| 490 if (retargetedCompositorTransitions.contains(id)) { | 490 if (retargetedCompositorTransitions.contains(id)) { |
| 491 const std::pair<RefPtr<Animation>, double>& oldTransition = retarget
edCompositorTransitions.get(id); | 491 const std::pair<RefPtr<Animation>, double>& oldTransition = retarget
edCompositorTransitions.get(id); |
| 492 RefPtr<Animation> oldAnimation = oldTransition.first; | 492 RefPtr<Animation> oldAnimation = oldTransition.first; |
| 493 double oldStartTime = oldTransition.second; | 493 double oldStartTime = oldTransition.second; |
| 494 double inheritedTime = isNull(oldStartTime) ? 0 : element->document(
).transitionTimeline().currentTime() - oldStartTime; | 494 double inheritedTime = isNull(oldStartTime) ? 0 : element->document(
).transitionTimeline().currentTime() - oldStartTime; |
| 495 oldAnimation->updateInheritedTime(inheritedTime); | 495 oldAnimation->updateInheritedTime(inheritedTime); |
| 496 KeyframeEffectModel* oldEffect = toKeyframeEffectModel(inertAnimatio
n->effect()); | 496 AnimatableValueKeyframeEffectModel* oldEffect = toAnimatableValueKey
frameEffectModel(inertAnimation->effect()); |
| 497 const KeyframeEffectModel::KeyframeVector& frames = oldEffect->getFr
ames(); | 497 const KeyframeVector& frames = oldEffect->getFrames(); |
| 498 KeyframeEffectModel::KeyframeVector newFrames; | 498 AnimatableValueKeyframeVector newFrames; |
| 499 newFrames.append(frames[0]->clone()); | 499 newFrames.append(toAnimatableValueKeyframe(frames[0]->clone().get())
); |
| 500 newFrames[0]->clearPropertyValue(id); | 500 newFrames[0]->clearPropertyValue(id); |
| 501 ASSERT(oldAnimation->activeInterpolations().size() == 1); | 501 ASSERT(oldAnimation->activeInterpolations().size() == 1); |
| 502 const AnimatableValue* value = toLegacyStyleInterpolation(oldAnimati
on->activeInterpolations()[0].get())->currentValue(); | 502 RefPtr<AnimatableValue> value = toLegacyStyleInterpolation(oldAnimat
ion->activeInterpolations()[0].get())->currentValue(); |
| 503 newFrames[0]->setPropertyValue(id, value); | 503 newFrames[0]->setPropertyValue(id, value.release()); |
| 504 newFrames.append(frames[1]->clone()); | 504 newFrames.append(toAnimatableValueKeyframe(frames[1]->clone().get())
); |
| 505 effect = KeyframeEffectModel::create(newFrames); | 505 effect = AnimatableValueKeyframeEffectModel::create(newFrames); |
| 506 } | 506 } |
| 507 RefPtr<Animation> transition = Animation::create(element, effect, inertA
nimation->specifiedTiming(), Animation::TransitionPriority, eventDelegate.releas
e()); | 507 RefPtr<Animation> transition = Animation::create(element, effect, inertA
nimation->specifiedTiming(), Animation::TransitionPriority, eventDelegate.releas
e()); |
| 508 RefPtr<AnimationPlayer> player = element->document().transitionTimeline(
).createAnimationPlayer(transition.get()); | 508 RefPtr<AnimationPlayer> player = element->document().transitionTimeline(
).createAnimationPlayer(transition.get()); |
| 509 player->update(); | 509 player->update(); |
| 510 element->document().cssPendingAnimations().add(player.get()); | 510 element->document().cssPendingAnimations().add(player.get()); |
| 511 runningTransition.transition = transition.get(); | 511 runningTransition.transition = transition.get(); |
| 512 m_transitions.set(id, runningTransition); | 512 m_transitions.set(id, runningTransition); |
| 513 ASSERT(id != CSSPropertyInvalid); | 513 ASSERT(id != CSSPropertyInvalid); |
| 514 blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProper
ties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); | 514 blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProper
ties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); |
| 515 } | 515 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 544 if (AnimatableValue::usesDefaultInterpolation(to.get(), from.get())) | 544 if (AnimatableValue::usesDefaultInterpolation(to.get(), from.get())) |
| 545 return; | 545 return; |
| 546 | 546 |
| 547 Timing timing; | 547 Timing timing; |
| 548 bool isPaused; | 548 bool isPaused; |
| 549 RefPtr<TimingFunction> timingFunction = timingFromAnimationData(anim, timing
, isPaused); | 549 RefPtr<TimingFunction> timingFunction = timingFromAnimationData(anim, timing
, isPaused); |
| 550 ASSERT(!isPaused); | 550 ASSERT(!isPaused); |
| 551 // Note that the backwards part is required for delay to work. | 551 // Note that the backwards part is required for delay to work. |
| 552 timing.fillMode = Timing::FillModeBoth; | 552 timing.fillMode = Timing::FillModeBoth; |
| 553 | 553 |
| 554 KeyframeEffectModel::KeyframeVector keyframes; | 554 AnimatableValueKeyframeVector keyframes; |
| 555 | 555 |
| 556 RefPtrWillBeRawPtr<Keyframe> startKeyframe = Keyframe::create(); | 556 RefPtrWillBeRawPtr<AnimatableValueKeyframe> startKeyframe = AnimatableValueK
eyframe::create(); |
| 557 startKeyframe->setPropertyValue(id, from.get()); | 557 startKeyframe->setPropertyValue(id, from.get()); |
| 558 startKeyframe->setOffset(0); | 558 startKeyframe->setOffset(0); |
| 559 startKeyframe->setEasing(timingFunction); | 559 startKeyframe->setEasing(timingFunction); |
| 560 keyframes.append(startKeyframe); | 560 keyframes.append(startKeyframe); |
| 561 | 561 |
| 562 RefPtrWillBeRawPtr<Keyframe> endKeyframe = Keyframe::create(); | 562 RefPtrWillBeRawPtr<AnimatableValueKeyframe> endKeyframe = AnimatableValueKey
frame::create(); |
| 563 endKeyframe->setPropertyValue(id, to.get()); | 563 endKeyframe->setPropertyValue(id, to.get()); |
| 564 endKeyframe->setOffset(1); | 564 endKeyframe->setOffset(1); |
| 565 keyframes.append(endKeyframe); | 565 keyframes.append(endKeyframe); |
| 566 | 566 |
| 567 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create
(keyframes); | 567 RefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> effect = AnimatableVa
lueKeyframeEffectModel::create(keyframes); |
| 568 | 568 |
| 569 update->startTransition(id, from.get(), to.get(), InertAnimation::create(eff
ect, timing, isPaused)); | 569 update->startTransition(id, from.get(), to.get(), InertAnimation::create(eff
ect, timing, isPaused)); |
| 570 ASSERT(!element->activeAnimations() || !element->activeAnimations()->isAnima
tionStyleChange()); | 570 ASSERT(!element->activeAnimations() || !element->activeAnimations()->isAnima
tionStyleChange()); |
| 571 } | 571 } |
| 572 | 572 |
| 573 void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate* update, const
Element* element, const RenderStyle& style) | 573 void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate* update, const
Element* element, const RenderStyle& style) |
| 574 { | 574 { |
| 575 if (!element) | 575 if (!element) |
| 576 return; | 576 return; |
| 577 | 577 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 } | 903 } |
| 904 | 904 |
| 905 void CSSAnimationUpdate::trace(Visitor* visitor) | 905 void CSSAnimationUpdate::trace(Visitor* visitor) |
| 906 { | 906 { |
| 907 visitor->trace(m_newTransitions); | 907 visitor->trace(m_newTransitions); |
| 908 visitor->trace(m_activeInterpolationsForAnimations); | 908 visitor->trace(m_activeInterpolationsForAnimations); |
| 909 visitor->trace(m_activeInterpolationsForTransitions); | 909 visitor->trace(m_activeInterpolationsForTransitions); |
| 910 } | 910 } |
| 911 | 911 |
| 912 } // namespace WebCore | 912 } // namespace WebCore |
| OLD | NEW |