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

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: 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 a1c51cf1c3ee4242a27064ec410192fdfd4266da..b1d86689bc67bb9a4c531df7b1b5f07220cb72ea 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)
@@ -1530,6 +1535,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()
@@ -2011,6 +2019,8 @@ void FrameView::performPostLayoutTasks()
scrollingCoordinator->notifyGeometryChanged();
scrollToFragmentAnchor();
ojan 2016/02/02 06:51:01 We'll need to think of what the right behavior is
skobes 2016/02/02 22:39:10 Added TODO. I think the right behavior is for the
ojan 2016/02/03 01:23:43 I agree.
+ if (scrollAnchoringEnabled())
+ m_scrollAnchor.restore();
sendResizeEventIfNeeded();
}
@@ -4056,4 +4066,11 @@ LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
return *layoutView();
}
+bool FrameView::scrollAnchoringEnabled() const
+{
+ if (Settings* settings = frame().settings())
+ return settings->scrollAnchoringEnabled();
+ return false;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698