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/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" |
| 11 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" | |
| 11 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 12 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 12 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 13 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
| 13 #include "platform/testing/UnitTestHelpers.h" | 14 #include "platform/testing/UnitTestHelpers.h" |
| 14 #include "platform/text/TextStream.h" | 15 #include "platform/text/TextStream.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "wtf/HashMap.h" | 17 #include "wtf/HashMap.h" |
| 17 #include "wtf/Vector.h" | 18 #include "wtf/Vector.h" |
| 18 | 19 |
| 19 namespace blink { | 20 namespace blink { |
| 20 | 21 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 } | 72 } |
| 72 | 73 |
| 73 const ClipPaintPropertyNode* frameContentClip() | 74 const ClipPaintPropertyNode* frameContentClip() |
| 74 { | 75 { |
| 75 FrameView* frameView = document().view(); | 76 FrameView* frameView = document().view(); |
| 76 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 77 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 77 return frameView->layoutView()->objectPaintProperties()->overflowCli p(); | 78 return frameView->layoutView()->objectPaintProperties()->overflowCli p(); |
| 78 return frameView->contentClip(); | 79 return frameView->contentClip(); |
| 79 } | 80 } |
| 80 | 81 |
| 82 const ScrollPaintPropertyNode* frameScroll() | |
| 83 { | |
| 84 FrameView* frameView = document().view(); | |
| 85 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | |
| 86 return frameView->layoutView()->objectPaintProperties()->scroll(); | |
| 87 return frameView->scroll(); | |
| 88 } | |
| 89 | |
| 81 private: | 90 private: |
| 82 void SetUp() override | 91 void SetUp() override |
| 83 { | 92 { |
| 84 Settings::setMockScrollbarsEnabled(true); | 93 Settings::setMockScrollbarsEnabled(true); |
| 85 | 94 |
| 86 RenderingTest::SetUp(); | 95 RenderingTest::SetUp(); |
| 87 enableCompositing(); | 96 enableCompositing(); |
| 88 } | 97 } |
| 89 | 98 |
| 90 void TearDown() override | 99 void TearDown() override |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 } while (0) | 135 } while (0) |
| 127 | 136 |
| 128 #define CHECK_EXACT_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObje ct) CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, 0) | 137 #define CHECK_EXACT_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObje ct) CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, 0) |
| 129 | 138 |
| 130 INSTANTIATE_TEST_CASE_P(All, PaintPropertyTreeBuilderTest, ::testing::Bool()); | 139 INSTANTIATE_TEST_CASE_P(All, PaintPropertyTreeBuilderTest, ::testing::Bool()); |
| 131 | 140 |
| 132 TEST_P(PaintPropertyTreeBuilderTest, FixedPosition) | 141 TEST_P(PaintPropertyTreeBuilderTest, FixedPosition) |
| 133 { | 142 { |
| 134 loadTestData("fixed-position.html"); | 143 loadTestData("fixed-position.html"); |
| 135 | 144 |
| 145 Element* positionedScroll = document().getElementById("positionedScroll"); | |
| 146 positionedScroll->setScrollTop(3); | |
| 147 Element* transformedScroll = document().getElementById("transformedScroll"); | |
| 148 transformedScroll->setScrollTop(5); | |
| 149 | |
| 136 FrameView* frameView = document().view(); | 150 FrameView* frameView = document().view(); |
| 151 frameView->updateAllLifecyclePhases(); | |
| 137 | 152 |
| 138 // target1 is a fixed-position element inside an absolute-position scrolling element. | 153 // target1 is a fixed-position element inside an absolute-position scrolling element. |
| 139 // It should be attached under the viewport to skip scrolling and offset of the parent. | 154 // It should be attached under the viewport to skip scrolling and offset of the parent. |
| 140 Element* target1 = document().getElementById("target1"); | 155 Element* target1 = document().getElementById("target1"); |
| 141 const ObjectPaintProperties* target1Properties = target1->layoutObject()->ob jectPaintProperties(); | 156 const ObjectPaintProperties* target1Properties = target1->layoutObject()->ob jectPaintProperties(); |
| 142 EXPECT_EQ(TransformationMatrix().translate(200, 150), target1Properties->pai ntOffsetTranslation()->matrix()); | 157 EXPECT_EQ(TransformationMatrix().translate(200, 150), target1Properties->pai ntOffsetTranslation()->matrix()); |
| 143 EXPECT_EQ(framePreTranslation(), target1Properties->paintOffsetTranslation() ->parent()); | 158 EXPECT_EQ(framePreTranslation(), target1Properties->paintOffsetTranslation() ->parent()); |
| 144 EXPECT_EQ(target1Properties->paintOffsetTranslation(), target1Properties->ov erflowClip()->localTransformSpace()); | 159 EXPECT_EQ(target1Properties->paintOffsetTranslation(), target1Properties->ov erflowClip()->localTransformSpace()); |
| 145 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target1Properties->overflowClip( )->clipRect()); | 160 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target1Properties->overflowClip( )->clipRect()); |
| 146 // Likewise, it inherits clip from the viewport, skipping overflow clip of t he scroller. | 161 // Likewise, it inherits clip from the viewport, skipping overflow clip of t he scroller. |
| 147 EXPECT_EQ(frameContentClip(), target1Properties->overflowClip()->parent()); | 162 EXPECT_EQ(frameContentClip(), target1Properties->overflowClip()->parent()); |
| 163 // target1 should not have it's own scroll node and instead should inherit p ositionedScroll's. | |
| 164 const ObjectPaintProperties* positionedScrollProperties = positionedScroll-> layoutObject()->objectPaintProperties(); | |
| 165 EXPECT_EQ(frameScroll(), positionedScrollProperties->scroll()->parent()); | |
| 166 EXPECT_EQ(TransformationMatrix().translate(0, -3), positionedScrollPropertie s->scroll()->scrollOffsetTranslation()->matrix()); | |
| 167 EXPECT_EQ(nullptr, target1Properties->scroll()); | |
| 168 | |
| 148 CHECK_EXACT_VISUAL_RECT(LayoutRect(200, 150, 100, 100), target1->layoutObjec t(), frameView->layoutView()); | 169 CHECK_EXACT_VISUAL_RECT(LayoutRect(200, 150, 100, 100), target1->layoutObjec t(), frameView->layoutView()); |
| 149 | 170 |
| 150 // target2 is a fixed-position element inside a transformed scrolling elemen t. | 171 // target2 is a fixed-position element inside a transformed scrolling elemen t. |
| 151 // It should be attached under the scrolled box of the transformed element. | 172 // It should be attached under the scrolled box of the transformed element. |
| 152 Element* target2 = document().getElementById("target2"); | 173 Element* target2 = document().getElementById("target2"); |
| 153 const ObjectPaintProperties* target2Properties = target2->layoutObject()->ob jectPaintProperties(); | 174 const ObjectPaintProperties* target2Properties = target2->layoutObject()->ob jectPaintProperties(); |
| 154 Element* scroller = document().getElementById("scroller"); | 175 Element* scroller = document().getElementById("transformedScroll"); |
| 155 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()-> objectPaintProperties(); | 176 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()-> objectPaintProperties(); |
| 156 EXPECT_EQ(TransformationMatrix().translate(200, 150), target2Properties->pai ntOffsetTranslation()->matrix()); | 177 EXPECT_EQ(TransformationMatrix().translate(200, 150), target2Properties->pai ntOffsetTranslation()->matrix()); |
| 157 EXPECT_EQ(scrollerProperties->scrollTranslation(), target2Properties->paintO ffsetTranslation()->parent()); | 178 EXPECT_EQ(scrollerProperties->scrollTranslation(), target2Properties->paintO ffsetTranslation()->parent()); |
| 158 EXPECT_EQ(target2Properties->paintOffsetTranslation(), target2Properties->ov erflowClip()->localTransformSpace()); | 179 EXPECT_EQ(target2Properties->paintOffsetTranslation(), target2Properties->ov erflowClip()->localTransformSpace()); |
| 159 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target2Properties->overflowClip( )->clipRect()); | 180 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target2Properties->overflowClip( )->clipRect()); |
| 160 EXPECT_EQ(scrollerProperties->overflowClip(), target2Properties->overflowCli p()->parent()); | 181 EXPECT_EQ(scrollerProperties->overflowClip(), target2Properties->overflowCli p()->parent()); |
| 161 CHECK_EXACT_VISUAL_RECT(LayoutRect(208, 158, 200, 100), target2->layoutObjec t(), frameView->layoutView()); | 182 // target2 should not have it's own scroll node and instead should inherit t ransformedScroll's. |
| 183 const ObjectPaintProperties* transformedScrollProperties = transformedScroll ->layoutObject()->objectPaintProperties(); | |
| 184 EXPECT_EQ(frameScroll(), transformedScrollProperties->scroll()->parent()); | |
| 185 EXPECT_EQ(TransformationMatrix().translate(0, -5), transformedScrollProperti es->scroll()->scrollOffsetTranslation()->matrix()); | |
| 186 EXPECT_EQ(nullptr, target2Properties->scroll()); | |
| 187 | |
| 188 CHECK_EXACT_VISUAL_RECT(LayoutRect(208, 153, 200, 100), target2->layoutObjec t(), frameView->layoutView()); | |
| 162 } | 189 } |
| 163 | 190 |
| 164 TEST_P(PaintPropertyTreeBuilderTest, PositionAndScroll) | 191 TEST_P(PaintPropertyTreeBuilderTest, PositionAndScroll) |
| 165 { | 192 { |
| 166 loadTestData("position-and-scroll.html"); | 193 loadTestData("position-and-scroll.html"); |
| 167 | 194 |
| 168 Element* scroller = document().getElementById("scroller"); | 195 Element* scroller = document().getElementById("scroller"); |
| 169 scroller->scrollTo(0, 100); | 196 scroller->scrollTo(0, 100); |
| 170 FrameView* frameView = document().view(); | 197 FrameView* frameView = document().view(); |
| 171 frameView->updateAllLifecyclePhases(); | 198 frameView->updateAllLifecyclePhases(); |
| 172 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()-> objectPaintProperties(); | 199 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()-> objectPaintProperties(); |
| 173 EXPECT_EQ(TransformationMatrix().translate(0, -100), scrollerProperties->scr ollTranslation()->matrix()); | 200 EXPECT_EQ(TransformationMatrix().translate(0, -100), scrollerProperties->scr ollTranslation()->matrix()); |
| 174 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->scrollTranslation()- >parent()); | 201 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->scrollTranslation()- >parent()); |
| 175 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->overflowClip()->loca lTransformSpace()); | 202 EXPECT_EQ(frameScrollTranslation(), scrollerProperties->overflowClip()->loca lTransformSpace()); |
| 176 EXPECT_EQ(FloatRoundedRect(120, 340, 400, 300), scrollerProperties->overflow Clip()->clipRect()); | 203 EXPECT_EQ(frameScroll(), scrollerProperties->scroll()->parent()); |
| 204 EXPECT_EQ(FloatSize(413, 317), scrollerProperties->scroll()->clip()); | |
| 205 EXPECT_EQ(FloatSize(660, 10200), scrollerProperties->scroll()->bounds()); | |
| 206 EXPECT_FALSE(scrollerProperties->scroll()->userScrollableHorizontal()); | |
| 207 EXPECT_TRUE(scrollerProperties->scroll()->userScrollableVertical()); | |
| 208 EXPECT_EQ(FloatRoundedRect(120, 340, 413, 317), scrollerProperties->overflow Clip()->clipRect()); | |
| 177 EXPECT_EQ(frameContentClip(), scrollerProperties->overflowClip()->parent()); | 209 EXPECT_EQ(frameContentClip(), scrollerProperties->overflowClip()->parent()); |
| 178 // http://crbug.com/638415 | 210 // http://crbug.com/638415 |
| 179 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 211 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 180 CHECK_EXACT_VISUAL_RECT(LayoutRect(120, 340, 400, 300), scroller->layout Object(), frameView->layoutView()); | 212 CHECK_EXACT_VISUAL_RECT(LayoutRect(120, 340, 413, 317), scroller->layout Object(), frameView->layoutView()); |
| 181 } | 213 } |
| 182 | 214 |
| 183 // The relative-positioned element should have accumulated box offset (exclu de scrolling), | 215 // The relative-positioned element should have accumulated box offset (exclu de scrolling), |
| 184 // and should be affected by ancestor scroll transforms. | 216 // and should be affected by ancestor scroll transforms. |
| 185 Element* relPos = document().getElementById("rel-pos"); | 217 Element* relPos = document().getElementById("rel-pos"); |
| 186 const ObjectPaintProperties* relPosProperties = relPos->layoutObject()->obje ctPaintProperties(); | 218 const ObjectPaintProperties* relPosProperties = relPos->layoutObject()->obje ctPaintProperties(); |
| 187 EXPECT_EQ(TransformationMatrix().translate(680, 1120), relPosProperties->pai ntOffsetTranslation()->matrix()); | 219 EXPECT_EQ(TransformationMatrix().translate(680, 1120), relPosProperties->pai ntOffsetTranslation()->matrix()); |
| 188 EXPECT_EQ(scrollerProperties->scrollTranslation(), relPosProperties->paintOf fsetTranslation()->parent()); | 220 EXPECT_EQ(scrollerProperties->scrollTranslation(), relPosProperties->paintOf fsetTranslation()->parent()); |
| 189 EXPECT_EQ(relPosProperties->transform(), relPosProperties->overflowClip()->l ocalTransformSpace()); | 221 EXPECT_EQ(relPosProperties->transform(), relPosProperties->overflowClip()->l ocalTransformSpace()); |
| 190 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 200), relPosProperties->overflowClip() ->clipRect()); | 222 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 200), relPosProperties->overflowClip() ->clipRect()); |
| (...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1707 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")- >layoutObject(); | 1739 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")- >layoutObject(); |
| 1708 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec tPaintProperties(); | 1740 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec tPaintProperties(); |
| 1709 | 1741 |
| 1710 EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBox Properties()->propertyTreeState.transform); | 1742 EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBox Properties()->propertyTreeState.transform); |
| 1711 | 1743 |
| 1712 PropertyTreeState contentsProperties; | 1744 PropertyTreeState contentsProperties; |
| 1713 svgWithViewBoxProperties->getContentsProperties(contentsProperties); | 1745 svgWithViewBoxProperties->getContentsProperties(contentsProperties); |
| 1714 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents Properties.transform); | 1746 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents Properties.transform); |
| 1715 } | 1747 } |
| 1716 | 1748 |
| 1749 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties) | |
| 1750 { | |
| 1751 setBodyInnerHTML( | |
| 1752 "<style>" | |
| 1753 " body {" | |
| 1754 " margin: 0px;" | |
| 1755 " }" | |
| 1756 " #overflowHidden {" | |
| 1757 " overflow: hidden;" | |
| 1758 " width: 5px;" | |
| 1759 " height: 3px;" | |
| 1760 " }" | |
| 1761 " .forceScroll {" | |
| 1762 " height: 79px;" | |
| 1763 " }" | |
| 1764 "</style>" | |
| 1765 "<div id='overflowHidden'>" | |
| 1766 " <div class='forceScroll'></div>" | |
| 1767 "</div>"); | |
| 1768 | |
| 1769 Element* overflowHidden = document().getElementById("overflowHidden"); | |
| 1770 overflowHidden->setScrollTop(37); | |
| 1771 | |
| 1772 document().view()->updateAllLifecyclePhases(); | |
| 1773 | |
| 1774 const ObjectPaintProperties* overflowHiddenScrollProperties = overflowHidden ->layoutObject()->objectPaintProperties(); | |
| 1775 EXPECT_EQ(frameScroll(), overflowHiddenScrollProperties->scroll()->parent()) ; | |
| 1776 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowHiddenScrollProp erties->scroll()->scrollOffsetTranslation()->matrix()); | |
| 1777 // This should match the overflow's dimensions. | |
| 1778 EXPECT_EQ(IntSize(5, 3), overflowHiddenScrollProperties->scroll()->clip()); | |
| 1779 // The scrolling content's bounds should include both the overflow's dimensi ons (5x3) and the | |
| 1780 // 0x79 "forceScroll" object. | |
| 1781 EXPECT_EQ(IntSize(5, 79), overflowHiddenScrollProperties->scroll()->bounds() ); | |
| 1782 // Although overflow: hidden is programmatically scrollable, it is not user scrollable. | |
| 1783 EXPECT_FALSE(overflowHiddenScrollProperties->scroll()->userScrollableHorizon tal()); | |
| 1784 EXPECT_FALSE(overflowHiddenScrollProperties->scroll()->userScrollableVertica l()); | |
| 1785 } | |
| 1786 | |
| 1787 TEST_P(PaintPropertyTreeBuilderTest, NestedScrollProperties) | |
| 1788 { | |
| 1789 setBodyInnerHTML( | |
| 1790 "<style>" | |
| 1791 " * {" | |
| 1792 " margin: 0px;" | |
| 1793 " }" | |
| 1794 " #overflowA {" | |
| 1795 " overflow: scroll;" | |
| 1796 " width: 5px;" | |
| 1797 " height: 3px;" | |
| 1798 " }" | |
| 1799 " #overflowB {" | |
| 1800 " overflow: scroll;" | |
| 1801 " width: 9px;" | |
| 1802 " height: 7px;" | |
| 1803 " }" | |
| 1804 " .forceScroll {" | |
| 1805 " height: 100px;" | |
| 1806 " }" | |
| 1807 "</style>" | |
| 1808 "<div id='overflowA'>" | |
| 1809 " <div id='overflowB'>" | |
| 1810 " <div class='forceScroll'></div>" | |
| 1811 " </div>" | |
| 1812 " <div class='forceScroll'></div>" | |
| 1813 "</div>"); | |
| 1814 | |
| 1815 Element* overflowA = document().getElementById("overflowA"); | |
| 1816 overflowA->setScrollTop(37); | |
| 1817 Element* overflowB = document().getElementById("overflowB"); | |
| 1818 overflowB->setScrollTop(41); | |
| 1819 | |
| 1820 document().view()->updateAllLifecyclePhases(); | |
| 1821 | |
| 1822 const ObjectPaintProperties* overflowAScrollProperties = overflowA->layoutOb ject()->objectPaintProperties(); | |
| 1823 EXPECT_EQ(frameScroll(), overflowAScrollProperties->scroll()->parent()); | |
| 1824 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowAScrollPropertie s->scroll()->scrollOffsetTranslation()->matrix()); | |
| 1825 EXPECT_EQ(IntSize(5, 3), overflowAScrollProperties->scroll()->clip()); | |
| 1826 // 107 is the forceScroll element plus the height of the overflow scroll chi ld (overflowB). | |
| 1827 EXPECT_EQ(IntSize(9, 107), overflowAScrollProperties->scroll()->bounds()); | |
| 1828 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableHorizontal()) ; | |
| 1829 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableVertical()); | |
| 1830 | |
| 1831 const ObjectPaintProperties* overflowBScrollProperties = overflowB->layoutOb ject()->objectPaintProperties(); | |
| 1832 // The overflow child's scroll node should be a child of the parent's (overf lowA) scroll node. | |
| 1833 EXPECT_EQ(overflowAScrollProperties->scroll(), overflowBScrollProperties->sc roll()->parent()); | |
| 1834 EXPECT_EQ(TransformationMatrix().translate(0, -41), overflowBScrollPropertie s->scroll()->scrollOffsetTranslation()->matrix()); | |
| 1835 EXPECT_EQ(IntSize(9, 7), overflowBScrollProperties->scroll()->clip()); | |
| 1836 EXPECT_EQ(IntSize(9, 100), overflowBScrollProperties->scroll()->bounds()); | |
| 1837 EXPECT_TRUE(overflowBScrollProperties->scroll()->userScrollableHorizontal()) ; | |
| 1838 EXPECT_TRUE(overflowBScrollProperties->scroll()->userScrollableVertical()); | |
| 1839 } | |
| 1840 | |
| 1841 TEST_P(PaintPropertyTreeBuilderTest, PositionedScrollerIsNotNested) | |
| 1842 { | |
| 1843 setBodyInnerHTML( | |
| 1844 "<style>" | |
| 1845 " * {" | |
| 1846 " margin: 0px;" | |
| 1847 " }" | |
| 1848 " #overflow {" | |
| 1849 " overflow: scroll;" | |
| 1850 " width: 5px;" | |
| 1851 " height: 3px;" | |
| 1852 " }" | |
| 1853 " #positionedOverflow {" | |
|
chrishtr
2016/09/08 20:43:59
s/positionedOverflow/absposOverflow/
| |
| 1854 " position: absolute;" | |
| 1855 " top: 0;" | |
| 1856 " left: 0;" | |
| 1857 " overflow: scroll;" | |
| 1858 " width: 9px;" | |
| 1859 " height: 7px;" | |
| 1860 " }" | |
| 1861 " .forceScroll {" | |
| 1862 " height: 100px;" | |
| 1863 " }" | |
| 1864 "</style>" | |
| 1865 "<div id='overflow'>" | |
| 1866 " <div id='positionedOverflow'>" | |
|
chrishtr
2016/09/08 20:43:59
Also add a fixed-pos child. And another test that
pdr.
2016/09/08 23:16:26
Adding the fixed-pos test revealed a bug where we
chrishtr
2016/09/09 16:27:28
It only has a child with absolute position. I'm su
| |
| 1867 " <div class='forceScroll'></div>" | |
| 1868 " </div>" | |
| 1869 " <div class='forceScroll'></div>" | |
| 1870 "</div>"); | |
| 1871 | |
| 1872 Element* overflow = document().getElementById("overflow"); | |
| 1873 overflow->setScrollTop(37); | |
| 1874 Element* positionedOverflow = document().getElementById("positionedOverflow" ); | |
| 1875 positionedOverflow->setScrollTop(41); | |
| 1876 | |
| 1877 document().view()->updateAllLifecyclePhases(); | |
| 1878 | |
| 1879 const ObjectPaintProperties* overflowScrollProperties = overflow->layoutObje ct()->objectPaintProperties(); | |
| 1880 EXPECT_EQ(frameScroll(), overflowScrollProperties->scroll()->parent()); | |
| 1881 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowScrollProperties ->scroll()->scrollOffsetTranslation()->matrix()); | |
| 1882 EXPECT_EQ(IntSize(5, 3), overflowScrollProperties->scroll()->clip()); | |
| 1883 // The height should be 100px because the (dom-order) overflow child is posi tioned and does not | |
| 1884 // contribute to the height. Only the 100px "forceScroll" height is present. | |
| 1885 EXPECT_EQ(IntSize(5, 100), overflowScrollProperties->scroll()->bounds()); | |
| 1886 | |
| 1887 const ObjectPaintProperties* positionedOverflowScrollProperties = positioned Overflow->layoutObject()->objectPaintProperties(); | |
| 1888 // The positioned overflow scroll node is parented under the frame, not the dom-order parent. | |
| 1889 EXPECT_EQ(frameScroll(), positionedOverflowScrollProperties->scroll()->paren t()); | |
| 1890 EXPECT_EQ(TransformationMatrix().translate(0, -41), positionedOverflowScroll Properties->scroll()->scrollOffsetTranslation()->matrix()); | |
| 1891 EXPECT_EQ(IntSize(9, 7), positionedOverflowScrollProperties->scroll()->clip( )); | |
| 1892 EXPECT_EQ(IntSize(9, 100), positionedOverflowScrollProperties->scroll()->bou nds()); | |
| 1893 } | |
| 1894 | |
| 1717 } // namespace blink | 1895 } // namespace blink |
| OLD | NEW |