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

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

Issue 244253002: Avoid useless initialization in ScrollAnimatorNone::PerAxisData::animateScroll() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/scroll/ScrollAnimatorNone.cpp
diff --git a/Source/platform/scroll/ScrollAnimatorNone.cpp b/Source/platform/scroll/ScrollAnimatorNone.cpp
index 4a24201241b5a35b37f3c3de5060472d319feafb..cf21a24f99de6cb00571e993f1a37ad676c0c5a9 100644
--- a/Source/platform/scroll/ScrollAnimatorNone.cpp
+++ b/Source/platform/scroll/ScrollAnimatorNone.cpp
@@ -334,18 +334,18 @@ bool ScrollAnimatorNone::PerAxisData::animateScroll(double currentTime)
m_lastAnimationTime = currentTime;
double deltaTime = currentTime - m_startTime;
- double newPosition = *m_currentPosition;
if (deltaTime > m_animationTime) {
*m_currentPosition = m_desiredPosition;
reset();
return false;
}
- if (deltaTime < m_attackTime)
+ double newPosition;
abarth-chromium 2014/04/20 14:10:05 Can we initialize it to zero? We generally like t
Inactive 2014/04/20 15:00:56 Counter proposal: I moved the initialization to a
+ if (deltaTime < m_attackTime) {
newPosition = attackCurve(m_attackCurve, deltaTime, m_attackTime, m_startPosition, m_attackPosition);
- else if (deltaTime < (m_animationTime - m_releaseTime))
+ } else if (deltaTime < (m_animationTime - m_releaseTime)) {
newPosition = m_attackPosition + (deltaTime - m_attackTime) * m_desiredVelocity;
- else {
+ } else {
// release is based on targeting the exact final position.
double releaseDeltaT = deltaTime - (m_animationTime - m_releaseTime);
newPosition = releaseCurve(m_releaseCurve, releaseDeltaT, m_releaseTime, m_releasePosition, m_desiredPosition);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698