Index: third_party/WebKit/Source/core/frame/FrameView.cpp |
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp |
index 92fc41da4e9b6acd0ff2bff1a01d8aa5c2561f3b..87e9ca9087d81c2622ecabbf65718c6bbfbf6306 100644 |
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp |
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp |
@@ -2144,6 +2144,13 @@ PlatformChromeClient* FrameView::GetChromeClient() const { |
return &page->GetChromeClient(); |
} |
+SmoothScrollSequencer* FrameView::GetSmoothScrollSequencer() const { |
+ Page* page = GetFrame().GetPage(); |
+ if (!page) |
+ return nullptr; |
+ return page->GetSmoothScrollSequencer(); |
+} |
+ |
void FrameView::ContentsResized() { |
if (frame_->IsMainFrame() && frame_->GetDocument()) { |
if (TextAutosizer* text_autosizer = |
@@ -4617,14 +4624,20 @@ bool FrameView::ShouldPlaceVerticalScrollbarOnLeft() const { |
LayoutRect FrameView::ScrollIntoView(const LayoutRect& rect_in_content, |
const ScrollAlignment& align_x, |
const ScrollAlignment& align_y, |
- ScrollType scroll_type) { |
+ ScrollType scroll_type, |
+ bool is_smooth) { |
LayoutRect view_rect(VisibleContentRect()); |
LayoutRect expose_rect = ScrollAlignment::GetRectToExpose( |
view_rect, rect_in_content, align_x, align_y); |
if (expose_rect != view_rect) { |
- SetScrollOffset( |
- ScrollOffset(expose_rect.X().ToFloat(), expose_rect.Y().ToFloat()), |
- scroll_type); |
+ ScrollOffset target_offset(expose_rect.X().ToFloat(), |
+ expose_rect.Y().ToFloat()); |
+ if (is_smooth) { |
+ DCHECK(scroll_type != kUserScroll); |
+ GetSmoothScrollSequencer()->QueueAnimation(this, target_offset); |
+ } else { |
+ SetScrollOffset(target_offset, scroll_type); |
+ } |
} |
// Scrolling the FrameView cannot change the input rect's location relative to |