| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 " animation-duration: 1s " | 407 " animation-duration: 1s " |
| 408 "}" | 408 "}" |
| 409 "</style>" | 409 "</style>" |
| 410 "<div id='target' class='animate'></div>"); | 410 "<div id='target' class='animate'></div>"); |
| 411 Element* target = document().getElementById("target"); | 411 Element* target = document().getElementById("target"); |
| 412 const ObjectPaintProperties* properties = | 412 const ObjectPaintProperties* properties = |
| 413 target->layoutObject()->paintProperties(); | 413 target->layoutObject()->paintProperties(); |
| 414 EXPECT_TRUE(properties->transform()->hasDirectCompositingReasons()); | 414 EXPECT_TRUE(properties->transform()->hasDirectCompositingReasons()); |
| 415 } | 415 } |
| 416 | 416 |
| 417 namespace { |
| 418 |
| 419 const char* kSimpleOpacityExampleHTML = |
| 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 } // namespace |
| 436 |
| 417 TEST_P(PaintPropertyTreeBuilderTest, | 437 TEST_P(PaintPropertyTreeBuilderTest, |
| 418 OpacityAnimationDoesNotCreateTransformNode) { | 438 OpacityAnimationDoesNotCreateTransformNode) { |
| 419 setBodyInnerHTML( | 439 setBodyInnerHTML(kSimpleOpacityExampleHTML); |
| 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"); | 440 Element* target = document().getElementById("target"); |
| 436 const ObjectPaintProperties* properties = | 441 const ObjectPaintProperties* properties = |
| 437 target->layoutObject()->paintProperties(); | 442 target->layoutObject()->paintProperties(); |
| 438 EXPECT_EQ(nullptr, properties->transform()); | 443 EXPECT_EQ(nullptr, properties->transform()); |
| 439 } | 444 } |
| 440 | 445 |
| 446 TEST_P(PaintPropertyTreeBuilderTest, |
| 447 EffectNodeWithActiveAnimationHasDirectCompositingReason) { |
| 448 setBodyInnerHTML(kSimpleOpacityExampleHTML); |
| 449 Element* target = document().getElementById("target"); |
| 450 const ObjectPaintProperties* properties = |
| 451 target->layoutObject()->paintProperties(); |
| 452 EXPECT_TRUE(properties->effect()->hasDirectCompositingReasons()); |
| 453 } |
| 454 |
| 441 TEST_P(PaintPropertyTreeBuilderTest, WillChangeTransform) { | 455 TEST_P(PaintPropertyTreeBuilderTest, WillChangeTransform) { |
| 442 setBodyInnerHTML( | 456 setBodyInnerHTML( |
| 443 "<style> body { margin: 0 } </style>" | 457 "<style> body { margin: 0 } </style>" |
| 444 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" | 458 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" |
| 445 " width: 400px; height: 300px;" | 459 " width: 400px; height: 300px;" |
| 446 " will-change: transform'>" | 460 " will-change: transform'>" |
| 447 "</div>"); | 461 "</div>"); |
| 448 | 462 |
| 449 Element* transform = document().getElementById("transform"); | 463 Element* transform = document().getElementById("transform"); |
| 450 const ObjectPaintProperties* transformProperties = | 464 const ObjectPaintProperties* transformProperties = |
| (...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3065 EXPECT_EQ(framePreTranslation(), | 3079 EXPECT_EQ(framePreTranslation(), |
| 3066 childProperties->paintOffsetTranslation()->parent()); | 3080 childProperties->paintOffsetTranslation()->parent()); |
| 3067 EXPECT_EQ(childProperties->paintOffsetTranslation(), | 3081 EXPECT_EQ(childProperties->paintOffsetTranslation(), |
| 3068 childPaintState.transform()); | 3082 childPaintState.transform()); |
| 3069 // This will change once we added clip expansion node. | 3083 // This will change once we added clip expansion node. |
| 3070 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); | 3084 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); |
| 3071 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); | 3085 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); |
| 3072 } | 3086 } |
| 3073 | 3087 |
| 3074 } // namespace blink | 3088 } // namespace blink |
| OLD | NEW |