| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 setBodyInnerHTML( | 353 setBodyInnerHTML( |
| 354 "<style> body { margin: 0 } </style>" | 354 "<style> body { margin: 0 } </style>" |
| 355 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" | 355 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" |
| 356 " width: 400px; height: 300px;" | 356 " width: 400px; height: 300px;" |
| 357 " transform: translate3d(123px, 456px, 789px)'>" | 357 " transform: translate3d(123px, 456px, 789px)'>" |
| 358 "</div>"); | 358 "</div>"); |
| 359 | 359 |
| 360 Element* transform = document().getElementById("transform"); | 360 Element* transform = document().getElementById("transform"); |
| 361 const ObjectPaintProperties* transformProperties = | 361 const ObjectPaintProperties* transformProperties = |
| 362 transform->layoutObject()->paintProperties(); | 362 transform->layoutObject()->paintProperties(); |
| 363 |
| 363 EXPECT_EQ(TransformationMatrix().translate3d(123, 456, 789), | 364 EXPECT_EQ(TransformationMatrix().translate3d(123, 456, 789), |
| 364 transformProperties->transform()->matrix()); | 365 transformProperties->transform()->matrix()); |
| 365 EXPECT_EQ(FloatPoint3D(200, 150, 0), | 366 EXPECT_EQ(FloatPoint3D(200, 150, 0), |
| 366 transformProperties->transform()->origin()); | 367 transformProperties->transform()->origin()); |
| 367 EXPECT_EQ(transformProperties->paintOffsetTranslation(), | 368 EXPECT_EQ(transformProperties->paintOffsetTranslation(), |
| 368 transformProperties->transform()->parent()); | 369 transformProperties->transform()->parent()); |
| 369 EXPECT_EQ(TransformationMatrix().translate(50, 100), | 370 EXPECT_EQ(TransformationMatrix().translate(50, 100), |
| 370 transformProperties->paintOffsetTranslation()->matrix()); | 371 transformProperties->paintOffsetTranslation()->matrix()); |
| 371 EXPECT_EQ(frameScrollTranslation(), | 372 EXPECT_EQ(frameScrollTranslation(), |
| 372 transformProperties->paintOffsetTranslation()->parent()); | 373 transformProperties->paintOffsetTranslation()->parent()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 387 transform->setAttribute( | 388 transform->setAttribute( |
| 388 HTMLNames::styleAttr, | 389 HTMLNames::styleAttr, |
| 389 "margin-left: 50px; margin-top: 100px; width: 400px; height: 300px; " | 390 "margin-left: 50px; margin-top: 100px; width: 400px; height: 300px; " |
| 390 "transform: translate3d(123px, 456px, 789px)"); | 391 "transform: translate3d(123px, 456px, 789px)"); |
| 391 document().view()->updateAllLifecyclePhases(); | 392 document().view()->updateAllLifecyclePhases(); |
| 392 EXPECT_EQ( | 393 EXPECT_EQ( |
| 393 TransformationMatrix().translate3d(123, 456, 789), | 394 TransformationMatrix().translate3d(123, 456, 789), |
| 394 transform->layoutObject()->paintProperties()->transform()->matrix()); | 395 transform->layoutObject()->paintProperties()->transform()->matrix()); |
| 395 } | 396 } |
| 396 | 397 |
| 398 TEST_P(PaintPropertyTreeBuilderTest, Preserve3D3DTransformedDescendant) { |
| 399 setBodyInnerHTML( |
| 400 "<style> body { margin: 0 } </style>" |
| 401 "<div id='preserve' style='transform-style: preserve-3d'>" |
| 402 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" |
| 403 " width: 400px; height: 300px;" |
| 404 " transform: translate3d(123px, 456px, 789px)'>" |
| 405 "</div>" |
| 406 "</div>"); |
| 407 |
| 408 Element* preserve = document().getElementById("preserve"); |
| 409 const ObjectPaintProperties* preserveProperties = |
| 410 preserve->layoutObject()->paintProperties(); |
| 411 |
| 412 EXPECT_TRUE(preserveProperties->transform()); |
| 413 EXPECT_TRUE(preserveProperties->transform()->hasDirectCompositingReasons()); |
| 414 } |
| 415 |
| 416 TEST_P(PaintPropertyTreeBuilderTest, Perspective3DTransformedDescendant) { |
| 417 setBodyInnerHTML( |
| 418 "<style> body { margin: 0 } </style>" |
| 419 "<div id='perspective' style='perspective: 800px;'>" |
| 420 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" |
| 421 " width: 400px; height: 300px;" |
| 422 " transform: translate3d(123px, 456px, 789px)'>" |
| 423 "</div>" |
| 424 "</div>"); |
| 425 |
| 426 Element* perspective = document().getElementById("perspective"); |
| 427 const ObjectPaintProperties* perspectiveProperties = |
| 428 perspective->layoutObject()->paintProperties(); |
| 429 |
| 430 EXPECT_TRUE(perspectiveProperties->transform()); |
| 431 EXPECT_TRUE( |
| 432 perspectiveProperties->transform()->hasDirectCompositingReasons()); |
| 433 } |
| 434 |
| 397 TEST_P(PaintPropertyTreeBuilderTest, | 435 TEST_P(PaintPropertyTreeBuilderTest, |
| 398 TransformNodeWithActiveAnimationHasDirectCompositingReason) { | 436 TransformNodeWithActiveAnimationHasDirectCompositingReason) { |
| 399 setBodyInnerHTML( | 437 setBodyInnerHTML( |
| 400 "<style>" | 438 "<style>" |
| 401 "@keyframes test {" | 439 "@keyframes test {" |
| 402 " 0% { transform: translate(1em, 1em) } " | 440 " 0% { transform: translate(1em, 1em) } " |
| 403 " 100% { transform: translate(2em, 2em) } " | 441 " 100% { transform: translate(2em, 2em) } " |
| 404 "} " | 442 "} " |
| 405 ".animate { " | 443 ".animate { " |
| 406 " animation-name: test; " | 444 " animation-name: test; " |
| (...skipping 2770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3177 toElement(ancestor->node()) | 3215 toElement(ancestor->node()) |
| 3178 ->setAttribute(HTMLNames::styleAttr, "position: static"); | 3216 ->setAttribute(HTMLNames::styleAttr, "position: static"); |
| 3179 document().view()->updateAllLifecyclePhases(); | 3217 document().view()->updateAllLifecyclePhases(); |
| 3180 EXPECT_NE(ancestor->paintProperties()->overflowClip(), | 3218 EXPECT_NE(ancestor->paintProperties()->overflowClip(), |
| 3181 descendant->paintProperties() | 3219 descendant->paintProperties() |
| 3182 ->localBorderBoxProperties() | 3220 ->localBorderBoxProperties() |
| 3183 ->propertyTreeState.clip()); | 3221 ->propertyTreeState.clip()); |
| 3184 } | 3222 } |
| 3185 | 3223 |
| 3186 } // namespace blink | 3224 } // namespace blink |
| OLD | NEW |