| 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 16 matching lines...) Expand all  Loading... | 
|   27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |   27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
|   28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |   28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
|   29  */ |   29  */ | 
|   30  |   30  | 
|   31 #include "config.h" |   31 #include "config.h" | 
|   32 #include "core/animation/TimedItem.h" |   32 #include "core/animation/TimedItem.h" | 
|   33 #include "core/animation/TimedItemCalculations.h" |   33 #include "core/animation/TimedItemCalculations.h" | 
|   34  |   34  | 
|   35 namespace WebCore { |   35 namespace WebCore { | 
|   36  |   36  | 
|   37 TimedItem::TimedItem(const Timing& timing) |   37 TimedItem::TimedItem(const Timing& timing, PassOwnPtr<TimedItemEventDelegate> ev
     entDelegate) | 
|   38     : m_parent(0) |   38     : m_parent(0) | 
|   39     , m_player(0) |   39     , m_player(0) | 
|   40     , m_startTime(0) |   40     , m_startTime(0) | 
|   41     , m_specified(timing) |   41     , m_specified(timing) | 
|   42     , m_calculated() |   42     , m_calculated() | 
 |   43     , m_eventDelegate(eventDelegate) | 
|   43 { |   44 { | 
|   44     timing.assertValid(); |   45     timing.assertValid(); | 
|   45 } |   46 } | 
|   46  |   47  | 
|   47 void TimedItem::updateInheritedTime(double inheritedTime) const |   48 void TimedItem::updateInheritedTime(double inheritedTime) const | 
|   48 { |   49 { | 
|   49     const double localTime = inheritedTime - m_startTime; |   50     const double localTime = inheritedTime - m_startTime; | 
|   50     const double iterationDuration = m_specified.hasIterationDuration |   51     const double iterationDuration = m_specified.hasIterationDuration | 
|   51         ? m_specified.iterationDuration |   52         ? m_specified.iterationDuration | 
|   52         : intrinsicIterationDuration(); |   53         : intrinsicIterationDuration(); | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
|   79         const TimedItem::Phase phase = calculatePhase(activeDuration, newLocalTi
     me, m_specified); |   80         const TimedItem::Phase phase = calculatePhase(activeDuration, newLocalTi
     me, m_specified); | 
|   80         const double activeTime = calculateActiveTime(activeDuration, newLocalTi
     me, parentPhase, phase, m_specified); |   81         const double activeTime = calculateActiveTime(activeDuration, newLocalTi
     me, parentPhase, phase, m_specified); | 
|   81         const double startOffset = m_specified.iterationStart * iterationDuratio
     n; |   82         const double startOffset = m_specified.iterationStart * iterationDuratio
     n; | 
|   82         const double scaledActiveTime = calculateScaledActiveTime(activeDuration
     , activeTime, startOffset, m_specified); |   83         const double scaledActiveTime = calculateScaledActiveTime(activeDuration
     , activeTime, startOffset, m_specified); | 
|   83         const double iterationTime = calculateIterationTime(iterationDuration, r
     epeatedDuration, scaledActiveTime, startOffset, m_specified); |   84         const double iterationTime = calculateIterationTime(iterationDuration, r
     epeatedDuration, scaledActiveTime, startOffset, m_specified); | 
|   84  |   85  | 
|   85         currentIteration = calculateCurrentIteration(iterationDuration, iteratio
     nTime, scaledActiveTime, m_specified); |   86         currentIteration = calculateCurrentIteration(iterationDuration, iteratio
     nTime, scaledActiveTime, m_specified); | 
|   86         timeFraction = calculateTransformedTime(currentIteration, iterationDurat
     ion, iterationTime, m_specified); |   87         timeFraction = calculateTransformedTime(currentIteration, iterationDurat
     ion, iterationTime, m_specified); | 
|   87     } |   88     } | 
|   88  |   89  | 
 |   90     const double lastIteration = m_calculated.currentIteration; | 
|   89     m_calculated.currentIteration = currentIteration; |   91     m_calculated.currentIteration = currentIteration; | 
|   90     m_calculated.activeDuration = activeDuration; |   92     m_calculated.activeDuration = activeDuration; | 
|   91     m_calculated.timeFraction = timeFraction; |   93     m_calculated.timeFraction = timeFraction; | 
|   92  |   94  | 
|   93     const bool wasInEffect = isInEffect(); |   95     const bool wasInEffect = m_calculated.isInEffect; | 
 |   96     const bool wasInPlay = m_calculated.isInPlay; | 
|   94     m_calculated.isInEffect = !isNull(activeTime); |   97     m_calculated.isInEffect = !isNull(activeTime); | 
|   95     m_calculated.isInPlay = phase == PhaseActive && (!m_parent || m_parent->isIn
     Play()); |   98     m_calculated.isInPlay = phase == PhaseActive && (!m_parent || m_parent->isIn
     Play()); | 
|   96     m_calculated.isCurrent = phase == PhaseBefore || isInPlay() || (m_parent && 
     m_parent->isCurrent()); |   99     m_calculated.isCurrent = phase == PhaseBefore || isInPlay() || (m_parent && 
     m_parent->isCurrent()); | 
|   97  |  100  | 
 |  101     if (m_eventDelegate && (isInPlay() != wasInPlay || (isInPlay() && lastIterat
     ion != currentIteration))) | 
 |  102         m_eventDelegate->onEventCondition(wasInPlay, isInPlay(), lastIteration, 
     currentIteration); | 
 |  103  | 
|   98     // FIXME: This probably shouldn't be recursive. |  104     // FIXME: This probably shouldn't be recursive. | 
|   99     updateChildrenAndEffects(wasInEffect); |  105     updateChildrenAndEffects(wasInEffect); | 
|  100 } |  106 } | 
|  101  |  107  | 
|  102 TimedItem::CalculatedTiming::CalculatedTiming() |  108 TimedItem::CalculatedTiming::CalculatedTiming() | 
|  103     : activeDuration(nullValue()) |  109     : activeDuration(nullValue()) | 
|  104     , currentIteration(nullValue()) |  110     , currentIteration(nullValue()) | 
|  105     , timeFraction(nullValue()) |  111     , timeFraction(nullValue()) | 
|  106     , isCurrent(false) |  112     , isCurrent(false) | 
|  107     , isInEffect(false) |  113     , isInEffect(false) | 
|  108     , isInPlay(false) |  114     , isInPlay(false) | 
|  109 { |  115 { | 
|  110 } |  116 } | 
|  111  |  117  | 
|  112 } // namespace WebCore |  118 } // namespace WebCore | 
| OLD | NEW |