| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 190 } |
| 191 | 191 |
| 192 return true; | 192 return true; |
| 193 } | 193 } |
| 194 | 194 |
| 195 bool CompositorAnimations::canStartAnimationOnCompositor(const Element& element) | 195 bool CompositorAnimations::canStartAnimationOnCompositor(const Element& element) |
| 196 { | 196 { |
| 197 return element.renderer() && element.renderer()->compositingState() == Paint
sIntoOwnBacking; | 197 return element.renderer() && element.renderer()->compositingState() == Paint
sIntoOwnBacking; |
| 198 } | 198 } |
| 199 | 199 |
| 200 bool CompositorAnimations::startAnimationOnCompositor(const Element& element, do
uble startTime, double timeOffset, const Timing& timing, const AnimationEffect&
effect, Vector<int>& startedAnimationIds, double playerPlaybackRate) | 200 bool CompositorAnimations::startAnimationOnCompositor(const Element& element, in
t group, double startTime, double timeOffset, const Timing& timing, const Animat
ionEffect& effect, Vector<int>& startedAnimationIds, double playerPlaybackRate) |
| 201 { | 201 { |
| 202 ASSERT(startedAnimationIds.isEmpty()); | 202 ASSERT(startedAnimationIds.isEmpty()); |
| 203 ASSERT(isCandidateForAnimationOnCompositor(timing, effect, playerPlaybackRat
e)); | 203 ASSERT(isCandidateForAnimationOnCompositor(timing, effect, playerPlaybackRat
e)); |
| 204 ASSERT(canStartAnimationOnCompositor(element)); | 204 ASSERT(canStartAnimationOnCompositor(element)); |
| 205 | 205 |
| 206 const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(ef
fect); | 206 const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(ef
fect); |
| 207 | 207 |
| 208 RenderLayer* layer = toRenderBoxModelObject(element.renderer())->layer(); | 208 RenderLayer* layer = toRenderBoxModelObject(element.renderer())->layer(); |
| 209 ASSERT(layer); | 209 ASSERT(layer); |
| 210 | 210 |
| 211 Vector<OwnPtr<WebCompositorAnimation>> animations; | 211 Vector<OwnPtr<WebCompositorAnimation>> animations; |
| 212 CompositorAnimationsImpl::getAnimationOnCompositor(timing, startTime, timeOf
fset, keyframeEffect, animations, playerPlaybackRate); | 212 CompositorAnimationsImpl::getAnimationOnCompositor(timing, group, startTime,
timeOffset, keyframeEffect, animations, playerPlaybackRate); |
| 213 ASSERT(!animations.isEmpty()); | 213 ASSERT(!animations.isEmpty()); |
| 214 for (auto& animation : animations) { | 214 for (auto& animation : animations) { |
| 215 int id = animation->id(); | 215 int id = animation->id(); |
| 216 if (!layer->compositedLayerMapping()->mainGraphicsLayer()->addAnimation(
animation.release())) { | 216 if (!layer->compositedLayerMapping()->mainGraphicsLayer()->addAnimation(
animation.release())) { |
| 217 // FIXME: We should know ahead of time whether these animations can
be started. | 217 // FIXME: We should know ahead of time whether these animations can
be started. |
| 218 for (int startedAnimationId : startedAnimationIds) | 218 for (int startedAnimationId : startedAnimationIds) |
| 219 cancelAnimationOnCompositor(element, startedAnimationId); | 219 cancelAnimationOnCompositor(element, startedAnimationId); |
| 220 startedAnimationIds.clear(); | 220 startedAnimationIds.clear(); |
| 221 return false; | 221 return false; |
| 222 } | 222 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 WebTransformAnimationCurve* transformCurve = static_cast<WebTransfor
mAnimationCurve*>(&curve); | 379 WebTransformAnimationCurve* transformCurve = static_cast<WebTransfor
mAnimationCurve*>(&curve); |
| 380 addKeyframeWithTimingFunction(*transformCurve, transformKeyframe, ke
yframeTimingFunction); | 380 addKeyframeWithTimingFunction(*transformCurve, transformKeyframe, ke
yframeTimingFunction); |
| 381 break; | 381 break; |
| 382 } | 382 } |
| 383 default: | 383 default: |
| 384 ASSERT_NOT_REACHED(); | 384 ASSERT_NOT_REACHED(); |
| 385 } | 385 } |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 | 388 |
| 389 void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, do
uble startTime, double timeOffset, const KeyframeEffectModelBase& effect, Vector
<OwnPtr<WebCompositorAnimation> >& animations, double playerPlaybackRate) | 389 void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, in
t group, double startTime, double timeOffset, const KeyframeEffectModelBase& eff
ect, Vector<OwnPtr<WebCompositorAnimation> >& animations, double playerPlaybackR
ate) |
| 390 { | 390 { |
| 391 ASSERT(animations.isEmpty()); | 391 ASSERT(animations.isEmpty()); |
| 392 CompositorTiming compositorTiming; | 392 CompositorTiming compositorTiming; |
| 393 bool timingValid = convertTimingForCompositor(timing, timeOffset, compositor
Timing, playerPlaybackRate); | 393 bool timingValid = convertTimingForCompositor(timing, timeOffset, compositor
Timing, playerPlaybackRate); |
| 394 ASSERT_UNUSED(timingValid, timingValid); | 394 ASSERT_UNUSED(timingValid, timingValid); |
| 395 | 395 |
| 396 PropertySet properties = effect.properties(); | 396 PropertySet properties = effect.properties(); |
| 397 ASSERT(!properties.isEmpty()); | 397 ASSERT(!properties.isEmpty()); |
| 398 for (const auto& property : properties) { | 398 for (const auto& property : properties) { |
| 399 PropertySpecificKeyframeVector values; | 399 PropertySpecificKeyframeVector values; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 423 addKeyframesToCurve(*transformCurve, values, timing); | 423 addKeyframesToCurve(*transformCurve, values, timing); |
| 424 curve = adoptPtr(transformCurve); | 424 curve = adoptPtr(transformCurve); |
| 425 break; | 425 break; |
| 426 } | 426 } |
| 427 default: | 427 default: |
| 428 ASSERT_NOT_REACHED(); | 428 ASSERT_NOT_REACHED(); |
| 429 continue; | 429 continue; |
| 430 } | 430 } |
| 431 ASSERT(curve.get()); | 431 ASSERT(curve.get()); |
| 432 | 432 |
| 433 OwnPtr<WebCompositorAnimation> animation = adoptPtr(Platform::current()-
>compositorSupport()->createAnimation(*curve, targetProperty)); | 433 OwnPtr<WebCompositorAnimation> animation = adoptPtr(Platform::current()-
>compositorSupport()->createAnimation(*curve, targetProperty, group, 0)); |
| 434 | 434 |
| 435 if (!std::isnan(startTime)) | 435 if (!std::isnan(startTime)) |
| 436 animation->setStartTime(startTime); | 436 animation->setStartTime(startTime); |
| 437 | 437 |
| 438 animation->setIterations(compositorTiming.adjustedIterationCount); | 438 animation->setIterations(compositorTiming.adjustedIterationCount); |
| 439 animation->setIterationStart(compositorTiming.iterationStart); | 439 animation->setIterationStart(compositorTiming.iterationStart); |
| 440 animation->setTimeOffset(compositorTiming.scaledTimeOffset); | 440 animation->setTimeOffset(compositorTiming.scaledTimeOffset); |
| 441 | 441 |
| 442 switch (compositorTiming.direction) { | 442 switch (compositorTiming.direction) { |
| 443 case Timing::PlaybackDirectionNormal: | 443 case Timing::PlaybackDirectionNormal: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 472 break; | 472 break; |
| 473 default: | 473 default: |
| 474 ASSERT_NOT_REACHED(); | 474 ASSERT_NOT_REACHED(); |
| 475 } | 475 } |
| 476 animations.append(animation.release()); | 476 animations.append(animation.release()); |
| 477 } | 477 } |
| 478 ASSERT(!animations.isEmpty()); | 478 ASSERT(!animations.isEmpty()); |
| 479 } | 479 } |
| 480 | 480 |
| 481 } // namespace blink | 481 } // namespace blink |
| OLD | NEW |