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

Unified Diff: Source/WebCore/platform/graphics/chromium/cc/CCActiveAnimation.cpp

Issue 10384167: Merge 116554 - [chromium] Add impl-thread support for fill-mode and direction css animation propert… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 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/WebCore/platform/graphics/chromium/cc/CCActiveAnimation.cpp
===================================================================
--- Source/WebCore/platform/graphics/chromium/cc/CCActiveAnimation.cpp (revision 116999)
+++ Source/WebCore/platform/graphics/chromium/cc/CCActiveAnimation.cpp (working copy)
@@ -45,6 +45,7 @@
, m_runState(WaitingForTargetAvailability)
, m_iterations(1)
, m_startTime(0)
+ , m_alternatesDirection(false)
, m_timeOffset(0)
, m_needsSynchronizedStartTime(false)
, m_suspended(false)
@@ -119,11 +120,23 @@
return trimmed;
// If greater than or equal to the total duration, return iteration duration.
- if (m_iterations >= 0 && trimmed >= m_curve->duration() * m_iterations)
+ if (m_iterations >= 0 && trimmed >= m_curve->duration() * m_iterations) {
+ if (m_alternatesDirection && !(m_iterations % 2))
+ return 0;
return m_curve->duration();
+ }
- // Finally, return x where trimmed = x + n * m_animation->duration() for some positive integer n.
- return fmod(trimmed, m_curve->duration());
+ // We need to know the current iteration if we're alternating.
+ int iteration = static_cast<int>(trimmed / m_curve->duration());
+
+ // Calculate x where trimmed = x + n * m_curve->duration() for some positive integer n.
+ trimmed = fmod(trimmed, m_curve->duration());
+
+ // If we're alternating and on an odd iteration, reverse the direction.
+ if (m_alternatesDirection && iteration % 2 == 1)
+ return m_curve->duration() - trimmed;
+
+ return trimmed;
}
PassOwnPtr<CCActiveAnimation> CCActiveAnimation::cloneForImplThread() const
@@ -135,6 +148,7 @@
toReturn->m_pauseTime = m_pauseTime;
toReturn->m_totalPausedTime = m_totalPausedTime;
toReturn->m_timeOffset = m_timeOffset;
+ toReturn->m_alternatesDirection = m_alternatesDirection;
return toReturn.release();
}

Powered by Google App Engine
This is Rietveld 408576698