| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 attachedAnimation->cancelAnimationOnCompositor(); | 340 attachedAnimation->cancelAnimationOnCompositor(); |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 bool CompositorAnimations::canStartAnimationOnCompositor( | 344 bool CompositorAnimations::canStartAnimationOnCompositor( |
| 345 const Element& element) { | 345 const Element& element) { |
| 346 if (!Platform::current()->isThreadedAnimationEnabled()) | 346 if (!Platform::current()->isThreadedAnimationEnabled()) |
| 347 return false; | 347 return false; |
| 348 | 348 |
| 349 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 349 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 350 // TODO(wkorman): Consider effect node for opacity. | 350 // We query paint property tree state below to determine whether the |
| 351 // animation is compositable. There is a known lifecycle violation where an |
| 352 // animation can be cancelled during style update. See |
| 353 // CompositorAnimations::cancelAnimationOnCompositor and |
| 354 // http://crbug.com/676456. When this is fixed we would like to enable |
| 355 // the DCHECK below. |
| 356 // DCHECK(document().lifecycle().state() >= |
| 357 // DocumentLifecycle::PrePaintClean); |
| 358 const ObjectPaintProperties* paintProperties = |
| 359 element.layoutObject()->paintProperties(); |
| 351 const TransformPaintPropertyNode* transformNode = | 360 const TransformPaintPropertyNode* transformNode = |
| 352 element.layoutObject()->paintProperties()->transform(); | 361 paintProperties->transform(); |
| 353 return transformNode && transformNode->hasDirectCompositingReasons(); | 362 const EffectPaintPropertyNode* effectNode = paintProperties->effect(); |
| 363 return (transformNode && transformNode->hasDirectCompositingReasons()) || |
| 364 (effectNode && effectNode->hasDirectCompositingReasons()); |
| 354 } | 365 } |
| 355 | 366 |
| 356 return element.layoutObject() && | 367 return element.layoutObject() && |
| 357 element.layoutObject()->compositingState() == PaintsIntoOwnBacking; | 368 element.layoutObject()->compositingState() == PaintsIntoOwnBacking; |
| 358 } | 369 } |
| 359 | 370 |
| 360 void CompositorAnimations::startAnimationOnCompositor( | 371 void CompositorAnimations::startAnimationOnCompositor( |
| 361 const Element& element, | 372 const Element& element, |
| 362 int group, | 373 int group, |
| 363 double startTime, | 374 double startTime, |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 animation->setTimeOffset(compositorTiming.scaledTimeOffset); | 636 animation->setTimeOffset(compositorTiming.scaledTimeOffset); |
| 626 animation->setDirection(compositorTiming.direction); | 637 animation->setDirection(compositorTiming.direction); |
| 627 animation->setPlaybackRate(compositorTiming.playbackRate); | 638 animation->setPlaybackRate(compositorTiming.playbackRate); |
| 628 animation->setFillMode(compositorTiming.fillMode); | 639 animation->setFillMode(compositorTiming.fillMode); |
| 629 animations.push_back(std::move(animation)); | 640 animations.push_back(std::move(animation)); |
| 630 } | 641 } |
| 631 DCHECK(!animations.isEmpty()); | 642 DCHECK(!animations.isEmpty()); |
| 632 } | 643 } |
| 633 | 644 |
| 634 } // namespace blink | 645 } // namespace blink |
| OLD | NEW |