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

Unified 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 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintLayerTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp
index f137b1c4470ed5d0ded0c5611d4fc2b56cfc2ce6..aa3d293a52bb1e73c5251e9081c6f6abcf280cb4 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerTest.cpp
@@ -345,4 +345,59 @@ TEST_P(PaintLayerTest, DescendantDependentFlagsStopsAtThrottledFrames) {
->m_needsDescendantDependentFlagsUpdate);
}
+TEST_P(PaintLayerTest, PaintInvalidationOnNonCompositedScroll) {
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
+ return;
+
+ setBodyInnerHTML(
+ "<style>* { margin: 0 } ::-webkit-scrollbar { display: none }</style>"
+ "<div id='scroller' style='overflow: scroll; width: 50px; height: 50px'>"
+ " <div style='height: 400px'>"
+ " <div id='content-layer' style='position: relative; height: 10px;"
+ " top: 30px; background: blue'>"
+ " <div id='content' style='height: 5px; background: yellow'></div>"
+ " </div>"
+ " </div>"
+ "</div>");
+
+ LayoutBox* scroller = toLayoutBox(getLayoutObjectByElementId("scroller"));
+ LayoutObject* contentLayer = getLayoutObjectByElementId("content-layer");
+ LayoutObject* content = getLayoutObjectByElementId("content");
+ EXPECT_EQ(LayoutRect(0, 30, 50, 10), contentLayer->visualRect());
+ EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect());
+
+ scroller->getScrollableArea()->setScrollOffset(ScrollOffset(0, 20),
+ ProgrammaticScroll);
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_EQ(LayoutRect(0, 10, 50, 10), contentLayer->visualRect());
+ EXPECT_EQ(LayoutRect(0, 10, 50, 5), content->visualRect());
+}
+
+TEST_P(PaintLayerTest, PaintInvalidationOnCompositedScroll) {
+ enableCompositing();
+ setBodyInnerHTML(
+ "<style>* { margin: 0 } ::-webkit-scrollbar { display: none }</style>"
+ "<div id='scroller' style='overflow: scroll; width: 50px; height: 50px;"
+ " will-change: transform'>"
+ " <div style='height: 400px'>"
+ " <div id='content-layer' style='position: relative; height: 10px;"
+ " top: 30px; background: blue'>"
+ " <div id='content' style='height: 5px; background: yellow'></div>"
+ " </div>"
+ " </div>"
+ "</div>");
+
+ LayoutBox* scroller = toLayoutBox(getLayoutObjectByElementId("scroller"));
+ LayoutObject* contentLayer = getLayoutObjectByElementId("content-layer");
+ LayoutObject* content = getLayoutObjectByElementId("content");
+ EXPECT_EQ(LayoutRect(0, 30, 50, 10), contentLayer->visualRect());
+ EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect());
+
+ scroller->getScrollableArea()->setScrollOffset(ScrollOffset(0, 20),
+ ProgrammaticScroll);
+ document().view()->updateAllLifecyclePhases();
+ EXPECT_EQ(LayoutRect(0, 30, 50, 10), contentLayer->visualRect());
+ EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698