| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/layout/compositing/CompositedLayerMapping.h" | 5 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/layout/LayoutBoxModelObject.h" | 8 #include "core/layout/LayoutBoxModelObject.h" |
| 9 #include "core/layout/LayoutTestHelper.h" | 9 #include "core/layout/LayoutTestHelper.h" |
| 10 #include "core/layout/api/LayoutViewItem.h" | 10 #include "core/layout/api/LayoutViewItem.h" |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 // Paint invalidation and repaint should not change previous paint interest
rect. | 497 // Paint invalidation and repaint should not change previous paint interest
rect. |
| 498 document().getElementById("content")->setTextContent("Change"); | 498 document().getElementById("content")->setTextContent("Change"); |
| 499 document().view()->updateAllLifecyclePhases(); | 499 document().view()->updateAllLifecyclePhases(); |
| 500 EXPECT_RECT_EQ(IntRect(0, 5400, 400, 4600), recomputeInterestRect(scrollingL
ayer)); | 500 EXPECT_RECT_EQ(IntRect(0, 5400, 400, 4600), recomputeInterestRect(scrollingL
ayer)); |
| 501 EXPECT_RECT_EQ(IntRect(0, 1400, 400, 8600), previousInterestRect(scrollingLa
yer)); | 501 EXPECT_RECT_EQ(IntRect(0, 1400, 400, 8600), previousInterestRect(scrollingLa
yer)); |
| 502 } | 502 } |
| 503 | 503 |
| 504 TEST_F(CompositedLayerMappingTest, InterestRectOfSquashingLayerWithNegativeOverf
low) | 504 TEST_F(CompositedLayerMappingTest, InterestRectOfSquashingLayerWithNegativeOverf
low) |
| 505 { | 505 { |
| 506 setBodyInnerHTML( | 506 setBodyInnerHTML( |
| 507 "<style>body { margin: 0 }</style>" | 507 "<style>body { margin: 0; font-size: 16px; }</style>" |
| 508 "<div style='position: absolute; top: -500px; width: 200px; height: 700p
x; will-change: transform'></div>" | 508 "<div style='position: absolute; top: -500px; width: 200px; height: 700p
x; will-change: transform'></div>" |
| 509 "<div id='squashed' style='position: absolute; top: 190px'>" | 509 "<div id='squashed' style='position: absolute; top: 190px;'>" |
| 510 " <div style='width: 100px; height: 100px; text-indent: -10000px'>text<
/div>" | 510 " <div id='inside' style='width: 100px; height: 100px; text-indent: -10
000px'>text</div>" |
| 511 "</div>"); | 511 "</div>"); |
| 512 | 512 |
| 513 EXPECT_EQ(document().getElementById("inside")->layoutBox()->visualOverflowRe
ct().size().height(), 100); |
| 514 |
| 513 CompositedLayerMapping* groupedMapping = document().getElementById("squashed
")->layoutBox()->layer()->groupedMapping(); | 515 CompositedLayerMapping* groupedMapping = document().getElementById("squashed
")->layoutBox()->layer()->groupedMapping(); |
| 514 // The squashing layer is at (-10000, 190, 10100, 100) in viewport coordinat
es. | 516 // The squashing layer is at (-10000, 190, 10100, 100) in viewport coordinat
es. |
| 515 // The following rect is at (-4000, 190, 4100, 100) in viewport coordinates. | 517 // The following rect is at (-4000, 190, 4100, 100) in viewport coordinates. |
| 516 EXPECT_RECT_EQ(IntRect(6000, 0, 4100, 100), groupedMapping->computeInterestR
ect(groupedMapping->squashingLayer(), IntRect())); | 518 EXPECT_RECT_EQ(IntRect(6000, 0, 4100, 100), groupedMapping->computeInterestR
ect(groupedMapping->squashingLayer(), IntRect())); |
| 517 } | 519 } |
| 518 | 520 |
| 519 TEST_F(CompositedLayerMappingTest, InterestRectOfSquashingLayerWithAncestorClip) | 521 TEST_F(CompositedLayerMappingTest, InterestRectOfSquashingLayerWithAncestorClip) |
| 520 { | 522 { |
| 521 setBodyInnerHTML( | 523 setBodyInnerHTML( |
| 522 "<style>body { margin: 0; }</style>" | 524 "<style>body { margin: 0; }</style>" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 negativeCompositedChild->parentNode()->removeChild(negativeCompositedChild); | 620 negativeCompositedChild->parentNode()->removeChild(negativeCompositedChild); |
| 619 document().view()->updateAllLifecyclePhases(); | 621 document().view()->updateAllLifecyclePhases(); |
| 620 | 622 |
| 621 mapping = toLayoutBlock(getLayoutObjectByElementId("container"))->layer()->c
ompositedLayerMapping(); | 623 mapping = toLayoutBlock(getLayoutObjectByElementId("container"))->layer()->c
ompositedLayerMapping(); |
| 622 ASSERT_TRUE(mapping->scrollingContentsLayer()); | 624 ASSERT_TRUE(mapping->scrollingContentsLayer()); |
| 623 EXPECT_EQ(static_cast<GraphicsLayerPaintingPhase>(GraphicsLayerPaintOverflow
Contents | GraphicsLayerPaintCompositedScroll | GraphicsLayerPaintForeground), m
apping->scrollingContentsLayer()->paintingPhase()); | 625 EXPECT_EQ(static_cast<GraphicsLayerPaintingPhase>(GraphicsLayerPaintOverflow
Contents | GraphicsLayerPaintCompositedScroll | GraphicsLayerPaintForeground), m
apping->scrollingContentsLayer()->paintingPhase()); |
| 624 EXPECT_FALSE(mapping->foregroundLayer()); | 626 EXPECT_FALSE(mapping->foregroundLayer()); |
| 625 } | 627 } |
| 626 | 628 |
| 627 } // namespace blink | 629 } // namespace blink |
| OLD | NEW |