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

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

Issue 1663963004: Blink Compositor Animation: Use PassOwnPtr in CompositorFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@curves
Patch Set: Created 4 years, 10 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
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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 keyframeTimingFunction = &keyframe->easing(); 629 keyframeTimingFunction = &keyframe->easing();
630 } 630 }
631 631
632 // FIXME: This relies on StringKeyframes being eagerly evaluated, which will 632 // FIXME: This relies on StringKeyframes being eagerly evaluated, which will
633 // not happen eventually. Instead we should extract the CSSValue here 633 // not happen eventually. Instead we should extract the CSSValue here
634 // and convert using another set of toAnimatableXXXOperations functions. 634 // and convert using another set of toAnimatableXXXOperations functions.
635 const AnimatableValue* value = keyframe->getAnimatableValue().get(); 635 const AnimatableValue* value = keyframe->getAnimatableValue().get();
636 636
637 switch (curve.type()) { 637 switch (curve.type()) {
638 case CompositorAnimationCurve::AnimationCurveTypeFilter: { 638 case CompositorAnimationCurve::AnimationCurveTypeFilter: {
639 OwnPtr<CompositorFilterOperations> ops = adoptPtr(CompositorFactory: :current().createFilterOperations()); 639 OwnPtr<CompositorFilterOperations> ops = CompositorFactory::current( ).createFilterOperations();
640 toCompositorFilterOperations(toAnimatableFilterOperations(value)->op erations(), ops.get()); 640 toCompositorFilterOperations(toAnimatableFilterOperations(value)->op erations(), ops.get());
641 641
642 CompositorFilterKeyframe filterKeyframe(keyframe->offset(), ops.rele ase()); 642 CompositorFilterKeyframe filterKeyframe(keyframe->offset(), ops.rele ase());
643 CompositorFilterAnimationCurve* filterCurve = static_cast<Compositor FilterAnimationCurve*>(&curve); 643 CompositorFilterAnimationCurve* filterCurve = static_cast<Compositor FilterAnimationCurve*>(&curve);
644 addKeyframeWithTimingFunction(*filterCurve, filterKeyframe, keyframe TimingFunction); 644 addKeyframeWithTimingFunction(*filterCurve, filterKeyframe, keyframe TimingFunction);
645 break; 645 break;
646 } 646 }
647 case CompositorAnimationCurve::AnimationCurveTypeFloat: { 647 case CompositorAnimationCurve::AnimationCurveTypeFloat: {
648 CompositorFloatKeyframe floatKeyframe(keyframe->offset(), toAnimatab leDouble(value)->toDouble()); 648 CompositorFloatKeyframe floatKeyframe(keyframe->offset(), toAnimatab leDouble(value)->toDouble());
649 CompositorFloatAnimationCurve* floatCurve = static_cast<CompositorFl oatAnimationCurve*>(&curve); 649 CompositorFloatAnimationCurve* floatCurve = static_cast<CompositorFl oatAnimationCurve*>(&curve);
650 addKeyframeWithTimingFunction(*floatCurve, floatKeyframe, keyframeTi mingFunction); 650 addKeyframeWithTimingFunction(*floatCurve, floatKeyframe, keyframeTi mingFunction);
651 break; 651 break;
652 } 652 }
653 case CompositorAnimationCurve::AnimationCurveTypeTransform: { 653 case CompositorAnimationCurve::AnimationCurveTypeTransform: {
654 OwnPtr<CompositorTransformOperations> ops = adoptPtr(CompositorFacto ry::current().createTransformOperations()); 654 OwnPtr<CompositorTransformOperations> ops = CompositorFactory::curre nt().createTransformOperations();
655 toCompositorTransformOperations(toAnimatableTransform(value)->transf ormOperations(), ops.get()); 655 toCompositorTransformOperations(toAnimatableTransform(value)->transf ormOperations(), ops.get());
656 656
657 CompositorTransformKeyframe transformKeyframe(keyframe->offset(), op s.release()); 657 CompositorTransformKeyframe transformKeyframe(keyframe->offset(), op s.release());
658 CompositorTransformAnimationCurve* transformCurve = static_cast<Comp ositorTransformAnimationCurve*>(&curve); 658 CompositorTransformAnimationCurve* transformCurve = static_cast<Comp ositorTransformAnimationCurve*>(&curve);
659 addKeyframeWithTimingFunction(*transformCurve, transformKeyframe, ke yframeTimingFunction); 659 addKeyframeWithTimingFunction(*transformCurve, transformKeyframe, ke yframeTimingFunction);
660 break; 660 break;
661 } 661 }
662 default: 662 default:
663 ASSERT_NOT_REACHED(); 663 ASSERT_NOT_REACHED();
664 } 664 }
(...skipping 12 matching lines...) Expand all
677 for (const auto& property : properties) { 677 for (const auto& property : properties) {
678 PropertySpecificKeyframeVector values; 678 PropertySpecificKeyframeVector values;
679 getKeyframeValuesForProperty(&effect, property, compositorTiming.scaledD uration, values); 679 getKeyframeValuesForProperty(&effect, property, compositorTiming.scaledD uration, values);
680 680
681 CompositorAnimation::TargetProperty targetProperty; 681 CompositorAnimation::TargetProperty targetProperty;
682 OwnPtr<CompositorAnimationCurve> curve; 682 OwnPtr<CompositorAnimationCurve> curve;
683 switch (property.cssProperty()) { 683 switch (property.cssProperty()) {
684 case CSSPropertyOpacity: { 684 case CSSPropertyOpacity: {
685 targetProperty = CompositorAnimation::TargetPropertyOpacity; 685 targetProperty = CompositorAnimation::TargetPropertyOpacity;
686 686
687 CompositorFloatAnimationCurve* floatCurve = CompositorFactory::curre nt().createFloatAnimationCurve(); 687 OwnPtr<CompositorFloatAnimationCurve> floatCurve = CompositorFactory ::current().createFloatAnimationCurve();
688 addKeyframesToCurve(*floatCurve, values, timing); 688 addKeyframesToCurve(*floatCurve, values, timing);
689 setTimingFunctionOnCurve(*floatCurve, timing.timingFunction.get()); 689 setTimingFunctionOnCurve(*floatCurve, timing.timingFunction.get());
690 curve = adoptPtr(floatCurve); 690 curve = floatCurve.release();
691 break; 691 break;
692 } 692 }
693 case CSSPropertyWebkitFilter: 693 case CSSPropertyWebkitFilter:
694 case CSSPropertyBackdropFilter: { 694 case CSSPropertyBackdropFilter: {
695 targetProperty = CompositorAnimation::TargetPropertyFilter; 695 targetProperty = CompositorAnimation::TargetPropertyFilter;
696 CompositorFilterAnimationCurve* filterCurve = CompositorFactory::cur rent().createFilterAnimationCurve(); 696 OwnPtr<CompositorFilterAnimationCurve> filterCurve = CompositorFacto ry::current().createFilterAnimationCurve();
697 addKeyframesToCurve(*filterCurve, values, timing); 697 addKeyframesToCurve(*filterCurve, values, timing);
698 setTimingFunctionOnCurve(*filterCurve, timing.timingFunction.get()); 698 setTimingFunctionOnCurve(*filterCurve, timing.timingFunction.get());
699 curve = adoptPtr(filterCurve); 699 curve = filterCurve.release();
700 break; 700 break;
701 } 701 }
702 case CSSPropertyRotate: 702 case CSSPropertyRotate:
703 case CSSPropertyScale: 703 case CSSPropertyScale:
704 case CSSPropertyTranslate: 704 case CSSPropertyTranslate:
705 case CSSPropertyTransform: { 705 case CSSPropertyTransform: {
706 targetProperty = CompositorAnimation::TargetPropertyTransform; 706 targetProperty = CompositorAnimation::TargetPropertyTransform;
707 CompositorTransformAnimationCurve* transformCurve = CompositorFactor y::current().createTransformAnimationCurve(); 707 OwnPtr<CompositorTransformAnimationCurve> transformCurve = Composito rFactory::current().createTransformAnimationCurve();
708 addKeyframesToCurve(*transformCurve, values, timing); 708 addKeyframesToCurve(*transformCurve, values, timing);
709 setTimingFunctionOnCurve(*transformCurve, timing.timingFunction.get( )); 709 setTimingFunctionOnCurve(*transformCurve, timing.timingFunction.get( ));
710 curve = adoptPtr(transformCurve); 710 curve = transformCurve.release();
711 break; 711 break;
712 } 712 }
713 default: 713 default:
714 ASSERT_NOT_REACHED(); 714 ASSERT_NOT_REACHED();
715 continue; 715 continue;
716 } 716 }
717 ASSERT(curve.get()); 717 ASSERT(curve.get());
718 718
719 OwnPtr<CompositorAnimation> animation = adoptPtr(CompositorFactory::curr ent().createAnimation(*curve, targetProperty, group, 0)); 719 OwnPtr<CompositorAnimation> animation = CompositorFactory::current().cre ateAnimation(*curve, targetProperty, group, 0);
720 720
721 if (!std::isnan(startTime)) 721 if (!std::isnan(startTime))
722 animation->setStartTime(startTime); 722 animation->setStartTime(startTime);
723 723
724 animation->setIterations(compositorTiming.adjustedIterationCount); 724 animation->setIterations(compositorTiming.adjustedIterationCount);
725 animation->setIterationStart(compositorTiming.iterationStart); 725 animation->setIterationStart(compositorTiming.iterationStart);
726 animation->setTimeOffset(compositorTiming.scaledTimeOffset); 726 animation->setTimeOffset(compositorTiming.scaledTimeOffset);
727 727
728 switch (compositorTiming.direction) { 728 switch (compositorTiming.direction) {
729 case Timing::PlaybackDirectionNormal: 729 case Timing::PlaybackDirectionNormal:
(...skipping 28 matching lines...) Expand all
758 break; 758 break;
759 default: 759 default:
760 ASSERT_NOT_REACHED(); 760 ASSERT_NOT_REACHED();
761 } 761 }
762 animations.append(animation.release()); 762 animations.append(animation.release());
763 } 763 }
764 ASSERT(!animations.isEmpty()); 764 ASSERT(!animations.isEmpty());
765 } 765 }
766 766
767 } // namespace blink 767 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698