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

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2123053002: Improve scroll anchoring's interactions with the visual viewport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix broken tests 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/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 2d84b43ae9109b0c87637d76bc20790eb18184be..67130b954161c72cc97a25dc2a87dd39c76407a0 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -164,7 +164,6 @@ FrameView::FrameView(LocalFrame* frame)
, m_crossOriginForThrottling(false)
, m_subtreeThrottled(false)
, m_currentUpdateLifecyclePhasesTargetState(DocumentLifecycle::Uninitialized)
- , m_scrollAnchor(this)
, m_needsScrollbarsUpdate(false)
, m_suppressAdjustViewSize(false)
, m_allowsLayoutInvalidationAfterLayoutClean(true)
@@ -813,6 +812,16 @@ void FrameView::performPreLayoutTasks()
document->updateStyleAndLayoutTree();
lifecycle().advanceTo(DocumentLifecycle::StyleClean);
+ if (m_frame->isMainFrame() && !m_viewportScrollableArea) {
+ ScrollableArea& visualViewport = m_frame->host()->visualViewport();
+ ScrollableArea* layoutViewport = layoutViewportScrollableArea();
+ DCHECK(layoutViewport);
+ m_viewportScrollableArea = RootFrameViewport::create(visualViewport, *layoutViewport);
+ }
+
+ if (!m_scrollAnchor.hasScroller())
+ m_scrollAnchor.setScroller(m_viewportScrollableArea ? m_viewportScrollableArea : this);
+
if (RuntimeEnabledFeatures::scrollAnchoringEnabled())
m_scrollAnchor.save();
}
@@ -3381,8 +3390,15 @@ void FrameView::setScrollOffset(const DoublePoint& offset, ScrollType scrollType
frame().loader().saveScrollState();
frame().loader().client()->didChangeScrollOffset();
- if (RuntimeEnabledFeatures::scrollAnchoringEnabled() && scrollType != AnchoringScroll)
- m_scrollAnchor.clear();
+ if (scrollType != AnchoringScroll)
+ clearScrollAnchor();
+}
+
+void FrameView::clearScrollAnchor()
+{
+ if (!RuntimeEnabledFeatures::scrollAnchoringEnabled())
+ return;
+ m_scrollAnchor.clear();
}
void FrameView::windowResizerRectChanged()
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/frame/RootFrameViewport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698