Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Unified Diff: Source/core/frame/FrameView.cpp

Issue 1158673006: Replace various ScrollableArea scroll methods with setScrollPosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/frame/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index 04c1c28aa2015b31187252cfe1648fa47d30b9f4..9861b162c145cbc4ee6a0df7939e9265f96e3a77 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -1499,7 +1499,7 @@ void FrameView::maintainScrollPositionAtAnchor(Node* anchorNode)
scrollToAnchor();
}
-void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollBehavior scrollBehavior)
+void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollType scrollType, ScrollBehavior scrollBehavior)
{
cancelProgrammaticScrollAnimation();
m_maintainScrollPositionAnchor = nullptr;
@@ -1513,9 +1513,11 @@ void FrameView::setScrollPosition(const DoublePoint& scrollPoint, ScrollBehavior
if (scrollBehavior == ScrollBehaviorInstant) {
DoubleSize newOffset(newScrollPosition.x(), newScrollPosition.y());
+ // TODO(bokan): Why do we need to go through updateScrollbars? If not, we can
+ // just delete this whole method and use the base version.
updateScrollbars(newOffset);
} else {
- programmaticallyScrollSmoothlyToOffset(toFloatPoint(newScrollPosition));
+ ScrollableArea::setScrollPosition(newScrollPosition, ProgrammaticScroll, ScrollBehaviorSmooth);
}
}
@@ -3213,12 +3215,12 @@ int FrameView::scrollSize(ScrollbarOrientation orientation) const
return scrollbar->totalSize() - scrollbar->visibleSize();
}
-void FrameView::setScrollOffset(const IntPoint& offset)
+void FrameView::setScrollOffset(const IntPoint& offset, ScrollType)
{
scrollTo(DoublePoint(adjustScrollPositionWithinRange(offset)));
}
-void FrameView::setScrollOffset(const DoublePoint& offset)
+void FrameView::setScrollOffset(const DoublePoint& offset, ScrollType)
{
scrollTo(adjustScrollPositionWithinRange(offset));
}
@@ -3460,7 +3462,7 @@ void FrameView::setScrollOffsetFromUpdateScrollbars(const DoubleSize& offset)
adjustedScrollPosition = adjustScrollPositionWithinRange(adjustedScrollPosition);
if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged()) {
- ScrollableArea::scrollToOffsetWithoutAnimation(toFloatPoint(adjustedScrollPosition));
+ ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticScroll);
resetScrollOriginChanged();
}
}
@@ -3746,7 +3748,7 @@ LayoutRect FrameView::scrollIntoView(const LayoutRect& rectInContent, const Scro
double xOffset = exposeRect.x();
double yOffset = exposeRect.y();
- setScrollPosition(DoublePoint(xOffset, yOffset));
+ setScrollPosition(DoublePoint(xOffset, yOffset), ProgrammaticScroll);
// Scrolling the FrameView cannot change the input rect's location relative to the document.
return rectInContent;

Powered by Google App Engine
This is Rietveld 408576698