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

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

Issue 2655023003: Background attachment behavior update for rootlayer with root-layer-scrolls enabled (Closed)
Patch Set: Update condition check 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintLayer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/HTMLNames.h" 5 #include "core/HTMLNames.h"
6 #include "core/frame/FrameView.h" 6 #include "core/frame/FrameView.h"
7 #include "core/layout/LayoutTestHelper.h" 7 #include "core/layout/LayoutTestHelper.h"
8 #include "core/layout/LayoutView.h" 8 #include "core/layout/LayoutView.h"
9 #include "core/paint/PaintLayer.h" 9 #include "core/paint/PaintLayer.h"
10 #include "platform/graphics/GraphicsLayer.h" 10 #include "platform/graphics/GraphicsLayer.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 enableCompositing(); 225 enableCompositing();
226 Element* target = document().getElementById("target"); 226 Element* target = document().getElementById("target");
227 target->setAttribute(HTMLNames::classAttr, ""); 227 target->setAttribute(HTMLNames::classAttr, "");
228 target->setAttribute(HTMLNames::styleAttr, "height: 2000px"); 228 target->setAttribute(HTMLNames::styleAttr, "height: 2000px");
229 document().view()->updateAllLifecyclePhases(); 229 document().view()->updateAllLifecyclePhases();
230 230
231 // Resize the content. 231 // Resize the content.
232 document().view()->setTracksPaintInvalidations(true); 232 document().view()->setTracksPaintInvalidations(true);
233 target->setAttribute(HTMLNames::styleAttr, "height: 3000px"); 233 target->setAttribute(HTMLNames::styleAttr, "height: 3000px");
234 document().view()->updateAllLifecyclePhases(); 234 document().view()->updateAllLifecyclePhases();
235 const auto& rasterInvalidations =
236 getRasterInvalidationTracking()->trackedRasterInvalidations;
237 // TODO(wangxianzhu): Temporary for crbug.com/680745.
238 // ASSERT_EQ(1u, rasterInvalidations.size());
239 ASSERT_EQ(2u, rasterInvalidations.size());
240 EXPECT_EQ(IntRect(0, 2000, 800, 1000), rasterInvalidations[0].rect);
241 EXPECT_EQ(static_cast<const DisplayItemClient*>(&layoutView()),
242 rasterInvalidations[0].client);
235 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 243 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
236 // For now in RootLayerScrolling mode root background is invalidated and 244 EXPECT_EQ(PaintInvalidationBackgroundOnScrollingContentsLayer,
237 // painted on the container layer. No invalidation because the changed part 245 rasterInvalidations[0].reason);
238 // is clipped.
239 // TODO(skobes): Treat LayoutView in the same way as normal objects having
240 // background-attachment: local. crbug.com/568847.
241 // TODO(wangxianzhu): Temporary for crbug.com/680745.
242 // EXPECT_FALSE(layoutView()
243 // .layer()
244 // ->graphicsLayerBacking()
245 // ->getRasterInvalidationTracking());
246 EXPECT_EQ(1u, layoutView()
247 .layer()
248 ->graphicsLayerBacking()
249 ->getRasterInvalidationTracking()
250 ->trackedRasterInvalidations.size());
251 } else { 246 } else {
252 const auto& rasterInvalidations =
253 getRasterInvalidationTracking()->trackedRasterInvalidations;
254 // TODO(wangxianzhu): Temporary for crbug.com/680745.
255 // ASSERT_EQ(1u, rasterInvalidations.size());
256 ASSERT_EQ(2u, rasterInvalidations.size());
257 EXPECT_EQ(IntRect(0, 2000, 800, 1000), rasterInvalidations[0].rect);
258 EXPECT_EQ(static_cast<const DisplayItemClient*>(&layoutView()),
259 rasterInvalidations[0].client);
260 EXPECT_EQ(PaintInvalidationIncremental, rasterInvalidations[0].reason); 247 EXPECT_EQ(PaintInvalidationIncremental, rasterInvalidations[0].reason);
261 } 248 }
249
262 document().view()->setTracksPaintInvalidations(false); 250 document().view()->setTracksPaintInvalidations(false);
263 251
264 // Resize the viewport. No paint invalidation. 252 // Resize the viewport. No paint invalidation.
265 document().view()->setTracksPaintInvalidations(true); 253 document().view()->setTracksPaintInvalidations(true);
266 document().view()->resize(800, 1000); 254 document().view()->resize(800, 1000);
267 document().view()->updateAllLifecyclePhases(); 255 document().view()->updateAllLifecyclePhases();
268 EXPECT_FALSE(getRasterInvalidationTracking()); 256 EXPECT_FALSE(getRasterInvalidationTracking());
269 document().view()->setTracksPaintInvalidations(false); 257 document().view()->setTracksPaintInvalidations(false);
270 } 258 }
271 259
272 TEST_P(BoxPaintInvalidatorTest, CompositedLayoutViewGradientResize) { 260 TEST_P(BoxPaintInvalidatorTest, CompositedLayoutViewGradientResize) {
273 enableCompositing(); 261 enableCompositing();
274 document().body()->setAttribute(HTMLNames::classAttr, "gradient"); 262 document().body()->setAttribute(HTMLNames::classAttr, "gradient");
275 Element* target = document().getElementById("target"); 263 Element* target = document().getElementById("target");
276 target->setAttribute(HTMLNames::classAttr, ""); 264 target->setAttribute(HTMLNames::classAttr, "");
277 target->setAttribute(HTMLNames::styleAttr, "height: 2000px"); 265 target->setAttribute(HTMLNames::styleAttr, "height: 2000px");
278 document().view()->updateAllLifecyclePhases(); 266 document().view()->updateAllLifecyclePhases();
279 267
280 // Resize the content. 268 // Resize the content.
281 document().view()->setTracksPaintInvalidations(true); 269 document().view()->setTracksPaintInvalidations(true);
282 target->setAttribute(HTMLNames::styleAttr, "height: 3000px"); 270 target->setAttribute(HTMLNames::styleAttr, "height: 3000px");
283 document().view()->updateAllLifecyclePhases(); 271 document().view()->updateAllLifecyclePhases();
272
273 const auto& rasterInvalidations =
274 getRasterInvalidationTracking()->trackedRasterInvalidations;
275 // TODO(wangxianzhu): Temporary for crbug.com/680745.
276 // ASSERT_EQ(1u, rasterInvalidations.size());
277 ASSERT_EQ(2u, rasterInvalidations.size());
278 EXPECT_EQ(IntRect(0, 0, 800, 3000), rasterInvalidations[0].rect);
279 EXPECT_EQ(static_cast<const DisplayItemClient*>(&layoutView()),
280 rasterInvalidations[0].client);
284 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 281 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
285 // For now in RootLayerScrolling mode root background is invalidated and 282 EXPECT_EQ(PaintInvalidationBackgroundOnScrollingContentsLayer,
286 // painted on the container layer.
287 // TODO(skobes): Treat LayoutView in the same way as normal objects having
288 // background-attachment: local. crbug.com/568847.
289 const auto& rasterInvalidations = layoutView()
290 .layer()
291 ->graphicsLayerBacking(&layoutView())
292 ->getRasterInvalidationTracking()
293 ->trackedRasterInvalidations;
294 ASSERT_EQ(1u, rasterInvalidations.size());
295 EXPECT_EQ(IntRect(0, 0, 800, 600), rasterInvalidations[0].rect);
296 EXPECT_EQ(static_cast<const DisplayItemClient*>(&layoutView()),
297 rasterInvalidations[0].client);
298 EXPECT_EQ(PaintInvalidationLayoutOverflowBoxChange,
299 rasterInvalidations[0].reason); 283 rasterInvalidations[0].reason);
300 } else { 284 } else {
301 const auto& rasterInvalidations =
302 getRasterInvalidationTracking()->trackedRasterInvalidations;
303 // TODO(wangxianzhu): Temporary for crbug.com/680745.
304 // ASSERT_EQ(1u, rasterInvalidations.size());
305 ASSERT_EQ(2u, rasterInvalidations.size());
306 EXPECT_EQ(IntRect(0, 0, 800, 3000), rasterInvalidations[0].rect);
307 EXPECT_EQ(static_cast<const DisplayItemClient*>(&layoutView()),
308 rasterInvalidations[0].client);
309 EXPECT_EQ(PaintInvalidationLayoutOverflowBoxChange, 285 EXPECT_EQ(PaintInvalidationLayoutOverflowBoxChange,
310 rasterInvalidations[0].reason); 286 rasterInvalidations[0].reason);
311 } 287 }
288
312 document().view()->setTracksPaintInvalidations(false); 289 document().view()->setTracksPaintInvalidations(false);
313 290
314 // Resize the viewport. No paint invalidation. 291 // Resize the viewport. No paint invalidation.
315 document().view()->setTracksPaintInvalidations(true); 292 document().view()->setTracksPaintInvalidations(true);
316 document().view()->resize(800, 1000); 293 document().view()->resize(800, 1000);
317 document().view()->updateAllLifecyclePhases(); 294 document().view()->updateAllLifecyclePhases();
318 EXPECT_FALSE(getRasterInvalidationTracking()); 295 EXPECT_FALSE(getRasterInvalidationTracking());
319 document().view()->setTracksPaintInvalidations(false); 296 document().view()->setTracksPaintInvalidations(false);
320 } 297 }
321 298
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 getRasterInvalidationTracking()->trackedRasterInvalidations; 555 getRasterInvalidationTracking()->trackedRasterInvalidations;
579 ASSERT_EQ(1u, rasterInvalidations.size()); 556 ASSERT_EQ(1u, rasterInvalidations.size());
580 EXPECT_EQ(IntRect(0, 120, 70, 120), rasterInvalidations[0].rect); 557 EXPECT_EQ(IntRect(0, 120, 70, 120), rasterInvalidations[0].rect);
581 EXPECT_EQ(static_cast<const DisplayItemClient*>(target->layoutObject()), 558 EXPECT_EQ(static_cast<const DisplayItemClient*>(target->layoutObject()),
582 rasterInvalidations[0].client); 559 rasterInvalidations[0].client);
583 EXPECT_EQ(PaintInvalidationIncremental, rasterInvalidations[0].reason); 560 EXPECT_EQ(PaintInvalidationIncremental, rasterInvalidations[0].reason);
584 document().view()->setTracksPaintInvalidations(false); 561 document().view()->setTracksPaintInvalidations(false);
585 } 562 }
586 563
587 } // namespace blink 564 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698