Chromium Code Reviews| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 "<div id='transform' " | 396 "<div id='transform' " |
| 397 " style='animation-name: test; animation-duration: 1s'>" | 397 " style='animation-name: test; animation-duration: 1s'>" |
| 398 "</div>"); | 398 "</div>"); |
| 399 | 399 |
| 400 Element* transform = document().getElementById("transform"); | 400 Element* transform = document().getElementById("transform"); |
| 401 const ObjectPaintProperties* transformProperties = | 401 const ObjectPaintProperties* transformProperties = |
| 402 transform->layoutObject()->paintProperties(); | 402 transform->layoutObject()->paintProperties(); |
| 403 EXPECT_TRUE(transformProperties->transform()->hasDirectCompositingReasons()); | 403 EXPECT_TRUE(transformProperties->transform()->hasDirectCompositingReasons()); |
| 404 } | 404 } |
| 405 | 405 |
| 406 TEST_P(PaintPropertyTreeBuilderTest, | |
| 407 OpacityAnimationDoesNotCreateTransformNode) { | |
| 408 setBodyInnerHTML( | |
| 409 "<style>" | |
| 410 "div {" | |
| 411 " width: 100px;" | |
| 412 " height: 100px;" | |
| 413 " background-color: red;" | |
| 414 " animation-name: example;" | |
| 415 " animation-duration: 4s;" | |
| 416 "}" | |
| 417 "@keyframes example {" | |
| 418 " from { opacity: 0.0;}" | |
| 419 " to { opacity: 1.0;}" | |
| 420 "}" | |
| 421 "</style>" | |
| 422 "<div id='target'></div>"); | |
| 423 | |
| 424 Element* target = document().getElementById("target"); | |
|
pdr.
2016/12/21 00:02:24
Can you add a test to PaintPropertyTreeUpdateTests
wkorman
2016/12/21 18:58:49
Done.
| |
| 425 const ObjectPaintProperties* properties = | |
| 426 target->layoutObject()->paintProperties(); | |
| 427 EXPECT_EQ(nullptr, properties->transform()); | |
| 428 } | |
| 429 | |
| 406 TEST_P(PaintPropertyTreeBuilderTest, WillChangeTransform) { | 430 TEST_P(PaintPropertyTreeBuilderTest, WillChangeTransform) { |
| 407 setBodyInnerHTML( | 431 setBodyInnerHTML( |
| 408 "<style> body { margin: 0 } </style>" | 432 "<style> body { margin: 0 } </style>" |
| 409 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" | 433 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" |
| 410 " width: 400px; height: 300px;" | 434 " width: 400px; height: 300px;" |
| 411 " will-change: transform'>" | 435 " will-change: transform'>" |
| 412 "</div>"); | 436 "</div>"); |
| 413 | 437 |
| 414 Element* transform = document().getElementById("transform"); | 438 Element* transform = document().getElementById("transform"); |
| 415 const ObjectPaintProperties* transformProperties = | 439 const ObjectPaintProperties* transformProperties = |
| (...skipping 2428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2844 EXPECT_EQ(framePreTranslation(), | 2868 EXPECT_EQ(framePreTranslation(), |
| 2845 childProperties->paintOffsetTranslation()->parent()); | 2869 childProperties->paintOffsetTranslation()->parent()); |
| 2846 EXPECT_EQ(childProperties->paintOffsetTranslation(), | 2870 EXPECT_EQ(childProperties->paintOffsetTranslation(), |
| 2847 childPaintState.transform()); | 2871 childPaintState.transform()); |
| 2848 // This will change once we added clip expansion node. | 2872 // This will change once we added clip expansion node. |
| 2849 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); | 2873 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip()); |
| 2850 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); | 2874 EXPECT_EQ(filterProperties->effect(), childPaintState.effect()); |
| 2851 } | 2875 } |
| 2852 | 2876 |
| 2853 } // namespace blink | 2877 } // namespace blink |
| OLD | NEW |