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 fef30afdfad7a909217d58e949c98e9c91e8fca7..138d6f4f50ce3ac92759d1b80d71bda69355b57d 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
@@ -209,6 +209,13 @@ PlatformChromeClient* PaintLayerScrollableArea::GetChromeClient() const { |
return nullptr; |
} |
+SmoothScrollSequencer* PaintLayerScrollableArea::GetSmoothScrollSequencer() |
+ const { |
+ if (Page* page = Box().GetFrame()->GetPage()) |
+ return page->GetSmoothScrollSequencer(); |
+ return nullptr; |
+} |
+ |
GraphicsLayer* PaintLayerScrollableArea::LayerForScrolling() const { |
return Layer()->HasCompositedLayerMapping() |
? Layer()->GetCompositedLayerMapping()->ScrollingContentsLayer() |
@@ -1723,7 +1730,8 @@ LayoutRect PaintLayerScrollableArea::ScrollIntoView( |
const LayoutRect& rect, |
const ScrollAlignment& align_x, |
const ScrollAlignment& align_y, |
- ScrollType scroll_type) { |
+ ScrollType scroll_type, |
+ bool is_smooth) { |
LayoutRect local_expose_rect( |
Box() |
.AbsoluteToLocalQuad(FloatQuad(FloatRect(rect)), kUseTransforms) |
@@ -1736,8 +1744,14 @@ LayoutRect PaintLayerScrollableArea::ScrollIntoView( |
ScrollOffset old_scroll_offset = GetScrollOffset(); |
ScrollOffset new_scroll_offset(ClampScrollOffset(RoundedIntSize( |
ToScrollOffset(FloatPoint(r.Location()) + old_scroll_offset)))); |
- SetScrollOffset(new_scroll_offset, scroll_type, kScrollBehaviorInstant); |
- ScrollOffset scroll_offset_difference = GetScrollOffset() - old_scroll_offset; |
+ if (is_smooth) { |
+ DCHECK(scroll_type != kUserScroll); |
+ GetSmoothScrollSequencer()->QueueAnimation(this, new_scroll_offset); |
+ } else { |
+ SetScrollOffset(new_scroll_offset, scroll_type, kScrollBehaviorInstant); |
+ } |
+ ScrollOffset scroll_offset_difference = |
+ ClampScrollOffset(new_scroll_offset) - old_scroll_offset; |
local_expose_rect.Move(-LayoutSize(scroll_offset_difference)); |
LayoutRect intersect = |