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 c54b6e215a9009a14879f49fbd3513c22fa15a51..6010de568163bbd498daf484510148fdb1cf3f25 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,13 @@ LayoutRect RootFrameViewport::scrollIntoView(const LayoutRect& rectInContent, |
LayoutRect targetViewport = ScrollAlignment::getRectToExpose( |
viewRectInContent, rectInContent, alignX, alignY); |
if (targetViewport != viewRectInContent) { |
- setScrollOffset(ScrollOffset(targetViewport.x(), targetViewport.y()), |
- scrollType); |
+ ScrollOffset targetOffset(targetViewport.x(), targetViewport.y()); |
+ if (isSmooth) { |
+ DCHECK(scrollType != UserScroll); |
+ getSmoothScrollSequencer()->queueAnimation(this, targetOffset); |
+ } else { |
+ setScrollOffset(targetOffset, scrollType); |
+ } |
} |
// RootFrameViewport only changes the viewport relative to the document so we |
@@ -430,6 +436,10 @@ HostWindow* RootFrameViewport::getHostWindow() const { |
return layoutViewport().getHostWindow(); |
} |
+SmoothScrollSequencer* RootFrameViewport::getSmoothScrollSequencer() const { |
+ return layoutViewport().getSmoothScrollSequencer(); |
+} |
+ |
void RootFrameViewport::serviceScrollAnimations(double monotonicTime) { |
ScrollableArea::serviceScrollAnimations(monotonicTime); |
layoutViewport().serviceScrollAnimations(monotonicTime); |