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

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

Issue 2605543002: Replace adjustment of previous visual rects on scroll with normal paint invalidation (Closed)
Patch Set: Remove unused parameters Created 3 years, 11 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/paint/PaintLayer.h" 5 #include "core/paint/PaintLayer.h"
6 6
7 #include "core/html/HTMLIFrameElement.h" 7 #include "core/html/HTMLIFrameElement.h"
8 #include "core/layout/LayoutBoxModelObject.h" 8 #include "core/layout/LayoutBoxModelObject.h"
9 #include "core/layout/LayoutTestHelper.h" 9 #include "core/layout/LayoutTestHelper.h"
10 #include "core/layout/LayoutView.h" 10 #include "core/layout/LayoutView.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 338 }
339 339
340 document().view()->updateAllLifecyclePhases(); 340 document().view()->updateAllLifecyclePhases();
341 EXPECT_FALSE(childDocument() 341 EXPECT_FALSE(childDocument()
342 .view() 342 .view()
343 ->layoutView() 343 ->layoutView()
344 ->layer() 344 ->layer()
345 ->m_needsDescendantDependentFlagsUpdate); 345 ->m_needsDescendantDependentFlagsUpdate);
346 } 346 }
347 347
348 TEST_P(PaintLayerTest, PaintInvalidationOnNonCompositedScroll) {
349 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
350 return;
351
352 setBodyInnerHTML(
353 "<style>* { margin: 0 } ::-webkit-scrollbar { display: none }</style>"
354 "<div id='scroller' style='overflow: scroll; width: 50px; height: 50px'>"
355 " <div style='height: 400px'>"
356 " <div id='content-layer' style='position: relative; height: 10px;"
357 " top: 30px; background: blue'>"
358 " <div id='content' style='height: 5px; background: yellow'></div>"
359 " </div>"
360 " </div>"
361 "</div>");
362
363 LayoutBox* scroller = toLayoutBox(getLayoutObjectByElementId("scroller"));
364 LayoutObject* contentLayer = getLayoutObjectByElementId("content-layer");
365 LayoutObject* content = getLayoutObjectByElementId("content");
366 EXPECT_EQ(LayoutRect(0, 30, 50, 10), contentLayer->visualRect());
367 EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect());
368
369 scroller->getScrollableArea()->setScrollOffset(ScrollOffset(0, 20),
370 ProgrammaticScroll);
371 document().view()->updateAllLifecyclePhases();
372 EXPECT_EQ(LayoutRect(0, 10, 50, 10), contentLayer->visualRect());
373 EXPECT_EQ(LayoutRect(0, 10, 50, 5), content->visualRect());
374 }
375
376 TEST_P(PaintLayerTest, PaintInvalidationOnCompositedScroll) {
377 enableCompositing();
378 setBodyInnerHTML(
379 "<style>* { margin: 0 } ::-webkit-scrollbar { display: none }</style>"
380 "<div id='scroller' style='overflow: scroll; width: 50px; height: 50px;"
381 " will-change: transform'>"
382 " <div style='height: 400px'>"
383 " <div id='content-layer' style='position: relative; height: 10px;"
384 " top: 30px; background: blue'>"
385 " <div id='content' style='height: 5px; background: yellow'></div>"
386 " </div>"
387 " </div>"
388 "</div>");
389
390 LayoutBox* scroller = toLayoutBox(getLayoutObjectByElementId("scroller"));
391 LayoutObject* contentLayer = getLayoutObjectByElementId("content-layer");
392 LayoutObject* content = getLayoutObjectByElementId("content");
393 EXPECT_EQ(LayoutRect(0, 30, 50, 10), contentLayer->visualRect());
394 EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect());
395
396 scroller->getScrollableArea()->setScrollOffset(ScrollOffset(0, 20),
397 ProgrammaticScroll);
398 document().view()->updateAllLifecyclePhases();
399 EXPECT_EQ(LayoutRect(0, 30, 50, 10), contentLayer->visualRect());
400 EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect());
401 }
402
348 } // namespace blink 403 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698