Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp

Issue 2578343002: Support compositing for active animations in SPv2. (Closed)
Patch Set: setNeedsPaintPropertyUpdate on PaintLayer::styleDidChange. Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 23 matching lines...) Expand all
34 #include "core/animation/AnimationTimeline.h" 34 #include "core/animation/AnimationTimeline.h"
35 #include "core/animation/CompositorPendingAnimations.h" 35 #include "core/animation/CompositorPendingAnimations.h"
36 #include "core/animation/ElementAnimations.h" 36 #include "core/animation/ElementAnimations.h"
37 #include "core/animation/KeyframeEffect.h" 37 #include "core/animation/KeyframeEffect.h"
38 #include "core/animation/animatable/AnimatableDouble.h" 38 #include "core/animation/animatable/AnimatableDouble.h"
39 #include "core/animation/animatable/AnimatableFilterOperations.h" 39 #include "core/animation/animatable/AnimatableFilterOperations.h"
40 #include "core/animation/animatable/AnimatableTransform.h" 40 #include "core/animation/animatable/AnimatableTransform.h"
41 #include "core/animation/animatable/AnimatableValueTestHelper.h" 41 #include "core/animation/animatable/AnimatableValueTestHelper.h"
42 #include "core/dom/Document.h" 42 #include "core/dom/Document.h"
43 #include "core/layout/LayoutObject.h" 43 #include "core/layout/LayoutObject.h"
44 #include "core/paint/ObjectPaintProperties.h"
44 #include "core/style/FilterOperations.h" 45 #include "core/style/FilterOperations.h"
45 #include "core/testing/DummyPageHolder.h" 46 #include "core/testing/DummyPageHolder.h"
46 #include "platform/animation/CompositorAnimation.h" 47 #include "platform/animation/CompositorAnimation.h"
47 #include "platform/animation/CompositorFloatAnimationCurve.h" 48 #include "platform/animation/CompositorFloatAnimationCurve.h"
48 #include "platform/animation/CompositorFloatKeyframe.h" 49 #include "platform/animation/CompositorFloatKeyframe.h"
49 #include "platform/geometry/FloatBox.h" 50 #include "platform/geometry/FloatBox.h"
50 #include "platform/geometry/IntSize.h" 51 #include "platform/geometry/IntSize.h"
52 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
51 #include "platform/transforms/TransformOperations.h" 53 #include "platform/transforms/TransformOperations.h"
52 #include "platform/transforms/TranslateTransformOperation.h" 54 #include "platform/transforms/TranslateTransformOperation.h"
53 #include "testing/gtest/include/gtest/gtest.h" 55 #include "testing/gtest/include/gtest/gtest.h"
54 #include "wtf/HashFunctions.h" 56 #include "wtf/HashFunctions.h"
55 #include "wtf/PassRefPtr.h" 57 #include "wtf/PassRefPtr.h"
56 #include "wtf/PtrUtil.h" 58 #include "wtf/PtrUtil.h"
57 #include "wtf/RefPtr.h" 59 #include "wtf/RefPtr.h"
58 #include <memory> 60 #include <memory>
59 61
60 namespace blink { 62 namespace blink {
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 EXPECT_EQ(2U, element->elementAnimations()->animations().size()); 1247 EXPECT_EQ(2U, element->elementAnimations()->animations().size());
1246 simulateFrame(1.); 1248 simulateFrame(1.);
1247 1249
1248 element->setLayoutObject(nullptr); 1250 element->setLayoutObject(nullptr);
1249 LayoutObjectProxy::dispose(layoutObject); 1251 LayoutObjectProxy::dispose(layoutObject);
1250 1252
1251 ThreadState::current()->collectAllGarbage(); 1253 ThreadState::current()->collectAllGarbage();
1252 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty()); 1254 EXPECT_TRUE(element->elementAnimations()->animations().isEmpty());
1253 } 1255 }
1254 1256
1257 TEST_F(AnimationCompositorAnimationsTest,
1258 canStartAnimationOnCompositorTransformSPv2) {
1259 Persistent<Element> element = m_document->createElement("shared");
1260 LayoutObjectProxy* layoutObject = LayoutObjectProxy::create(element.get());
1261 element->setLayoutObject(layoutObject);
1262
1263 ScopedSlimmingPaintV2ForTest enableSPv2(true);
1264 auto& properties =
1265 layoutObject->getMutableForPainting().ensurePaintProperties();
1266
1267 // Add a transform with a compositing reason, which should allow starting
1268 // animation.
1269 properties.updateTransform(TransformPaintPropertyNode::root(),
1270 TransformationMatrix(), FloatPoint3D(), false, 0,
1271 CompositingReasonActiveAnimation);
1272 EXPECT_TRUE(CompositorAnimations::canStartAnimationOnCompositor(*element));
1273
1274 // Setting to CompositingReasonNone should produce false.
1275 properties.updateTransform(TransformPaintPropertyNode::root(),
1276 TransformationMatrix(), FloatPoint3D(), false, 0,
1277 CompositingReasonNone);
1278 EXPECT_FALSE(CompositorAnimations::canStartAnimationOnCompositor(*element));
1279
1280 // Clearing the transform node entirely should also produce false.
1281 properties.clearTransform();
1282 EXPECT_FALSE(CompositorAnimations::canStartAnimationOnCompositor(*element));
1283
1284 element->setLayoutObject(nullptr);
1285 LayoutObjectProxy::dispose(layoutObject);
1286 }
1287
1255 } // namespace blink 1288 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698