| Index: third_party/WebKit/Source/core/frame/RootFrameViewport.cpp
|
| diff --git a/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp b/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp
|
| index 2eed1f5ab8236f91d790f10d6246ae3cf7024062..5b1435d3f041072cba94559554389ac5b4998df8 100644
|
| --- a/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp
|
| @@ -23,6 +23,11 @@ void RootFrameViewport::setLayoutViewport(ScrollableArea& newLayoutViewport)
|
| m_layoutViewport = &newLayoutViewport;
|
| }
|
|
|
| +LayoutBox* RootFrameViewport::layoutBox() const
|
| +{
|
| + return layoutViewport().layoutBox();
|
| +}
|
| +
|
| void RootFrameViewport::updateScrollAnimator()
|
| {
|
| scrollAnimator().setCurrentPosition(toFloatPoint(scrollOffsetFromScrollAnimators()));
|
| @@ -82,8 +87,13 @@ void RootFrameViewport::setScrollPosition(const DoublePoint& position, ScrollTyp
|
| if (scrollType == ProgrammaticScroll && !layoutViewport().isProgrammaticallyScrollable())
|
| return;
|
|
|
| + if (scrollType == AnchoringScroll) {
|
| + distributeScrollBetweenViewports(position, scrollType, scrollBehavior, LayoutViewport);
|
| + return;
|
| + }
|
| +
|
| if (scrollBehavior == ScrollBehaviorSmooth) {
|
| - distributeScrollBetweenViewports(position, scrollType, scrollBehavior);
|
| + distributeScrollBetweenViewports(position, scrollType, scrollBehavior, VisualViewport);
|
| return;
|
| }
|
|
|
| @@ -124,10 +134,10 @@ LayoutRect RootFrameViewport::scrollIntoView(const LayoutRect& rectInContent, co
|
|
|
| void RootFrameViewport::setScrollOffset(const DoublePoint& offset, ScrollType scrollType)
|
| {
|
| - distributeScrollBetweenViewports(DoublePoint(offset), scrollType, ScrollBehaviorInstant);
|
| + distributeScrollBetweenViewports(DoublePoint(offset), scrollType, ScrollBehaviorInstant, VisualViewport);
|
| }
|
|
|
| -void RootFrameViewport::distributeScrollBetweenViewports(const DoublePoint& offset, ScrollType scrollType, ScrollBehavior behavior)
|
| +void RootFrameViewport::distributeScrollBetweenViewports(const DoublePoint& offset, ScrollType scrollType, ScrollBehavior behavior, ViewportToScrollFirst scrollFirst)
|
| {
|
| // Make sure we use the scroll positions as reported by each viewport's ScrollAnimatorBase, since its
|
| // ScrollableArea's position may have the fractional part truncated off.
|
| @@ -138,22 +148,25 @@ void RootFrameViewport::distributeScrollBetweenViewports(const DoublePoint& offs
|
| if (delta.isZero())
|
| return;
|
|
|
| - DoublePoint targetPosition = visualViewport().clampScrollPosition(
|
| - visualViewport().scrollAnimator().currentPosition() + delta);
|
| + ScrollableArea& primary = scrollFirst == VisualViewport ? visualViewport() : layoutViewport();
|
| + ScrollableArea& secondary = scrollFirst == VisualViewport ? layoutViewport() : visualViewport();
|
| +
|
| + DoublePoint targetPosition = primary.clampScrollPosition(
|
| + primary.scrollAnimator().currentPosition() + delta);
|
|
|
| - visualViewport().setScrollPosition(targetPosition, scrollType, behavior);
|
| + primary.setScrollPosition(targetPosition, scrollType, behavior);
|
|
|
| // Scroll the secondary viewport if all of the scroll was not applied to the
|
| // primary viewport.
|
| - DoublePoint updatedPosition = layoutViewport().scrollAnimator().currentPosition() + FloatPoint(targetPosition);
|
| + DoublePoint updatedPosition = secondary.scrollAnimator().currentPosition() + FloatPoint(targetPosition);
|
| DoubleSize applied = updatedPosition - oldPosition;
|
| delta -= applied;
|
|
|
| if (delta.isZero())
|
| return;
|
|
|
| - targetPosition = layoutViewport().clampScrollPosition(layoutViewport().scrollAnimator().currentPosition() + delta);
|
| - layoutViewport().setScrollPosition(targetPosition, scrollType, behavior);
|
| + targetPosition = secondary.clampScrollPosition(secondary.scrollAnimator().currentPosition() + delta);
|
| + secondary.setScrollPosition(targetPosition, scrollType, behavior);
|
| }
|
|
|
| IntPoint RootFrameViewport::scrollPosition() const
|
|
|