| 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 1f4632132bb43eaf0d7c679da4023ffbf3a4fed0..516383333a5c0ca6237df85b3a19bc0f42834766 100644
|
| --- a/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp
|
| @@ -209,7 +209,8 @@ ScrollBehavior RootFrameViewport::scrollBehaviorStyle() const {
|
| LayoutRect RootFrameViewport::scrollIntoView(const LayoutRect& rectInContent,
|
| const ScrollAlignment& alignX,
|
| const ScrollAlignment& alignY,
|
| - ScrollType scrollType) {
|
| + ScrollType scrollType,
|
| + bool isSmooth) {
|
| // We want to move the rect into the viewport that excludes the scrollbars so
|
| // we intersect the visual viewport with the scrollbar-excluded frameView
|
| // content rect. However, we don't use visibleContentRect directly since it
|
| @@ -229,8 +230,14 @@ LayoutRect RootFrameViewport::scrollIntoView(const LayoutRect& rectInContent,
|
| LayoutRect targetViewport = ScrollAlignment::getRectToExpose(
|
| viewRectInContent, rectInContent, alignX, alignY);
|
| if (targetViewport != viewRectInContent) {
|
| - setScrollOffset(ScrollOffset(targetViewport.x(), targetViewport.y()),
|
| - scrollType);
|
| + if (isSmooth) {
|
| + DCHECK(scrollType != UserScroll);
|
| + getProgrammaticScrollCoordinator()->queueAnimation(
|
| + this, ScrollOffset(targetViewport.x(), targetViewport.y()));
|
| + } else {
|
| + setScrollOffset(ScrollOffset(targetViewport.x(), targetViewport.y()),
|
| + scrollType);
|
| + }
|
| }
|
|
|
| // RootFrameViewport only changes the viewport relative to the document so we
|
| @@ -430,6 +437,11 @@ HostWindow* RootFrameViewport::getHostWindow() const {
|
| return layoutViewport().getHostWindow();
|
| }
|
|
|
| +ProgrammaticScrollCoordinator*
|
| +RootFrameViewport::getProgrammaticScrollCoordinator() const {
|
| + return layoutViewport().getProgrammaticScrollCoordinator();
|
| +}
|
| +
|
| void RootFrameViewport::serviceScrollAnimations(double monotonicTime) {
|
| ScrollableArea::serviceScrollAnimations(monotonicTime);
|
| layoutViewport().serviceScrollAnimations(monotonicTime);
|
|
|