Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp

Issue 2719083005: Use PropertyHandle instead of CSSPropertyID to identify CSS Transitions (Closed)
Patch Set: Rebasedagainaaaa Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/animation/css/CSSAnimations.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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, std::pair<KeyframeEffectReadOnly*, double>(
510 effect, animation->startTimeInternal())); 511 effect, animation->startTimeInternal()));
512 }
511 animation->cancel(); 513 animation->cancel();
512 // after cancelation, transitions must be downgraded or they'll fail 514 // after cancelation, transitions must be downgraded or they'll fail
513 // to be considered when retriggering themselves. This can happen if 515 // to be considered when retriggering themselves. This can happen if
514 // the transition is captured through getAnimations then played. 516 // the transition is captured through getAnimations then played.
515 if (animation->effect() && animation->effect()->isKeyframeEffectReadOnly()) 517 if (animation->effect() && animation->effect()->isKeyframeEffectReadOnly())
516 toKeyframeEffectReadOnly(animation->effect())->downgradeToNormal(); 518 toKeyframeEffectReadOnly(animation->effect())->downgradeToNormal();
517 animation->update(TimingUpdateOnDemand); 519 animation->update(TimingUpdateOnDemand);
518 } 520 }
519 521
520 for (CSSPropertyID id : m_pendingUpdate.finishedTransitions()) { 522 for (const PropertyHandle& property : m_pendingUpdate.finishedTransitions()) {
521 // This transition can also be cancelled and finished at the same time 523 // This transition can also be cancelled and finished at the same time
522 if (m_transitions.contains(id)) { 524 if (m_transitions.contains(property)) {
523 Animation* animation = m_transitions.take(id).animation; 525 Animation* animation = m_transitions.take(property).animation;
524 // Transition must be downgraded 526 // Transition must be downgraded
525 if (animation->effect() && 527 if (animation->effect() &&
526 animation->effect()->isKeyframeEffectReadOnly()) 528 animation->effect()->isKeyframeEffectReadOnly())
527 toKeyframeEffectReadOnly(animation->effect())->downgradeToNormal(); 529 toKeyframeEffectReadOnly(animation->effect())->downgradeToNormal();
528 } 530 }
529 } 531 }
530 532
531 for (const auto& entry : m_pendingUpdate.newTransitions()) { 533 for (const auto& entry : m_pendingUpdate.newTransitions()) {
532 const CSSAnimationUpdate::NewTransition& newTransition = entry.value; 534 const CSSAnimationUpdate::NewTransition& newTransition = entry.value;
533 535
534 RunningTransition runningTransition; 536 RunningTransition runningTransition;
535 runningTransition.from = newTransition.from; 537 runningTransition.from = newTransition.from;
536 runningTransition.to = newTransition.to; 538 runningTransition.to = newTransition.to;
537 runningTransition.reversingAdjustedStartValue = 539 runningTransition.reversingAdjustedStartValue =
538 newTransition.reversingAdjustedStartValue; 540 newTransition.reversingAdjustedStartValue;
539 runningTransition.reversingShorteningFactor = 541 runningTransition.reversingShorteningFactor =
540 newTransition.reversingShorteningFactor; 542 newTransition.reversingShorteningFactor;
541 543
542 CSSPropertyID id = newTransition.id; 544 const PropertyHandle& property = newTransition.property;
543 const InertEffect* inertAnimation = newTransition.effect.get(); 545 const InertEffect* inertAnimation = newTransition.effect.get();
544 TransitionEventDelegate* eventDelegate = 546 TransitionEventDelegate* eventDelegate =
545 new TransitionEventDelegate(element, id); 547 new TransitionEventDelegate(element, property);
546 548
547 EffectModel* model = inertAnimation->model(); 549 EffectModel* model = inertAnimation->model();
548 550
549 if (retargetedCompositorTransitions.contains(id)) { 551 if (retargetedCompositorTransitions.contains(property)) {
550 const std::pair<Member<KeyframeEffectReadOnly>, double>& oldTransition = 552 const std::pair<Member<KeyframeEffectReadOnly>, double>& oldTransition =
551 retargetedCompositorTransitions.at(id); 553 retargetedCompositorTransitions.at(property);
552 KeyframeEffectReadOnly* oldAnimation = oldTransition.first; 554 KeyframeEffectReadOnly* oldAnimation = oldTransition.first;
553 double oldStartTime = oldTransition.second; 555 double oldStartTime = oldTransition.second;
554 double inheritedTime = 556 double inheritedTime =
555 isNull(oldStartTime) 557 isNull(oldStartTime)
556 ? 0 558 ? 0
557 : element->document().timeline().currentTimeInternal() - 559 : element->document().timeline().currentTimeInternal() -
558 oldStartTime; 560 oldStartTime;
559 561
560 TransitionKeyframeEffectModel* oldEffect = 562 TransitionKeyframeEffectModel* oldEffect =
561 toTransitionKeyframeEffectModel(inertAnimation->model()); 563 toTransitionKeyframeEffectModel(inertAnimation->model());
(...skipping 19 matching lines...) Expand all
581 newFrames[1]->setCompositorValue( 583 newFrames[1]->setCompositorValue(
582 interpolation.getInterpolatedCompositorValue()); 584 interpolation.getInterpolatedCompositorValue());
583 model = TransitionKeyframeEffectModel::create(newFrames); 585 model = TransitionKeyframeEffectModel::create(newFrames);
584 } 586 }
585 } 587 }
586 588
587 KeyframeEffect* transition = KeyframeEffect::create( 589 KeyframeEffect* transition = KeyframeEffect::create(
588 element, model, inertAnimation->specifiedTiming(), 590 element, model, inertAnimation->specifiedTiming(),
589 KeyframeEffectReadOnly::TransitionPriority, eventDelegate); 591 KeyframeEffectReadOnly::TransitionPriority, eventDelegate);
590 Animation* animation = element->document().timeline().play(transition); 592 Animation* animation = element->document().timeline().play(transition);
591 animation->setId(getPropertyName(newTransition.id)); 593 if (property.isCSSCustomProperty()) {
594 animation->setId(property.customPropertyName());
595 } else {
596 animation->setId(getPropertyName(property.cssProperty()));
597 }
592 // Set the current time as the start time for retargeted transitions 598 // Set the current time as the start time for retargeted transitions
593 if (retargetedCompositorTransitions.contains(id)) 599 if (retargetedCompositorTransitions.contains(property))
594 animation->setStartTime(element->document().timeline().currentTime()); 600 animation->setStartTime(element->document().timeline().currentTime());
595 animation->update(TimingUpdateOnDemand); 601 animation->update(TimingUpdateOnDemand);
596 runningTransition.animation = animation; 602 runningTransition.animation = animation;
597 m_transitions.set(id, runningTransition); 603 m_transitions.set(property, runningTransition);
598 DCHECK(isValidCSSPropertyID(id)); 604 DCHECK(isValidCSSPropertyID(property.cssProperty()));
599 605
600 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram, 606 DEFINE_STATIC_LOCAL(SparseHistogram, propertyHistogram,
601 ("WebCore.Animation.CSSProperties")); 607 ("WebCore.Animation.CSSProperties"));
602 propertyHistogram.sample( 608 propertyHistogram.sample(
603 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); 609 UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(
610 property.cssProperty()));
604 } 611 }
605 clearPendingUpdate(); 612 clearPendingUpdate();
606 } 613 }
607 614
608 void CSSAnimations::calculateTransitionUpdateForProperty( 615 void CSSAnimations::calculateTransitionUpdateForProperty(
609 CSSPropertyID id, 616 const PropertyHandle& property,
610 const CSSTransitionData& transitionData, 617 const CSSTransitionData& transitionData,
611 size_t transitionIndex, 618 size_t transitionIndex,
612 const ComputedStyle& oldStyle, 619 const ComputedStyle& oldStyle,
613 const ComputedStyle& style, 620 const ComputedStyle& style,
614 const TransitionMap* activeTransitions, 621 const TransitionMap* activeTransitions,
615 CSSAnimationUpdate& update, 622 CSSAnimationUpdate& update,
616 const Element* element) { 623 const Element* element) {
617 RefPtr<AnimatableValue> to = nullptr; 624 RefPtr<AnimatableValue> to = nullptr;
618 const RunningTransition* interruptedTransition = nullptr; 625 const RunningTransition* interruptedTransition = nullptr;
619 if (activeTransitions) { 626 if (activeTransitions) {
620 TransitionMap::const_iterator activeTransitionIter = 627 TransitionMap::const_iterator activeTransitionIter =
621 activeTransitions->find(id); 628 activeTransitions->find(property);
622 if (activeTransitionIter != activeTransitions->end()) { 629 if (activeTransitionIter != activeTransitions->end()) {
623 const RunningTransition* runningTransition = &activeTransitionIter->value; 630 const RunningTransition* runningTransition = &activeTransitionIter->value;
624 to = CSSAnimatableValueFactory::create(id, style); 631 to = CSSAnimatableValueFactory::create(property.cssProperty(), style);
625 const AnimatableValue* activeTo = runningTransition->to.get(); 632 const AnimatableValue* activeTo = runningTransition->to.get();
626 if (to->equals(activeTo)) 633 if (to->equals(activeTo))
627 return; 634 return;
628 update.cancelTransition(id); 635 update.cancelTransition(property);
629 DCHECK(!element->elementAnimations() || 636 DCHECK(!element->elementAnimations() ||
630 !element->elementAnimations()->isAnimationStyleChange()); 637 !element->elementAnimations()->isAnimationStyleChange());
631 638
632 if (to->equals(runningTransition->reversingAdjustedStartValue.get())) 639 if (to->equals(runningTransition->reversingAdjustedStartValue.get()))
633 interruptedTransition = runningTransition; 640 interruptedTransition = runningTransition;
634 } 641 }
635 } 642 }
636 643
637 if (CSSPropertyEquality::propertiesEqual(id, oldStyle, style)) 644 if (CSSPropertyEquality::propertiesEqual(property.cssProperty(), oldStyle,
645 style))
638 return; 646 return;
639 647
640 if (!to) 648 if (!to)
641 to = CSSAnimatableValueFactory::create(id, style); 649 to = CSSAnimatableValueFactory::create(property.cssProperty(), style);
642 RefPtr<AnimatableValue> from = 650 RefPtr<AnimatableValue> from =
643 CSSAnimatableValueFactory::create(id, oldStyle); 651 CSSAnimatableValueFactory::create(property.cssProperty(), oldStyle);
644 652
645 // TODO(alancutter): Support transitions on registered custom properties and 653 // TODO(alancutter): Support transitions on registered custom properties and
646 // give the map a PropertyRegistry. 654 // give the map a PropertyRegistry.
647 CSSInterpolationTypesMap map(nullptr); 655 CSSInterpolationTypesMap map(nullptr);
648 InterpolationEnvironment oldEnvironment(map, oldStyle); 656 InterpolationEnvironment oldEnvironment(map, oldStyle);
649 InterpolationEnvironment newEnvironment(map, style); 657 InterpolationEnvironment newEnvironment(map, style);
650 InterpolationValue start = nullptr; 658 InterpolationValue start = nullptr;
651 InterpolationValue end = nullptr; 659 InterpolationValue end = nullptr;
652 const InterpolationType* transitionType = nullptr; 660 const InterpolationType* transitionType = nullptr;
653 PropertyHandle property(id);
654 for (const auto& interpolationType : map.get(property)) { 661 for (const auto& interpolationType : map.get(property)) {
655 start = interpolationType->maybeConvertUnderlyingValue(oldEnvironment); 662 start = interpolationType->maybeConvertUnderlyingValue(oldEnvironment);
656 if (!start) { 663 if (!start) {
657 continue; 664 continue;
658 } 665 }
659 end = interpolationType->maybeConvertUnderlyingValue(newEnvironment); 666 end = interpolationType->maybeConvertUnderlyingValue(newEnvironment);
660 if (!end) { 667 if (!end) {
661 continue; 668 continue;
662 } 669 }
663 // Merge will only succeed if the two values are considered interpolable. 670 // Merge will only succeed if the two values are considered interpolable.
(...skipping 12 matching lines...) Expand all
676 // If we have multiple transitions on the same property, we will use the 683 // If we have multiple transitions on the same property, we will use the
677 // last one since we iterate over them in order. 684 // last one since we iterate over them in order.
678 685
679 Timing timing = transitionData.convertToTiming(transitionIndex); 686 Timing timing = transitionData.convertToTiming(transitionIndex);
680 if (timing.startDelay + timing.iterationDuration <= 0) { 687 if (timing.startDelay + timing.iterationDuration <= 0) {
681 // We may have started a transition in a prior CSSTransitionData update, 688 // We may have started a transition in a prior CSSTransitionData update,
682 // this CSSTransitionData update needs to override them. 689 // this CSSTransitionData update needs to override them.
683 // TODO(alancutter): Just iterate over the CSSTransitionDatas in reverse and 690 // TODO(alancutter): Just iterate over the CSSTransitionDatas in reverse and
684 // skip any properties that have already been visited so we don't need to 691 // skip any properties that have already been visited so we don't need to
685 // "undo" work like this. 692 // "undo" work like this.
686 update.unstartTransition(id); 693 update.unstartTransition(property);
687 return; 694 return;
688 } 695 }
689 696
690 AnimatableValue* reversingAdjustedStartValue = from.get(); 697 AnimatableValue* reversingAdjustedStartValue = from.get();
691 double reversingShorteningFactor = 1; 698 double reversingShorteningFactor = 1;
692 if (interruptedTransition) { 699 if (interruptedTransition) {
693 const double interruptedProgress = 700 const double interruptedProgress =
694 interruptedTransition->animation->effect()->progress(); 701 interruptedTransition->animation->effect()->progress();
695 if (!std::isnan(interruptedProgress)) { 702 if (!std::isnan(interruptedProgress)) {
696 reversingAdjustedStartValue = interruptedTransition->to.get(); 703 reversingAdjustedStartValue = interruptedTransition->to.get();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 timing.timingFunction = LinearTimingFunction::shared(); 740 timing.timingFunction = LinearTimingFunction::shared();
734 keyframes.push_back(startKeyframe); 741 keyframes.push_back(startKeyframe);
735 742
736 RefPtr<TransitionKeyframe> endKeyframe = TransitionKeyframe::create(property); 743 RefPtr<TransitionKeyframe> endKeyframe = TransitionKeyframe::create(property);
737 endKeyframe->setValue(TypedInterpolationValue::create( 744 endKeyframe->setValue(TypedInterpolationValue::create(
738 *transitionType, end.interpolableValue->clone(), 745 *transitionType, end.interpolableValue->clone(),
739 end.nonInterpolableValue)); 746 end.nonInterpolableValue));
740 endKeyframe->setOffset(1); 747 endKeyframe->setOffset(1);
741 keyframes.push_back(endKeyframe); 748 keyframes.push_back(endKeyframe);
742 749
743 if (CompositorAnimations::isCompositableProperty(id)) { 750 if (CompositorAnimations::isCompositableProperty(property.cssProperty())) {
744 delayKeyframe->setCompositorValue(from); 751 delayKeyframe->setCompositorValue(from);
745 startKeyframe->setCompositorValue(from); 752 startKeyframe->setCompositorValue(from);
746 endKeyframe->setCompositorValue(to); 753 endKeyframe->setCompositorValue(to);
747 } 754 }
748 755
749 TransitionKeyframeEffectModel* model = 756 TransitionKeyframeEffectModel* model =
750 TransitionKeyframeEffectModel::create(keyframes); 757 TransitionKeyframeEffectModel::create(keyframes);
751 update.startTransition(id, from.get(), to.get(), reversingAdjustedStartValue, 758 update.startTransition(property, from.get(), to.get(),
752 reversingShorteningFactor, 759 reversingAdjustedStartValue, reversingShorteningFactor,
753 *InertEffect::create(model, timing, false, 0)); 760 *InertEffect::create(model, timing, false, 0));
754 DCHECK(!element->elementAnimations() || 761 DCHECK(!element->elementAnimations() ||
755 !element->elementAnimations()->isAnimationStyleChange()); 762 !element->elementAnimations()->isAnimationStyleChange());
756 } 763 }
757 764
758 void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate& update, 765 void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate& update,
759 const Element* animatingElement, 766 const Element* animatingElement,
760 const ComputedStyle& style) { 767 const ComputedStyle& style) {
761 if (!animatingElement) 768 if (!animatingElement)
762 return; 769 return;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 818
812 // FIXME: We should transition if an !important property changes even 819 // FIXME: We should transition if an !important property changes even
813 // when an animation is running, but this is a bit hard to do with the 820 // when an animation is running, but this is a bit hard to do with the
814 // current applyMatchedProperties system. 821 // current applyMatchedProperties system.
815 PropertyHandle property = PropertyHandle(id); 822 PropertyHandle property = PropertyHandle(id);
816 if (!update.activeInterpolationsForAnimations().contains(property) && 823 if (!update.activeInterpolationsForAnimations().contains(property) &&
817 (!elementAnimations || 824 (!elementAnimations ||
818 !elementAnimations->cssAnimations() 825 !elementAnimations->cssAnimations()
819 .m_previousActiveInterpolationsForAnimations.contains( 826 .m_previousActiveInterpolationsForAnimations.contains(
820 property))) { 827 property))) {
821 calculateTransitionUpdateForProperty(id, *transitionData, i, oldStyle, 828 calculateTransitionUpdateForProperty(
822 style, activeTransitions, update, 829 property, *transitionData, i, oldStyle, style, activeTransitions,
823 animatingElement); 830 update, animatingElement);
824 } 831 }
825 } 832 }
826 } 833 }
827 } 834 }
828 835
829 if (activeTransitions) { 836 if (activeTransitions) {
830 for (const auto& entry : *activeTransitions) { 837 for (const auto& entry : *activeTransitions) {
831 CSSPropertyID id = entry.key; 838 const PropertyHandle& property = entry.key;
839 // TODO(alancutter): Handle transitions on custom properties.
840 DCHECK(!property.isCSSCustomProperty());
841 CSSPropertyID id = property.cssProperty();
832 if (!anyTransitionHadTransitionAll && !animationStyleRecalc && 842 if (!anyTransitionHadTransitionAll && !animationStyleRecalc &&
833 !listedProperties.test(id - firstCSSProperty)) { 843 !listedProperties.test(id - firstCSSProperty)) {
834 update.cancelTransition(id); 844 update.cancelTransition(property);
835 } else if (entry.value.animation->finishedInternal()) { 845 } else if (entry.value.animation->finishedInternal()) {
836 update.finishTransition(id); 846 update.finishTransition(property);
837 } 847 }
838 } 848 }
839 } 849 }
840 calculateTransitionActiveInterpolations(update, animatingElement); 850 calculateTransitionActiveInterpolations(update, animatingElement);
841 } 851 }
842 852
843 void CSSAnimations::cancel() { 853 void CSSAnimations::cancel() {
844 for (const auto& runningAnimation : m_runningAnimations) { 854 for (const auto& runningAnimation : m_runningAnimations) {
845 runningAnimation->animation->cancel(); 855 runningAnimation->animation->cancel();
846 runningAnimation->animation->update(TimingUpdateOnDemand); 856 runningAnimation->animation->update(TimingUpdateOnDemand);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 } else { 930 } else {
921 HeapVector<Member<const InertEffect>> newTransitions; 931 HeapVector<Member<const InertEffect>> newTransitions;
922 for (const auto& entry : update.newTransitions()) 932 for (const auto& entry : update.newTransitions())
923 newTransitions.push_back(entry.value.effect.get()); 933 newTransitions.push_back(entry.value.effect.get());
924 934
925 HeapHashSet<Member<const Animation>> cancelledAnimations; 935 HeapHashSet<Member<const Animation>> cancelledAnimations;
926 if (!update.cancelledTransitions().isEmpty()) { 936 if (!update.cancelledTransitions().isEmpty()) {
927 DCHECK(elementAnimations); 937 DCHECK(elementAnimations);
928 const TransitionMap& transitionMap = 938 const TransitionMap& transitionMap =
929 elementAnimations->cssAnimations().m_transitions; 939 elementAnimations->cssAnimations().m_transitions;
930 for (CSSPropertyID id : update.cancelledTransitions()) { 940 for (const PropertyHandle& property : update.cancelledTransitions()) {
931 DCHECK(transitionMap.contains(id)); 941 DCHECK(transitionMap.contains(property));
932 cancelledAnimations.insert(transitionMap.at(id).animation.get()); 942 cancelledAnimations.insert(transitionMap.at(property).animation.get());
933 } 943 }
934 } 944 }
935 945
936 activeInterpolationsForTransitions = EffectStack::activeInterpolations( 946 activeInterpolationsForTransitions = EffectStack::activeInterpolations(
937 effectStack, &newTransitions, &cancelledAnimations, 947 effectStack, &newTransitions, &cancelledAnimations,
938 KeyframeEffectReadOnly::TransitionPriority, isStylePropertyHandle); 948 KeyframeEffectReadOnly::TransitionPriority, isStylePropertyHandle);
939 } 949 }
940 950
941 // Properties being animated by animations don't get values from transitions 951 // Properties being animated by animations don't get values from transitions
942 // applied. 952 // applied.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 EventTarget* CSSAnimations::TransitionEventDelegate::eventTarget() const { 1028 EventTarget* CSSAnimations::TransitionEventDelegate::eventTarget() const {
1019 return EventPath::eventTargetRespectingTargetRules(*m_transitionTarget); 1029 return EventPath::eventTargetRespectingTargetRules(*m_transitionTarget);
1020 } 1030 }
1021 1031
1022 void CSSAnimations::TransitionEventDelegate::onEventCondition( 1032 void CSSAnimations::TransitionEventDelegate::onEventCondition(
1023 const AnimationEffectReadOnly& animationNode) { 1033 const AnimationEffectReadOnly& animationNode) {
1024 const AnimationEffectReadOnly::Phase currentPhase = animationNode.getPhase(); 1034 const AnimationEffectReadOnly::Phase currentPhase = animationNode.getPhase();
1025 if (currentPhase == AnimationEffectReadOnly::PhaseAfter && 1035 if (currentPhase == AnimationEffectReadOnly::PhaseAfter &&
1026 currentPhase != m_previousPhase && 1036 currentPhase != m_previousPhase &&
1027 document().hasListenerType(Document::TRANSITIONEND_LISTENER)) { 1037 document().hasListenerType(Document::TRANSITIONEND_LISTENER)) {
1028 String propertyName = getPropertyNameString(m_property); 1038 String propertyName = m_property.isCSSCustomProperty()
1039 ? m_property.customPropertyName()
1040 : getPropertyNameString(m_property.cssProperty());
1029 const Timing& timing = animationNode.specifiedTiming(); 1041 const Timing& timing = animationNode.specifiedTiming();
1030 double elapsedTime = timing.iterationDuration; 1042 double elapsedTime = timing.iterationDuration;
1031 const AtomicString& eventType = EventTypeNames::transitionend; 1043 const AtomicString& eventType = EventTypeNames::transitionend;
1032 String pseudoElement = 1044 String pseudoElement =
1033 PseudoElement::pseudoElementNameForEvents(getPseudoId()); 1045 PseudoElement::pseudoElementNameForEvents(getPseudoId());
1034 TransitionEvent* event = TransitionEvent::create( 1046 TransitionEvent* event = TransitionEvent::create(
1035 eventType, propertyName, elapsedTime, pseudoElement); 1047 eventType, propertyName, elapsedTime, pseudoElement);
1036 event->setTarget(eventTarget()); 1048 event->setTarget(eventTarget());
1037 document().enqueueAnimationFrameEvent(event); 1049 document().enqueueAnimationFrameEvent(event);
1038 } 1050 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 isCustomPropertyHandle); 1130 isCustomPropertyHandle);
1119 } 1131 }
1120 1132
1121 DEFINE_TRACE(CSSAnimations) { 1133 DEFINE_TRACE(CSSAnimations) {
1122 visitor->trace(m_transitions); 1134 visitor->trace(m_transitions);
1123 visitor->trace(m_pendingUpdate); 1135 visitor->trace(m_pendingUpdate);
1124 visitor->trace(m_runningAnimations); 1136 visitor->trace(m_runningAnimations);
1125 } 1137 }
1126 1138
1127 } // namespace blink 1139 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/css/CSSAnimations.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698