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

Unified Diff: third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp

Issue 2118773002: Respect main thread scrolling reasons for fallback to root layer scrolling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reviewer comments. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
index 4b444f9b9237fa328f1dcbec4003f9b4d6c1f077..2f28ac169ba6acc1287970633c40282de73938b4 100644
--- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
+++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -671,6 +671,8 @@ void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh
if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFrame()->view())
return;
+ GraphicsLayer* visualViewportLayer = m_page->frameHost().visualViewport().scrollLayer();
+ WebLayer* visualViewportScrollLayer = toWebLayer(visualViewportLayer);
GraphicsLayer* layer = m_page->deprecatedLocalMainFrame()->view()->layerForScrolling();
if (WebLayer* scrollLayer = toWebLayer(layer)) {
m_lastMainThreadScrollingReasons = mainThreadScrollingReasons;
@@ -680,12 +682,21 @@ void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainTh
scrollAnimator->takeOverCompositorAnimation();
}
scrollLayer->addMainThreadScrollingReasons(mainThreadScrollingReasons);
+ if (visualViewportScrollLayer) {
+ if (ScrollAnimatorBase* scrollAnimator = visualViewportLayer->getScrollableArea()->existingScrollAnimator()) {
+ DCHECK(m_page->deprecatedLocalMainFrame()->document()->lifecycle().state() >= DocumentLifecycle::CompositingClean);
+ scrollAnimator->takeOverCompositorAnimation();
+ }
+ visualViewportScrollLayer->addMainThreadScrollingReasons(mainThreadScrollingReasons);
+ }
} else {
// Clear all main thread scrolling reasons except the one that's set
// if there is a running scroll animation.
uint32_t mainThreadScrollingReasonsToClear = ~0u;
mainThreadScrollingReasonsToClear &= ~MainThreadScrollingReason::kAnimatingScrollOnMainThread;
scrollLayer->clearMainThreadScrollingReasons(mainThreadScrollingReasonsToClear);
+ if (visualViewportScrollLayer)
+ visualViewportScrollLayer->clearMainThreadScrollingReasons(mainThreadScrollingReasonsToClear);
}
}
}
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698