| 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/paint/PaintLayer.h" | 5 #include "core/paint/PaintLayer.h" |
| 6 | 6 |
| 7 #include "core/html/HTMLIFrameElement.h" | 7 #include "core/html/HTMLIFrameElement.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/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 ->layer(); | 656 ->layer(); |
| 657 | 657 |
| 658 // enclosingLayerWithCompositedLayerMapping is not needed or applicable to | 658 // enclosingLayerWithCompositedLayerMapping is not needed or applicable to |
| 659 // SPv2. | 659 // SPv2. |
| 660 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 660 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 661 EXPECT_EQ(compositedContainer, | 661 EXPECT_EQ(compositedContainer, |
| 662 target->enclosingLayerWithCompositedLayerMapping(ExcludeSelf)); | 662 target->enclosingLayerWithCompositedLayerMapping(ExcludeSelf)); |
| 663 } | 663 } |
| 664 } | 664 } |
| 665 | 665 |
| 666 TEST_P(PaintLayerTest, CompositingContainerSelfPaintingNonStackedFloat) { |
| 667 setBodyInnerHTML( |
| 668 "<div id='container' style='position: relative'>" |
| 669 " <span id='span' style='opacity: 0.9'>" |
| 670 " <div id='target' style='columns: 1; float: left'></div>" |
| 671 " </span>" |
| 672 "</div>"); |
| 673 |
| 674 // The target layer is self-painting, but not stacked. |
| 675 PaintLayer* target = |
| 676 toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer(); |
| 677 EXPECT_TRUE(target->isSelfPaintingLayer()); |
| 678 EXPECT_FALSE(target->stackingNode()->isStacked()); |
| 679 |
| 680 PaintLayer* container = |
| 681 toLayoutBoxModelObject(getLayoutObjectByElementId("container"))->layer(); |
| 682 PaintLayer* span = |
| 683 toLayoutBoxModelObject(getLayoutObjectByElementId("span"))->layer(); |
| 684 EXPECT_EQ(container, target->containingLayer()); |
| 685 EXPECT_EQ(span, target->compositingContainer()); |
| 686 } |
| 687 |
| 666 TEST_P(PaintLayerTest, ColumnSpanLayerUnderExtraLayerScrolled) { | 688 TEST_P(PaintLayerTest, ColumnSpanLayerUnderExtraLayerScrolled) { |
| 667 setBodyInnerHTML( | 689 setBodyInnerHTML( |
| 668 "<div id='columns' style='overflow: hidden; width: 80px; height: 80px; " | 690 "<div id='columns' style='overflow: hidden; width: 80px; height: 80px; " |
| 669 " columns: 2; column-gap: 0'>" | 691 " columns: 2; column-gap: 0'>" |
| 670 " <div id='extraLayer'" | 692 " <div id='extraLayer'" |
| 671 " style='position: relative; top: 100px; left: 100px'>" | 693 " style='position: relative; top: 100px; left: 100px'>" |
| 672 " <div id='spanner' style='column-span: all; position: relative; " | 694 " <div id='spanner' style='column-span: all; position: relative; " |
| 673 " top: 50px; left: 50px'>" | 695 " top: 50px; left: 50px'>" |
| 674 " </div>" | 696 " </div>" |
| 675 " </div>" | 697 " </div>" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 693 EXPECT_EQ(LayoutPoint(-150, 50), spanner->location()); | 715 EXPECT_EQ(LayoutPoint(-150, 50), spanner->location()); |
| 694 EXPECT_EQ(LayoutPoint(100, 100), extraLayer->location()); | 716 EXPECT_EQ(LayoutPoint(100, 100), extraLayer->location()); |
| 695 // -60 = 2nd-column-x(40) - scroll-offset-x(200) + x-location(100) | 717 // -60 = 2nd-column-x(40) - scroll-offset-x(200) + x-location(100) |
| 696 // 20 = y-location(100) - column-height(80) | 718 // 20 = y-location(100) - column-height(80) |
| 697 EXPECT_EQ(LayoutPoint(-60, 20), | 719 EXPECT_EQ(LayoutPoint(-60, 20), |
| 698 extraLayer->visualOffsetFromAncestor(columns)); | 720 extraLayer->visualOffsetFromAncestor(columns)); |
| 699 EXPECT_EQ(LayoutPoint(-150, 50), spanner->visualOffsetFromAncestor(columns)); | 721 EXPECT_EQ(LayoutPoint(-150, 50), spanner->visualOffsetFromAncestor(columns)); |
| 700 } | 722 } |
| 701 | 723 |
| 702 } // namespace blink | 724 } // namespace blink |
| OLD | NEW |