Chromium Code Reviews| 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 5cfb85f3f5f5fddc20055ed245de877eeb10987f..c408695156592179321d7acd7d9797aa35e4acfd 100644 |
| --- a/third_party/WebKit/Source/core/frame/FrameView.cpp |
| +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp |
| @@ -224,6 +224,7 @@ DEFINE_TRACE(FrameView) { |
| visitor->trace(m_children); |
| visitor->trace(m_viewportScrollableArea); |
| visitor->trace(m_scrollAnchor); |
| + visitor->trace(m_anchoringAdjustmentQueue); |
| Widget::trace(visitor); |
| ScrollableArea::trace(visitor); |
| } |
| @@ -846,7 +847,7 @@ void FrameView::performPreLayoutTasks() { |
| lifecycle().advanceTo(DocumentLifecycle::StyleClean); |
| if (shouldPerformScrollAnchoring()) |
| - m_scrollAnchor.save(); |
| + m_scrollAnchor.notifyBeforeLayout(); |
| } |
| bool FrameView::shouldPerformScrollAnchoring() const { |
| @@ -2222,11 +2223,6 @@ void FrameView::performPostLayoutTasks() { |
| scrollingCoordinator->notifyGeometryChanged(); |
| scrollToFragmentAnchor(); |
| - // TODO(skobes): Figure out interactions between scroll anchor, fragment |
| - // anchor, and history restoration. |
| - if (shouldPerformScrollAnchoring()) |
| - m_scrollAnchor.restore(); |
| - |
| sendResizeEventIfNeeded(); |
| } |
| @@ -2653,6 +2649,10 @@ void FrameView::updateLifecyclePhasesInternal( |
| return; |
| } |
| + forAllNonThrottledFrameViews([](FrameView& frameView) { |
|
szager1
2016/10/13 17:54:49
Shouldn't this happen before updateViewportInterse
skobes
2016/10/13 18:00:31
It does. For targetState > LayoutClean, the call
szager1
2016/10/13 18:50:56
Ah, I see, thanks.
|
| + frameView.performScrollAnchoringAdjustments(); |
| + }); |
| + |
| if (targetState == DocumentLifecycle::PaintClean) { |
| forAllNonThrottledFrameViews( |
| [](FrameView& frameView) { frameView.notifyResizeObservers(); }); |
| @@ -2720,6 +2720,19 @@ void FrameView::updateLifecyclePhasesInternal( |
| updateViewportIntersectionsForSubtree(targetState); |
| } |
| +void FrameView::enqueueScrollAnchoringAdjustment( |
| + ScrollableArea* scrollableArea) { |
| + m_anchoringAdjustmentQueue.add(scrollableArea); |
| +} |
| + |
| +void FrameView::performScrollAnchoringAdjustments() { |
| + for (WeakMember<ScrollableArea>& scroller : m_anchoringAdjustmentQueue) { |
| + if (scroller) |
| + scroller->scrollAnchor()->adjust(); |
| + } |
| + m_anchoringAdjustmentQueue.clear(); |
| +} |
| + |
| void FrameView::updatePaintProperties() { |
| TRACE_EVENT0("blink", "FrameView::updatePaintProperties"); |
| @@ -3610,7 +3623,7 @@ void FrameView::updateScrollOffset(const ScrollOffset& offset, |
| documentLoader->initialScrollState().wasScrolledByUser = true; |
| } |
| - if (scrollType != AnchoringScroll) |
| + if (scrollType != AnchoringScroll && scrollType != ClampingScroll) |
| clearScrollAnchor(); |
| } |
| @@ -3838,15 +3851,8 @@ void FrameView::updateScrollbars() { |
| void FrameView::adjustScrollOffsetFromUpdateScrollbars() { |
| ScrollOffset clamped = clampScrollOffset(scrollOffset()); |
| - // Restore before clamping because clamping clears the scroll anchor. |
| - // TODO(ymalik): This same logic exists in PaintLayerScrollableArea. |
| - // Remove when root-layer-scrolls is enabled. |
| - if (clamped != scrollOffset() && shouldPerformScrollAnchoring()) { |
| - m_scrollAnchor.restore(); |
| - clamped = clampScrollOffset(scrollOffset()); |
| - } |
| if (clamped != scrollOffset() || scrollOriginChanged()) { |
| - ScrollableArea::setScrollOffset(clamped, ProgrammaticScroll); |
| + ScrollableArea::setScrollOffset(clamped, ClampingScroll); |
| resetScrollOriginChanged(); |
| } |
| } |