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

Unified Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp

Issue 2593833002: Constrain transform animation direct compositing reason to transforms. (Closed)
Patch Set: Add test. Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
index 22eb51954dd4b16b8abb28a41037359e5c256f8a..be2c3a55fdf35d85268fa1d3956dd7ac680a6332 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp
@@ -394,23 +394,68 @@ TEST_P(PaintPropertyTreeBuilderTest, Transform) {
transform->layoutObject()->paintProperties()->transform()->matrix());
}
+namespace {
+
+const char* kSimpleTransformAnimationHTML =
+ "<style>"
+ "@keyframes test {"
+ " 0% { transform: translate(1em, 1em) } "
+ " 100% { transform: translate(2em, 2em) } "
+ "} "
+ ".animate { "
+ " animation-name: test; "
+ " animation-duration: 1s "
+ "}"
+ "</style>"
+ "<div id='target' class='animate'></div>";
+
+} // namespace
+
TEST_P(PaintPropertyTreeBuilderTest,
TransformNodeWithActiveAnimationHasDirectCompositingReason) {
+ setBodyInnerHTML(kSimpleTransformAnimationHTML);
+ Element* target = document().getElementById("target");
+ const ObjectPaintProperties* properties =
+ target->layoutObject()->paintProperties();
+ EXPECT_TRUE(properties->transform()->hasDirectCompositingReasons());
+}
+
+TEST_P(PaintPropertyTreeBuilderTest,
+ TransformNodeWithAnimationLosesNodeWhenAnimationRemoved) {
pdr. 2016/12/21 19:00:06 Nit: can you move this test to PaintPropertyTreeUp
wkorman 2016/12/21 19:20:53 Done.
+ setBodyInnerHTML(kSimpleTransformAnimationHTML);
+ Element* target = document().getElementById("target");
+ const ObjectPaintProperties* properties =
+ target->layoutObject()->paintProperties();
+ EXPECT_TRUE(properties->transform()->hasDirectCompositingReasons());
+
+ // Removing the animation should remove the transform node.
+ target->removeAttribute(HTMLNames::classAttr);
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_EQ(nullptr, properties->transform());
+}
+
+TEST_P(PaintPropertyTreeBuilderTest,
+ OpacityAnimationDoesNotCreateTransformNode) {
setBodyInnerHTML(
"<style>"
- "@keyframes test {"
- " 0% { transform: translate(1em, 1em) } "
- " 100% { transform: translate(2em, 2em) } "
- "} "
+ "div {"
+ " width: 100px;"
+ " height: 100px;"
+ " background-color: red;"
+ " animation-name: example;"
+ " animation-duration: 4s;"
+ "}"
+ "@keyframes example {"
+ " from { opacity: 0.0;}"
+ " to { opacity: 1.0;}"
+ "}"
"</style>"
- "<div id='transform'"
- " style='animation-name: test; animation-duration: 1s'>"
- "</div>");
+ "<div id='target'></div>");
- Element* transform = document().getElementById("transform");
- const ObjectPaintProperties* transformProperties =
- transform->layoutObject()->paintProperties();
- EXPECT_TRUE(transformProperties->transform()->hasDirectCompositingReasons());
+ Element* target = document().getElementById("target");
+ const ObjectPaintProperties* properties =
+ target->layoutObject()->paintProperties();
+ EXPECT_EQ(nullptr, properties->transform());
}
TEST_P(PaintPropertyTreeBuilderTest, WillChangeTransform) {
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698