| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/HTMLNames.h" | 5 #include "core/HTMLNames.h" |
| 6 #include "core/frame/FrameView.h" | 6 #include "core/frame/FrameView.h" |
| 7 #include "core/layout/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.h" |
| 8 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
| 9 #include "core/paint/PaintLayer.h" | 9 #include "core/paint/PaintLayer.h" |
| 10 #include "platform/graphics/GraphicsLayer.h" | 10 #include "platform/graphics/GraphicsLayer.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 const auto& raster_invalidations = | 375 const auto& raster_invalidations = |
| 376 GetRasterInvalidationTracking()->tracked_raster_invalidations; | 376 GetRasterInvalidationTracking()->tracked_raster_invalidations; |
| 377 ASSERT_EQ(2u, raster_invalidations.size()); | 377 ASSERT_EQ(2u, raster_invalidations.size()); |
| 378 EXPECT_EQ(IntRect(0, 100, 100, 100), raster_invalidations[0].rect); | 378 EXPECT_EQ(IntRect(0, 100, 100, 100), raster_invalidations[0].rect); |
| 379 EXPECT_EQ(static_cast<const DisplayItemClient*>(iframe->GetLayoutObject()), | 379 EXPECT_EQ(static_cast<const DisplayItemClient*>(iframe->GetLayoutObject()), |
| 380 raster_invalidations[0].client); | 380 raster_invalidations[0].client); |
| 381 EXPECT_EQ(kPaintInvalidationIncremental, raster_invalidations[0].reason); | 381 EXPECT_EQ(kPaintInvalidationIncremental, raster_invalidations[0].reason); |
| 382 EXPECT_EQ( | 382 EXPECT_EQ( |
| 383 static_cast<const DisplayItemClient*>(content->GetLayoutObject()->View()), | 383 static_cast<const DisplayItemClient*>(content->GetLayoutObject()->View()), |
| 384 raster_invalidations[1].client); | 384 raster_invalidations[1].client); |
| 385 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 385 EXPECT_EQ(IntRect(0, 100, 100, 100), raster_invalidations[1].rect); |
| 386 // TODO(skobes): Treat LayoutView in the same way as normal objects having | 386 EXPECT_EQ(kPaintInvalidationIncremental, raster_invalidations[1].reason); |
| 387 // background-attachment: local. crbug.com/568847. | |
| 388 EXPECT_EQ(IntRect(0, 0, 100, 200), raster_invalidations[1].rect); | |
| 389 EXPECT_EQ(kPaintInvalidationFull, raster_invalidations[1].reason); | |
| 390 } else { | |
| 391 EXPECT_EQ(IntRect(0, 100, 100, 100), raster_invalidations[1].rect); | |
| 392 EXPECT_EQ(kPaintInvalidationIncremental, raster_invalidations[1].reason); | |
| 393 } | |
| 394 GetDocument().View()->SetTracksPaintInvalidations(false); | 387 GetDocument().View()->SetTracksPaintInvalidations(false); |
| 395 } | 388 } |
| 396 | 389 |
| 397 TEST_P(BoxPaintInvalidatorTest, NonCompositedLayoutViewGradientResize) { | 390 TEST_P(BoxPaintInvalidatorTest, NonCompositedLayoutViewGradientResize) { |
| 398 SetBodyInnerHTML( | 391 SetBodyInnerHTML( |
| 399 "<style>" | 392 "<style>" |
| 400 " body { margin: 0 }" | 393 " body { margin: 0 }" |
| 401 " iframe { display: block; width: 100px; height: 100px; border: none; }" | 394 " iframe { display: block; width: 100px; height: 100px; border: none; }" |
| 402 "</style>" | 395 "</style>" |
| 403 "<iframe id='iframe'></iframe>"); | 396 "<iframe id='iframe'></iframe>"); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 raster_invalidations = | 432 raster_invalidations = |
| 440 &GetRasterInvalidationTracking()->tracked_raster_invalidations; | 433 &GetRasterInvalidationTracking()->tracked_raster_invalidations; |
| 441 ASSERT_EQ(2u, raster_invalidations->size()); | 434 ASSERT_EQ(2u, raster_invalidations->size()); |
| 442 EXPECT_EQ(IntRect(0, 100, 100, 100), (*raster_invalidations)[0].rect); | 435 EXPECT_EQ(IntRect(0, 100, 100, 100), (*raster_invalidations)[0].rect); |
| 443 EXPECT_EQ(static_cast<const DisplayItemClient*>(iframe->GetLayoutObject()), | 436 EXPECT_EQ(static_cast<const DisplayItemClient*>(iframe->GetLayoutObject()), |
| 444 (*raster_invalidations)[0].client); | 437 (*raster_invalidations)[0].client); |
| 445 EXPECT_EQ(kPaintInvalidationIncremental, (*raster_invalidations)[0].reason); | 438 EXPECT_EQ(kPaintInvalidationIncremental, (*raster_invalidations)[0].reason); |
| 446 EXPECT_EQ(static_cast<const DisplayItemClient*>(frame_layout_view), | 439 EXPECT_EQ(static_cast<const DisplayItemClient*>(frame_layout_view), |
| 447 (*raster_invalidations)[1].client); | 440 (*raster_invalidations)[1].client); |
| 448 EXPECT_EQ(IntRect(0, 0, 100, 200), (*raster_invalidations)[1].rect); | 441 EXPECT_EQ(IntRect(0, 0, 100, 200), (*raster_invalidations)[1].rect); |
| 449 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 442 EXPECT_EQ(kPaintInvalidationViewBackground, |
| 450 // TODO(skobes): Treat LayoutView in the same way as normal objects having | 443 (*raster_invalidations)[1].reason); |
| 451 // background-attachment: local. crbug.com/568847. | |
| 452 EXPECT_EQ(kPaintInvalidationFull, (*raster_invalidations)[1].reason); | |
| 453 } else { | |
| 454 EXPECT_EQ(kPaintInvalidationViewBackground, | |
| 455 (*raster_invalidations)[1].reason); | |
| 456 } | |
| 457 GetDocument().View()->SetTracksPaintInvalidations(false); | 444 GetDocument().View()->SetTracksPaintInvalidations(false); |
| 458 } | 445 } |
| 459 | 446 |
| 460 TEST_P(BoxPaintInvalidatorTest, CompositedBackgroundAttachmentLocalResize) { | 447 TEST_P(BoxPaintInvalidatorTest, CompositedBackgroundAttachmentLocalResize) { |
| 461 EnableCompositing(); | 448 EnableCompositing(); |
| 462 | 449 |
| 463 Element* target = GetDocument().getElementById("target"); | 450 Element* target = GetDocument().getElementById("target"); |
| 464 target->setAttribute(HTMLNames::classAttr, "border local-background"); | 451 target->setAttribute(HTMLNames::classAttr, "border local-background"); |
| 465 target->setAttribute(HTMLNames::styleAttr, "will-change: transform"); | 452 target->setAttribute(HTMLNames::styleAttr, "will-change: transform"); |
| 466 target->setInnerHTML( | 453 target->setInnerHTML( |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 GetRasterInvalidationTracking()->tracked_raster_invalidations; | 582 GetRasterInvalidationTracking()->tracked_raster_invalidations; |
| 596 ASSERT_EQ(1u, raster_invalidations.size()); | 583 ASSERT_EQ(1u, raster_invalidations.size()); |
| 597 EXPECT_EQ(IntRect(0, 120, 70, 120), raster_invalidations[0].rect); | 584 EXPECT_EQ(IntRect(0, 120, 70, 120), raster_invalidations[0].rect); |
| 598 EXPECT_EQ(static_cast<const DisplayItemClient*>(target->GetLayoutObject()), | 585 EXPECT_EQ(static_cast<const DisplayItemClient*>(target->GetLayoutObject()), |
| 599 raster_invalidations[0].client); | 586 raster_invalidations[0].client); |
| 600 EXPECT_EQ(kPaintInvalidationIncremental, raster_invalidations[0].reason); | 587 EXPECT_EQ(kPaintInvalidationIncremental, raster_invalidations[0].reason); |
| 601 GetDocument().View()->SetTracksPaintInvalidations(false); | 588 GetDocument().View()->SetTracksPaintInvalidations(false); |
| 602 } | 589 } |
| 603 | 590 |
| 604 } // namespace blink | 591 } // namespace blink |
| OLD | NEW |