| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 switch (animation.playStateInternal()) { | 81 switch (animation.playStateInternal()) { |
| 82 case Animation::Idle: | 82 case Animation::Idle: |
| 83 return false; | 83 return false; |
| 84 case Animation::Pending: | 84 case Animation::Pending: |
| 85 case Animation::Running: | 85 case Animation::Running: |
| 86 return true; | 86 return true; |
| 87 case Animation::Paused: | 87 case Animation::Paused: |
| 88 case Animation::Finished: | 88 case Animation::Finished: |
| 89 return Animation::hasLowerPriority(&animationToAdd, &animation); | 89 return Animation::hasLowerPriority(&animationToAdd, &animation); |
| 90 default: | 90 default: |
| 91 ASSERT_NOT_REACHED(); | 91 NOTREACHED(); |
| 92 return true; | 92 return true; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool isTransformRelatedCSSProperty(const PropertyHandle property) | 96 bool isTransformRelatedCSSProperty(const PropertyHandle property) |
| 97 { | 97 { |
| 98 return property.isCSSProperty() | 98 return property.isCSSProperty() |
| 99 && (property.cssProperty() == CSSPropertyRotate | 99 && (property.cssProperty() == CSSPropertyRotate |
| 100 || property.cssProperty() == CSSPropertyScale | 100 || property.cssProperty() == CSSPropertyScale |
| 101 || property.cssProperty() == CSSPropertyTransform | 101 || property.cssProperty() == CSSPropertyTransform |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 compositorPlayer->removeAnimation(id); | 362 compositorPlayer->removeAnimation(id); |
| 363 } | 363 } |
| 364 | 364 |
| 365 void CompositorAnimations::pauseAnimationForTestingOnCompositor(const Element& e
lement, const Animation& animation, int id, double pauseTime) | 365 void CompositorAnimations::pauseAnimationForTestingOnCompositor(const Element& e
lement, const Animation& animation, int id, double pauseTime) |
| 366 { | 366 { |
| 367 // FIXME: canStartAnimationOnCompositor queries compositingState, which is n
ot necessarily up to date. | 367 // FIXME: canStartAnimationOnCompositor queries compositingState, which is n
ot necessarily up to date. |
| 368 // https://code.google.com/p/chromium/issues/detail?id=339847 | 368 // https://code.google.com/p/chromium/issues/detail?id=339847 |
| 369 DisableCompositingQueryAsserts disabler; | 369 DisableCompositingQueryAsserts disabler; |
| 370 | 370 |
| 371 if (!canStartAnimationOnCompositor(element)) { | 371 if (!canStartAnimationOnCompositor(element)) { |
| 372 ASSERT_NOT_REACHED(); | 372 NOTREACHED(); |
| 373 return; | 373 return; |
| 374 } | 374 } |
| 375 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); | 375 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); |
| 376 ASSERT(compositorPlayer); | 376 ASSERT(compositorPlayer); |
| 377 compositorPlayer->pauseAnimation(id, pauseTime); | 377 compositorPlayer->pauseAnimation(id, pauseTime); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void CompositorAnimations::attachCompositedLayers(Element& element, const Animat
ion& animation) | 380 void CompositorAnimations::attachCompositedLayers(Element& element, const Animat
ion& animation) |
| 381 { | 381 { |
| 382 if (!animation.compositorPlayer()) | 382 if (!animation.compositorPlayer()) |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 case CSSPropertyTranslate: | 589 case CSSPropertyTranslate: |
| 590 case CSSPropertyTransform: { | 590 case CSSPropertyTransform: { |
| 591 targetProperty = CompositorTargetProperty::TRANSFORM; | 591 targetProperty = CompositorTargetProperty::TRANSFORM; |
| 592 std::unique_ptr<CompositorTransformAnimationCurve> transformCurve =
CompositorTransformAnimationCurve::create(); | 592 std::unique_ptr<CompositorTransformAnimationCurve> transformCurve =
CompositorTransformAnimationCurve::create(); |
| 593 addKeyframesToCurve(*transformCurve, values); | 593 addKeyframesToCurve(*transformCurve, values); |
| 594 setTimingFunctionOnCurve(*transformCurve, timing.timingFunction.get(
)); | 594 setTimingFunctionOnCurve(*transformCurve, timing.timingFunction.get(
)); |
| 595 curve = std::move(transformCurve); | 595 curve = std::move(transformCurve); |
| 596 break; | 596 break; |
| 597 } | 597 } |
| 598 default: | 598 default: |
| 599 ASSERT_NOT_REACHED(); | 599 NOTREACHED(); |
| 600 continue; | 600 continue; |
| 601 } | 601 } |
| 602 ASSERT(curve.get()); | 602 ASSERT(curve.get()); |
| 603 | 603 |
| 604 std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::cr
eate(*curve, targetProperty, group, 0); | 604 std::unique_ptr<CompositorAnimation> animation = CompositorAnimation::cr
eate(*curve, targetProperty, group, 0); |
| 605 | 605 |
| 606 if (!std::isnan(startTime)) | 606 if (!std::isnan(startTime)) |
| 607 animation->setStartTime(startTime); | 607 animation->setStartTime(startTime); |
| 608 | 608 |
| 609 animation->setIterations(compositorTiming.adjustedIterationCount); | 609 animation->setIterations(compositorTiming.adjustedIterationCount); |
| 610 animation->setIterationStart(compositorTiming.iterationStart); | 610 animation->setIterationStart(compositorTiming.iterationStart); |
| 611 animation->setTimeOffset(compositorTiming.scaledTimeOffset); | 611 animation->setTimeOffset(compositorTiming.scaledTimeOffset); |
| 612 | 612 |
| 613 switch (compositorTiming.direction) { | 613 switch (compositorTiming.direction) { |
| 614 case Timing::PlaybackDirectionNormal: | 614 case Timing::PlaybackDirectionNormal: |
| 615 animation->setDirection(CompositorAnimation::Direction::NORMAL); | 615 animation->setDirection(CompositorAnimation::Direction::NORMAL); |
| 616 break; | 616 break; |
| 617 case Timing::PlaybackDirectionReverse: | 617 case Timing::PlaybackDirectionReverse: |
| 618 animation->setDirection(CompositorAnimation::Direction::REVERSE); | 618 animation->setDirection(CompositorAnimation::Direction::REVERSE); |
| 619 break; | 619 break; |
| 620 case Timing::PlaybackDirectionAlternate: | 620 case Timing::PlaybackDirectionAlternate: |
| 621 animation->setDirection(CompositorAnimation::Direction::ALTERNATE_NO
RMAL); | 621 animation->setDirection(CompositorAnimation::Direction::ALTERNATE_NO
RMAL); |
| 622 break; | 622 break; |
| 623 case Timing::PlaybackDirectionAlternateReverse: | 623 case Timing::PlaybackDirectionAlternateReverse: |
| 624 animation->setDirection(CompositorAnimation::Direction::ALTERNATE_RE
VERSE); | 624 animation->setDirection(CompositorAnimation::Direction::ALTERNATE_RE
VERSE); |
| 625 break; | 625 break; |
| 626 default: | 626 default: |
| 627 ASSERT_NOT_REACHED(); | 627 NOTREACHED(); |
| 628 } | 628 } |
| 629 animation->setPlaybackRate(compositorTiming.playbackRate); | 629 animation->setPlaybackRate(compositorTiming.playbackRate); |
| 630 | 630 |
| 631 switch (compositorTiming.fillMode) { | 631 switch (compositorTiming.fillMode) { |
| 632 case Timing::FillModeNone: | 632 case Timing::FillModeNone: |
| 633 animation->setFillMode(CompositorAnimation::FillMode::NONE); | 633 animation->setFillMode(CompositorAnimation::FillMode::NONE); |
| 634 break; | 634 break; |
| 635 case Timing::FillModeForwards: | 635 case Timing::FillModeForwards: |
| 636 animation->setFillMode(CompositorAnimation::FillMode::FORWARDS); | 636 animation->setFillMode(CompositorAnimation::FillMode::FORWARDS); |
| 637 break; | 637 break; |
| 638 case Timing::FillModeBackwards: | 638 case Timing::FillModeBackwards: |
| 639 animation->setFillMode(CompositorAnimation::FillMode::BACKWARDS); | 639 animation->setFillMode(CompositorAnimation::FillMode::BACKWARDS); |
| 640 break; | 640 break; |
| 641 case Timing::FillModeBoth: | 641 case Timing::FillModeBoth: |
| 642 animation->setFillMode(CompositorAnimation::FillMode::BOTH); | 642 animation->setFillMode(CompositorAnimation::FillMode::BOTH); |
| 643 break; | 643 break; |
| 644 default: | 644 default: |
| 645 ASSERT_NOT_REACHED(); | 645 NOTREACHED(); |
| 646 } | 646 } |
| 647 animations.append(std::move(animation)); | 647 animations.append(std::move(animation)); |
| 648 } | 648 } |
| 649 ASSERT(!animations.isEmpty()); | 649 ASSERT(!animations.isEmpty()); |
| 650 } | 650 } |
| 651 | 651 |
| 652 } // namespace blink | 652 } // namespace blink |
| OLD | NEW |