| 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 c03a43da5441570cb3df102af5f03d1cedbceeb4..27fbda41b65f7107f5b55832b95d43603a0db20a 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);
|
| @@ -794,6 +796,9 @@ void FrameView::performPreLayoutTasks()
|
| ASSERT(layoutViewport);
|
| m_viewportScrollableArea = RootFrameViewport::create(visualViewport, *layoutViewport);
|
| }
|
| +
|
| + if (scrollAnchoringEnabled())
|
| + m_scrollAnchor.save();
|
| }
|
|
|
| static inline void layoutFromRootObject(LayoutObject& root)
|
| @@ -1529,6 +1534,9 @@ void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollType scr
|
| scrollBehavior = scrollBehaviorStyle();
|
|
|
| ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehavior);
|
| +
|
| + if (scrollAnchoringEnabled() && scrollType != AnchoringScroll)
|
| + m_scrollAnchor.clear();
|
| }
|
|
|
| void FrameView::didUpdateElasticOverscroll()
|
| @@ -2010,6 +2018,9 @@ void FrameView::performPostLayoutTasks()
|
| scrollingCoordinator->notifyGeometryChanged();
|
|
|
| scrollToFragmentAnchor();
|
| + // TODO(skobes): Figure out interactions between scroll anchor, fragment anchor, and history restoration.
|
| + if (scrollAnchoringEnabled())
|
| + m_scrollAnchor.restore();
|
|
|
| sendResizeEventIfNeeded();
|
| }
|
| @@ -4057,4 +4068,11 @@ LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
|
| return *layoutView();
|
| }
|
|
|
| +bool FrameView::scrollAnchoringEnabled() const
|
| +{
|
| + if (Settings* settings = frame().settings())
|
| + return settings->scrollAnchoringEnabled();
|
| + return false;
|
| +}
|
| +
|
| } // namespace blink
|
|
|