Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp

Issue 2657863004: Move scroll paint property nodes to be owned by the transform tree (Closed)
Patch Set: Rebase & remove parens Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/html/HTMLIFrameElement.h" 5 #include "core/html/HTMLIFrameElement.h"
6 #include "core/paint/PaintPropertyTreeBuilderTest.h" 6 #include "core/paint/PaintPropertyTreeBuilderTest.h"
7 #include "core/paint/PaintPropertyTreePrinter.h" 7 #include "core/paint/PaintPropertyTreePrinter.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 17 matching lines...) Expand all
28 " }" 28 " }"
29 "</style>" 29 "</style>"
30 "<div id='overflowA'>" 30 "<div id='overflowA'>"
31 " <div class='forceScroll'></div>" 31 " <div class='forceScroll'></div>"
32 "</div>" 32 "</div>"
33 "<div class='forceScroll'></div>"); 33 "<div class='forceScroll'></div>");
34 Element* overflowA = document().getElementById("overflowA"); 34 Element* overflowA = document().getElementById("overflowA");
35 EXPECT_FALSE(frameScroll()->threadedScrollingDisabled()); 35 EXPECT_FALSE(frameScroll()->threadedScrollingDisabled());
36 EXPECT_FALSE(overflowA->layoutObject() 36 EXPECT_FALSE(overflowA->layoutObject()
37 ->paintProperties() 37 ->paintProperties()
38 ->scroll() 38 ->scrollTranslation()
39 ->scrollNode()
39 ->threadedScrollingDisabled()); 40 ->threadedScrollingDisabled());
40 41
41 document().settings()->setThreadedScrollingEnabled(false); 42 document().settings()->setThreadedScrollingEnabled(false);
42 // TODO(pdr): The main thread scrolling setting should invalidate properties. 43 // TODO(pdr): The main thread scrolling setting should invalidate properties.
43 document().view()->setNeedsPaintPropertyUpdate(); 44 document().view()->setNeedsPaintPropertyUpdate();
44 overflowA->layoutObject()->setNeedsPaintPropertyUpdate(); 45 overflowA->layoutObject()->setNeedsPaintPropertyUpdate();
45 document().view()->updateAllLifecyclePhases(); 46 document().view()->updateAllLifecyclePhases();
46 47
47 EXPECT_TRUE(frameScroll()->threadedScrollingDisabled()); 48 EXPECT_TRUE(frameScroll()->threadedScrollingDisabled());
48 EXPECT_TRUE(overflowA->layoutObject() 49 EXPECT_TRUE(overflowA->layoutObject()
49 ->paintProperties() 50 ->paintProperties()
50 ->scroll() 51 ->scrollTranslation()
52 ->scrollNode()
51 ->threadedScrollingDisabled()); 53 ->threadedScrollingDisabled());
52 } 54 }
53 55
54 TEST_P(PaintPropertyTreeUpdateTest, 56 TEST_P(PaintPropertyTreeUpdateTest,
55 BackgroundAttachmentFixedMainThreadScrollReasonsWithNestedScrollers) { 57 BackgroundAttachmentFixedMainThreadScrollReasonsWithNestedScrollers) {
56 setBodyInnerHTML( 58 setBodyInnerHTML(
57 "<style>" 59 "<style>"
58 " #overflowA {" 60 " #overflowA {"
59 " position: absolute;" 61 " position: absolute;"
60 " overflow: scroll;" 62 " overflow: scroll;"
(...skipping 20 matching lines...) Expand all
81 " </div>" 83 " </div>"
82 " <div class='forceScroll'></div>" 84 " <div class='forceScroll'></div>"
83 "</div>" 85 "</div>"
84 "<div class='forceScroll'></div>"); 86 "<div class='forceScroll'></div>");
85 Element* overflowA = document().getElementById("overflowA"); 87 Element* overflowA = document().getElementById("overflowA");
86 Element* overflowB = document().getElementById("overflowB"); 88 Element* overflowB = document().getElementById("overflowB");
87 89
88 EXPECT_TRUE(frameScroll()->hasBackgroundAttachmentFixedDescendants()); 90 EXPECT_TRUE(frameScroll()->hasBackgroundAttachmentFixedDescendants());
89 EXPECT_TRUE(overflowA->layoutObject() 91 EXPECT_TRUE(overflowA->layoutObject()
90 ->paintProperties() 92 ->paintProperties()
91 ->scroll() 93 ->scrollTranslation()
94 ->scrollNode()
92 ->hasBackgroundAttachmentFixedDescendants()); 95 ->hasBackgroundAttachmentFixedDescendants());
93 EXPECT_TRUE(overflowB->layoutObject() 96 EXPECT_TRUE(overflowB->layoutObject()
94 ->paintProperties() 97 ->paintProperties()
95 ->scroll() 98 ->scrollTranslation()
99 ->scrollNode()
96 ->hasBackgroundAttachmentFixedDescendants()); 100 ->hasBackgroundAttachmentFixedDescendants());
97 101
98 // Removing a main thread scrolling reason should update the entire tree. 102 // Removing a main thread scrolling reason should update the entire tree.
99 overflowB->removeAttribute("class"); 103 overflowB->removeAttribute("class");
100 document().view()->updateAllLifecyclePhases(); 104 document().view()->updateAllLifecyclePhases();
101 EXPECT_FALSE(frameScroll()->hasBackgroundAttachmentFixedDescendants()); 105 EXPECT_FALSE(frameScroll()->hasBackgroundAttachmentFixedDescendants());
102 EXPECT_FALSE(overflowA->layoutObject() 106 EXPECT_FALSE(overflowA->layoutObject()
103 ->paintProperties() 107 ->paintProperties()
104 ->scroll() 108 ->scrollTranslation()
109 ->scrollNode()
105 ->hasBackgroundAttachmentFixedDescendants()); 110 ->hasBackgroundAttachmentFixedDescendants());
106 EXPECT_FALSE(overflowB->layoutObject() 111 EXPECT_FALSE(overflowB->layoutObject()
107 ->paintProperties() 112 ->paintProperties()
108 ->scroll() 113 ->scrollTranslation()
114 ->scrollNode()
109 ->hasBackgroundAttachmentFixedDescendants()); 115 ->hasBackgroundAttachmentFixedDescendants());
110 116
111 // Adding a main thread scrolling reason should update the entire tree. 117 // Adding a main thread scrolling reason should update the entire tree.
112 overflowB->setAttribute(HTMLNames::classAttr, "backgroundAttachmentFixed"); 118 overflowB->setAttribute(HTMLNames::classAttr, "backgroundAttachmentFixed");
113 document().view()->updateAllLifecyclePhases(); 119 document().view()->updateAllLifecyclePhases();
114 EXPECT_TRUE(frameScroll()->hasBackgroundAttachmentFixedDescendants()); 120 EXPECT_TRUE(frameScroll()->hasBackgroundAttachmentFixedDescendants());
115 EXPECT_TRUE(overflowA->layoutObject() 121 EXPECT_TRUE(overflowA->layoutObject()
116 ->paintProperties() 122 ->paintProperties()
117 ->scroll() 123 ->scrollTranslation()
124 ->scrollNode()
118 ->hasBackgroundAttachmentFixedDescendants()); 125 ->hasBackgroundAttachmentFixedDescendants());
119 EXPECT_TRUE(overflowB->layoutObject() 126 EXPECT_TRUE(overflowB->layoutObject()
120 ->paintProperties() 127 ->paintProperties()
121 ->scroll() 128 ->scrollTranslation()
129 ->scrollNode()
122 ->hasBackgroundAttachmentFixedDescendants()); 130 ->hasBackgroundAttachmentFixedDescendants());
123 } 131 }
124 132
125 TEST_P(PaintPropertyTreeUpdateTest, ParentFrameMainThreadScrollReasons) { 133 TEST_P(PaintPropertyTreeUpdateTest, ParentFrameMainThreadScrollReasons) {
126 setBodyInnerHTML( 134 setBodyInnerHTML(
127 "<style>" 135 "<style>"
128 " body { margin: 0; }" 136 " body { margin: 0; }"
129 " .fixedBackground {" 137 " .fixedBackground {"
130 " background-image: url('foo');" 138 " background-image: url('foo');"
131 " background-attachment: fixed;" 139 " background-attachment: fixed;"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 " <div class='forceScroll'></div>" 233 " <div class='forceScroll'></div>"
226 "</div>" 234 "</div>"
227 "<div class='forceScroll'></div>"); 235 "<div class='forceScroll'></div>");
228 Element* overflowA = document().getElementById("overflowA"); 236 Element* overflowA = document().getElementById("overflowA");
229 Element* overflowB = document().getElementById("overflowB"); 237 Element* overflowB = document().getElementById("overflowB");
230 238
231 // This should be false. We are not as strict about main thread scrolling 239 // This should be false. We are not as strict about main thread scrolling
232 // reasons as we could be. 240 // reasons as we could be.
233 EXPECT_TRUE(overflowA->layoutObject() 241 EXPECT_TRUE(overflowA->layoutObject()
234 ->paintProperties() 242 ->paintProperties()
235 ->scroll() 243 ->scrollTranslation()
244 ->scrollNode()
236 ->hasBackgroundAttachmentFixedDescendants()); 245 ->hasBackgroundAttachmentFixedDescendants());
237 EXPECT_FALSE(overflowB->layoutObject() 246 EXPECT_FALSE(overflowB->layoutObject()
238 ->paintProperties() 247 ->paintProperties()
239 ->scroll() 248 ->scrollTranslation()
249 ->scrollNode()
240 ->hasBackgroundAttachmentFixedDescendants()); 250 ->hasBackgroundAttachmentFixedDescendants());
241 EXPECT_TRUE(overflowB->layoutObject() 251 EXPECT_TRUE(overflowB->layoutObject()
242 ->paintProperties() 252 ->paintProperties()
243 ->scroll() 253 ->scrollTranslation()
254 ->scrollNode()
244 ->parent() 255 ->parent()
245 ->isRoot()); 256 ->isRoot());
246 257
247 // Removing a main thread scrolling reason should update the entire tree. 258 // Removing a main thread scrolling reason should update the entire tree.
248 overflowB->removeAttribute("class"); 259 overflowB->removeAttribute("class");
249 document().view()->updateAllLifecyclePhases(); 260 document().view()->updateAllLifecyclePhases();
250 EXPECT_FALSE(overflowA->layoutObject() 261 EXPECT_FALSE(overflowA->layoutObject()
251 ->paintProperties() 262 ->paintProperties()
252 ->scroll() 263 ->scrollTranslation()
264 ->scrollNode()
253 ->hasBackgroundAttachmentFixedDescendants()); 265 ->hasBackgroundAttachmentFixedDescendants());
254 EXPECT_FALSE(overflowB->layoutObject() 266 EXPECT_FALSE(overflowB->layoutObject()
255 ->paintProperties() 267 ->paintProperties()
256 ->scroll() 268 ->scrollTranslation()
269 ->scrollNode()
257 ->hasBackgroundAttachmentFixedDescendants()); 270 ->hasBackgroundAttachmentFixedDescendants());
258 EXPECT_FALSE(overflowB->layoutObject() 271 EXPECT_FALSE(overflowB->layoutObject()
259 ->paintProperties() 272 ->paintProperties()
260 ->scroll() 273 ->scrollTranslation()
274 ->scrollNode()
261 ->parent() 275 ->parent()
262 ->hasBackgroundAttachmentFixedDescendants()); 276 ->hasBackgroundAttachmentFixedDescendants());
263 } 277 }
264 278
265 TEST_P(PaintPropertyTreeUpdateTest, DescendantNeedsUpdateAcrossFrames) { 279 TEST_P(PaintPropertyTreeUpdateTest, DescendantNeedsUpdateAcrossFrames) {
266 setBodyInnerHTML( 280 setBodyInnerHTML(
267 "<style>body { margin: 0; }</style>" 281 "<style>body { margin: 0; }</style>"
268 "<div id='divWithTransform' style='transform: translate3d(1px,2px,3px);'>" 282 "<div id='divWithTransform' style='transform: translate3d(1px,2px,3px);'>"
269 " <iframe style='border: 7px solid black'></iframe>" 283 " <iframe style='border: 7px solid black'></iframe>"
270 "</div>"); 284 "</div>");
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 EXPECT_EQ(TransformationMatrix().translate3d(50, 100, 0), 644 EXPECT_EQ(TransformationMatrix().translate3d(50, 100, 0),
631 transformObject->paintProperties()->transform()->matrix()); 645 transformObject->paintProperties()->transform()->matrix());
632 646
633 transform->setAttribute(HTMLNames::styleAttr, "width: 200px; height: 300px;"); 647 transform->setAttribute(HTMLNames::styleAttr, "width: 200px; height: 300px;");
634 document().view()->updateAllLifecyclePhases(); 648 document().view()->updateAllLifecyclePhases();
635 EXPECT_EQ(TransformationMatrix().translate3d(100, 150, 0), 649 EXPECT_EQ(TransformationMatrix().translate3d(100, 150, 0),
636 transformObject->paintProperties()->transform()->matrix()); 650 transformObject->paintProperties()->transform()->matrix());
637 } 651 }
638 652
639 } // namespace blink 653 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698