| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // FIXME: parentPhase depends on groups being implemented. | 149 // FIXME: parentPhase depends on groups being implemented. |
| 150 const AnimationEffect::Phase parentPhase = AnimationEffect::PhaseActive; | 150 const AnimationEffect::Phase parentPhase = AnimationEffect::PhaseActive; |
| 151 const double activeTime = calculateActiveTime(activeDuration, resolvedFi
llMode(m_timing.fillMode, isKeyframeEffect()), localTime, parentPhase, currentPh
ase, m_timing); | 151 const double activeTime = calculateActiveTime(activeDuration, resolvedFi
llMode(m_timing.fillMode, isKeyframeEffect()), localTime, parentPhase, currentPh
ase, m_timing); |
| 152 | 152 |
| 153 double currentIteration; | 153 double currentIteration; |
| 154 double progress; | 154 double progress; |
| 155 if (const double iterationDuration = this->iterationDuration()) { | 155 if (const double iterationDuration = this->iterationDuration()) { |
| 156 const double startOffset = multiplyZeroAlwaysGivesZero(m_timing.iter
ationStart, iterationDuration); | 156 const double startOffset = multiplyZeroAlwaysGivesZero(m_timing.iter
ationStart, iterationDuration); |
| 157 ASSERT(startOffset >= 0); | 157 ASSERT(startOffset >= 0); |
| 158 const double scaledActiveTime = calculateScaledActiveTime(activeDura
tion, activeTime, startOffset, m_timing); | 158 const double scaledActiveTime = calculateScaledActiveTime(activeDura
tion, activeTime, startOffset, m_timing); |
| 159 const double iterationTime = calculateIterationTime(iterationDuratio
n, repeatedDuration(), scaledActiveTime, startOffset, m_timing); | 159 const double iterationTime = calculateIterationTime(iterationDuratio
n, repeatedDuration(), scaledActiveTime, startOffset, currentPhase, m_timing); |
| 160 | 160 |
| 161 currentIteration = calculateCurrentIteration(iterationDuration, iter
ationTime, scaledActiveTime, m_timing); | 161 currentIteration = calculateCurrentIteration(iterationDuration, iter
ationTime, scaledActiveTime, m_timing); |
| 162 const double transformedTime = calculateTransformedTime(currentItera
tion, iterationDuration, iterationTime, m_timing); | 162 const double transformedTime = calculateTransformedTime(currentItera
tion, iterationDuration, iterationTime, m_timing); |
| 163 | 163 |
| 164 // The infinite iterationDuration case here is a workaround because | 164 // The infinite iterationDuration case here is a workaround because |
| 165 // the specified behaviour does not handle infinite durations well. | 165 // the specified behaviour does not handle infinite durations well. |
| 166 // There is an open issue against the spec to fix this: | 166 // There is an open issue against the spec to fix this: |
| 167 // https://github.com/w3c/web-animations/issues/142 | 167 // https://github.com/w3c/web-animations/issues/142 |
| 168 if (!std::isfinite(iterationDuration)) | 168 if (!std::isfinite(iterationDuration)) |
| 169 progress = fmod(m_timing.iterationStart, 1.0); | 169 progress = fmod(m_timing.iterationStart, 1.0); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 180 const double localRepeatedDuration = localIterationDuration * m_timi
ng.iterationCount; | 180 const double localRepeatedDuration = localIterationDuration * m_timi
ng.iterationCount; |
| 181 ASSERT(localRepeatedDuration >= 0); | 181 ASSERT(localRepeatedDuration >= 0); |
| 182 const double localActiveDuration = m_timing.playbackRate ? localRepe
atedDuration / std::abs(m_timing.playbackRate) : std::numeric_limits<double>::in
finity(); | 182 const double localActiveDuration = m_timing.playbackRate ? localRepe
atedDuration / std::abs(m_timing.playbackRate) : std::numeric_limits<double>::in
finity(); |
| 183 ASSERT(localActiveDuration >= 0); | 183 ASSERT(localActiveDuration >= 0); |
| 184 const double localLocalTime = localTime < m_timing.startDelay ? loca
lTime : localActiveDuration + m_timing.startDelay; | 184 const double localLocalTime = localTime < m_timing.startDelay ? loca
lTime : localActiveDuration + m_timing.startDelay; |
| 185 const AnimationEffect::Phase localCurrentPhase = calculatePhase(loca
lActiveDuration, localLocalTime, m_timing); | 185 const AnimationEffect::Phase localCurrentPhase = calculatePhase(loca
lActiveDuration, localLocalTime, m_timing); |
| 186 const double localActiveTime = calculateActiveTime(localActiveDurati
on, resolvedFillMode(m_timing.fillMode, isKeyframeEffect()), localLocalTime, par
entPhase, localCurrentPhase, m_timing); | 186 const double localActiveTime = calculateActiveTime(localActiveDurati
on, resolvedFillMode(m_timing.fillMode, isKeyframeEffect()), localLocalTime, par
entPhase, localCurrentPhase, m_timing); |
| 187 const double startOffset = m_timing.iterationStart * localIterationD
uration; | 187 const double startOffset = m_timing.iterationStart * localIterationD
uration; |
| 188 ASSERT(startOffset >= 0); | 188 ASSERT(startOffset >= 0); |
| 189 const double scaledActiveTime = calculateScaledActiveTime(localActiv
eDuration, localActiveTime, startOffset, m_timing); | 189 const double scaledActiveTime = calculateScaledActiveTime(localActiv
eDuration, localActiveTime, startOffset, m_timing); |
| 190 const double iterationTime = calculateIterationTime(localIterationDu
ration, localRepeatedDuration, scaledActiveTime, startOffset, m_timing); | 190 const double iterationTime = calculateIterationTime(localIterationDu
ration, localRepeatedDuration, scaledActiveTime, startOffset, currentPhase, m_ti
ming); |
| 191 | 191 |
| 192 currentIteration = calculateCurrentIteration(localIterationDuration,
iterationTime, scaledActiveTime, m_timing); | 192 currentIteration = calculateCurrentIteration(localIterationDuration,
iterationTime, scaledActiveTime, m_timing); |
| 193 progress = calculateTransformedTime(currentIteration, localIteration
Duration, iterationTime, m_timing); | 193 progress = calculateTransformedTime(currentIteration, localIteration
Duration, iterationTime, m_timing); |
| 194 } | 194 } |
| 195 | 195 |
| 196 m_calculated.currentIteration = currentIteration; | 196 m_calculated.currentIteration = currentIteration; |
| 197 m_calculated.progress = progress; | 197 m_calculated.progress = progress; |
| 198 | 198 |
| 199 m_calculated.phase = currentPhase; | 199 m_calculated.phase = currentPhase; |
| 200 m_calculated.isInEffect = !isNull(activeTime); | 200 m_calculated.isInEffect = !isNull(activeTime); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 return AnimationEffectTiming::create(this); | 233 return AnimationEffectTiming::create(this); |
| 234 } | 234 } |
| 235 | 235 |
| 236 DEFINE_TRACE(AnimationEffect) | 236 DEFINE_TRACE(AnimationEffect) |
| 237 { | 237 { |
| 238 visitor->trace(m_animation); | 238 visitor->trace(m_animation); |
| 239 visitor->trace(m_eventDelegate); | 239 visitor->trace(m_eventDelegate); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace blink | 242 } // namespace blink |
| OLD | NEW |