Chromium Code Reviews| 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 1f4632132bb43eaf0d7c679da4023ffbf3a4fed0..56141911974a9e12e821b3215c1a307e2722b646 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& rectInContent, |
| const ScrollAlignment& alignX, |
| const ScrollAlignment& alignY, |
| - ScrollType scrollType) { |
| + ScrollType scrollType, |
| + ScrollBehavior scrollBehavior) { |
| // 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,14 @@ LayoutRect RootFrameViewport::scrollIntoView(const LayoutRect& rectInContent, |
| LayoutRect targetViewport = ScrollAlignment::getRectToExpose( |
| viewRectInContent, rectInContent, alignX, alignY); |
| if (targetViewport != viewRectInContent) { |
| - setScrollOffset(ScrollOffset(targetViewport.x(), targetViewport.y()), |
| - scrollType); |
| + if (scrollType == ProgrammaticScroll && |
|
bokan
2017/02/02 22:51:50
Ditto here for DCHECK
sunyunjia
2017/02/10 23:25:20
Done.
|
| + scrollBehavior == ScrollBehaviorSmooth) { |
| + getProgrammaticScrollCoordinator()->queueAnimation( |
| + this, ScrollOffset(targetViewport.x(), targetViewport.y())); |
| + } else { |
| + setScrollOffset(ScrollOffset(targetViewport.x(), targetViewport.y()), |
| + scrollType); |
| + } |
| } |
| // RootFrameViewport only changes the viewport relative to the document so we |
| @@ -430,6 +437,11 @@ HostWindow* RootFrameViewport::getHostWindow() const { |
| return layoutViewport().getHostWindow(); |
| } |
| +ProgrammaticScrollCoordinator* |
| +RootFrameViewport::getProgrammaticScrollCoordinator() const { |
| + return layoutViewport().getProgrammaticScrollCoordinator(); |
| +} |
| + |
| void RootFrameViewport::serviceScrollAnimations(double monotonicTime) { |
| ScrollableArea::serviceScrollAnimations(monotonicTime); |
| layoutViewport().serviceScrollAnimations(monotonicTime); |