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/html/HTMLIFrameElement.h" | 5 #include "core/html/HTMLIFrameElement.h" |
| 6 #include "core/layout/LayoutTestHelper.h" | 6 #include "core/layout/LayoutTestHelper.h" |
| 7 #include "core/layout/LayoutTreeAsText.h" | 7 #include "core/layout/LayoutTreeAsText.h" |
| 8 #include "core/layout/api/LayoutViewItem.h" | 8 #include "core/layout/api/LayoutViewItem.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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 inner->layoutObject()->paintProperties(); | 327 inner->layoutObject()->paintProperties(); |
| 328 EXPECT_EQ(TransformationMatrix().translate(50, 100), | 328 EXPECT_EQ(TransformationMatrix().translate(50, 100), |
| 329 innerProperties->paintOffsetTranslation()->matrix()); | 329 innerProperties->paintOffsetTranslation()->matrix()); |
| 330 EXPECT_EQ(perspectiveProperties->perspective(), | 330 EXPECT_EQ(perspectiveProperties->perspective(), |
| 331 innerProperties->paintOffsetTranslation()->parent()); | 331 innerProperties->paintOffsetTranslation()->parent()); |
| 332 CHECK_EXACT_VISUAL_RECT(LayoutRect(50, 100, 100, 200), inner->layoutObject(), | 332 CHECK_EXACT_VISUAL_RECT(LayoutRect(50, 100, 100, 200), inner->layoutObject(), |
| 333 document().view()->layoutView()); | 333 document().view()->layoutView()); |
| 334 } | 334 } |
| 335 | 335 |
| 336 TEST_P(PaintPropertyTreeBuilderTest, Transform) { | 336 TEST_P(PaintPropertyTreeBuilderTest, Transform) { |
| 337 loadTestData("transform.html"); | 337 setBodyInnerHTML( |
| 338 "<style> body { margin: 0 } </style>" | |
|
chrishtr
2016/12/13 23:35:35
I inlined this for imrpoved clarity and to be like
| |
| 339 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" | |
| 340 " width: 400px; height: 300px;" | |
| 341 " transform: translate3D(123px, 456px, 789px)'>" | |
| 342 "</div>"); | |
| 338 | 343 |
| 339 Element* transform = document().getElementById("transform"); | 344 Element* transform = document().getElementById("transform"); |
| 340 const ObjectPaintProperties* transformProperties = | 345 const ObjectPaintProperties* transformProperties = |
| 341 transform->layoutObject()->paintProperties(); | 346 transform->layoutObject()->paintProperties(); |
| 342 EXPECT_EQ(TransformationMatrix().translate3d(123, 456, 789), | 347 EXPECT_EQ(TransformationMatrix().translate3d(123, 456, 789), |
| 343 transformProperties->transform()->matrix()); | 348 transformProperties->transform()->matrix()); |
| 344 EXPECT_EQ(FloatPoint3D(200, 150, 0), | 349 EXPECT_EQ(FloatPoint3D(200, 150, 0), |
| 345 transformProperties->transform()->origin()); | 350 transformProperties->transform()->origin()); |
| 346 EXPECT_EQ(transformProperties->paintOffsetTranslation(), | 351 EXPECT_EQ(transformProperties->paintOffsetTranslation(), |
| 347 transformProperties->transform()->parent()); | 352 transformProperties->transform()->parent()); |
| 348 EXPECT_EQ(TransformationMatrix().translate(50, 100), | 353 EXPECT_EQ(TransformationMatrix().translate(50, 100), |
| 349 transformProperties->paintOffsetTranslation()->matrix()); | 354 transformProperties->paintOffsetTranslation()->matrix()); |
| 350 EXPECT_EQ(frameScrollTranslation(), | 355 EXPECT_EQ(frameScrollTranslation(), |
| 351 transformProperties->paintOffsetTranslation()->parent()); | 356 transformProperties->paintOffsetTranslation()->parent()); |
| 357 | |
| 358 EXPECT_TRUE(transformProperties->transform()->hasDirectCompositingReasons()); | |
| 359 EXPECT_FALSE(frameScrollTranslation()->hasDirectCompositingReasons()); | |
| 360 | |
| 352 CHECK_EXACT_VISUAL_RECT(LayoutRect(173, 556, 400, 300), | 361 CHECK_EXACT_VISUAL_RECT(LayoutRect(173, 556, 400, 300), |
| 353 transform->layoutObject(), | 362 transform->layoutObject(), |
| 354 document().view()->layoutView()); | 363 document().view()->layoutView()); |
| 355 } | 364 } |
| 356 | 365 |
| 357 TEST_P(PaintPropertyTreeBuilderTest, RelativePositionInline) { | 366 TEST_P(PaintPropertyTreeBuilderTest, RelativePositionInline) { |
| 358 loadTestData("relative-position-inline.html"); | 367 loadTestData("relative-position-inline.html"); |
| 359 | 368 |
| 360 Element* inlineBlock = document().getElementById("inline-block"); | 369 Element* inlineBlock = document().getElementById("inline-block"); |
| 361 const ObjectPaintProperties* inlineBlockProperties = | 370 const ObjectPaintProperties* inlineBlockProperties = |
| (...skipping 2781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3143 setBodyInnerHTML("<div id='div' style='background-color: blue'>DIV</div>"); | 3152 setBodyInnerHTML("<div id='div' style='background-color: blue'>DIV</div>"); |
| 3144 auto* div = document().getElementById("div"); | 3153 auto* div = document().getElementById("div"); |
| 3145 | 3154 |
| 3146 document().view()->updateAllLifecyclePhases(); | 3155 document().view()->updateAllLifecyclePhases(); |
| 3147 div->setAttribute(HTMLNames::styleAttr, "background-color: green"); | 3156 div->setAttribute(HTMLNames::styleAttr, "background-color: green"); |
| 3148 document().view()->updateLifecycleToLayoutClean(); | 3157 document().view()->updateLifecycleToLayoutClean(); |
| 3149 EXPECT_FALSE(div->layoutObject()->needsPaintPropertyUpdate()); | 3158 EXPECT_FALSE(div->layoutObject()->needsPaintPropertyUpdate()); |
| 3150 } | 3159 } |
| 3151 | 3160 |
| 3152 } // namespace blink | 3161 } // namespace blink |
| OLD | NEW |