| 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" | |
| 41 #include "core/layout/LayoutBoxModelObject.h" | 40 #include "core/layout/LayoutBoxModelObject.h" |
| 42 #include "core/layout/LayoutObject.h" | 41 #include "core/layout/LayoutObject.h" |
| 43 #include "core/layout/compositing/CompositedLayerMapping.h" | 42 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 44 #include "core/paint/PaintLayer.h" | 43 #include "core/paint/PaintLayer.h" |
| 45 #include "platform/animation/AnimationTranslationUtil.h" | 44 #include "platform/animation/AnimationTranslationUtil.h" |
| 46 #include "platform/animation/CompositorAnimation.h" | 45 #include "platform/animation/CompositorAnimation.h" |
| 47 #include "platform/animation/CompositorAnimationPlayer.h" | 46 #include "platform/animation/CompositorAnimationPlayer.h" |
| 48 #include "platform/animation/CompositorFilterAnimationCurve.h" | 47 #include "platform/animation/CompositorFilterAnimationCurve.h" |
| 49 #include "platform/animation/CompositorFilterKeyframe.h" | 48 #include "platform/animation/CompositorFilterKeyframe.h" |
| 50 #include "platform/animation/CompositorFloatAnimationCurve.h" | 49 #include "platform/animation/CompositorFloatAnimationCurve.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 369 |
| 371 if (!canStartAnimationOnCompositor(element)) { | 370 if (!canStartAnimationOnCompositor(element)) { |
| 372 ASSERT_NOT_REACHED(); | 371 ASSERT_NOT_REACHED(); |
| 373 return; | 372 return; |
| 374 } | 373 } |
| 375 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); | 374 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); |
| 376 ASSERT(compositorPlayer); | 375 ASSERT(compositorPlayer); |
| 377 compositorPlayer->pauseAnimation(id, pauseTime); | 376 compositorPlayer->pauseAnimation(id, pauseTime); |
| 378 } | 377 } |
| 379 | 378 |
| 380 void CompositorAnimations::attachCompositedLayers(Element& element, const Animat
ion& animation) | 379 bool CompositorAnimations::canAttachCompositedLayers(const Element& element, con
st Animation& animation) |
| 381 { | 380 { |
| 382 if (!animation.compositorPlayer()) | 381 if (!animation.compositorPlayer()) |
| 383 return; | 382 return false; |
| 383 |
| 384 if (!element.layoutObject() || !element.layoutObject()->isBoxModelObject()) |
| 385 return false; |
| 386 |
| 387 PaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer(); |
| 388 |
| 389 if (!layer || !layer->isAllowedToQueryCompositingState() |
| 390 || !layer->compositedLayerMapping() |
| 391 || !layer->compositedLayerMapping()->mainGraphicsLayer()) |
| 392 return false; |
| 393 |
| 394 if (!layer->compositedLayerMapping()->mainGraphicsLayer()->platformLayer()) |
| 395 return false; |
| 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); |
| 384 | 406 |
| 385 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); | 407 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); |
| 386 compositorPlayer->attachElement(createCompositorElementId(DOMNodeIds::idForN
ode(&element), CompositorSubElementId::Primary)); | 408 ASSERT(compositorPlayer); |
| 409 |
| 410 ASSERT(layer->compositedLayerMapping()); |
| 411 compositorPlayer->attachLayer(layer->compositedLayerMapping()->mainGraphicsL
ayer()->platformLayer()); |
| 387 } | 412 } |
| 388 | 413 |
| 389 bool CompositorAnimations::convertTimingForCompositor(const Timing& timing, doub
le timeOffset, CompositorTiming& out, double animationPlaybackRate) | 414 bool CompositorAnimations::convertTimingForCompositor(const Timing& timing, doub
le timeOffset, CompositorTiming& out, double animationPlaybackRate) |
| 390 { | 415 { |
| 391 timing.assertValid(); | 416 timing.assertValid(); |
| 392 | 417 |
| 393 // FIXME: Compositor does not know anything about endDelay. | 418 // FIXME: Compositor does not know anything about endDelay. |
| 394 if (timing.endDelay != 0) | 419 if (timing.endDelay != 0) |
| 395 return false; | 420 return false; |
| 396 | 421 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 break; | 656 break; |
| 632 default: | 657 default: |
| 633 ASSERT_NOT_REACHED(); | 658 ASSERT_NOT_REACHED(); |
| 634 } | 659 } |
| 635 animations.append(std::move(animation)); | 660 animations.append(std::move(animation)); |
| 636 } | 661 } |
| 637 ASSERT(!animations.isEmpty()); | 662 ASSERT(!animations.isEmpty()); |
| 638 } | 663 } |
| 639 | 664 |
| 640 } // namespace blink | 665 } // namespace blink |
| OLD | NEW |