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 98c634e298f3e9b6b6d2a31cc326aaeefac8c51c..d4dba5b1fea1d328c96c274c13c3197a6354d16e 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
@@ -210,6 +210,13 @@ HostWindow* PaintLayerScrollableArea::getHostWindow() const { |
return nullptr; |
} |
+ProgrammaticScrollCoordinator* |
+PaintLayerScrollableArea::getProgrammaticScrollCoordinator() const { |
+ if (Page* page = box().frame()->page()) |
+ return page->scrollingCoordinator()->programmaticScrollCoordinator(); |
+ return nullptr; |
+} |
+ |
GraphicsLayer* PaintLayerScrollableArea::layerForScrolling() const { |
return layer()->hasCompositedLayerMapping() |
? layer()->compositedLayerMapping()->scrollingContentsLayer() |
@@ -1634,7 +1641,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) |
@@ -1648,7 +1656,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); |
+ getProgrammaticScrollCoordinator()->queueAnimation(this, newScrollOffset); |
+ } else { |
+ setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant); |
+ } |
ScrollOffset scrollOffsetDifference = getScrollOffset() - oldScrollOffset; |
localExposeRect.move(-LayoutSize(scrollOffsetDifference)); |