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

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

Issue 2565223002: Add more specific metrics for main thread scrolling reasons (Closed)
Patch Set: Relocate the logic of updating mainThreadScrollingFromStyle 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 a2194782061ed57c8b036b8c1d5418d3dfd5a2c3..740d71fea1527d8b8aafaa7f64949a9260bc36e4 100644
--- a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
@@ -849,4 +849,38 @@ TEST_F(ScrollingCoordinatorTest, CustomScrollbarShouldTriggerMainThreadScroll) {
MainThreadScrollingReason::kCustomScrollbarScrolling);
}
+TEST_F(ScrollingCoordinatorTest, MainThreadScrollingReasonFromStyle) {
+ registerMockedHttpURLLoad("two_transparent_scrollable_area.html");
+ navigateTo(m_baseURL + "two_transparent_scrollable_area.html");
+ forceFullCompositingUpdate();
+
+ Page* page = frame()->page();
+ ASSERT_TRUE(page->scrollingCoordinator());
+ ASSERT_TRUE(page->scrollingCoordinator()->mainThreadScrollingReasons() &
+ MainThreadScrollingReason::kHasOpacity);
+
+ // Remove opacity from one of the layouts.
bokan 2016/12/14 13:28:59 layouts->scrollers
yigu 2016/12/14 21:17:33 Done.
+ // Still need to scroll on main thread.
+ Document* document = frame()->document();
+ Element* container = document->getElementById("scroller1");
+ DCHECK(container);
+
+ container->removeAttribute("class");
+ forceFullCompositingUpdate();
+
+ ASSERT_TRUE(page->scrollingCoordinator()->mainThreadScrollingReasons() &
+ MainThreadScrollingReason::kHasOpacity);
+
+ // Remove opacity from the other layout would lead to
+ // scroll on impl.
+ container = document->getElementById("scroller2");
+ DCHECK(container);
+
+ container->removeAttribute("class");
+ forceFullCompositingUpdate();
+
+ ASSERT_FALSE(page->scrollingCoordinator()->mainThreadScrollingReasons() &
+ MainThreadScrollingReason::kHasOpacity);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698