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

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

Issue 1647793002: Use ScrollAnchor in FrameView and PaintLayerScrollableArea. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@anchor-skeleton
Patch Set: move save/restore from LayoutBlockFlow into LayoutBlock Created 4 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/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 98fbad2cfa1d92d0135b8f87a218ea762d250839..be15e2992e63bdd3eafcd0a687096da44f4a096a 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -153,6 +153,7 @@ FrameView::FrameView(LocalFrame* frame)
, m_hiddenForThrottling(false)
, m_crossOriginForThrottling(false)
, m_isUpdatingAllLifecyclePhases(false)
+ , m_scrollAnchor(this)
{
ASSERT(m_frame);
init();
@@ -197,6 +198,7 @@ DEFINE_TRACE(FrameView)
visitor->trace(m_verticalScrollbar);
visitor->trace(m_children);
visitor->trace(m_viewportScrollableArea);
+ visitor->trace(m_scrollAnchor);
#endif
Widget::trace(visitor);
ScrollableArea::trace(visitor);
@@ -270,6 +272,9 @@ void FrameView::dispose()
scrollAnimator->cancelAnimation();
cancelProgrammaticScrollAnimation();
+ if (RuntimeEnabledFeatures::scrollAnchoringEnabled())
+ m_scrollAnchor.clear();
+
detachScrollbars();
// When the view is no longer associated with a frame, it needs to be removed from the ax object cache
@@ -795,6 +800,9 @@ void FrameView::performPreLayoutTasks()
ASSERT(layoutViewport);
m_viewportScrollableArea = RootFrameViewport::create(visualViewport, *layoutViewport);
}
+
+ if (RuntimeEnabledFeatures::scrollAnchoringEnabled())
+ m_scrollAnchor.save();
}
static inline void layoutFromRootObject(LayoutObject& root)
@@ -1534,6 +1542,9 @@ void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollType scr
scrollBehavior = scrollBehaviorStyle();
ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehavior);
+
+ if (RuntimeEnabledFeatures::scrollAnchoringEnabled() && scrollType != AnchoringScroll)
+ m_scrollAnchor.clear();
}
void FrameView::didUpdateElasticOverscroll()
@@ -2045,6 +2056,9 @@ void FrameView::performPostLayoutTasks()
scrollingCoordinator->notifyGeometryChanged();
scrollToFragmentAnchor();
+ // TODO(skobes): Figure out interactions between scroll anchor, fragment anchor, and history restoration.
+ if (RuntimeEnabledFeatures::scrollAnchoringEnabled())
+ m_scrollAnchor.restore();
sendResizeEventIfNeeded();
}

Powered by Google App Engine
This is Rietveld 408576698