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

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

Issue 196413030: Web animations: Supply CSS transition easing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use iteration duration when choosing accuracy during keyframe animation Created 6 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
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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 return; 538 return;
539 if (!to) 539 if (!to)
540 to = CSSAnimatableValueFactory::create(id, style); 540 to = CSSAnimatableValueFactory::create(id, style);
541 541
542 RefPtr<AnimatableValue> from = CSSAnimatableValueFactory::create(id, oldStyl e); 542 RefPtr<AnimatableValue> from = CSSAnimatableValueFactory::create(id, oldStyl e);
543 // If we have multiple transitions on the same property, we will use the 543 // If we have multiple transitions on the same property, we will use the
544 // last one since we iterate over them in order. 544 // last one since we iterate over them in order.
545 if (AnimatableValue::usesDefaultInterpolation(to.get(), from.get())) 545 if (AnimatableValue::usesDefaultInterpolation(to.get(), from.get()))
546 return; 546 return;
547 547
548 Timing timing;
549 bool isPaused;
550 RefPtr<TimingFunction> timingFunction = timingFromAnimationData(anim, timing , isPaused);
551 ASSERT(!isPaused);
552 // Note that the backwards part is required for delay to work.
553 timing.fillMode = Timing::FillModeBoth;
554
548 KeyframeEffectModel::KeyframeVector keyframes; 555 KeyframeEffectModel::KeyframeVector keyframes;
549 556
550 RefPtrWillBeRawPtr<Keyframe> startKeyframe = Keyframe::create(); 557 RefPtrWillBeRawPtr<Keyframe> startKeyframe = Keyframe::create();
551 startKeyframe->setPropertyValue(id, from.get()); 558 startKeyframe->setPropertyValue(id, from.get());
552 startKeyframe->setOffset(0); 559 startKeyframe->setOffset(0);
560 startKeyframe->setEasing(timingFunction);
553 keyframes.append(startKeyframe); 561 keyframes.append(startKeyframe);
554 562
555 RefPtrWillBeRawPtr<Keyframe> endKeyframe = Keyframe::create(); 563 RefPtrWillBeRawPtr<Keyframe> endKeyframe = Keyframe::create();
556 endKeyframe->setPropertyValue(id, to.get()); 564 endKeyframe->setPropertyValue(id, to.get());
557 endKeyframe->setOffset(1); 565 endKeyframe->setOffset(1);
558 keyframes.append(endKeyframe); 566 keyframes.append(endKeyframe);
559 567
560 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create (keyframes); 568 RefPtrWillBeRawPtr<KeyframeEffectModel> effect = KeyframeEffectModel::create (keyframes);
561 569
562 Timing timing;
563 bool isPaused;
564 RefPtr<TimingFunction> timingFunction = timingFromAnimationData(anim, timing , isPaused);
565 ASSERT(!isPaused);
566 timing.timingFunction = timingFunction;
567 // Note that the backwards part is required for delay to work.
568 timing.fillMode = Timing::FillModeBoth;
569
570 update->startTransition(id, from.get(), to.get(), InertAnimation::create(eff ect, timing, isPaused)); 570 update->startTransition(id, from.get(), to.get(), InertAnimation::create(eff ect, timing, isPaused));
571 ASSERT(!element->activeAnimations() || !element->activeAnimations()->isAnima tionStyleChange()); 571 ASSERT(!element->activeAnimations() || !element->activeAnimations()->isAnima tionStyleChange());
572 } 572 }
573 573
574 void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate* update, const Element* element, const RenderStyle& style) 574 void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate* update, const Element* element, const RenderStyle& style)
575 { 575 {
576 if (!element) 576 if (!element)
577 return; 577 return;
578 578
579 ActiveAnimations* activeAnimations = element->activeAnimations(); 579 ActiveAnimations* activeAnimations = element->activeAnimations();
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 CSSPropertyID id = convertToCSSPropertyID(i); 890 CSSPropertyID id = convertToCSSPropertyID(i);
891 if (isAnimatableProperty(id)) 891 if (isAnimatableProperty(id))
892 properties.append(id); 892 properties.append(id);
893 } 893 }
894 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie s.begin(), properties.size()); 894 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie s.begin(), properties.size());
895 } 895 }
896 return propertyShorthand; 896 return propertyShorthand;
897 } 897 }
898 898
899 } // namespace WebCore 899 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698