| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 void DocumentTimeline::serviceAnimations(double monotonicAnimationStartTime) | 80 void DocumentTimeline::serviceAnimations(double monotonicAnimationStartTime) |
| 81 { | 81 { |
| 82 TRACE_EVENT0("webkit", "DocumentTimeline::serviceAnimations"); | 82 TRACE_EVENT0("webkit", "DocumentTimeline::serviceAnimations"); |
| 83 | 83 |
| 84 m_timing->cancelWake(); | 84 m_timing->cancelWake(); |
| 85 | 85 |
| 86 m_document->animationClock().updateTime(monotonicAnimationStartTime); | 86 m_document->animationClock().updateTime(monotonicAnimationStartTime); |
| 87 | 87 |
| 88 double timeToNextEffect = std::numeric_limits<double>::infinity(); | 88 double timeToNextEffect = std::numeric_limits<double>::infinity(); |
| 89 double playerNextEffect; | 89 bool didTriggerStyleRecalc = false; |
| 90 for (int i = m_players.size() - 1; i >= 0; --i) { | 90 for (int i = m_players.size() - 1; i >= 0; --i) { |
| 91 if (!m_players[i]->update(&playerNextEffect)) | 91 double playerNextEffect; |
| 92 bool playerDidTriggerStyleRecalc; |
| 93 if (!m_players[i]->update(&playerNextEffect, &playerDidTriggerStyleRecal
c)) |
| 92 m_players.remove(i); | 94 m_players.remove(i); |
| 95 didTriggerStyleRecalc |= playerDidTriggerStyleRecalc; |
| 93 if (playerNextEffect < timeToNextEffect) | 96 if (playerNextEffect < timeToNextEffect) |
| 94 timeToNextEffect = playerNextEffect; | 97 timeToNextEffect = playerNextEffect; |
| 95 } | 98 } |
| 96 | 99 |
| 100 if (!didTriggerStyleRecalc) |
| 101 m_document->animationClock().unfreeze(); |
| 102 |
| 97 if (!m_players.isEmpty()) { | 103 if (!m_players.isEmpty()) { |
| 98 if (timeToNextEffect < s_minimumDelay) | 104 if (timeToNextEffect < s_minimumDelay) |
| 99 m_timing->serviceOnNextFrame(); | 105 m_timing->serviceOnNextFrame(); |
| 100 else if (timeToNextEffect != std::numeric_limits<double>::infinity()) | 106 else if (timeToNextEffect != std::numeric_limits<double>::infinity()) |
| 101 m_timing->wakeAfter(timeToNextEffect - s_minimumDelay); | 107 m_timing->wakeAfter(timeToNextEffect - s_minimumDelay); |
| 102 } | 108 } |
| 103 | 109 |
| 104 if (m_document->view() && !m_players.isEmpty()) | 110 if (m_document->view() && !m_players.isEmpty()) |
| 105 m_document->view()->scheduleAnimation(); | 111 m_document->view()->scheduleAnimation(); |
| 106 } | 112 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 156 } |
| 151 | 157 |
| 152 size_t DocumentTimeline::numberOfActiveAnimationsForTesting() const | 158 size_t DocumentTimeline::numberOfActiveAnimationsForTesting() const |
| 153 { | 159 { |
| 154 // Includes all players whose directly associated timed items | 160 // Includes all players whose directly associated timed items |
| 155 // are current or in effect. | 161 // are current or in effect. |
| 156 return isNull(m_zeroTime) ? 0 : m_players.size(); | 162 return isNull(m_zeroTime) ? 0 : m_players.size(); |
| 157 } | 163 } |
| 158 | 164 |
| 159 } // namespace | 165 } // namespace |
| OLD | NEW |