| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/PaintPropertyTreeBuilderTest.h" | 5 #include "core/paint/PaintPropertyTreeBuilderTest.h" |
| 6 | 6 |
| 7 #include "core/html/HTMLIFrameElement.h" | 7 #include "core/html/HTMLIFrameElement.h" |
| 8 #include "core/layout/LayoutTreeAsText.h" | 8 #include "core/layout/LayoutTreeAsText.h" |
| 9 #include "core/paint/ObjectPaintProperties.h" | 9 #include "core/paint/ObjectPaintProperties.h" |
| 10 #include "core/paint/PaintPropertyTreePrinter.h" | 10 #include "core/paint/PaintPropertyTreePrinter.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 } | 395 } |
| 396 | 396 |
| 397 TEST_P(PaintPropertyTreeBuilderTest, | 397 TEST_P(PaintPropertyTreeBuilderTest, |
| 398 TransformNodeWithActiveAnimationHasDirectCompositingReason) { | 398 TransformNodeWithActiveAnimationHasDirectCompositingReason) { |
| 399 setBodyInnerHTML( | 399 setBodyInnerHTML( |
| 400 "<style>" | 400 "<style>" |
| 401 "@keyframes test {" | 401 "@keyframes test {" |
| 402 " 0% { transform: translate(1em, 1em) } " | 402 " 0% { transform: translate(1em, 1em) } " |
| 403 " 100% { transform: translate(2em, 2em) } " | 403 " 100% { transform: translate(2em, 2em) } " |
| 404 "} " | 404 "} " |
| 405 ".animate { " |
| 406 " animation-name: test; " |
| 407 " animation-duration: 1s " |
| 408 "}" |
| 405 "</style>" | 409 "</style>" |
| 406 "<div id='transform'" | 410 "<div id='target' class='animate'></div>"); |
| 407 " style='animation-name: test; animation-duration: 1s'>" | 411 Element* target = document().getElementById("target"); |
| 408 "</div>"); | 412 const ObjectPaintProperties* properties = |
| 413 target->layoutObject()->paintProperties(); |
| 414 EXPECT_TRUE(properties->transform()->hasDirectCompositingReasons()); |
| 415 } |
| 409 | 416 |
| 410 Element* transform = document().getElementById("transform"); | 417 TEST_P(PaintPropertyTreeBuilderTest, |
| 411 const ObjectPaintProperties* transformProperties = | 418 OpacityAnimationDoesNotCreateTransformNode) { |
| 412 transform->layoutObject()->paintProperties(); | 419 setBodyInnerHTML( |
| 413 EXPECT_TRUE(transformProperties->transform()->hasDirectCompositingReasons()); | 420 "<style>" |
| 421 "div {" |
| 422 " width: 100px;" |
| 423 " height: 100px;" |
| 424 " background-color: red;" |
| 425 " animation-name: example;" |
| 426 " animation-duration: 4s;" |
| 427 "}" |
| 428 "@keyframes example {" |
| 429 " from { opacity: 0.0;}" |
| 430 " to { opacity: 1.0;}" |
| 431 "}" |
| 432 "</style>" |
| 433 "<div id='target'></div>"); |
| 434 |
| 435 Element* target = document().getElementById("target"); |
| 436 const ObjectPaintProperties* properties = |
| 437 target->layoutObject()->paintProperties(); |
| 438 EXPECT_EQ(nullptr, properties->transform()); |
| 414 } | 439 } |
| 415 | 440 |
| 416 TEST_P(PaintPropertyTreeBuilderTest, WillChangeTransform) { | 441 TEST_P(PaintPropertyTreeBuilderTest, WillChangeTransform) { |
| 417 setBodyInnerHTML( | 442 setBodyInnerHTML( |
| 418 "<style> body { margin: 0 } </style>" | 443 "<style> body { margin: 0 } </style>" |
| 419 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" | 444 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" |
| 420 " width: 400px; height: 300px;" | 445 " width: 400px; height: 300px;" |
| 421 " will-change: transform'>" | 446 " will-change: transform'>" |
| 422 "</div>"); | 447 "</div>"); |
| 423 | 448 |
| (...skipping 2616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3040 EXPECT_EQ(framePreTranslation(), | 3065 EXPECT_EQ(framePreTranslation(), |
| 3041 childProperties->paintOffsetTranslation()->parent()); | 3066 childProperties->paintOffsetTranslation()->parent()); |
| 3042 EXPECT_EQ(childProperties->paintOffsetTranslation(), | 3067 EXPECT_EQ(childProperties->paintOffsetTranslation(), |
| 3043 childPaintState.transform()); | 3068 childPaintState.transform()); |
| 3044 // This will change once we added clip expansion node. | 3069 // This will change once we added clip expansion node. |
| 3045 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); | 3070 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); |
| 3046 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); | 3071 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); |
| 3047 } | 3072 } |
| 3048 | 3073 |
| 3049 } // namespace blink | 3074 } // namespace blink |
| OLD | NEW |