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 db2ee4b233d8dab7ebc5736b177856ad63136137..746b01b04c40e49660c88a3fc24107459abfceed 100644 |
| --- a/third_party/WebKit/Source/core/frame/FrameView.cpp |
| +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp |
| @@ -2102,6 +2102,13 @@ HostWindow* FrameView::getHostWindow() const { |
| return &page->chromeClient(); |
| } |
| +SmoothScrollSequencer* FrameView::getSmoothScrollSequencer() const { |
| + Page* page = frame().page(); |
| + if (!page) |
| + return nullptr; |
| + return page->smoothScrollSequencer(); |
| +} |
| + |
| void FrameView::contentsResized() { |
| if (m_frame->isMainFrame() && m_frame->document()) { |
| if (TextAutosizer* textAutosizer = m_frame->document()->textAutosizer()) |
| @@ -4496,16 +4503,21 @@ FrameViewBase* FrameView::getFrameViewBase() { |
| LayoutRect FrameView::scrollIntoView(const LayoutRect& rectInContent, |
| const ScrollAlignment& alignX, |
| const ScrollAlignment& alignY, |
| - ScrollType scrollType) { |
| + ScrollType scrollType, |
| + bool isSmooth) { |
| LayoutRect viewRect(visibleContentRect()); |
| LayoutRect exposeRect = |
| ScrollAlignment::getRectToExpose(viewRect, rectInContent, alignX, alignY); |
| if (exposeRect != viewRect) { |
| - setScrollOffset( |
| - ScrollOffset(exposeRect.x().toFloat(), exposeRect.y().toFloat()), |
| - scrollType); |
| + ScrollOffset targetOffset(exposeRect.x().toFloat(), |
| + exposeRect.y().toFloat()); |
| + if (isSmooth) { |
| + DCHECK(scrollType != UserScroll); |
| + getSmoothScrollSequencer()->queueAnimation(this, targetOffset); |
| + } else { |
| + setScrollOffset(targetOffset, scrollType); |
| + } |
| } |
| - |
|
bokan
2017/04/07 15:56:52
Nit: the blank line was fine
sunyunjia
2017/05/12 18:40:25
Done.
|
| // Scrolling the FrameView cannot change the input rect's location relative to |
| // the document. |
| return rectInContent; |