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

Unified Diff: third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp

Issue 2565223002: Add more specific metrics for main thread scrolling reasons (Closed)
Patch Set: Test that there should be no reason set if setPrefercompositingToCDLTextEnabled(true) 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/web/tests/ScrollingCoordinatorTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
index 5356075bbc232b79d5b9cefd8b484425c421f1dc..5a51b96e2378b20a161b1b3571543a812b5154ff 100644
--- a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
@@ -1029,4 +1029,51 @@ TEST_F(ScrollingCoordinatorTest,
MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects);
}
+TEST_F(ScrollingCoordinatorTest, StyleRelatedMainThreadScrollingReason) {
+ registerMockedHttpURLLoad("two_transparent_scrollable_area.html");
+ navigateTo(m_baseURL + "two_transparent_scrollable_area.html");
+ webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(false);
+ forceFullCompositingUpdate();
+
+ FrameView* frameView = frame()->view();
+ ASSERT_TRUE(frameView);
+ ASSERT_TRUE(frameView->mainThreadScrollingReasons() &
+ MainThreadScrollingReason::kHasOpacity);
+
+ // Remove opacity from one of the scrollers.
+ // Still need to scroll on main thread.
+ Document* document = frame()->document();
+ Element* container = document->getElementById("scroller1");
+ DCHECK(container);
+
+ container->removeAttribute("class");
+ forceFullCompositingUpdate();
+
+ ASSERT_TRUE(frameView->mainThreadScrollingReasons() &
+ MainThreadScrollingReason::kHasOpacity);
+
+ // Remove opacity from the other scroller would lead to
+ // scroll on impl.
+ container = document->getElementById("scroller2");
+ DCHECK(container);
+
+ container->removeAttribute("class");
+ forceFullCompositingUpdate();
+
+ ASSERT_FALSE(frameView->mainThreadScrollingReasons() &
+ MainThreadScrollingReason::kHasOpacity);
+
+ // Add opacity would again lead to scroll on main thread
+ container->setAttribute("class", "transparent", ASSERT_NO_EXCEPTION);
+ forceFullCompositingUpdate();
+
+ ASSERT_TRUE(frameView->mainThreadScrollingReasons() &
+ MainThreadScrollingReason::kHasOpacity);
+
+ webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(true);
+ forceFullCompositingUpdate();
+
+ ASSERT_FALSE(frameView->mainThreadScrollingReasons());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698