Index: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
index 88564c1998ba2953560f23f7d4a073a71ebab6db..39c9316ce0b7f34a9fd7f9445abd0e6cfa0caebd 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
@@ -209,6 +209,13 @@ HostWindow* PaintLayerScrollableArea::getHostWindow() const { |
return nullptr; |
} |
+SmoothScrollSequencer* PaintLayerScrollableArea::getSmoothScrollSequencer() |
+ const { |
+ if (Page* page = box().frame()->page()) |
+ return page->smoothScrollSequencer(); |
+ return nullptr; |
+} |
+ |
GraphicsLayer* PaintLayerScrollableArea::layerForScrolling() const { |
return layer()->hasCompositedLayerMapping() |
? layer()->compositedLayerMapping()->scrollingContentsLayer() |
@@ -1670,7 +1677,8 @@ LayoutRect PaintLayerScrollableArea::scrollIntoView( |
const LayoutRect& rect, |
const ScrollAlignment& alignX, |
const ScrollAlignment& alignY, |
- ScrollType scrollType) { |
+ ScrollType scrollType, |
+ bool isSmooth) { |
LayoutRect localExposeRect( |
box() |
.absoluteToLocalQuad(FloatQuad(FloatRect(rect)), UseTransforms) |
@@ -1684,7 +1692,12 @@ LayoutRect PaintLayerScrollableArea::scrollIntoView( |
ScrollOffset oldScrollOffset = getScrollOffset(); |
ScrollOffset newScrollOffset(clampScrollOffset(roundedIntSize( |
toScrollOffset(FloatPoint(r.location()) + oldScrollOffset)))); |
- setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant); |
+ if (isSmooth) { |
+ DCHECK(scrollType != UserScroll); |
+ getSmoothScrollSequencer()->queueAnimation(this, newScrollOffset); |
+ } else { |
+ setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant); |
+ } |
ScrollOffset scrollOffsetDifference = getScrollOffset() - oldScrollOffset; |
localExposeRect.move(-LayoutSize(scrollOffsetDifference)); |