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

Unified Diff: Source/platform/scroll/ProgrammaticScrollAnimator.cpp

Issue 1173053003: Remove ScrollableArea::notifyScrollPositionChanged and cleanup scroll animators. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase + remove updateScrollbars from FrameView::setScrollPosition 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
« no previous file with comments | « Source/platform/scroll/ProgrammaticScrollAnimator.h ('k') | Source/platform/scroll/ScrollAnimator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/scroll/ProgrammaticScrollAnimator.cpp
diff --git a/Source/platform/scroll/ProgrammaticScrollAnimator.cpp b/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
index f43c914e7f26554dd007de4f90cba4497b448fca..1de1c2a307664d35d6c54faa3c17cc3508d879dc 100644
--- a/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
+++ b/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
@@ -42,6 +42,17 @@ void ProgrammaticScrollAnimator::resetAnimationState()
m_compositorAnimationGroupId = 0;
}
+void ProgrammaticScrollAnimator::notifyPositionChanged(const DoublePoint& offset)
+{
+ m_scrollableArea->scrollPositionChanged(offset, ProgrammaticScroll);
+}
+
+void ProgrammaticScrollAnimator::scrollToOffsetWithoutAnimation(const FloatPoint& offset)
+{
+ cancelAnimation();
+ notifyPositionChanged(offset);
+}
+
void ProgrammaticScrollAnimator::animateToOffset(FloatPoint offset)
{
m_startTime = 0.0;
@@ -52,7 +63,7 @@ void ProgrammaticScrollAnimator::animateToOffset(FloatPoint offset)
m_scrollableArea->registerForAnimation();
if (!m_scrollableArea->scheduleAnimation()) {
resetAnimationState();
- m_scrollableArea->notifyScrollPositionChanged(IntPoint(offset.x(), offset.y()));
+ notifyPositionChanged(IntPoint(offset.x(), offset.y()));
}
m_runState = RunState::WaitingToSendToCompositor;
}
@@ -92,12 +103,12 @@ void ProgrammaticScrollAnimator::tickAnimation(double monotonicTime)
double elapsedTime = monotonicTime - m_startTime;
bool isFinished = (elapsedTime > m_animationCurve->duration());
FloatPoint offset = m_animationCurve->getValue(elapsedTime);
- m_scrollableArea->notifyScrollPositionChanged(IntPoint(offset.x(), offset.y()));
+ notifyPositionChanged(IntPoint(offset.x(), offset.y()));
if (isFinished) {
resetAnimationState();
} else if (!m_scrollableArea->scheduleAnimation()) {
- m_scrollableArea->notifyScrollPositionChanged(IntPoint(m_targetOffset.x(), m_targetOffset.y()));
+ notifyPositionChanged(IntPoint(m_targetOffset.x(), m_targetOffset.y()));
resetAnimationState();
}
}
@@ -156,7 +167,7 @@ void ProgrammaticScrollAnimator::updateCompositorAnimations()
if (!sentToCompositor) {
m_runState = RunState::RunningOnMainThread;
if (!m_scrollableArea->scheduleAnimation()) {
- m_scrollableArea->notifyScrollPositionChanged(IntPoint(m_targetOffset.x(), m_targetOffset.y()));
+ notifyPositionChanged(IntPoint(m_targetOffset.x(), m_targetOffset.y()));
resetAnimationState();
}
}
@@ -175,7 +186,7 @@ void ProgrammaticScrollAnimator::layerForCompositedScrollingDidChange()
m_scrollableArea->registerForAnimation();
if (!m_scrollableArea->scheduleAnimation()) {
resetAnimationState();
- m_scrollableArea->notifyScrollPositionChanged(IntPoint(m_targetOffset.x(), m_targetOffset.y()));
+ notifyPositionChanged(IntPoint(m_targetOffset.x(), m_targetOffset.y()));
}
}
}
« no previous file with comments | « Source/platform/scroll/ProgrammaticScrollAnimator.h ('k') | Source/platform/scroll/ScrollAnimator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698