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 24 matching lines...) Expand all Loading... | |
35 #include "core/animation/AnimationTimeline.h" | 35 #include "core/animation/AnimationTimeline.h" |
36 #include "core/animation/CompositorAnimationsImpl.h" | 36 #include "core/animation/CompositorAnimationsImpl.h" |
37 #include "core/animation/CompositorAnimationsTestHelper.h" | 37 #include "core/animation/CompositorAnimationsTestHelper.h" |
38 #include "core/animation/ElementAnimations.h" | 38 #include "core/animation/ElementAnimations.h" |
39 #include "core/animation/KeyframeEffect.h" | 39 #include "core/animation/KeyframeEffect.h" |
40 #include "core/animation/animatable/AnimatableDouble.h" | 40 #include "core/animation/animatable/AnimatableDouble.h" |
41 #include "core/animation/animatable/AnimatableFilterOperations.h" | 41 #include "core/animation/animatable/AnimatableFilterOperations.h" |
42 #include "core/animation/animatable/AnimatableTransform.h" | 42 #include "core/animation/animatable/AnimatableTransform.h" |
43 #include "core/animation/animatable/AnimatableValueTestHelper.h" | 43 #include "core/animation/animatable/AnimatableValueTestHelper.h" |
44 #include "core/dom/Document.h" | 44 #include "core/dom/Document.h" |
45 #include "core/layout/LayoutBox.h" | |
45 #include "core/layout/LayoutObject.h" | 46 #include "core/layout/LayoutObject.h" |
47 #include "core/loader/EmptyClients.h" | |
48 #include "core/paint/PaintLayer.h" | |
46 #include "core/testing/DummyPageHolder.h" | 49 #include "core/testing/DummyPageHolder.h" |
47 #include "platform/geometry/FloatBox.h" | 50 #include "platform/geometry/FloatBox.h" |
48 #include "platform/geometry/IntSize.h" | 51 #include "platform/geometry/IntSize.h" |
49 #include "platform/graphics/filters/FilterOperations.h" | 52 #include "platform/graphics/filters/FilterOperations.h" |
53 #include "platform/graphics/paint/PaintArtifact.h" | |
54 #include "platform/graphics/test/FakeGraphicsLayerFactory.h" | |
50 #include "platform/transforms/TransformOperations.h" | 55 #include "platform/transforms/TransformOperations.h" |
51 #include "platform/transforms/TranslateTransformOperation.h" | 56 #include "platform/transforms/TranslateTransformOperation.h" |
52 #include "public/platform/WebCompositorAnimation.h" | 57 #include "public/platform/WebCompositorAnimation.h" |
53 #include "testing/gmock/include/gmock/gmock.h" | 58 #include "testing/gmock/include/gmock/gmock.h" |
54 #include "testing/gtest/include/gtest/gtest.h" | 59 #include "testing/gtest/include/gtest/gtest.h" |
55 #include "wtf/HashFunctions.h" | 60 #include "wtf/HashFunctions.h" |
56 #include "wtf/OwnPtr.h" | 61 #include "wtf/OwnPtr.h" |
57 #include "wtf/PassOwnPtr.h" | 62 #include "wtf/PassOwnPtr.h" |
58 #include "wtf/PassRefPtr.h" | 63 #include "wtf/PassRefPtr.h" |
59 #include "wtf/RefPtr.h" | 64 #include "wtf/RefPtr.h" |
60 | 65 |
61 namespace blink { | 66 namespace blink { |
62 | 67 |
63 using ::testing::ExpectationSet; | 68 using ::testing::ExpectationSet; |
64 using ::testing::Ref; | 69 using ::testing::Ref; |
65 using ::testing::Return; | 70 using ::testing::Return; |
66 using ::testing::_; | 71 using ::testing::_; |
67 | 72 |
73 class MockChromeClient : public EmptyChromeClient { | |
74 public: | |
75 MockChromeClient() {} | |
76 GraphicsLayerFactory* graphicsLayerFactory() const override | |
77 { | |
78 return FakeGraphicsLayerFactory::instance(); | |
79 } | |
80 }; | |
81 | |
68 class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTe stBase { | 82 class AnimationCompositorAnimationsTest : public AnimationCompositorAnimationsTe stBase { |
69 protected: | 83 protected: |
70 RefPtr<TimingFunction> m_linearTimingFunction; | 84 RefPtr<TimingFunction> m_linearTimingFunction; |
71 RefPtr<TimingFunction> m_cubicEaseTimingFunction; | 85 RefPtr<TimingFunction> m_cubicEaseTimingFunction; |
72 RefPtr<TimingFunction> m_cubicCustomTimingFunction; | 86 RefPtr<TimingFunction> m_cubicCustomTimingFunction; |
73 RefPtr<TimingFunction> m_stepTimingFunction; | 87 RefPtr<TimingFunction> m_stepTimingFunction; |
74 | 88 |
75 Timing m_timing; | 89 Timing m_timing; |
76 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; | 90 CompositorAnimationsImpl::CompositorTiming m_compositorTiming; |
77 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector2; | 91 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector2; |
78 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2; | 92 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect2; |
79 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector5; | 93 OwnPtr<AnimatableValueKeyframeVector> m_keyframeVector5; |
80 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5; | 94 Persistent<AnimatableValueKeyframeEffectModel> m_keyframeAnimationEffect5; |
81 | 95 |
82 RefPtrWillBePersistent<Document> m_document; | 96 RefPtrWillBePersistent<Document> m_document; |
83 RefPtrWillBePersistent<Element> m_element; | 97 RefPtrWillBePersistent<Element> m_element; |
84 Persistent<AnimationTimeline> m_timeline; | 98 Persistent<AnimationTimeline> m_timeline; |
99 OwnPtrWillBePersistent<MockChromeClient> m_chromeClient; | |
85 OwnPtr<DummyPageHolder> m_pageHolder; | 100 OwnPtr<DummyPageHolder> m_pageHolder; |
86 WebCompositorSupportMock m_mockCompositor; | 101 WebCompositorSupportMock m_mockCompositor; |
87 | 102 |
88 virtual void SetUp() | 103 virtual void SetUp() |
89 { | 104 { |
105 m_chromeClient = adoptPtrWillBeNoop(new MockChromeClient); | |
106 | |
90 AnimationCompositorAnimationsTestBase::SetUp(); | 107 AnimationCompositorAnimationsTestBase::SetUp(); |
91 setCompositorForTesting(m_mockCompositor); | 108 setCompositorForTesting(m_mockCompositor); |
92 | 109 |
93 m_linearTimingFunction = LinearTimingFunction::shared(); | 110 m_linearTimingFunction = LinearTimingFunction::shared(); |
94 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::Ease); | 111 m_cubicEaseTimingFunction = CubicBezierTimingFunction::preset(CubicBezie rTimingFunction::Ease); |
95 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3, 4); | 112 m_cubicCustomTimingFunction = CubicBezierTimingFunction::create(1, 2, 3, 4); |
96 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio n::End); | 113 m_stepTimingFunction = StepsTimingFunction::create(1, StepsTimingFunctio n::End); |
97 | 114 |
98 m_timing = createCompositableTiming(); | 115 m_timing = createCompositableTiming(); |
99 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming(); | 116 m_compositorTiming = CompositorAnimationsImpl::CompositorTiming(); |
100 // Make sure the CompositableTiming is really compositable, otherwise | 117 // Make sure the CompositableTiming is really compositable, otherwise |
101 // most other tests will fail. | 118 // most other tests will fail. |
102 ASSERT(convertTimingForCompositor(m_timing, m_compositorTiming)); | 119 ASSERT(convertTimingForCompositor(m_timing, m_compositorTiming)); |
103 | 120 |
104 m_keyframeVector2 = createCompositableFloatKeyframeVector(2); | 121 m_keyframeVector2 = createCompositableFloatKeyframeVector(2); |
105 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector2); | 122 m_keyframeAnimationEffect2 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector2); |
106 | 123 |
107 m_keyframeVector5 = createCompositableFloatKeyframeVector(5); | 124 m_keyframeVector5 = createCompositableFloatKeyframeVector(5); |
108 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector5); | 125 m_keyframeAnimationEffect5 = AnimatableValueKeyframeEffectModel::create( *m_keyframeVector5); |
109 | 126 |
110 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) { | 127 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) { |
111 EXPECT_CALL(m_mockCompositor, createAnimationTimeline()) | 128 EXPECT_CALL(m_mockCompositor, createAnimationTimeline()) |
112 .WillOnce(Return(new WebCompositorAnimationTimelineMock())); | 129 .WillOnce(Return(new WebCompositorAnimationTimelineMock())); |
113 } | 130 } |
114 m_pageHolder = DummyPageHolder::create(); | 131 |
132 Page::PageClients clients; | |
133 fillWithEmptyClients(clients); | |
134 clients.chromeClient = m_chromeClient.get(); | |
135 m_pageHolder = DummyPageHolder::create(IntSize(), &clients); | |
136 | |
115 m_document = &m_pageHolder->document(); | 137 m_document = &m_pageHolder->document(); |
116 m_document->animationClock().resetTimeForTesting(); | 138 m_document->animationClock().resetTimeForTesting(); |
117 | 139 |
118 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) { | 140 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) { |
119 EXPECT_CALL(m_mockCompositor, createAnimationTimeline()) | 141 EXPECT_CALL(m_mockCompositor, createAnimationTimeline()) |
120 .WillOnce(Return(new WebCompositorAnimationTimelineMock())); | 142 .WillOnce(Return(new WebCompositorAnimationTimelineMock())); |
121 } | 143 } |
122 m_timeline = AnimationTimeline::create(m_document.get()); | 144 m_timeline = AnimationTimeline::create(m_document.get()); |
123 m_timeline->resetForTesting(); | 145 m_timeline->resetForTesting(); |
124 m_element = m_document->createElement("test", ASSERT_NO_EXCEPTION); | 146 m_element = m_document->createElement("test", ASSERT_NO_EXCEPTION); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 } | 279 } |
258 return nullptr; | 280 return nullptr; |
259 } | 281 } |
260 | 282 |
261 void simulateFrame(double time) | 283 void simulateFrame(double time) |
262 { | 284 { |
263 m_document->animationClock().updateTime(time); | 285 m_document->animationClock().updateTime(time); |
264 m_document->compositorPendingAnimations().update(false); | 286 m_document->compositorPendingAnimations().update(false); |
265 m_timeline->serviceAnimations(TimingUpdateForAnimationFrame); | 287 m_timeline->serviceAnimations(TimingUpdateForAnimationFrame); |
266 } | 288 } |
289 | |
290 void preCommit(Animation* animation) | |
291 { | |
292 WebFloatAnimationCurveMock* mockCurvePtr = new WebFloatAnimationCurveMoc k; | |
293 ExpectationSet usesMockCurve; | |
294 EXPECT_CALL(m_mockCompositor, createFloatAnimationCurve()) | |
295 .WillOnce(Return(mockCurvePtr)); | |
296 | |
297 WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimatio nMock(WebCompositorAnimation::TargetPropertyOpacity); | |
298 EXPECT_CALL(m_mockCompositor, createAnimation(Ref(*mockCurvePtr), WebCom positorAnimation::TargetPropertyOpacity, _, _)) | |
299 .WillOnce(Return(mockAnimationPtr)); | |
300 | |
301 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) { | |
302 EXPECT_TRUE(m_timeline->compositorTimeline()); | |
303 EXPECT_CALL(m_mockCompositor, createAnimationPlayer()) | |
304 .WillOnce(Return(new WebCompositorAnimationPlayerMock())); | |
305 } | |
306 | |
307 const int compositorGroup = 1; | |
308 DisableCompositingQueryAsserts disabler; | |
309 EXPECT_TRUE(animation->preCommit(compositorGroup, true)); | |
310 | |
311 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) | |
312 EXPECT_TRUE(animation->compositorPlayer()); | |
313 | |
314 EXPECT_TRUE(animation->hasActiveAnimationsOnCompositor()); | |
315 } | |
267 }; | 316 }; |
268 | 317 |
269 class LayoutObjectProxy : public LayoutObject { | 318 class LayoutObjectProxy : public LayoutBox { |
270 public: | 319 public: |
271 static LayoutObjectProxy* create(Node* node) | 320 static LayoutObjectProxy* create(ContainerNode* node) |
272 { | 321 { |
273 return new LayoutObjectProxy(node); | 322 return new LayoutObjectProxy(node); |
274 } | 323 } |
275 | 324 |
276 static void dispose(LayoutObjectProxy* proxy) | 325 static void dispose(LayoutObjectProxy* proxy) |
277 { | 326 { |
278 proxy->destroy(); | 327 proxy->destroy(); |
279 } | 328 } |
280 | 329 |
281 const char* name() const override { return nullptr; } | 330 const char* name() const override { return nullptr; } |
282 void layout() override { } | 331 |
332 void createCompositedLayer() | |
333 { | |
334 RefPtr<ComputedStyle> computedStyle = ComputedStyle::create(); | |
335 styleWillChange(StyleDifference(), *computedStyle.get()); | |
336 setStyle(computedStyle); | |
337 styleDidChange(StyleDifference(), nullptr); | |
338 | |
339 DisableCompositingQueryAsserts disabler; | |
340 layer()->ensureCompositedLayerMapping(); | |
341 } | |
283 | 342 |
284 private: | 343 private: |
285 explicit LayoutObjectProxy(Node* node) | 344 explicit LayoutObjectProxy(ContainerNode* node) |
286 : LayoutObject(node) | 345 : LayoutBox(node) |
287 { | 346 { |
288 } | 347 } |
348 | |
349 PaintLayerType layerTypeRequired() const override | |
350 { | |
351 return NormalPaintLayer; | |
352 } | |
289 }; | 353 }; |
290 | 354 |
291 // ----------------------------------------------------------------------- | 355 // ----------------------------------------------------------------------- |
292 // ----------------------------------------------------------------------- | 356 // ----------------------------------------------------------------------- |
293 | 357 |
294 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey frameMultipleCSSProperties) | 358 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey frameMultipleCSSProperties) |
295 { | 359 { |
296 RefPtr<AnimatableValueKeyframe> keyframeGoodMultiple = createDefaultKeyframe (CSSPropertyOpacity, EffectModel::CompositeReplace); | 360 RefPtr<AnimatableValueKeyframe> keyframeGoodMultiple = createDefaultKeyframe (CSSPropertyOpacity, EffectModel::CompositeReplace); |
297 keyframeGoodMultiple->setPropertyValue(CSSPropertyTransform, AnimatableTrans form::create(TransformOperations(), 1).get()); | 361 keyframeGoodMultiple->setPropertyValue(CSSPropertyTransform, AnimatableTrans form::create(TransformOperations(), 1).get()); |
298 EXPECT_TRUE(duplicateSingleKeyframeAndTestIsCandidateOnResult(keyframeGoodMu ltiple.get())); | 362 EXPECT_TRUE(duplicateSingleKeyframeAndTestIsCandidateOnResult(keyframeGoodMu ltiple.get())); |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1168 .Times(1) | 1232 .Times(1) |
1169 .After(usesMockCurve); | 1233 .After(usesMockCurve); |
1170 | 1234 |
1171 // Go! | 1235 // Go! |
1172 Vector<OwnPtr<WebCompositorAnimation>> result; | 1236 Vector<OwnPtr<WebCompositorAnimation>> result; |
1173 getAnimationOnCompositor(m_timing, *effect, result); | 1237 getAnimationOnCompositor(m_timing, *effect, result); |
1174 EXPECT_EQ(1U, result.size()); | 1238 EXPECT_EQ(1U, result.size()); |
1175 result[0].clear(); | 1239 result[0].clear(); |
1176 } | 1240 } |
1177 | 1241 |
1242 TEST_F(AnimationCompositorAnimationsTest, CancelCompositorAnimationIfAnimationDi sposed) | |
1243 { | |
1244 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION); | |
1245 | |
1246 LayoutObjectProxy* layoutObject = LayoutObjectProxy::create(element.get()); | |
1247 element->setLayoutObject(layoutObject); | |
1248 layoutObject->createCompositedLayer(); | |
1249 | |
1250 AnimatableValueKeyframeVector keyFrames; | |
1251 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 0.0).get()); | |
1252 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 1.0).get()); | |
1253 EffectModel* animationEffect = AnimatableValueKeyframeEffectModel::create(ke yFrames); | |
1254 | |
1255 Timing timing; | |
1256 timing.iterationDuration = 1.f; | |
1257 | |
1258 KeyframeEffect* keyframeEffect = KeyframeEffect::create(element.get(), anima tionEffect, timing); | |
1259 Animation* animation = m_timeline->play(keyframeEffect); | |
1260 EXPECT_TRUE(animation->isCandidateForAnimationOnCompositor()); | |
1261 | |
1262 preCommit(animation); | |
1263 | |
1264 animation->dispose(); | |
1265 animation->cancelAnimationOnCompositor(); | |
Ian Vollick
2015/12/29 20:32:24
I may be misreading the purpose of this test -- it
loyso (OOO)
2015/12/29 23:54:25
That was just my assumption about the crash (ideas
| |
1266 | |
1267 EXPECT_FALSE(animation->hasActiveAnimationsOnCompositor()); | |
1268 | |
1269 simulateFrame(0); | |
1270 EXPECT_EQ(1U, element->elementAnimations()->animations().size()); | |
1271 simulateFrame(1.); | |
1272 | |
1273 element->setLayoutObject(nullptr); | |
1274 LayoutObjectProxy::dispose(layoutObject); | |
1275 | |
1276 Heap::collectAllGarbage(); | |
1277 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); | |
1278 } | |
1279 | |
1178 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations ) | 1280 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations ) |
1179 { | 1281 { |
1180 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION); | 1282 RefPtrWillBePersistent<Element> element = m_document->createElement("shared" , ASSERT_NO_EXCEPTION); |
1181 | 1283 |
1182 LayoutObjectProxy* layoutObject = LayoutObjectProxy::create(element.get()); | 1284 LayoutObjectProxy* layoutObject = LayoutObjectProxy::create(element.get()); |
1183 element->setLayoutObject(layoutObject); | 1285 element->setLayoutObject(layoutObject); |
1286 layoutObject->createCompositedLayer(); | |
1184 | 1287 |
1185 AnimatableValueKeyframeVector keyFrames; | 1288 AnimatableValueKeyframeVector keyFrames; |
1186 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 0.0).get()); | 1289 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 0.0).get()); |
1187 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 1.0).get()); | 1290 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, EffectModel::Comp ositeReplace, 1.0).get()); |
1188 EffectModel* animationEffect1 = AnimatableValueKeyframeEffectModel::create(k eyFrames); | 1291 EffectModel* animationEffect1 = AnimatableValueKeyframeEffectModel::create(k eyFrames); |
1189 EffectModel* animationEffect2 = AnimatableValueKeyframeEffectModel::create(k eyFrames); | 1292 EffectModel* animationEffect2 = AnimatableValueKeyframeEffectModel::create(k eyFrames); |
1190 | 1293 |
1191 Timing timing; | 1294 Timing timing; |
1192 timing.iterationDuration = 1.f; | 1295 timing.iterationDuration = 1.f; |
1193 | 1296 |
1194 // The first animation for opacity is ok to run on compositor. | 1297 // The first animation for opacity is ok to run on compositor. |
1195 KeyframeEffect* keyframeEffect1 = KeyframeEffect::create(element.get(), anim ationEffect1, timing); | 1298 KeyframeEffect* keyframeEffect1 = KeyframeEffect::create(element.get(), anim ationEffect1, timing); |
1196 Animation* animation1 = m_timeline->play(keyframeEffect1); | 1299 Animation* animation1 = m_timeline->play(keyframeEffect1); |
1197 EXPECT_TRUE(CompositorAnimations::instance()->isCandidateForAnimationOnCompo sitor(timing, *element.get(), animation1, *animationEffect1, 1)); | 1300 EXPECT_TRUE(animation1->isCandidateForAnimationOnCompositor()); |
1198 | 1301 |
1199 // simulate KeyframeEffect::maybeStartAnimationOnCompositor | 1302 preCommit(animation1); |
1200 Vector<int> compositorAnimationIds; | |
1201 compositorAnimationIds.append(1); | |
1202 keyframeEffect1->setCompositorAnimationIdsForTesting(compositorAnimationIds) ; | |
1203 EXPECT_TRUE(animation1->hasActiveAnimationsOnCompositor()); | |
1204 | 1303 |
1205 // The second animation for opacity is not ok to run on compositor. | 1304 // The second animation for opacity is not ok to run on compositor. |
1206 KeyframeEffect* keyframeEffect2 = KeyframeEffect::create(element.get(), anim ationEffect2, timing); | 1305 KeyframeEffect* keyframeEffect2 = KeyframeEffect::create(element.get(), anim ationEffect2, timing); |
1207 Animation* animation2 = m_timeline->play(keyframeEffect2); | 1306 Animation* animation2 = m_timeline->play(keyframeEffect2); |
1208 EXPECT_FALSE(CompositorAnimations::instance()->isCandidateForAnimationOnComp ositor(timing, *element.get(), animation2, *animationEffect2, 1)); | 1307 EXPECT_FALSE(CompositorAnimations::instance()->isCandidateForAnimationOnComp ositor(timing, *element.get(), animation2, *animationEffect2, 1)); |
1308 EXPECT_FALSE(animation2->isCandidateForAnimationOnCompositor()); | |
1209 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor()); | 1309 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor()); |
1210 | 1310 |
1211 // A fallback to blink implementation needed, so cancel all compositor-side opacity animations for this element. | 1311 // A fallback to blink implementation needed, so cancel all compositor-side opacity animations for this element. |
1212 animation2->cancelIncompatibleAnimationsOnCompositor(); | 1312 animation2->cancelIncompatibleAnimationsOnCompositor(); |
1213 | 1313 |
1214 EXPECT_FALSE(animation1->hasActiveAnimationsOnCompositor()); | 1314 EXPECT_FALSE(animation1->hasActiveAnimationsOnCompositor()); |
1215 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor()); | 1315 EXPECT_FALSE(animation2->hasActiveAnimationsOnCompositor()); |
1216 | 1316 |
1217 simulateFrame(0); | 1317 simulateFrame(0); |
1218 EXPECT_EQ(2U, element->elementAnimations()->animations().size()); | 1318 EXPECT_EQ(2U, element->elementAnimations()->animations().size()); |
1219 simulateFrame(1.); | 1319 simulateFrame(1.); |
1220 | 1320 |
1221 element->setLayoutObject(nullptr); | 1321 element->setLayoutObject(nullptr); |
1222 LayoutObjectProxy::dispose(layoutObject); | 1322 LayoutObjectProxy::dispose(layoutObject); |
1223 | 1323 |
1224 Heap::collectAllGarbage(); | 1324 Heap::collectAllGarbage(); |
1225 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); | 1325 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); |
1226 } | 1326 } |
1227 | 1327 |
1228 } // namespace blink | 1328 } // namespace blink |
OLD | NEW |