| 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/layout/LayoutTestHelper.h" | 5 #include "core/layout/LayoutTestHelper.h" |
| 6 #include "core/layout/LayoutTreeAsText.h" | 6 #include "core/layout/LayoutTreeAsText.h" |
| 7 #include "core/layout/api/LayoutViewItem.h" | 7 #include "core/layout/api/LayoutViewItem.h" |
| 8 #include "core/paint/ObjectPaintProperties.h" | 8 #include "core/paint/ObjectPaintProperties.h" |
| 9 #include "core/paint/PaintPropertyTreePrinter.h" | 9 #include "core/paint/PaintPropertyTreePrinter.h" |
| 10 #include "platform/graphics/paint/GeometryMapper.h" | 10 #include "platform/graphics/paint/GeometryMapper.h" |
| (...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 EXPECT_EQ(framePreTranslation(), contentsProperties.transform); | 1641 EXPECT_EQ(framePreTranslation(), contentsProperties.transform); |
| 1642 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); | 1642 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); |
| 1643 | 1643 |
| 1644 EXPECT_EQ(framePreTranslation(), childProperties->localBorderBoxProperties()
->geometryPropertyTreeState.transform); | 1644 EXPECT_EQ(framePreTranslation(), childProperties->localBorderBoxProperties()
->geometryPropertyTreeState.transform); |
| 1645 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.clip); | 1645 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.clip); |
| 1646 | 1646 |
| 1647 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp
ertyTreeState.effect); | 1647 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp
ertyTreeState.effect); |
| 1648 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); | 1648 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 1649 } | 1649 } |
| 1650 | 1650 |
| 1651 TEST_P(PaintPropertyTreeBuilderTest, ContainsPaintContentsProperties) |
| 1652 { |
| 1653 setBodyInnerHTML( |
| 1654 "<style>body { margin: 0; }</style>" |
| 1655 "<div id='clipper' style='contain:paint; width:400px; height:300px;'>" |
| 1656 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" |
| 1657 "</div>" |
| 1658 ); |
| 1659 |
| 1660 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); |
| 1661 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); |
| 1662 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 1663 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); |
| 1664 |
| 1665 // No scroll translation because the document does not scroll (not enough co
ntent). |
| 1666 EXPECT_TRUE(!frameScrollTranslation()); |
| 1667 EXPECT_EQ(framePreTranslation(), clipProperties->localBorderBoxProperties()-
>geometryPropertyTreeState.transform); |
| 1668 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge
ometryPropertyTreeState.clip); |
| 1669 |
| 1670 GeometryPropertyTreeState contentsProperties; |
| 1671 clipProperties->getContentsProperties(contentsProperties); |
| 1672 EXPECT_EQ(framePreTranslation(), contentsProperties.transform); |
| 1673 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); |
| 1674 |
| 1675 EXPECT_EQ(framePreTranslation(), childProperties->localBorderBoxProperties()
->geometryPropertyTreeState.transform); |
| 1676 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.clip); |
| 1677 |
| 1678 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp
ertyTreeState.effect); |
| 1679 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 1680 } |
| 1681 |
| 1651 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties) | 1682 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties) |
| 1652 { | 1683 { |
| 1653 // This test verifies the tree builder correctly computes and records the pr
operty tree context | 1684 // This test verifies the tree builder correctly computes and records the pr
operty tree context |
| 1654 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of | 1685 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of |
| 1655 // the painting ancestors. | 1686 // the painting ancestors. |
| 1656 setBodyInnerHTML( | 1687 setBodyInnerHTML( |
| 1657 "<style>body { margin: 0; }</style>" | 1688 "<style>body { margin: 0; }</style>" |
| 1658 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" | 1689 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" |
| 1659 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" | 1690 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" |
| 1660 " <div style='width: 200px; height: 10000px'></div>" | 1691 " <div style='width: 200px; height: 10000px'></div>" |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2119 | 2150 |
| 2120 // Removing a main thread scrolling reason should update the entire tree. | 2151 // Removing a main thread scrolling reason should update the entire tree. |
| 2121 overflowB->removeAttribute("class"); | 2152 overflowB->removeAttribute("class"); |
| 2122 document().view()->updateAllLifecyclePhases(); | 2153 document().view()->updateAllLifecyclePhases(); |
| 2123 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); | 2154 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2124 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); | 2155 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2125 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->p
arent()->hasMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackground
AttachmentFixedObjects)); | 2156 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->p
arent()->hasMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackground
AttachmentFixedObjects)); |
| 2126 } | 2157 } |
| 2127 | 2158 |
| 2128 } // namespace blink | 2159 } // namespace blink |
| OLD | NEW |