Chromium Code Reviews| 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 492fabdffb528c5f48f0bcd315d3d5ef9b7dddf4..5fc070274c93abaf4fd5e589bd89f03cf83765c6 100644 |
| --- a/third_party/WebKit/Source/core/frame/FrameView.cpp |
| +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp |
| @@ -2053,6 +2053,14 @@ HostWindow* FrameView::getHostWindow() const { |
| return &page->chromeClient(); |
| } |
| +ProgrammaticScrollCoordinator* FrameView::getProgrammaticScrollCoordinator() |
| + const { |
| + Page* page = frame().page(); |
| + if (!page) |
| + return nullptr; |
| + return page->scrollingCoordinator()->programmaticScrollCoordinator(); |
| +} |
| + |
| void FrameView::contentsResized() { |
| if (m_frame->isMainFrame() && m_frame->document()) { |
| if (TextAutosizer* textAutosizer = m_frame->document()->textAutosizer()) |
| @@ -4378,16 +4386,23 @@ Widget* FrameView::getWidget() { |
| LayoutRect FrameView::scrollIntoView(const LayoutRect& rectInContent, |
| const ScrollAlignment& alignX, |
| const ScrollAlignment& alignY, |
| - ScrollType scrollType) { |
| + ScrollType scrollType, |
| + ScrollBehavior scrollBehavior) { |
| LayoutRect viewRect(visibleContentRect()); |
| LayoutRect exposeRect = |
| ScrollAlignment::getRectToExpose(viewRect, rectInContent, alignX, alignY); |
| if (exposeRect != viewRect) { |
| - setScrollOffset( |
| - ScrollOffset(exposeRect.x().toFloat(), exposeRect.y().toFloat()), |
| - scrollType); |
| + if (scrollType == ProgrammaticScroll && |
| + scrollBehavior == ScrollBehaviorSmooth) { |
|
bokan
2017/02/02 22:51:50
Add a DCHECK that we don't have a UserScroll passi
sunyunjia
2017/02/10 23:25:20
Done.
|
| + getProgrammaticScrollCoordinator()->queueAnimation( |
| + this, |
| + ScrollOffset(exposeRect.x().toFloat(), exposeRect.y().toFloat())); |
| + } else { |
| + setScrollOffset( |
| + ScrollOffset(exposeRect.x().toFloat(), exposeRect.y().toFloat()), |
| + scrollType); |
| + } |
| } |
| - |
| // Scrolling the FrameView cannot change the input rect's location relative to |
| // the document. |
| return rectInContent; |