Chromium Code Reviews| 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 486 animation->update(TimingUpdateOnDemand); | 486 animation->update(TimingUpdateOnDemand); |
| 487 | 487 |
| 488 m_runningAnimations.push_back(new RunningAnimation(animation, entry)); | 488 m_runningAnimations.push_back(new RunningAnimation(animation, entry)); |
| 489 } | 489 } |
| 490 | 490 |
| 491 // Transitions that are run on the compositor only update main-thread state | 491 // Transitions that are run on the compositor only update main-thread state |
| 492 // lazily. However, we need the new state to know what the from state shoud | 492 // lazily. However, we need the new state to know what the from state shoud |
| 493 // be when transitions are retargeted. Instead of triggering complete style | 493 // be when transitions are retargeted. Instead of triggering complete style |
| 494 // recalculation, we find these cases by searching for new transitions that | 494 // recalculation, we find these cases by searching for new transitions that |
| 495 // have matching cancelled animation property IDs on the compositor. | 495 // have matching cancelled animation property IDs on the compositor. |
| 496 HeapHashMap<CSSPropertyID, std::pair<Member<KeyframeEffectReadOnly>, double>> | 496 HeapHashMap<PropertyHandle, std::pair<Member<KeyframeEffectReadOnly>, double>> |
| 497 retargetedCompositorTransitions; | 497 retargetedCompositorTransitions; |
| 498 for (CSSPropertyID id : m_pendingUpdate.cancelledTransitions()) { | 498 for (const PropertyHandle& property : |
| 499 DCHECK(m_transitions.contains(id)); | 499 m_pendingUpdate.cancelledTransitions()) { |
| 500 DCHECK(m_transitions.contains(property)); | |
| 500 | 501 |
| 501 Animation* animation = m_transitions.take(id).animation; | 502 Animation* animation = m_transitions.take(property).animation; |
| 502 KeyframeEffectReadOnly* effect = | 503 KeyframeEffectReadOnly* effect = |
| 503 toKeyframeEffectReadOnly(animation->effect()); | 504 toKeyframeEffectReadOnly(animation->effect()); |
| 504 if (effect->hasActiveAnimationsOnCompositor(id) && | 505 if (effect->hasActiveAnimationsOnCompositor(property) && |
| 505 m_pendingUpdate.newTransitions().find(id) != | 506 m_pendingUpdate.newTransitions().find(property) != |
| 506 m_pendingUpdate.newTransitions().end() && | 507 m_pendingUpdate.newTransitions().end() && |
| 507 !animation->limited()) | 508 !animation->limited()) { |
| 508 retargetedCompositorTransitions.insert( | 509 retargetedCompositorTransitions.insert( |
| 509 id, std::pair<KeyframeEffectReadOnly*, double>( | 510 property, |
| 510 effect, animation->startTimeInternal())); | 511 std::pair<KeyframeEffectReadOnly*, double>( |
| 512 effect, animation->startTimeInternal())); | |
| 513 } | |
| 511 animation->cancel(); | 514 animation->cancel(); |
| 512 // after cancelation, transitions must be downgraded or they'll fail | 515 // after cancelation, transitions must be downgraded or they'll fail |
| 513 // to be considered when retriggering themselves. This can happen if | 516 // to be considered when retriggering themselves. This can happen if |
| 514 // the transition is captured through getAnimations then played. | 517 // the transition is captured through getAnimations then played. |
| 515 if (animation->effect() && animation->effect()->isKeyframeEffectReadOnly()) | 518 if (animation->effect() && animation->effect()->isKeyframeEffectReadOnly()) |
| 516 toKeyframeEffectReadOnly(animation->effect())->downgradeToNormal(); | 519 toKeyframeEffectReadOnly(animation->effect())->downgradeToNormal(); |
| 517 animation->update(TimingUpdateOnDemand); | 520 animation->update(TimingUpdateOnDemand); |
| 518 } | 521 } |
| 519 | 522 |
| 520 for (CSSPropertyID id : m_pendingUpdate.finishedTransitions()) { | 523 for (const PropertyHandle& property : m_pendingUpdate.finishedTransitions()) { |
| 521 // This transition can also be cancelled and finished at the same time | 524 // This transition can also be cancelled and finished at the same time |
| 522 if (m_transitions.contains(id)) { | 525 if (m_transitions.contains(property)) { |
| 523 Animation* animation = m_transitions.take(id).animation; | 526 Animation* animation = m_transitions.take(property).animation; |
| 524 // Transition must be downgraded | 527 // Transition must be downgraded |
| 525 if (animation->effect() && | 528 if (animation->effect() && |
| 526 animation->effect()->isKeyframeEffectReadOnly()) | 529 animation->effect()->isKeyframeEffectReadOnly()) |
| 527 toKeyframeEffectReadOnly(animation->effect())->downgradeToNormal(); | 530 toKeyframeEffectReadOnly(animation->effect())->downgradeToNormal(); |
| 528 } | 531 } |
| 529 } | 532 } |
| 530 | 533 |
| 531 for (const auto& entry : m_pendingUpdate.newTransitions()) { | 534 for (const auto& entry : m_pendingUpdate.newTransitions()) { |
| 532 const CSSAnimationUpdate::NewTransition& newTransition = entry.value; | 535 const CSSAnimationUpdate::NewTransition& newTransition = entry.value; |
| 533 | 536 |
| 534 RunningTransition runningTransition; | 537 RunningTransition runningTransition; |
| 535 runningTransition.from = newTransition.from; | 538 runningTransition.from = newTransition.from; |
| 536 runningTransition.to = newTransition.to; | 539 runningTransition.to = newTransition.to; |
| 537 runningTransition.reversingAdjustedStartValue = | 540 runningTransition.reversingAdjustedStartValue = |
| 538 newTransition.reversingAdjustedStartValue; | 541 newTransition.reversingAdjustedStartValue; |
| 539 runningTransition.reversingShorteningFactor = | 542 runningTransition.reversingShorteningFactor = |
| 540 newTransition.reversingShorteningFactor; | 543 newTransition.reversingShorteningFactor; |
| 541 | 544 |
| 542 CSSPropertyID id = newTransition.id; | 545 const PropertyHandle& property = newTransition.property; |
| 543 const InertEffect* inertAnimation = newTransition.effect.get(); | 546 const InertEffect* inertAnimation = newTransition.effect.get(); |
| 544 TransitionEventDelegate* eventDelegate = | 547 TransitionEventDelegate* eventDelegate = |
| 545 new TransitionEventDelegate(element, id); | 548 new TransitionEventDelegate(element, property); |
| 546 | 549 |
| 547 EffectModel* model = inertAnimation->model(); | 550 EffectModel* model = inertAnimation->model(); |
| 548 | 551 |
| 549 if (retargetedCompositorTransitions.contains(id)) { | 552 if (retargetedCompositorTransitions.contains(property)) { |
| 550 const std::pair<Member<KeyframeEffectReadOnly>, double>& oldTransition = | 553 const std::pair<Member<KeyframeEffectReadOnly>, double>& oldTransition = |
| 551 retargetedCompositorTransitions.get(id); | 554 retargetedCompositorTransitions.get(property); |
| 552 KeyframeEffectReadOnly* oldAnimation = oldTransition.first; | 555 KeyframeEffectReadOnly* oldAnimation = oldTransition.first; |
| 553 double oldStartTime = oldTransition.second; | 556 double oldStartTime = oldTransition.second; |
| 554 double inheritedTime = | 557 double inheritedTime = |
| 555 isNull(oldStartTime) | 558 isNull(oldStartTime) |
| 556 ? 0 | 559 ? 0 |
| 557 : element->document().timeline().currentTimeInternal() - | 560 : element->document().timeline().currentTimeInternal() - |
| 558 oldStartTime; | 561 oldStartTime; |
| 559 | 562 |
| 560 TransitionKeyframeEffectModel* oldEffect = | 563 TransitionKeyframeEffectModel* oldEffect = |
| 561 toTransitionKeyframeEffectModel(inertAnimation->model()); | 564 toTransitionKeyframeEffectModel(inertAnimation->model()); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 581 newFrames[1]->setCompositorValue( | 584 newFrames[1]->setCompositorValue( |
| 582 interpolation.getInterpolatedCompositorValue()); | 585 interpolation.getInterpolatedCompositorValue()); |
| 583 model = TransitionKeyframeEffectModel::create(newFrames); | 586 model = TransitionKeyframeEffectModel::create(newFrames); |
| 584 } | 587 } |
| 585 } | 588 } |
| 586 | 589 |
| 587 KeyframeEffect* transition = KeyframeEffect::create( | 590 KeyframeEffect* transition = KeyframeEffect::create( |
| 588 element, model, inertAnimation->specifiedTiming(), | 591 element, model, inertAnimation->specifiedTiming(), |
| 589 KeyframeEffectReadOnly::TransitionPriority, eventDelegate); | 592 KeyframeEffectReadOnly::TransitionPriority, eventDelegate); |
| 590 Animation* animation = element->document().timeline().play(transition); | 593 Animation* animation = element->document().timeline().play(transition); |
| 591 animation->setId(getPropertyName(newTransition.id)); | 594 if (property.isCSSCustomProperty()) { |
|
Eric Willigers
2017/03/01 02:33:35
braces optional
alancutter (OOO until 2018)
2017/03/01 02:36:25
I prefer always braces under 2 space indentation.
| |
| 595 animation->setId(property.customPropertyName()); | |
| 596 } else { | |
| 597 animation->setId(getPropertyName(property.cssProperty())); | |
| 598 } | |
| 592 // Set the current time as the start time for retargeted transitions | 599 // Set the current time as the start time for retargeted transitions |
| 593 if (retargetedCompositorTransitions.contains(id)) | 600 if (retargetedCompositorTransitions.contains(property)) |
| 594 animation->setStartTime(element->document().timeline().currentTime()); | 601 animation->setStartTime(element->document().timeline().currentTime()); |
| 595 animation->update(TimingUpdateOnDemand); | 602 animation->update(TimingUpdateOnDemand); |
| 596 runningTransition.animation = animation; | 603 runningTransition.animation = animation; |
| 597 m_transitions.set(id, runningTransition); | 604 m_transitions.set(property, runningTransition); |
| 598 DCHECK(isValidCSSPropertyID(id)); | 605 DCHECK(isValidCSSPropertyID(property.cssProperty())); |
| 599 | 606 |
| 600 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram, | 607 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram, |
| 601 ("WebCore.Animation.CSSProperties")); | 608 ("WebCore.Animation.CSSProperties")); |
| 602 propertyHistogram.sample( | 609 propertyHistogram.sample( |
| 603 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); | 610 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram( |
| 611 property.cssProperty())); | |
| 604 } | 612 } |
| 605 clearPendingUpdate(); | 613 clearPendingUpdate(); |
| 606 } | 614 } |
| 607 | 615 |
| 608 void CSSAnimations::calculateTransitionUpdateForProperty( | 616 void CSSAnimations::calculateTransitionUpdateForProperty( |
| 609 CSSPropertyID id, | 617 const PropertyHandle& property, |
| 610 const CSSTransitionData& transitionData, | 618 const CSSTransitionData& transitionData, |
| 611 size_t transitionIndex, | 619 size_t transitionIndex, |
| 612 const ComputedStyle& oldStyle, | 620 const ComputedStyle& oldStyle, |
| 613 const ComputedStyle& style, | 621 const ComputedStyle& style, |
| 614 const TransitionMap* activeTransitions, | 622 const TransitionMap* activeTransitions, |
| 615 CSSAnimationUpdate& update, | 623 CSSAnimationUpdate& update, |
| 616 const Element* element) { | 624 const Element* element) { |
| 617 RefPtr<AnimatableValue> to = nullptr; | 625 RefPtr<AnimatableValue> to = nullptr; |
| 618 const RunningTransition* interruptedTransition = nullptr; | 626 const RunningTransition* interruptedTransition = nullptr; |
| 619 if (activeTransitions) { | 627 if (activeTransitions) { |
| 620 TransitionMap::const_iterator activeTransitionIter = | 628 TransitionMap::const_iterator activeTransitionIter = |
| 621 activeTransitions->find(id); | 629 activeTransitions->find(property); |
| 622 if (activeTransitionIter != activeTransitions->end()) { | 630 if (activeTransitionIter != activeTransitions->end()) { |
| 623 const RunningTransition* runningTransition = &activeTransitionIter->value; | 631 const RunningTransition* runningTransition = &activeTransitionIter->value; |
| 624 to = CSSAnimatableValueFactory::create(id, style); | 632 to = CSSAnimatableValueFactory::create(property.cssProperty(), style); |
| 625 const AnimatableValue* activeTo = runningTransition->to.get(); | 633 const AnimatableValue* activeTo = runningTransition->to.get(); |
| 626 if (to->equals(activeTo)) | 634 if (to->equals(activeTo)) |
| 627 return; | 635 return; |
| 628 update.cancelTransition(id); | 636 update.cancelTransition(property); |
| 629 DCHECK(!element->elementAnimations() || | 637 DCHECK(!element->elementAnimations() || |
| 630 !element->elementAnimations()->isAnimationStyleChange()); | 638 !element->elementAnimations()->isAnimationStyleChange()); |
| 631 | 639 |
| 632 if (to->equals(runningTransition->reversingAdjustedStartValue.get())) | 640 if (to->equals(runningTransition->reversingAdjustedStartValue.get())) |
| 633 interruptedTransition = runningTransition; | 641 interruptedTransition = runningTransition; |
| 634 } | 642 } |
| 635 } | 643 } |
| 636 | 644 |
| 637 if (CSSPropertyEquality::propertiesEqual(id, oldStyle, style)) | 645 if (CSSPropertyEquality::propertiesEqual(property.cssProperty(), oldStyle, |
| 646 style)) | |
| 638 return; | 647 return; |
| 639 | 648 |
| 640 if (!to) | 649 if (!to) |
| 641 to = CSSAnimatableValueFactory::create(id, style); | 650 to = CSSAnimatableValueFactory::create(property.cssProperty(), style); |
| 642 RefPtr<AnimatableValue> from = | 651 RefPtr<AnimatableValue> from = |
| 643 CSSAnimatableValueFactory::create(id, oldStyle); | 652 CSSAnimatableValueFactory::create(property.cssProperty(), oldStyle); |
| 644 | 653 |
| 645 // TODO(alancutter): Support transitions on registered custom properties and | 654 // TODO(alancutter): Support transitions on registered custom properties and |
| 646 // give the map a PropertyRegistry. | 655 // give the map a PropertyRegistry. |
| 647 CSSInterpolationTypesMap map(nullptr); | 656 CSSInterpolationTypesMap map(nullptr); |
| 648 InterpolationEnvironment oldEnvironment(map, oldStyle); | 657 InterpolationEnvironment oldEnvironment(map, oldStyle); |
| 649 InterpolationEnvironment newEnvironment(map, style); | 658 InterpolationEnvironment newEnvironment(map, style); |
| 650 InterpolationValue start = nullptr; | 659 InterpolationValue start = nullptr; |
| 651 InterpolationValue end = nullptr; | 660 InterpolationValue end = nullptr; |
| 652 const InterpolationType* transitionType = nullptr; | 661 const InterpolationType* transitionType = nullptr; |
| 653 PropertyHandle property(id); | |
| 654 for (const auto& interpolationType : map.get(property)) { | 662 for (const auto& interpolationType : map.get(property)) { |
| 655 start = interpolationType->maybeConvertUnderlyingValue(oldEnvironment); | 663 start = interpolationType->maybeConvertUnderlyingValue(oldEnvironment); |
| 656 if (!start) { | 664 if (!start) { |
| 657 continue; | 665 continue; |
| 658 } | 666 } |
| 659 end = interpolationType->maybeConvertUnderlyingValue(newEnvironment); | 667 end = interpolationType->maybeConvertUnderlyingValue(newEnvironment); |
| 660 if (!end) { | 668 if (!end) { |
| 661 continue; | 669 continue; |
| 662 } | 670 } |
| 663 // Merge will only succeed if the two values are considered interpolable. | 671 // Merge will only succeed if the two values are considered interpolable. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 726 timing.timingFunction = LinearTimingFunction::shared(); | 734 timing.timingFunction = LinearTimingFunction::shared(); |
| 727 keyframes.push_back(startKeyframe); | 735 keyframes.push_back(startKeyframe); |
| 728 | 736 |
| 729 RefPtr<TransitionKeyframe> endKeyframe = TransitionKeyframe::create(property); | 737 RefPtr<TransitionKeyframe> endKeyframe = TransitionKeyframe::create(property); |
| 730 endKeyframe->setValue(TypedInterpolationValue::create( | 738 endKeyframe->setValue(TypedInterpolationValue::create( |
| 731 *transitionType, end.interpolableValue->clone(), | 739 *transitionType, end.interpolableValue->clone(), |
| 732 end.nonInterpolableValue)); | 740 end.nonInterpolableValue)); |
| 733 endKeyframe->setOffset(1); | 741 endKeyframe->setOffset(1); |
| 734 keyframes.push_back(endKeyframe); | 742 keyframes.push_back(endKeyframe); |
| 735 | 743 |
| 736 if (CompositorAnimations::isCompositableProperty(id)) { | 744 if (CompositorAnimations::isCompositableProperty(property.cssProperty())) { |
| 737 delayKeyframe->setCompositorValue(from); | 745 delayKeyframe->setCompositorValue(from); |
| 738 startKeyframe->setCompositorValue(from); | 746 startKeyframe->setCompositorValue(from); |
| 739 endKeyframe->setCompositorValue(to); | 747 endKeyframe->setCompositorValue(to); |
| 740 } | 748 } |
| 741 | 749 |
| 742 TransitionKeyframeEffectModel* model = | 750 TransitionKeyframeEffectModel* model = |
| 743 TransitionKeyframeEffectModel::create(keyframes); | 751 TransitionKeyframeEffectModel::create(keyframes); |
| 744 update.startTransition(id, from.get(), to.get(), reversingAdjustedStartValue, | 752 update.startTransition(property, from.get(), to.get(), |
| 745 reversingShorteningFactor, | 753 reversingAdjustedStartValue, reversingShorteningFactor, |
| 746 *InertEffect::create(model, timing, false, 0)); | 754 *InertEffect::create(model, timing, false, 0)); |
| 747 DCHECK(!element->elementAnimations() || | 755 DCHECK(!element->elementAnimations() || |
| 748 !element->elementAnimations()->isAnimationStyleChange()); | 756 !element->elementAnimations()->isAnimationStyleChange()); |
| 749 } | 757 } |
| 750 | 758 |
| 751 void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate& update, | 759 void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate& update, |
| 752 const Element* animatingElement, | 760 const Element* animatingElement, |
| 753 const ComputedStyle& style) { | 761 const ComputedStyle& style) { |
| 754 if (!animatingElement) | 762 if (!animatingElement) |
| 755 return; | 763 return; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 804 | 812 |
| 805 // FIXME: We should transition if an !important property changes even | 813 // FIXME: We should transition if an !important property changes even |
| 806 // when an animation is running, but this is a bit hard to do with the | 814 // when an animation is running, but this is a bit hard to do with the |
| 807 // current applyMatchedProperties system. | 815 // current applyMatchedProperties system. |
| 808 PropertyHandle property = PropertyHandle(id); | 816 PropertyHandle property = PropertyHandle(id); |
| 809 if (!update.activeInterpolationsForAnimations().contains(property) && | 817 if (!update.activeInterpolationsForAnimations().contains(property) && |
| 810 (!elementAnimations || | 818 (!elementAnimations || |
| 811 !elementAnimations->cssAnimations() | 819 !elementAnimations->cssAnimations() |
| 812 .m_previousActiveInterpolationsForAnimations.contains( | 820 .m_previousActiveInterpolationsForAnimations.contains( |
| 813 property))) { | 821 property))) { |
| 814 calculateTransitionUpdateForProperty(id, *transitionData, i, oldStyle, | 822 calculateTransitionUpdateForProperty( |
| 815 style, activeTransitions, update, | 823 property, *transitionData, i, oldStyle, style, activeTransitions, |
| 816 animatingElement); | 824 update, animatingElement); |
| 817 } | 825 } |
| 818 } | 826 } |
| 819 } | 827 } |
| 820 } | 828 } |
| 821 | 829 |
| 822 if (activeTransitions) { | 830 if (activeTransitions) { |
| 823 for (const auto& entry : *activeTransitions) { | 831 for (const auto& entry : *activeTransitions) { |
| 824 CSSPropertyID id = entry.key; | 832 const PropertyHandle& property = entry.key; |
| 833 // TODO(alancutter): Handle transitions on custom properties. | |
| 834 DCHECK(!property.isCSSCustomProperty()); | |
| 835 CSSPropertyID id = property.cssProperty(); | |
| 825 if (!anyTransitionHadTransitionAll && !animationStyleRecalc && | 836 if (!anyTransitionHadTransitionAll && !animationStyleRecalc && |
| 826 !listedProperties.test(id - firstCSSProperty)) { | 837 !listedProperties.test(id - firstCSSProperty)) { |
| 827 update.cancelTransition(id); | 838 update.cancelTransition(property); |
| 828 } else if (entry.value.animation->finishedInternal()) { | 839 } else if (entry.value.animation->finishedInternal()) { |
| 829 update.finishTransition(id); | 840 update.finishTransition(property); |
| 830 } | 841 } |
| 831 } | 842 } |
| 832 } | 843 } |
| 833 calculateTransitionActiveInterpolations(update, animatingElement); | 844 calculateTransitionActiveInterpolations(update, animatingElement); |
| 834 } | 845 } |
| 835 | 846 |
| 836 void CSSAnimations::cancel() { | 847 void CSSAnimations::cancel() { |
| 837 for (const auto& runningAnimation : m_runningAnimations) { | 848 for (const auto& runningAnimation : m_runningAnimations) { |
| 838 runningAnimation->animation->cancel(); | 849 runningAnimation->animation->cancel(); |
| 839 runningAnimation->animation->update(TimingUpdateOnDemand); | 850 runningAnimation->animation->update(TimingUpdateOnDemand); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 913 } else { | 924 } else { |
| 914 HeapVector<Member<const InertEffect>> newTransitions; | 925 HeapVector<Member<const InertEffect>> newTransitions; |
| 915 for (const auto& entry : update.newTransitions()) | 926 for (const auto& entry : update.newTransitions()) |
| 916 newTransitions.push_back(entry.value.effect.get()); | 927 newTransitions.push_back(entry.value.effect.get()); |
| 917 | 928 |
| 918 HeapHashSet<Member<const Animation>> cancelledAnimations; | 929 HeapHashSet<Member<const Animation>> cancelledAnimations; |
| 919 if (!update.cancelledTransitions().isEmpty()) { | 930 if (!update.cancelledTransitions().isEmpty()) { |
| 920 DCHECK(elementAnimations); | 931 DCHECK(elementAnimations); |
| 921 const TransitionMap& transitionMap = | 932 const TransitionMap& transitionMap = |
| 922 elementAnimations->cssAnimations().m_transitions; | 933 elementAnimations->cssAnimations().m_transitions; |
| 923 for (CSSPropertyID id : update.cancelledTransitions()) { | 934 for (const PropertyHandle& property : update.cancelledTransitions()) { |
| 924 DCHECK(transitionMap.contains(id)); | 935 DCHECK(transitionMap.contains(property)); |
| 925 cancelledAnimations.insert(transitionMap.get(id).animation.get()); | 936 cancelledAnimations.insert(transitionMap.get(property).animation.get()); |
| 926 } | 937 } |
| 927 } | 938 } |
| 928 | 939 |
| 929 activeInterpolationsForTransitions = EffectStack::activeInterpolations( | 940 activeInterpolationsForTransitions = EffectStack::activeInterpolations( |
| 930 effectStack, &newTransitions, &cancelledAnimations, | 941 effectStack, &newTransitions, &cancelledAnimations, |
| 931 KeyframeEffectReadOnly::TransitionPriority, isStylePropertyHandle); | 942 KeyframeEffectReadOnly::TransitionPriority, isStylePropertyHandle); |
| 932 } | 943 } |
| 933 | 944 |
| 934 // Properties being animated by animations don't get values from transitions | 945 // Properties being animated by animations don't get values from transitions |
| 935 // applied. | 946 // applied. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1011 EventTarget* CSSAnimations::TransitionEventDelegate::eventTarget() const { | 1022 EventTarget* CSSAnimations::TransitionEventDelegate::eventTarget() const { |
| 1012 return EventPath::eventTargetRespectingTargetRules(*m_transitionTarget); | 1023 return EventPath::eventTargetRespectingTargetRules(*m_transitionTarget); |
| 1013 } | 1024 } |
| 1014 | 1025 |
| 1015 void CSSAnimations::TransitionEventDelegate::onEventCondition( | 1026 void CSSAnimations::TransitionEventDelegate::onEventCondition( |
| 1016 const AnimationEffectReadOnly& animationNode) { | 1027 const AnimationEffectReadOnly& animationNode) { |
| 1017 const AnimationEffectReadOnly::Phase currentPhase = animationNode.getPhase(); | 1028 const AnimationEffectReadOnly::Phase currentPhase = animationNode.getPhase(); |
| 1018 if (currentPhase == AnimationEffectReadOnly::PhaseAfter && | 1029 if (currentPhase == AnimationEffectReadOnly::PhaseAfter && |
| 1019 currentPhase != m_previousPhase && | 1030 currentPhase != m_previousPhase && |
| 1020 document().hasListenerType(Document::TRANSITIONEND_LISTENER)) { | 1031 document().hasListenerType(Document::TRANSITIONEND_LISTENER)) { |
| 1021 String propertyName = getPropertyNameString(m_property); | 1032 String propertyName = m_property.isCSSCustomProperty() |
| 1033 ? m_property.customPropertyName() | |
| 1034 : getPropertyNameString(m_property.cssProperty()); | |
| 1022 const Timing& timing = animationNode.specifiedTiming(); | 1035 const Timing& timing = animationNode.specifiedTiming(); |
| 1023 double elapsedTime = timing.iterationDuration; | 1036 double elapsedTime = timing.iterationDuration; |
| 1024 const AtomicString& eventType = EventTypeNames::transitionend; | 1037 const AtomicString& eventType = EventTypeNames::transitionend; |
| 1025 String pseudoElement = | 1038 String pseudoElement = |
| 1026 PseudoElement::pseudoElementNameForEvents(getPseudoId()); | 1039 PseudoElement::pseudoElementNameForEvents(getPseudoId()); |
| 1027 TransitionEvent* event = TransitionEvent::create( | 1040 TransitionEvent* event = TransitionEvent::create( |
| 1028 eventType, propertyName, elapsedTime, pseudoElement); | 1041 eventType, propertyName, elapsedTime, pseudoElement); |
| 1029 event->setTarget(eventTarget()); | 1042 event->setTarget(eventTarget()); |
| 1030 document().enqueueAnimationFrameEvent(event); | 1043 document().enqueueAnimationFrameEvent(event); |
| 1031 } | 1044 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1111 isCustomPropertyHandle); | 1124 isCustomPropertyHandle); |
| 1112 } | 1125 } |
| 1113 | 1126 |
| 1114 DEFINE_TRACE(CSSAnimations) { | 1127 DEFINE_TRACE(CSSAnimations) { |
| 1115 visitor->trace(m_transitions); | 1128 visitor->trace(m_transitions); |
| 1116 visitor->trace(m_pendingUpdate); | 1129 visitor->trace(m_pendingUpdate); |
| 1117 visitor->trace(m_runningAnimations); | 1130 visitor->trace(m_runningAnimations); |
| 1118 } | 1131 } |
| 1119 | 1132 |
| 1120 } // namespace blink | 1133 } // namespace blink |
| OLD | NEW |