Chromium Code Reviews| 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) { |