| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/animation/Animation.h" | 34 #include "core/animation/Animation.h" |
| 35 #include "core/animation/DocumentTimeline.h" | 35 #include "core/animation/DocumentTimeline.h" |
| 36 #include "core/frame/FrameView.h" | 36 #include "core/frame/FrameView.h" |
| 37 #include "core/rendering/RenderLayer.h" | 37 #include "core/rendering/RenderLayer.h" |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 void CSSPendingAnimations::add(Player* player) | 41 void CSSPendingAnimations::add(Player* player) |
| 42 { | 42 { |
| 43 ASSERT(player->source()->isAnimation()); | 43 ASSERT(player->source()->isAnimation()); |
| 44 // The actual start time is either this value, or the time that | 44 m_pending.append(player); |
| 45 // this animation, or an animation that it is synchronized with | |
| 46 // is started on the compositor. | |
| 47 const double defaultStartTime = player->timeline()->currentTime(); | |
| 48 m_pending.append(std::make_pair(player, defaultStartTime)); | |
| 49 } | 45 } |
| 50 | 46 |
| 51 bool CSSPendingAnimations::startPendingAnimations() | 47 bool CSSPendingAnimations::startPendingAnimations() |
| 52 { | 48 { |
| 53 // FIXME: This is called from within style recalc, at which point compositor
state is not up to date. | |
| 54 // https://code.google.com/p/chromium/issues/detail?id=339847 | |
| 55 DisableCompositingQueryAsserts disabler; | |
| 56 | |
| 57 bool startedOnCompositor = false; | 49 bool startedOnCompositor = false; |
| 58 for (size_t i = 0; i < m_pending.size(); ++i) { | 50 for (size_t i = 0; i < m_pending.size(); ++i) { |
| 59 if (m_pending[i].first->maybeStartAnimationOnCompositor()) | 51 if (m_pending[i]->maybeStartAnimationOnCompositor()) |
| 60 startedOnCompositor = true; | 52 startedOnCompositor = true; |
| 61 } | 53 } |
| 62 | 54 |
| 63 // If any animations were started on the compositor, all remaining | 55 // If any animations were started on the compositor, all remaining |
| 64 // need to wait for a synchronized start time. Otherwise they may | 56 // need to wait for a synchronized start time. Otherwise they may |
| 65 // start immediately. | 57 // start immediately. |
| 66 if (startedOnCompositor) { | 58 if (startedOnCompositor) { |
| 67 for (size_t i = 0; i < m_pending.size(); ++i) | 59 for (size_t i = 0; i < m_pending.size(); ++i) |
| 68 m_waitingForCompositorAnimationStart.append(m_pending[i].first); | 60 m_waitingForCompositorAnimationStart.append(m_pending[i]); |
| 69 } else { | 61 } else { |
| 70 for (size_t i = 0; i < m_pending.size(); ++i) { | 62 for (size_t i = 0; i < m_pending.size(); ++i) { |
| 71 m_pending[i].first->setStartTime(m_pending[i].second); | 63 m_pending[i]->setStartTime(m_pending[i]->timeline()->currentTime()); |
| 72 m_pending[i].first->update(); | 64 m_pending[i]->update(); |
| 73 } | 65 } |
| 74 } | 66 } |
| 75 m_pending.clear(); | 67 m_pending.clear(); |
| 76 | 68 |
| 77 if (startedOnCompositor || m_waitingForCompositorAnimationStart.isEmpty()) | 69 if (startedOnCompositor || m_waitingForCompositorAnimationStart.isEmpty()) |
| 78 return !m_waitingForCompositorAnimationStart.isEmpty(); | 70 return !m_waitingForCompositorAnimationStart.isEmpty(); |
| 79 | 71 |
| 80 // Check if we're still waiting for any compositor animations to start. | 72 // Check if we're still waiting for any compositor animations to start. |
| 81 for (size_t i = 0; i < m_waitingForCompositorAnimationStart.size(); ++i) { | 73 for (size_t i = 0; i < m_waitingForCompositorAnimationStart.size(); ++i) { |
| 82 if (m_waitingForCompositorAnimationStart[i].get()->hasActiveAnimationsOn
Compositor()) | 74 if (m_waitingForCompositorAnimationStart[i].get()->hasActiveAnimationsOn
Compositor()) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 93 for (size_t i = 0; i < m_waitingForCompositorAnimationStart.size(); ++i) { | 85 for (size_t i = 0; i < m_waitingForCompositorAnimationStart.size(); ++i) { |
| 94 Player* player = m_waitingForCompositorAnimationStart[i].get(); | 86 Player* player = m_waitingForCompositorAnimationStart[i].get(); |
| 95 player->setStartTime(monotonicAnimationStartTime - player->timeline()->z
eroTime()); | 87 player->setStartTime(monotonicAnimationStartTime - player->timeline()->z
eroTime()); |
| 96 player->update(); | 88 player->update(); |
| 97 } | 89 } |
| 98 | 90 |
| 99 m_waitingForCompositorAnimationStart.clear(); | 91 m_waitingForCompositorAnimationStart.clear(); |
| 100 } | 92 } |
| 101 | 93 |
| 102 } // namespace | 94 } // namespace |
| OLD | NEW |