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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 void loadTestData(const char* fileName) | 34 void loadTestData(const char* fileName) |
35 { | 35 { |
36 String fullPath = testing::blinkRootDir(); | 36 String fullPath = testing::blinkRootDir(); |
37 fullPath.append("/Source/core/paint/test_data/"); | 37 fullPath.append("/Source/core/paint/test_data/"); |
38 fullPath.append(fileName); | 38 fullPath.append(fileName); |
39 RefPtr<SharedBuffer> inputBuffer = testing::readFromFile(fullPath); | 39 RefPtr<SharedBuffer> inputBuffer = testing::readFromFile(fullPath); |
40 setBodyInnerHTML(String(inputBuffer->data(), inputBuffer->size())); | 40 setBodyInnerHTML(String(inputBuffer->data(), inputBuffer->size())); |
41 } | 41 } |
42 | 42 |
43 const TransformPaintPropertyNode* rootTransform() | |
44 { | |
45 FrameView* frameView = document().view(); | |
46 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | |
47 return frameView->layoutView()->objectPaintProperties()->paintOffset
Translation(); | |
48 return frameView->rootTransform(); | |
49 } | |
50 | |
51 const ClipPaintPropertyNode* rootClip() | |
52 { | |
53 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | |
54 return document().view()->layoutView()->objectPaintProperties()->loc
alBorderBoxProperties()->geometryPropertyTreeState.clip.get(); | |
55 return document().view()->rootClip(); | |
56 } | |
57 | |
58 const ScrollPaintPropertyNode* rootScroll() | |
59 { | |
60 FrameView* frameView = document().view(); | |
61 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | |
62 return frameView->layoutView()->objectPaintProperties()->scroll(); | |
63 return frameView->rootScroll(); | |
64 } | |
65 | |
66 const TransformPaintPropertyNode* framePreTranslation() | 43 const TransformPaintPropertyNode* framePreTranslation() |
67 { | 44 { |
68 FrameView* frameView = document().view(); | 45 FrameView* frameView = document().view(); |
69 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 46 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
70 return frameView->layoutView()->objectPaintProperties()->paintOffset
Translation(); | 47 return frameView->layoutView()->objectPaintProperties()->paintOffset
Translation(); |
71 return frameView->preTranslation(); | 48 return frameView->preTranslation(); |
72 } | 49 } |
73 | 50 |
74 const TransformPaintPropertyNode* frameScrollTranslation() | 51 const TransformPaintPropertyNode* frameScrollTranslation() |
75 { | 52 { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 Element* target1 = document().getElementById("target1"); | 140 Element* target1 = document().getElementById("target1"); |
164 const ObjectPaintProperties* target1Properties = target1->layoutObject()->ob
jectPaintProperties(); | 141 const ObjectPaintProperties* target1Properties = target1->layoutObject()->ob
jectPaintProperties(); |
165 EXPECT_EQ(TransformationMatrix().translate(200, 150), target1Properties->pai
ntOffsetTranslation()->matrix()); | 142 EXPECT_EQ(TransformationMatrix().translate(200, 150), target1Properties->pai
ntOffsetTranslation()->matrix()); |
166 EXPECT_EQ(framePreTranslation(), target1Properties->paintOffsetTranslation()
->parent()); | 143 EXPECT_EQ(framePreTranslation(), target1Properties->paintOffsetTranslation()
->parent()); |
167 EXPECT_EQ(target1Properties->paintOffsetTranslation(), target1Properties->ov
erflowClip()->localTransformSpace()); | 144 EXPECT_EQ(target1Properties->paintOffsetTranslation(), target1Properties->ov
erflowClip()->localTransformSpace()); |
168 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target1Properties->overflowClip(
)->clipRect()); | 145 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target1Properties->overflowClip(
)->clipRect()); |
169 // Likewise, it inherits clip from the viewport, skipping overflow clip of t
he scroller. | 146 // Likewise, it inherits clip from the viewport, skipping overflow clip of t
he scroller. |
170 EXPECT_EQ(frameContentClip(), target1Properties->overflowClip()->parent()); | 147 EXPECT_EQ(frameContentClip(), target1Properties->overflowClip()->parent()); |
171 // target1 should not have it's own scroll node and instead should inherit p
ositionedScroll's. | 148 // target1 should not have it's own scroll node and instead should inherit p
ositionedScroll's. |
172 const ObjectPaintProperties* positionedScrollProperties = positionedScroll->
layoutObject()->objectPaintProperties(); | 149 const ObjectPaintProperties* positionedScrollProperties = positionedScroll->
layoutObject()->objectPaintProperties(); |
173 EXPECT_EQ(rootScroll(), positionedScrollProperties->scroll()->parent()); | 150 EXPECT_TRUE(positionedScrollProperties->scroll()->parent()->isRoot()); |
174 EXPECT_EQ(TransformationMatrix().translate(0, -3), positionedScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); | 151 EXPECT_EQ(TransformationMatrix().translate(0, -3), positionedScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); |
175 EXPECT_EQ(nullptr, target1Properties->scroll()); | 152 EXPECT_EQ(nullptr, target1Properties->scroll()); |
176 | 153 |
177 CHECK_EXACT_VISUAL_RECT(LayoutRect(200, 150, 100, 100), target1->layoutObjec
t(), frameView->layoutView()); | 154 CHECK_EXACT_VISUAL_RECT(LayoutRect(200, 150, 100, 100), target1->layoutObjec
t(), frameView->layoutView()); |
178 | 155 |
179 // target2 is a fixed-position element inside a transformed scrolling elemen
t. | 156 // target2 is a fixed-position element inside a transformed scrolling elemen
t. |
180 // It should be attached under the scrolled box of the transformed element. | 157 // It should be attached under the scrolled box of the transformed element. |
181 Element* target2 = document().getElementById("target2"); | 158 Element* target2 = document().getElementById("target2"); |
182 const ObjectPaintProperties* target2Properties = target2->layoutObject()->ob
jectPaintProperties(); | 159 const ObjectPaintProperties* target2Properties = target2->layoutObject()->ob
jectPaintProperties(); |
183 Element* scroller = document().getElementById("transformedScroll"); | 160 Element* scroller = document().getElementById("transformedScroll"); |
184 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()->
objectPaintProperties(); | 161 const ObjectPaintProperties* scrollerProperties = scroller->layoutObject()->
objectPaintProperties(); |
185 EXPECT_EQ(TransformationMatrix().translate(200, 150), target2Properties->pai
ntOffsetTranslation()->matrix()); | 162 EXPECT_EQ(TransformationMatrix().translate(200, 150), target2Properties->pai
ntOffsetTranslation()->matrix()); |
186 EXPECT_EQ(scrollerProperties->scrollTranslation(), target2Properties->paintO
ffsetTranslation()->parent()); | 163 EXPECT_EQ(scrollerProperties->scrollTranslation(), target2Properties->paintO
ffsetTranslation()->parent()); |
187 EXPECT_EQ(target2Properties->paintOffsetTranslation(), target2Properties->ov
erflowClip()->localTransformSpace()); | 164 EXPECT_EQ(target2Properties->paintOffsetTranslation(), target2Properties->ov
erflowClip()->localTransformSpace()); |
188 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target2Properties->overflowClip(
)->clipRect()); | 165 EXPECT_EQ(FloatRoundedRect(0, 0, 100, 100), target2Properties->overflowClip(
)->clipRect()); |
189 EXPECT_EQ(scrollerProperties->overflowClip(), target2Properties->overflowCli
p()->parent()); | 166 EXPECT_EQ(scrollerProperties->overflowClip(), target2Properties->overflowCli
p()->parent()); |
190 // target2 should not have it's own scroll node and instead should inherit t
ransformedScroll's. | 167 // target2 should not have it's own scroll node and instead should inherit t
ransformedScroll's. |
191 const ObjectPaintProperties* transformedScrollProperties = transformedScroll
->layoutObject()->objectPaintProperties(); | 168 const ObjectPaintProperties* transformedScrollProperties = transformedScroll
->layoutObject()->objectPaintProperties(); |
192 EXPECT_EQ(rootScroll(), transformedScrollProperties->scroll()->parent()); | 169 EXPECT_TRUE(transformedScrollProperties->scroll()->parent()->isRoot()); |
193 EXPECT_EQ(TransformationMatrix().translate(0, -5), transformedScrollProperti
es->scroll()->scrollOffsetTranslation()->matrix()); | 170 EXPECT_EQ(TransformationMatrix().translate(0, -5), transformedScrollProperti
es->scroll()->scrollOffsetTranslation()->matrix()); |
194 EXPECT_EQ(nullptr, target2Properties->scroll()); | 171 EXPECT_EQ(nullptr, target2Properties->scroll()); |
195 | 172 |
196 CHECK_EXACT_VISUAL_RECT(LayoutRect(208, 153, 200, 100), target2->layoutObjec
t(), frameView->layoutView()); | 173 CHECK_EXACT_VISUAL_RECT(LayoutRect(208, 153, 200, 100), target2->layoutObjec
t(), frameView->layoutView()); |
197 } | 174 } |
198 | 175 |
199 TEST_P(PaintPropertyTreeBuilderTest, PositionAndScroll) | 176 TEST_P(PaintPropertyTreeBuilderTest, PositionAndScroll) |
200 { | 177 { |
201 loadTestData("position-and-scroll.html"); | 178 loadTestData("position-and-scroll.html"); |
202 | 179 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 TEST_P(PaintPropertyTreeBuilderTest, FrameScrollingTraditional) | 225 TEST_P(PaintPropertyTreeBuilderTest, FrameScrollingTraditional) |
249 { | 226 { |
250 setBodyInnerHTML("<style> body { height: 10000px; } </style>"); | 227 setBodyInnerHTML("<style> body { height: 10000px; } </style>"); |
251 | 228 |
252 document().domWindow()->scrollTo(0, 100); | 229 document().domWindow()->scrollTo(0, 100); |
253 | 230 |
254 FrameView* frameView = document().view(); | 231 FrameView* frameView = document().view(); |
255 frameView->updateAllLifecyclePhases(); | 232 frameView->updateAllLifecyclePhases(); |
256 EXPECT_EQ(TransformationMatrix(), framePreTranslation()->matrix()); | 233 EXPECT_EQ(TransformationMatrix(), framePreTranslation()->matrix()); |
257 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 234 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
258 EXPECT_EQ(rootTransform(), framePreTranslation()->parent()); | 235 EXPECT_TRUE(framePreTranslation()->parent()->isRoot()); |
259 EXPECT_EQ(nullptr, rootTransform()->parent()); | 236 |
260 EXPECT_EQ(TransformationMatrix().translate(0, -100), frameScrollTranslation(
)->matrix()); | 237 EXPECT_EQ(TransformationMatrix().translate(0, -100), frameScrollTranslation(
)->matrix()); |
261 EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent()); | 238 EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent()); |
262 EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace()); | 239 EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace()); |
263 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect()); | 240 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect()); |
264 EXPECT_EQ(rootClip(), frameContentClip()->parent()); | 241 EXPECT_TRUE(frameContentClip()->parent()->isRoot()); |
265 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | |
266 EXPECT_EQ(nullptr, rootClip()->parent()); | |
267 | 242 |
268 LayoutViewItem layoutViewItem = document().layoutViewItem(); | 243 LayoutViewItem layoutViewItem = document().layoutViewItem(); |
269 const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPai
ntProperties(); | 244 const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPai
ntProperties(); |
270 // http://crbug.com/638415 | 245 // http://crbug.com/638415 |
271 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 246 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
272 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); | 247 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); |
273 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 10000), document().body()-
>layoutObject(), frameView->layoutView()); | 248 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 10000), document().body()-
>layoutObject(), frameView->layoutView()); |
274 } | 249 } |
275 } | 250 } |
276 | 251 |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 " <div class='forceScroll'></div>" | 1749 " <div class='forceScroll'></div>" |
1775 "</div>"); | 1750 "</div>"); |
1776 | 1751 |
1777 Element* overflowHidden = document().getElementById("overflowHidden"); | 1752 Element* overflowHidden = document().getElementById("overflowHidden"); |
1778 overflowHidden->setScrollTop(37); | 1753 overflowHidden->setScrollTop(37); |
1779 | 1754 |
1780 document().view()->updateAllLifecyclePhases(); | 1755 document().view()->updateAllLifecyclePhases(); |
1781 | 1756 |
1782 const ObjectPaintProperties* overflowHiddenScrollProperties = overflowHidden
->layoutObject()->objectPaintProperties(); | 1757 const ObjectPaintProperties* overflowHiddenScrollProperties = overflowHidden
->layoutObject()->objectPaintProperties(); |
1783 // Because the frameView is does not scroll, overflowHidden's scroll should
be under the root. | 1758 // Because the frameView is does not scroll, overflowHidden's scroll should
be under the root. |
1784 EXPECT_EQ(rootScroll(), overflowHiddenScrollProperties->scroll()->parent()); | 1759 EXPECT_TRUE(overflowHiddenScrollProperties->scroll()->parent()->isRoot()); |
1785 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowHiddenScrollProp
erties->scroll()->scrollOffsetTranslation()->matrix()); | 1760 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowHiddenScrollProp
erties->scroll()->scrollOffsetTranslation()->matrix()); |
1786 // This should match the overflow's dimensions. | 1761 // This should match the overflow's dimensions. |
1787 EXPECT_EQ(IntSize(5, 3), overflowHiddenScrollProperties->scroll()->clip()); | 1762 EXPECT_EQ(IntSize(5, 3), overflowHiddenScrollProperties->scroll()->clip()); |
1788 // The scrolling content's bounds should include both the overflow's dimensi
ons (5x3) and the | 1763 // The scrolling content's bounds should include both the overflow's dimensi
ons (5x3) and the |
1789 // 0x79 "forceScroll" object. | 1764 // 0x79 "forceScroll" object. |
1790 EXPECT_EQ(IntSize(5, 79), overflowHiddenScrollProperties->scroll()->bounds()
); | 1765 EXPECT_EQ(IntSize(5, 79), overflowHiddenScrollProperties->scroll()->bounds()
); |
1791 // Although overflow: hidden is programmatically scrollable, it is not user
scrollable. | 1766 // Although overflow: hidden is programmatically scrollable, it is not user
scrollable. |
1792 EXPECT_FALSE(overflowHiddenScrollProperties->scroll()->userScrollableHorizon
tal()); | 1767 EXPECT_FALSE(overflowHiddenScrollProperties->scroll()->userScrollableHorizon
tal()); |
1793 EXPECT_FALSE(overflowHiddenScrollProperties->scroll()->userScrollableVertica
l()); | 1768 EXPECT_FALSE(overflowHiddenScrollProperties->scroll()->userScrollableVertica
l()); |
1794 } | 1769 } |
(...skipping 28 matching lines...) Expand all Loading... |
1823 | 1798 |
1824 Element* overflowA = document().getElementById("overflowA"); | 1799 Element* overflowA = document().getElementById("overflowA"); |
1825 overflowA->setScrollTop(37); | 1800 overflowA->setScrollTop(37); |
1826 Element* overflowB = document().getElementById("overflowB"); | 1801 Element* overflowB = document().getElementById("overflowB"); |
1827 overflowB->setScrollTop(41); | 1802 overflowB->setScrollTop(41); |
1828 | 1803 |
1829 document().view()->updateAllLifecyclePhases(); | 1804 document().view()->updateAllLifecyclePhases(); |
1830 | 1805 |
1831 const ObjectPaintProperties* overflowAScrollProperties = overflowA->layoutOb
ject()->objectPaintProperties(); | 1806 const ObjectPaintProperties* overflowAScrollProperties = overflowA->layoutOb
ject()->objectPaintProperties(); |
1832 // Because the frameView is does not scroll, overflowA's scroll should be un
der the root. | 1807 // Because the frameView is does not scroll, overflowA's scroll should be un
der the root. |
1833 EXPECT_EQ(rootScroll(), overflowAScrollProperties->scroll()->parent()); | 1808 EXPECT_TRUE(overflowAScrollProperties->scroll()->parent()->isRoot()); |
1834 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowAScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); | 1809 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowAScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); |
1835 EXPECT_EQ(IntSize(5, 3), overflowAScrollProperties->scroll()->clip()); | 1810 EXPECT_EQ(IntSize(5, 3), overflowAScrollProperties->scroll()->clip()); |
1836 // 107 is the forceScroll element plus the height of the overflow scroll chi
ld (overflowB). | 1811 // 107 is the forceScroll element plus the height of the overflow scroll chi
ld (overflowB). |
1837 EXPECT_EQ(IntSize(9, 107), overflowAScrollProperties->scroll()->bounds()); | 1812 EXPECT_EQ(IntSize(9, 107), overflowAScrollProperties->scroll()->bounds()); |
1838 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableHorizontal())
; | 1813 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableHorizontal())
; |
1839 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableVertical()); | 1814 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableVertical()); |
1840 | 1815 |
1841 const ObjectPaintProperties* overflowBScrollProperties = overflowB->layoutOb
ject()->objectPaintProperties(); | 1816 const ObjectPaintProperties* overflowBScrollProperties = overflowB->layoutOb
ject()->objectPaintProperties(); |
1842 // The overflow child's scroll node should be a child of the parent's (overf
lowA) scroll node. | 1817 // The overflow child's scroll node should be a child of the parent's (overf
lowA) scroll node. |
1843 EXPECT_EQ(overflowAScrollProperties->scroll(), overflowBScrollProperties->sc
roll()->parent()); | 1818 EXPECT_EQ(overflowAScrollProperties->scroll(), overflowBScrollProperties->sc
roll()->parent()); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1913 | 1888 |
1914 const ObjectPaintProperties* absposOverflowScrollProperties = absposOverflow
->layoutObject()->objectPaintProperties(); | 1889 const ObjectPaintProperties* absposOverflowScrollProperties = absposOverflow
->layoutObject()->objectPaintProperties(); |
1915 // The absolute position overflow scroll node is parented under the frame, n
ot the dom-order parent. | 1890 // The absolute position overflow scroll node is parented under the frame, n
ot the dom-order parent. |
1916 EXPECT_EQ(frameScroll(), absposOverflowScrollProperties->scroll()->parent())
; | 1891 EXPECT_EQ(frameScroll(), absposOverflowScrollProperties->scroll()->parent())
; |
1917 EXPECT_EQ(TransformationMatrix().translate(0, -41), absposOverflowScrollProp
erties->scroll()->scrollOffsetTranslation()->matrix()); | 1892 EXPECT_EQ(TransformationMatrix().translate(0, -41), absposOverflowScrollProp
erties->scroll()->scrollOffsetTranslation()->matrix()); |
1918 EXPECT_EQ(IntSize(9, 7), absposOverflowScrollProperties->scroll()->clip()); | 1893 EXPECT_EQ(IntSize(9, 7), absposOverflowScrollProperties->scroll()->clip()); |
1919 EXPECT_EQ(IntSize(9, 4000), absposOverflowScrollProperties->scroll()->bounds
()); | 1894 EXPECT_EQ(IntSize(9, 4000), absposOverflowScrollProperties->scroll()->bounds
()); |
1920 | 1895 |
1921 const ObjectPaintProperties* fixedOverflowScrollProperties = fixedOverflow->
layoutObject()->objectPaintProperties(); | 1896 const ObjectPaintProperties* fixedOverflowScrollProperties = fixedOverflow->
layoutObject()->objectPaintProperties(); |
1922 // The fixed position overflow scroll node is parented under the root, not t
he dom-order parent or frame's scroll. | 1897 // The fixed position overflow scroll node is parented under the root, not t
he dom-order parent or frame's scroll. |
1923 EXPECT_EQ(rootScroll(), fixedOverflowScrollProperties->scroll()->parent()); | 1898 EXPECT_TRUE(fixedOverflowScrollProperties->scroll()->parent()->isRoot()); |
1924 EXPECT_EQ(TransformationMatrix().translate(0, -43), fixedOverflowScrollPrope
rties->scroll()->scrollOffsetTranslation()->matrix()); | 1899 EXPECT_EQ(TransformationMatrix().translate(0, -43), fixedOverflowScrollPrope
rties->scroll()->scrollOffsetTranslation()->matrix()); |
1925 EXPECT_EQ(IntSize(13, 11), fixedOverflowScrollProperties->scroll()->clip()); | 1900 EXPECT_EQ(IntSize(13, 11), fixedOverflowScrollProperties->scroll()->clip()); |
1926 EXPECT_EQ(IntSize(13, 4000), fixedOverflowScrollProperties->scroll()->bounds
()); | 1901 EXPECT_EQ(IntSize(13, 4000), fixedOverflowScrollProperties->scroll()->bounds
()); |
1927 } | 1902 } |
1928 | 1903 |
1929 TEST_P(PaintPropertyTreeBuilderTest, NestedPositionedScrollProperties) | 1904 TEST_P(PaintPropertyTreeBuilderTest, NestedPositionedScrollProperties) |
1930 { | 1905 { |
1931 setBodyInnerHTML( | 1906 setBodyInnerHTML( |
1932 "<style>" | 1907 "<style>" |
1933 " * {" | 1908 " * {" |
(...skipping 28 matching lines...) Expand all Loading... |
1962 | 1937 |
1963 Element* overflowA = document().getElementById("overflowA"); | 1938 Element* overflowA = document().getElementById("overflowA"); |
1964 overflowA->setScrollTop(37); | 1939 overflowA->setScrollTop(37); |
1965 Element* overflowB = document().getElementById("overflowB"); | 1940 Element* overflowB = document().getElementById("overflowB"); |
1966 overflowB->setScrollTop(41); | 1941 overflowB->setScrollTop(41); |
1967 | 1942 |
1968 document().view()->updateAllLifecyclePhases(); | 1943 document().view()->updateAllLifecyclePhases(); |
1969 | 1944 |
1970 const ObjectPaintProperties* overflowAScrollProperties = overflowA->layoutOb
ject()->objectPaintProperties(); | 1945 const ObjectPaintProperties* overflowAScrollProperties = overflowA->layoutOb
ject()->objectPaintProperties(); |
1971 // Because the frameView is does not scroll, overflowA's scroll should be un
der the root. | 1946 // Because the frameView is does not scroll, overflowA's scroll should be un
der the root. |
1972 EXPECT_EQ(rootScroll(), overflowAScrollProperties->scroll()->parent()); | 1947 EXPECT_TRUE(overflowAScrollProperties->scroll()->parent()->isRoot()); |
1973 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowAScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); | 1948 EXPECT_EQ(TransformationMatrix().translate(0, -37), overflowAScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); |
1974 EXPECT_EQ(IntSize(20, 20), overflowAScrollProperties->scroll()->clip()); | 1949 EXPECT_EQ(IntSize(20, 20), overflowAScrollProperties->scroll()->clip()); |
1975 // 100 is the forceScroll element's height because the overflow child does n
ot contribute to the height. | 1950 // 100 is the forceScroll element's height because the overflow child does n
ot contribute to the height. |
1976 EXPECT_EQ(IntSize(20, 100), overflowAScrollProperties->scroll()->bounds()); | 1951 EXPECT_EQ(IntSize(20, 100), overflowAScrollProperties->scroll()->bounds()); |
1977 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableHorizontal())
; | 1952 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableHorizontal())
; |
1978 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableVertical()); | 1953 EXPECT_TRUE(overflowAScrollProperties->scroll()->userScrollableVertical()); |
1979 | 1954 |
1980 const ObjectPaintProperties* overflowBScrollProperties = overflowB->layoutOb
ject()->objectPaintProperties(); | 1955 const ObjectPaintProperties* overflowBScrollProperties = overflowB->layoutOb
ject()->objectPaintProperties(); |
1981 // The overflow child's scroll node should be a child of the parent's (overf
lowA) scroll node. | 1956 // The overflow child's scroll node should be a child of the parent's (overf
lowA) scroll node. |
1982 EXPECT_EQ(overflowAScrollProperties->scroll(), overflowBScrollProperties->sc
roll()->parent()); | 1957 EXPECT_EQ(overflowAScrollProperties->scroll(), overflowBScrollProperties->sc
roll()->parent()); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 "<div id='overflowA'>" | 2093 "<div id='overflowA'>" |
2119 " <div id='overflowB' class='backgroundAttachmentFixed'>" | 2094 " <div id='overflowB' class='backgroundAttachmentFixed'>" |
2120 " <div class='forceScroll'></div>" | 2095 " <div class='forceScroll'></div>" |
2121 " </div>" | 2096 " </div>" |
2122 " <div class='forceScroll'></div>" | 2097 " <div class='forceScroll'></div>" |
2123 "</div>" | 2098 "</div>" |
2124 "<div class='forceScroll'></div>"); | 2099 "<div class='forceScroll'></div>"); |
2125 Element* overflowA = document().getElementById("overflowA"); | 2100 Element* overflowA = document().getElementById("overflowA"); |
2126 Element* overflowB = document().getElementById("overflowB"); | 2101 Element* overflowB = document().getElementById("overflowB"); |
2127 | 2102 |
2128 EXPECT_TRUE(rootScroll()->hasMainThreadScrollingReasons(MainThreadScrollingR
eason::kHasBackgroundAttachmentFixedObjects)); | |
2129 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); | 2103 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
2130 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); | 2104 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2105 EXPECT_TRUE(overflowB->layoutObject()->objectPaintProperties()->scroll()->pa
rent()->hasMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundA
ttachmentFixedObjects)); |
2131 | 2106 |
2132 // Removing a main thread scrolling reason should update the entire tree. | 2107 // Removing a main thread scrolling reason should update the entire tree. |
2133 overflowB->removeAttribute("class"); | 2108 overflowB->removeAttribute("class"); |
2134 document().view()->updateAllLifecyclePhases(); | 2109 document().view()->updateAllLifecyclePhases(); |
2135 EXPECT_FALSE(rootScroll()->hasMainThreadScrollingReasons(MainThreadScrolling
Reason::kHasBackgroundAttachmentFixedObjects)); | |
2136 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); | 2110 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
2137 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); | 2111 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2112 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->p
arent()->hasMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackground
AttachmentFixedObjects)); |
2138 } | 2113 } |
2139 | 2114 |
2140 } // namespace blink | 2115 } // namespace blink |
OLD | NEW |