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 ee56bd1fe8fe55e8983f89a21f5b4af5215b71d5..698a96f9d4a18121bc1e9dbfebad7ac5c3175114 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& rect_in_content, |
const ScrollAlignment& align_x, |
const ScrollAlignment& align_y, |
- ScrollType scroll_type) { |
+ ScrollType scroll_type, |
+ bool is_smooth) { |
// 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& rect_in_content, |
LayoutRect target_viewport = ScrollAlignment::GetRectToExpose( |
view_rect_in_content, rect_in_content, align_x, align_y); |
if (target_viewport != view_rect_in_content) { |
- SetScrollOffset(ScrollOffset(target_viewport.X(), target_viewport.Y()), |
- scroll_type); |
+ ScrollOffset target_offset(target_viewport.X(), target_viewport.Y()); |
+ if (is_smooth) { |
+ DCHECK(scroll_type != kUserScroll); |
+ GetSmoothScrollSequencer()->QueueAnimation(this, target_offset); |
+ } else { |
+ SetScrollOffset(target_offset, scroll_type); |
+ } |
} |
// RootFrameViewport only changes the viewport relative to the document so we |
@@ -431,6 +437,14 @@ PlatformChromeClient* RootFrameViewport::GetChromeClient() const { |
return LayoutViewport().GetChromeClient(); |
} |
+bool RootFrameViewport::ScheduleAnimation() { |
+ return LayoutViewport().ScheduleAnimation(); |
+} |
+ |
+SmoothScrollSequencer* RootFrameViewport::GetSmoothScrollSequencer() const { |
+ return LayoutViewport().GetSmoothScrollSequencer(); |
+} |
+ |
void RootFrameViewport::ServiceScrollAnimations(double monotonic_time) { |
ScrollableArea::ServiceScrollAnimations(monotonic_time); |
LayoutViewport().ServiceScrollAnimations(monotonic_time); |