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

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

Issue 194673002: Web Animations: Refactor KeyframeEffectModel to work via an InterpolationEffect. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@interpolationWrap
Patch Set: 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 const TimingFunction* keyframeTimingFunction = 0; 394 const TimingFunction* keyframeTimingFunction = 0;
395 if (i < keyframes.size() - 1) { // Ignore timing function of last frame. 395 if (i < keyframes.size() - 1) { // Ignore timing function of last frame.
396 if (reverse) { 396 if (reverse) {
397 reversedTimingFunction = CompositorAnimationsTimingFunctionRever ser::reverse(keyframes[i + 1]->easing()); 397 reversedTimingFunction = CompositorAnimationsTimingFunctionRever ser::reverse(keyframes[i + 1]->easing());
398 keyframeTimingFunction = reversedTimingFunction.get(); 398 keyframeTimingFunction = reversedTimingFunction.get();
399 } else { 399 } else {
400 keyframeTimingFunction = keyframes[i]->easing(); 400 keyframeTimingFunction = keyframes[i]->easing();
401 } 401 }
402 } 402 }
403 403
404 ASSERT(!keyframes[i]->value()->dependsOnUnderlyingValue()); 404 const AnimatableValue* value = keyframes[i]->value();
405 RefPtr<AnimatableValue> value = keyframes[i]->value()->compositeOnto(0);
406 405
407 switch (curve.type()) { 406 switch (curve.type()) {
408 case blink::WebAnimationCurve::AnimationCurveTypeFilter: { 407 case blink::WebAnimationCurve::AnimationCurveTypeFilter: {
409 OwnPtr<blink::WebFilterOperations> ops = adoptPtr(blink::Platform::c urrent()->compositorSupport()->createFilterOperations()); 408 OwnPtr<blink::WebFilterOperations> ops = adoptPtr(blink::Platform::c urrent()->compositorSupport()->createFilterOperations());
410 bool converted = toWebFilterOperations(toAnimatableFilterOperations( value.get())->operations(), ops.get()); 409 bool converted = toWebFilterOperations(toAnimatableFilterOperations( value)->operations(), ops.get());
411 ASSERT_UNUSED(converted, converted); 410 ASSERT_UNUSED(converted, converted);
412 411
413 blink::WebFilterKeyframe filterKeyframe(keyframes[i]->offset(), ops. release()); 412 blink::WebFilterKeyframe filterKeyframe(keyframes[i]->offset(), ops. release());
414 blink::WebFilterAnimationCurve* filterCurve = static_cast<blink::Web FilterAnimationCurve*>(&curve); 413 blink::WebFilterAnimationCurve* filterCurve = static_cast<blink::Web FilterAnimationCurve*>(&curve);
415 addKeyframeWithTimingFunction(*filterCurve, filterKeyframe, keyframe TimingFunction); 414 addKeyframeWithTimingFunction(*filterCurve, filterKeyframe, keyframe TimingFunction);
416 break; 415 break;
417 } 416 }
418 case blink::WebAnimationCurve::AnimationCurveTypeFloat: { 417 case blink::WebAnimationCurve::AnimationCurveTypeFloat: {
419 blink::WebFloatKeyframe floatKeyframe(keyframes[i]->offset(), toAnim atableDouble(value.get())->toDouble()); 418 blink::WebFloatKeyframe floatKeyframe(keyframes[i]->offset(), toAnim atableDouble(value)->toDouble());
420 blink::WebFloatAnimationCurve* floatCurve = static_cast<blink::WebFl oatAnimationCurve*>(&curve); 419 blink::WebFloatAnimationCurve* floatCurve = static_cast<blink::WebFl oatAnimationCurve*>(&curve);
421 addKeyframeWithTimingFunction(*floatCurve, floatKeyframe, keyframeTi mingFunction); 420 addKeyframeWithTimingFunction(*floatCurve, floatKeyframe, keyframeTi mingFunction);
422 break; 421 break;
423 } 422 }
424 case blink::WebAnimationCurve::AnimationCurveTypeTransform: { 423 case blink::WebAnimationCurve::AnimationCurveTypeTransform: {
425 OwnPtr<blink::WebTransformOperations> ops = adoptPtr(blink::Platform ::current()->compositorSupport()->createTransformOperations()); 424 OwnPtr<blink::WebTransformOperations> ops = adoptPtr(blink::Platform ::current()->compositorSupport()->createTransformOperations());
426 toWebTransformOperations(toAnimatableTransform(value.get())->transfo rmOperations(), ops.get()); 425 toWebTransformOperations(toAnimatableTransform(value)->transformOper ations(), ops.get());
427 426
428 blink::WebTransformKeyframe transformKeyframe(keyframes[i]->offset() , ops.release()); 427 blink::WebTransformKeyframe transformKeyframe(keyframes[i]->offset() , ops.release());
429 blink::WebTransformAnimationCurve* transformCurve = static_cast<blin k::WebTransformAnimationCurve*>(&curve); 428 blink::WebTransformAnimationCurve* transformCurve = static_cast<blin k::WebTransformAnimationCurve*>(&curve);
430 addKeyframeWithTimingFunction(*transformCurve, transformKeyframe, ke yframeTimingFunction); 429 addKeyframeWithTimingFunction(*transformCurve, transformKeyframe, ke yframeTimingFunction);
431 break; 430 break;
432 } 431 }
433 default: 432 default:
434 ASSERT_NOT_REACHED(); 433 ASSERT_NOT_REACHED();
435 } 434 }
436 } 435 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 animation->setIterations(compositorTiming.adjustedIterationCount); 489 animation->setIterations(compositorTiming.adjustedIterationCount);
491 animation->setTimeOffset(compositorTiming.scaledTimeOffset); 490 animation->setTimeOffset(compositorTiming.scaledTimeOffset);
492 animation->setAlternatesDirection(compositorTiming.alternate); 491 animation->setAlternatesDirection(compositorTiming.alternate);
493 492
494 animations.append(animation.release()); 493 animations.append(animation.release());
495 } 494 }
496 ASSERT(!animations.isEmpty()); 495 ASSERT(!animations.isEmpty());
497 } 496 }
498 497
499 } // namespace WebCore 498 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698