| 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 25 matching lines...) Expand all Loading... |
| 36 #include "core/animation/Animation.h" | 36 #include "core/animation/Animation.h" |
| 37 #include "core/animation/AnimationPlayer.h" | 37 #include "core/animation/AnimationPlayer.h" |
| 38 #include "core/animation/AnimationTimeline.h" | 38 #include "core/animation/AnimationTimeline.h" |
| 39 #include "core/animation/CompositorAnimationsImpl.h" | 39 #include "core/animation/CompositorAnimationsImpl.h" |
| 40 #include "core/animation/CompositorAnimationsTestHelper.h" | 40 #include "core/animation/CompositorAnimationsTestHelper.h" |
| 41 #include "core/animation/animatable/AnimatableDouble.h" | 41 #include "core/animation/animatable/AnimatableDouble.h" |
| 42 #include "core/animation/animatable/AnimatableFilterOperations.h" | 42 #include "core/animation/animatable/AnimatableFilterOperations.h" |
| 43 #include "core/animation/animatable/AnimatableTransform.h" | 43 #include "core/animation/animatable/AnimatableTransform.h" |
| 44 #include "core/animation/animatable/AnimatableValueTestHelper.h" | 44 #include "core/animation/animatable/AnimatableValueTestHelper.h" |
| 45 #include "core/dom/Document.h" | 45 #include "core/dom/Document.h" |
| 46 #include "core/rendering/RenderObject.h" | 46 #include "core/layout/LayoutObject.h" |
| 47 #include "platform/geometry/FloatBox.h" | 47 #include "platform/geometry/FloatBox.h" |
| 48 #include "platform/geometry/IntSize.h" | 48 #include "platform/geometry/IntSize.h" |
| 49 #include "platform/graphics/filters/FilterOperations.h" | 49 #include "platform/graphics/filters/FilterOperations.h" |
| 50 #include "platform/transforms/TransformOperations.h" | 50 #include "platform/transforms/TransformOperations.h" |
| 51 #include "platform/transforms/TranslateTransformOperation.h" | 51 #include "platform/transforms/TranslateTransformOperation.h" |
| 52 #include "public/platform/WebCompositorAnimation.h" | 52 #include "public/platform/WebCompositorAnimation.h" |
| 53 #include "wtf/HashFunctions.h" | 53 #include "wtf/HashFunctions.h" |
| 54 #include "wtf/OwnPtr.h" | 54 #include "wtf/OwnPtr.h" |
| 55 #include "wtf/PassOwnPtr.h" | 55 #include "wtf/PassOwnPtr.h" |
| 56 #include "wtf/PassRefPtr.h" | 56 #include "wtf/PassRefPtr.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 } | 247 } |
| 248 | 248 |
| 249 void simulateFrame(double time) | 249 void simulateFrame(double time) |
| 250 { | 250 { |
| 251 m_document->animationClock().updateTime(time); | 251 m_document->animationClock().updateTime(time); |
| 252 m_document->compositorPendingAnimations().update(false); | 252 m_document->compositorPendingAnimations().update(false); |
| 253 m_timeline->serviceAnimations(TimingUpdateForAnimationFrame); | 253 m_timeline->serviceAnimations(TimingUpdateForAnimationFrame); |
| 254 } | 254 } |
| 255 }; | 255 }; |
| 256 | 256 |
| 257 class RenderObjectProxy : public RenderObject { | 257 class LayoutObjectProxy : public LayoutObject { |
| 258 public: | 258 public: |
| 259 static RenderObjectProxy* create(Node* node) | 259 static LayoutObjectProxy* create(Node* node) |
| 260 { | 260 { |
| 261 return new RenderObjectProxy(node); | 261 return new LayoutObjectProxy(node); |
| 262 } | 262 } |
| 263 | 263 |
| 264 static void dispose(RenderObjectProxy* proxy) | 264 static void dispose(LayoutObjectProxy* proxy) |
| 265 { | 265 { |
| 266 proxy->destroy(); | 266 proxy->destroy(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 const char* renderName() const override { return nullptr; } | 269 const char* renderName() const override { return nullptr; } |
| 270 void layout() override { } | 270 void layout() override { } |
| 271 | 271 |
| 272 private: | 272 private: |
| 273 explicit RenderObjectProxy(Node* node) | 273 explicit LayoutObjectProxy(Node* node) |
| 274 : RenderObject(node) | 274 : LayoutObject(node) |
| 275 { | 275 { |
| 276 } | 276 } |
| 277 }; | 277 }; |
| 278 | 278 |
| 279 // ----------------------------------------------------------------------- | 279 // ----------------------------------------------------------------------- |
| 280 // ----------------------------------------------------------------------- | 280 // ----------------------------------------------------------------------- |
| 281 | 281 |
| 282 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameMultipleCSSProperties) | 282 TEST_F(AnimationCompositorAnimationsTest, isCandidateForAnimationOnCompositorKey
frameMultipleCSSProperties) |
| 283 { | 283 { |
| 284 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframeGoodMultiple = createDef
aultKeyframe(CSSPropertyOpacity, AnimationEffect::CompositeReplace); | 284 RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframeGoodMultiple = createDef
aultKeyframe(CSSPropertyOpacity, AnimationEffect::CompositeReplace); |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 result[0].clear(); | 1196 result[0].clear(); |
| 1197 } | 1197 } |
| 1198 | 1198 |
| 1199 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations
) | 1199 TEST_F(AnimationCompositorAnimationsTest, CancelIncompatibleCompositorAnimations
) |
| 1200 { | 1200 { |
| 1201 WebCompositorSupportMock mockCompositor; | 1201 WebCompositorSupportMock mockCompositor; |
| 1202 setCompositorForTesting(mockCompositor); | 1202 setCompositorForTesting(mockCompositor); |
| 1203 | 1203 |
| 1204 RefPtrWillBePersistent<Element> element = m_document->createElement("shared"
, ASSERT_NO_EXCEPTION); | 1204 RefPtrWillBePersistent<Element> element = m_document->createElement("shared"
, ASSERT_NO_EXCEPTION); |
| 1205 | 1205 |
| 1206 RenderObjectProxy* renderer = RenderObjectProxy::create(element.get()); | 1206 LayoutObjectProxy* renderer = LayoutObjectProxy::create(element.get()); |
| 1207 element->setRenderer(renderer); | 1207 element->setRenderer(renderer); |
| 1208 | 1208 |
| 1209 AnimatableValueKeyframeVector keyFrames; | 1209 AnimatableValueKeyframeVector keyFrames; |
| 1210 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect::
CompositeReplace, 0.0).get()); | 1210 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect::
CompositeReplace, 0.0).get()); |
| 1211 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect::
CompositeReplace, 1.0).get()); | 1211 keyFrames.append(createDefaultKeyframe(CSSPropertyOpacity, AnimationEffect::
CompositeReplace, 1.0).get()); |
| 1212 RefPtrWillBeRawPtr<AnimationEffect> animationEffect1 = AnimatableValueKeyfra
meEffectModel::create(keyFrames); | 1212 RefPtrWillBeRawPtr<AnimationEffect> animationEffect1 = AnimatableValueKeyfra
meEffectModel::create(keyFrames); |
| 1213 RefPtrWillBeRawPtr<AnimationEffect> animationEffect2 = AnimatableValueKeyfra
meEffectModel::create(keyFrames); | 1213 RefPtrWillBeRawPtr<AnimationEffect> animationEffect2 = AnimatableValueKeyfra
meEffectModel::create(keyFrames); |
| 1214 | 1214 |
| 1215 Timing timing; | 1215 Timing timing; |
| 1216 timing.iterationDuration = 1.f; | 1216 timing.iterationDuration = 1.f; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1236 player2->cancelIncompatibleAnimationsOnCompositor(); | 1236 player2->cancelIncompatibleAnimationsOnCompositor(); |
| 1237 | 1237 |
| 1238 EXPECT_FALSE(player1->hasActiveAnimationsOnCompositor()); | 1238 EXPECT_FALSE(player1->hasActiveAnimationsOnCompositor()); |
| 1239 EXPECT_FALSE(player2->hasActiveAnimationsOnCompositor()); | 1239 EXPECT_FALSE(player2->hasActiveAnimationsOnCompositor()); |
| 1240 | 1240 |
| 1241 simulateFrame(0); | 1241 simulateFrame(0); |
| 1242 EXPECT_EQ(2U, element->activeAnimations()->players().size()); | 1242 EXPECT_EQ(2U, element->activeAnimations()->players().size()); |
| 1243 simulateFrame(1.); | 1243 simulateFrame(1.); |
| 1244 | 1244 |
| 1245 element->setRenderer(nullptr); | 1245 element->setRenderer(nullptr); |
| 1246 RenderObjectProxy::dispose(renderer); | 1246 LayoutObjectProxy::dispose(renderer); |
| 1247 | 1247 |
| 1248 player1.release(); | 1248 player1.release(); |
| 1249 player2.release(); | 1249 player2.release(); |
| 1250 Heap::collectAllGarbage(); | 1250 Heap::collectAllGarbage(); |
| 1251 EXPECT_TRUE(element->activeAnimations()->players().isEmpty()); | 1251 EXPECT_TRUE(element->activeAnimations()->players().isEmpty()); |
| 1252 } | 1252 } |
| 1253 | 1253 |
| 1254 } // namespace blink | 1254 } // namespace blink |
| OLD | NEW |