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

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

Issue 2659183002: [RootLayerScrolls] Fix frame scrolling layer in ScrollingCoordinator (Closed)
Patch Set: nit scratched 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 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 90ffa14352af757a84d44e05f77c3eb11233fb38..0f6ed9237dd76ae8e572c22e88581f5893f061bc 100644
--- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
+++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -206,7 +206,8 @@ void ScrollingCoordinator::updateAfterCompositingChangeIfNeeded() {
}
FrameView* frameView = toLocalFrame(m_page->mainFrame())->view();
- bool frameIsScrollable = frameView && frameView->isScrollable();
+ bool frameIsScrollable =
+ frameView && frameView->layoutViewportScrollableArea()->isScrollable();
if (m_shouldScrollOnMainThreadDirty ||
m_wasFrameScrollable != frameIsScrollable) {
setShouldUpdateScrollLayerPositionOnMainThread(
@@ -221,8 +222,11 @@ void ScrollingCoordinator::updateAfterCompositingChangeIfNeeded() {
m_wasFrameScrollable = frameIsScrollable;
if (WebLayer* layoutViewportScrollLayer =
- frameView ? toWebLayer(frameView->layerForScrolling()) : nullptr) {
- layoutViewportScrollLayer->setBounds(frameView->contentsSize());
+ frameView ? toWebLayer(frameView->layoutViewportScrollableArea()
+ ->layerForScrolling())
+ : nullptr) {
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled())
+ layoutViewportScrollLayer->setBounds(frameView->contentsSize());
// If there is a non-root fullscreen element, prevent the viewport from
// scrolling.
@@ -241,21 +245,25 @@ void ScrollingCoordinator::updateAfterCompositingChangeIfNeeded() {
visualViewportScrollLayer->setUserScrollable(true, true);
}
- layoutViewportScrollLayer->setUserScrollable(
- frameView->userInputScrollable(HorizontalScrollbar),
- frameView->userInputScrollable(VerticalScrollbar));
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
+ layoutViewportScrollLayer->setUserScrollable(
+ frameView->userInputScrollable(HorizontalScrollbar),
+ frameView->userInputScrollable(VerticalScrollbar));
+ }
}
- const FrameTree& tree = m_page->mainFrame()->tree();
- for (const Frame* child = tree.firstChild(); child;
- child = child->tree().nextSibling()) {
- if (!child->isLocalFrame())
- continue;
- FrameView* frameView = toLocalFrame(child)->view();
- if (!frameView || frameView->shouldThrottleRendering())
- continue;
- if (WebLayer* scrollLayer = toWebLayer(frameView->layerForScrolling()))
- scrollLayer->setBounds(frameView->contentsSize());
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
+ const FrameTree& tree = m_page->mainFrame()->tree();
+ for (const Frame* child = tree.firstChild(); child;
+ child = child->tree().nextSibling()) {
+ if (!child->isLocalFrame())
+ continue;
+ FrameView* frameView = toLocalFrame(child)->view();
+ if (!frameView || frameView->shouldThrottleRendering())
+ continue;
+ if (WebLayer* scrollLayer = toWebLayer(frameView->layerForScrolling()))
+ scrollLayer->setBounds(frameView->contentsSize());
+ }
}
}
@@ -717,8 +725,8 @@ void ScrollingCoordinator::reset() {
m_wasFrameScrollable = false;
m_lastMainThreadScrollingReasons = 0;
- setShouldUpdateScrollLayerPositionOnMainThread(
- m_lastMainThreadScrollingReasons);
+ if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled())
+ setShouldUpdateScrollLayerPositionOnMainThread(0);
}
// Note that in principle this could be called more often than
@@ -820,19 +828,24 @@ void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(
GraphicsLayer* visualViewportLayer =
m_page->frameHost().visualViewport().scrollLayer();
WebLayer* visualViewportScrollLayer = toWebLayer(visualViewportLayer);
- GraphicsLayer* layer =
- m_page->deprecatedLocalMainFrame()->view()->layerForScrolling();
+ GraphicsLayer* layer = m_page->deprecatedLocalMainFrame()
+ ->view()
+ ->layoutViewportScrollableArea()
+ ->layerForScrolling();
if (WebLayer* scrollLayer = toWebLayer(layer)) {
m_lastMainThreadScrollingReasons = mainThreadScrollingReasons;
if (mainThreadScrollingReasons) {
- if (ScrollAnimatorBase* scrollAnimator =
- layer->getScrollableArea()->existingScrollAnimator()) {
- DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled() ||
- m_page->deprecatedLocalMainFrame()
- ->document()
- ->lifecycle()
- .state() >= DocumentLifecycle::CompositingClean);
- scrollAnimator->takeOverCompositorAnimation();
+ ScrollableArea* scrollableArea = layer->getScrollableArea();
+ if (scrollableArea) {
+ if (ScrollAnimatorBase* scrollAnimator =
+ scrollableArea->existingScrollAnimator()) {
+ DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled() ||
+ m_page->deprecatedLocalMainFrame()
+ ->document()
+ ->lifecycle()
+ .state() >= DocumentLifecycle::CompositingClean);
+ scrollAnimator->takeOverCompositorAnimation();
+ }
}
scrollLayer->addMainThreadScrollingReasons(mainThreadScrollingReasons);
if (visualViewportScrollLayer) {
@@ -1154,17 +1167,22 @@ void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) {
notifyGeometryChanged();
}
-bool ScrollingCoordinator::frameViewIsDirty() const {
+bool ScrollingCoordinator::frameScrollerIsDirty() const {
FrameView* frameView = m_page->mainFrame()->isLocalFrame()
? m_page->deprecatedLocalMainFrame()->view()
: nullptr;
- bool frameIsScrollable = frameView && frameView->isScrollable();
+ bool frameIsScrollable =
+ frameView && frameView->layoutViewportScrollableArea()->isScrollable();
if (frameIsScrollable != m_wasFrameScrollable)
return true;
if (WebLayer* scrollLayer =
- frameView ? toWebLayer(frameView->layerForScrolling()) : nullptr)
- return WebSize(frameView->contentsSize()) != scrollLayer->bounds();
+ frameView ? toWebLayer(frameView->layoutViewportScrollableArea()
+ ->layerForScrolling())
+ : nullptr) {
+ return WebSize(frameView->layoutViewportScrollableArea()->contentsSize()) !=
+ scrollLayer->bounds();
+ }
return false;
}

Powered by Google App Engine
This is Rietveld 408576698