OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 11 matching lines...) Expand all Loading... |
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 */ | 23 */ |
24 | 24 |
25 #include "platform/graphics/GraphicsLayer.h" | 25 #include "platform/graphics/GraphicsLayer.h" |
26 | 26 |
27 #include "platform/RuntimeEnabledFeatures.h" | 27 #include "platform/RuntimeEnabledFeatures.h" |
28 #include "platform/animation/CompositorAnimationPlayer.h" | 28 #include "platform/animation/CompositorAnimationPlayer.h" |
29 #include "platform/animation/CompositorAnimationPlayerClient.h" | 29 #include "platform/animation/CompositorAnimationPlayerClient.h" |
30 #include "platform/animation/CompositorAnimationTimeline.h" | 30 #include "platform/animation/CompositorAnimationTimeline.h" |
31 #include "platform/animation/CompositorFloatAnimationCurve.h" | 31 #include "platform/animation/CompositorFloatAnimationCurve.h" |
32 #include "platform/graphics/CompositorElementId.h" | |
33 #include "platform/graphics/CompositorFactory.h" | 32 #include "platform/graphics/CompositorFactory.h" |
34 #include "platform/scroll/ScrollableArea.h" | 33 #include "platform/scroll/ScrollableArea.h" |
35 #include "platform/testing/FakeGraphicsLayer.h" | 34 #include "platform/testing/FakeGraphicsLayer.h" |
36 #include "platform/testing/FakeGraphicsLayerClient.h" | 35 #include "platform/testing/FakeGraphicsLayerClient.h" |
37 #include "platform/testing/WebLayerTreeViewImplForTesting.h" | 36 #include "platform/testing/WebLayerTreeViewImplForTesting.h" |
38 #include "platform/transforms/Matrix3DTransformOperation.h" | 37 #include "platform/transforms/Matrix3DTransformOperation.h" |
39 #include "platform/transforms/RotateTransformOperation.h" | 38 #include "platform/transforms/RotateTransformOperation.h" |
40 #include "platform/transforms/TranslateTransformOperation.h" | 39 #include "platform/transforms/TranslateTransformOperation.h" |
41 #include "public/platform/Platform.h" | 40 #include "public/platform/Platform.h" |
42 #include "public/platform/WebCompositorSupport.h" | 41 #include "public/platform/WebCompositorSupport.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0.0, 0.0), CubicBezier
TimingFunction::EaseType::EASE); | 108 curve->addCubicBezierKeyframe(CompositorFloatKeyframe(0.0, 0.0), CubicBezier
TimingFunction::EaseType::EASE); |
110 OwnPtr<CompositorAnimation> floatAnimation(adoptPtr(CompositorFactory::curre
nt().createAnimation(*curve, CompositorTargetProperty::OPACITY))); | 109 OwnPtr<CompositorAnimation> floatAnimation(adoptPtr(CompositorFactory::curre
nt().createAnimation(*curve, CompositorTargetProperty::OPACITY))); |
111 int animationId = floatAnimation->id(); | 110 int animationId = floatAnimation->id(); |
112 | 111 |
113 OwnPtr<CompositorAnimationTimeline> compositorTimeline = adoptPtr(Compositor
Factory::current().createAnimationTimeline()); | 112 OwnPtr<CompositorAnimationTimeline> compositorTimeline = adoptPtr(Compositor
Factory::current().createAnimationTimeline()); |
114 AnimationPlayerForTesting player; | 113 AnimationPlayerForTesting player; |
115 | 114 |
116 layerTreeView()->attachCompositorAnimationTimeline(compositorTimeline->anima
tionTimeline()); | 115 layerTreeView()->attachCompositorAnimationTimeline(compositorTimeline->anima
tionTimeline()); |
117 compositorTimeline->playerAttached(player); | 116 compositorTimeline->playerAttached(player); |
118 | 117 |
119 m_platformLayer->setElementId(CompositorElementId(m_platformLayer->id(), 0))
; | 118 player.compositorPlayer()->attachLayer(m_platformLayer); |
120 | 119 ASSERT_TRUE(player.compositorPlayer()->isLayerAttached()); |
121 player.compositorPlayer()->attachElement(m_platformLayer->elementId()); | |
122 ASSERT_TRUE(player.compositorPlayer()->isElementAttached()); | |
123 | 120 |
124 player.compositorPlayer()->addAnimation(floatAnimation.leakPtr()); | 121 player.compositorPlayer()->addAnimation(floatAnimation.leakPtr()); |
125 | 122 |
126 ASSERT_TRUE(m_platformLayer->hasActiveAnimationForTesting()); | 123 ASSERT_TRUE(m_platformLayer->hasActiveAnimationForTesting()); |
127 | 124 |
128 m_graphicsLayer->setShouldFlattenTransform(false); | 125 m_graphicsLayer->setShouldFlattenTransform(false); |
129 | 126 |
130 m_platformLayer = m_graphicsLayer->platformLayer(); | 127 m_platformLayer = m_graphicsLayer->platformLayer(); |
131 ASSERT_TRUE(m_platformLayer); | 128 ASSERT_TRUE(m_platformLayer); |
132 | 129 |
133 ASSERT_TRUE(m_platformLayer->hasActiveAnimationForTesting()); | 130 ASSERT_TRUE(m_platformLayer->hasActiveAnimationForTesting()); |
134 player.compositorPlayer()->removeAnimation(animationId); | 131 player.compositorPlayer()->removeAnimation(animationId); |
135 ASSERT_FALSE(m_platformLayer->hasActiveAnimationForTesting()); | 132 ASSERT_FALSE(m_platformLayer->hasActiveAnimationForTesting()); |
136 | 133 |
137 m_graphicsLayer->setShouldFlattenTransform(true); | 134 m_graphicsLayer->setShouldFlattenTransform(true); |
138 | 135 |
139 m_platformLayer = m_graphicsLayer->platformLayer(); | 136 m_platformLayer = m_graphicsLayer->platformLayer(); |
140 ASSERT_TRUE(m_platformLayer); | 137 ASSERT_TRUE(m_platformLayer); |
141 | 138 |
142 ASSERT_FALSE(m_platformLayer->hasActiveAnimationForTesting()); | 139 ASSERT_FALSE(m_platformLayer->hasActiveAnimationForTesting()); |
143 | 140 |
144 player.compositorPlayer()->detachElement(); | 141 player.compositorPlayer()->detachLayer(); |
145 ASSERT_FALSE(player.compositorPlayer()->isElementAttached()); | 142 ASSERT_FALSE(player.compositorPlayer()->isLayerAttached()); |
146 | 143 |
147 compositorTimeline->playerDestroyed(player); | 144 compositorTimeline->playerDestroyed(player); |
148 layerTreeView()->detachCompositorAnimationTimeline(compositorTimeline->anima
tionTimeline()); | 145 layerTreeView()->detachCompositorAnimationTimeline(compositorTimeline->anima
tionTimeline()); |
149 } | 146 } |
150 | 147 |
151 class FakeScrollableArea : public GarbageCollectedFinalized<FakeScrollableArea>,
public ScrollableArea { | 148 class FakeScrollableArea : public GarbageCollectedFinalized<FakeScrollableArea>,
public ScrollableArea { |
152 USING_GARBAGE_COLLECTED_MIXIN(FakeScrollableArea); | 149 USING_GARBAGE_COLLECTED_MIXIN(FakeScrollableArea); |
153 public: | 150 public: |
154 static FakeScrollableArea* create() | 151 static FakeScrollableArea* create() |
155 { | 152 { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 193 |
197 WebDoublePoint scrollPosition(7, 9); | 194 WebDoublePoint scrollPosition(7, 9); |
198 m_platformLayer->setScrollPositionDouble(scrollPosition); | 195 m_platformLayer->setScrollPositionDouble(scrollPosition); |
199 m_graphicsLayer->didScroll(); | 196 m_graphicsLayer->didScroll(); |
200 | 197 |
201 EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea->scrollPositionDouble().x()
); | 198 EXPECT_FLOAT_EQ(scrollPosition.x, scrollableArea->scrollPositionDouble().x()
); |
202 EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea->scrollPositionDouble().y()
); | 199 EXPECT_FLOAT_EQ(scrollPosition.y, scrollableArea->scrollPositionDouble().y()
); |
203 } | 200 } |
204 | 201 |
205 } // namespace blink | 202 } // namespace blink |
OLD | NEW |