| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "core/animation/CompositorAnimations.h" | 31 #include "core/animation/CompositorAnimations.h" |
| 32 | 32 |
| 33 #include "core/animation/AnimationEffect.h" | 33 #include "core/animation/AnimationEffect.h" |
| 34 #include "core/animation/ElementAnimations.h" | 34 #include "core/animation/ElementAnimations.h" |
| 35 #include "core/animation/KeyframeEffectModel.h" | 35 #include "core/animation/KeyframeEffectModel.h" |
| 36 #include "core/animation/animatable/AnimatableDouble.h" | 36 #include "core/animation/animatable/AnimatableDouble.h" |
| 37 #include "core/animation/animatable/AnimatableFilterOperations.h" | 37 #include "core/animation/animatable/AnimatableFilterOperations.h" |
| 38 #include "core/animation/animatable/AnimatableTransform.h" | 38 #include "core/animation/animatable/AnimatableTransform.h" |
| 39 #include "core/animation/animatable/AnimatableValue.h" | 39 #include "core/animation/animatable/AnimatableValue.h" |
| 40 #include "core/dom/DOMNodeIds.h" |
| 40 #include "core/layout/LayoutBoxModelObject.h" | 41 #include "core/layout/LayoutBoxModelObject.h" |
| 41 #include "core/layout/LayoutObject.h" | 42 #include "core/layout/LayoutObject.h" |
| 42 #include "core/layout/compositing/CompositedLayerMapping.h" | 43 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 43 #include "core/paint/PaintLayer.h" | 44 #include "core/paint/PaintLayer.h" |
| 44 #include "platform/animation/AnimationTranslationUtil.h" | 45 #include "platform/animation/AnimationTranslationUtil.h" |
| 45 #include "platform/animation/CompositorAnimation.h" | 46 #include "platform/animation/CompositorAnimation.h" |
| 46 #include "platform/animation/CompositorAnimationPlayer.h" | 47 #include "platform/animation/CompositorAnimationPlayer.h" |
| 47 #include "platform/animation/CompositorFilterAnimationCurve.h" | 48 #include "platform/animation/CompositorFilterAnimationCurve.h" |
| 48 #include "platform/animation/CompositorFilterKeyframe.h" | 49 #include "platform/animation/CompositorFilterKeyframe.h" |
| 49 #include "platform/animation/CompositorFloatAnimationCurve.h" | 50 #include "platform/animation/CompositorFloatAnimationCurve.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 370 |
| 370 if (!canStartAnimationOnCompositor(element)) { | 371 if (!canStartAnimationOnCompositor(element)) { |
| 371 ASSERT_NOT_REACHED(); | 372 ASSERT_NOT_REACHED(); |
| 372 return; | 373 return; |
| 373 } | 374 } |
| 374 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); | 375 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); |
| 375 ASSERT(compositorPlayer); | 376 ASSERT(compositorPlayer); |
| 376 compositorPlayer->pauseAnimation(id, pauseTime); | 377 compositorPlayer->pauseAnimation(id, pauseTime); |
| 377 } | 378 } |
| 378 | 379 |
| 379 bool CompositorAnimations::canAttachCompositedLayers(const Element& element, con
st Animation& animation) | 380 void CompositorAnimations::attachCompositedLayers(Element& element, const Animat
ion& animation) |
| 380 { | 381 { |
| 381 if (!animation.compositorPlayer()) | 382 if (!animation.compositorPlayer()) |
| 382 return false; | 383 return; |
| 383 | 384 |
| 384 if (!element.layoutObject() || !element.layoutObject()->isBoxModelObject()) | 385 if (!element.layoutObject() || !element.layoutObject()->isBoxModelObject()) |
| 385 return false; | 386 return; |
| 386 | 387 |
| 387 PaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer(); | 388 PaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer(); |
| 388 | 389 |
| 389 if (!layer || !layer->isAllowedToQueryCompositingState() | 390 if (!layer || !layer->isAllowedToQueryCompositingState() |
| 390 || !layer->compositedLayerMapping() | 391 || !layer->compositedLayerMapping() |
| 391 || !layer->compositedLayerMapping()->mainGraphicsLayer()) | 392 || !layer->compositedLayerMapping()->mainGraphicsLayer()) |
| 392 return false; | 393 return; |
| 393 | 394 |
| 394 if (!layer->compositedLayerMapping()->mainGraphicsLayer()->platformLayer()) | 395 if (!layer->compositedLayerMapping()->mainGraphicsLayer()->platformLayer()) |
| 395 return false; | 396 return; |
| 396 | |
| 397 return true; | |
| 398 } | |
| 399 | |
| 400 void CompositorAnimations::attachCompositedLayers(const Element& element, const
Animation& animation) | |
| 401 { | |
| 402 ASSERT(element.layoutObject()); | |
| 403 | |
| 404 PaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer(); | |
| 405 ASSERT(layer); | |
| 406 | 397 |
| 407 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); | 398 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); |
| 408 ASSERT(compositorPlayer); | 399 compositorPlayer->attachElement(createCompositorElementId(DOMNodeIds::idForN
ode(&element), CompositorSubElementId::Primary)); |
| 409 | |
| 410 ASSERT(layer->compositedLayerMapping()); | |
| 411 compositorPlayer->attachLayer(layer->compositedLayerMapping()->mainGraphicsL
ayer()->platformLayer()); | |
| 412 } | 400 } |
| 413 | 401 |
| 414 bool CompositorAnimations::convertTimingForCompositor(const Timing& timing, doub
le timeOffset, CompositorTiming& out, double animationPlaybackRate) | 402 bool CompositorAnimations::convertTimingForCompositor(const Timing& timing, doub
le timeOffset, CompositorTiming& out, double animationPlaybackRate) |
| 415 { | 403 { |
| 416 timing.assertValid(); | 404 timing.assertValid(); |
| 417 | 405 |
| 418 // FIXME: Compositor does not know anything about endDelay. | 406 // FIXME: Compositor does not know anything about endDelay. |
| 419 if (timing.endDelay != 0) | 407 if (timing.endDelay != 0) |
| 420 return false; | 408 return false; |
| 421 | 409 |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 break; | 643 break; |
| 656 default: | 644 default: |
| 657 ASSERT_NOT_REACHED(); | 645 ASSERT_NOT_REACHED(); |
| 658 } | 646 } |
| 659 animations.append(std::move(animation)); | 647 animations.append(std::move(animation)); |
| 660 } | 648 } |
| 661 ASSERT(!animations.isEmpty()); | 649 ASSERT(!animations.isEmpty()); |
| 662 } | 650 } |
| 663 | 651 |
| 664 } // namespace blink | 652 } // namespace blink |
| OLD | NEW |