| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "LayerChromium.h" | 7 #include "LayerChromium.h" |
| 8 | 8 |
| 9 #include "CCGeometryTestUtils.h" | 9 #include "CCGeometryTestUtils.h" |
| 10 #include "CCKeyframedAnimationCurve.h" | 10 #include "CCKeyframedAnimationCurve.h" |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 WebCompositorInitializer compositorInitializer(0); | 784 WebCompositorInitializer compositorInitializer(0); |
| 785 scoped_refptr<LayerChromium> root = LayerChromium::create(); | 785 scoped_refptr<LayerChromium> root = LayerChromium::create(); |
| 786 scoped_refptr<LayerChromium> child = LayerChromium::create(); | 786 scoped_refptr<LayerChromium> child = LayerChromium::create(); |
| 787 root->addChild(child); | 787 root->addChild(child); |
| 788 scoped_ptr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create())
; | 788 scoped_ptr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create())
; |
| 789 layerTreeHost->setRootLayer(root); | 789 layerTreeHost->setRootLayer(root); |
| 790 } | 790 } |
| 791 | 791 |
| 792 static bool addTestAnimation(LayerChromium* layer) | 792 static bool addTestAnimation(LayerChromium* layer) |
| 793 { | 793 { |
| 794 OwnPtr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCurve:
:create()); | 794 scoped_ptr<CCKeyframedFloatAnimationCurve> curve(CCKeyframedFloatAnimationCu
rve::create()); |
| 795 curve->addKeyframe(CCFloatKeyframe::create(0, 0.3f, nullptr)); | 795 curve->addKeyframe(CCFloatKeyframe::create(0, 0.3f, scoped_ptr<CCTimingFunct
ion>())); |
| 796 curve->addKeyframe(CCFloatKeyframe::create(1, 0.7f, nullptr)); | 796 curve->addKeyframe(CCFloatKeyframe::create(1, 0.7f, scoped_ptr<CCTimingFunct
ion>())); |
| 797 OwnPtr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.release(
), 0, 0, CCActiveAnimation::Opacity)); | 797 scoped_ptr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.Pass
As<CCAnimationCurve>(), 0, 0, CCActiveAnimation::Opacity)); |
| 798 | 798 |
| 799 return layer->addAnimation(animation.release()); | 799 return layer->addAnimation(animation.Pass()); |
| 800 } | 800 } |
| 801 | 801 |
| 802 TEST(LayerChromiumLayerTreeHostTest, shouldNotAddAnimationWithoutLayerTreeHost) | 802 TEST(LayerChromiumLayerTreeHostTest, shouldNotAddAnimationWithoutLayerTreeHost) |
| 803 { | 803 { |
| 804 // Currently, WebCore assumes that animations will be started immediately /
very soon | 804 // Currently, WebCore assumes that animations will be started immediately /
very soon |
| 805 // if a composited layer's addAnimation() returns true. However, without a l
ayerTreeHost, | 805 // if a composited layer's addAnimation() returns true. However, without a l
ayerTreeHost, |
| 806 // layers cannot actually animate yet. So, to prevent violating this WebCore
assumption, | 806 // layers cannot actually animate yet. So, to prevent violating this WebCore
assumption, |
| 807 // the animation should not be accepted if the layer doesn't already have a
layerTreeHost. | 807 // the animation should not be accepted if the layer doesn't already have a
layerTreeHost. |
| 808 | 808 |
| 809 WebKit::Platform::current()->compositorSupport()->setAcceleratedAnimationEna
bled(true); | 809 WebKit::Platform::current()->compositorSupport()->setAcceleratedAnimationEna
bled(true); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 838 scoped_refptr<MockLayerChromium> layer(new MockLayerChromium); | 838 scoped_refptr<MockLayerChromium> layer(new MockLayerChromium); |
| 839 EXPECT_FALSE(layer->needsDisplay()); | 839 EXPECT_FALSE(layer->needsDisplay()); |
| 840 layer->setBounds(IntSize(0, 10)); | 840 layer->setBounds(IntSize(0, 10)); |
| 841 EXPECT_FALSE(layer->needsDisplay()); | 841 EXPECT_FALSE(layer->needsDisplay()); |
| 842 layer->setBounds(IntSize(10, 10)); | 842 layer->setBounds(IntSize(10, 10)); |
| 843 EXPECT_TRUE(layer->needsDisplay()); | 843 EXPECT_TRUE(layer->needsDisplay()); |
| 844 } | 844 } |
| 845 | 845 |
| 846 | 846 |
| 847 } // namespace | 847 } // namespace |
| OLD | NEW |