Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 #include "core/rendering/RenderView.h" | 43 #include "core/rendering/RenderView.h" |
| 44 | 44 |
| 45 namespace WebCore { | 45 namespace WebCore { |
| 46 | 46 |
| 47 namespace { | 47 namespace { |
| 48 | 48 |
| 49 void updateAnimationTiming(Document& document) | 49 void updateAnimationTiming(Document& document) |
| 50 { | 50 { |
| 51 document.timeline()->serviceAnimations(); | 51 document.timeline()->serviceAnimations(); |
| 52 document.transitionTimeline()->serviceAnimations(); | 52 document.transitionTimeline()->serviceAnimations(); |
| 53 if (!document.childNeedsStyleRecalc()) | |
| 54 document.animationClock().unfreeze(); | |
| 55 } | 53 } |
| 56 | 54 |
| 57 void dispatchAnimationEvents(Document& document) | 55 void dispatchAnimationEvents(Document& document) |
| 58 { | 56 { |
| 59 document.timeline()->dispatchEvents(); | 57 document.timeline()->dispatchEvents(); |
| 60 document.transitionTimeline()->dispatchEvents(); | 58 document.transitionTimeline()->dispatchEvents(); |
| 61 } | 59 } |
| 62 | 60 |
| 63 void dispatchAnimationEventsAsync(Document& document) | 61 void dispatchAnimationEventsAsync(Document& document) |
| 64 { | 62 { |
| 65 document.timeline()->dispatchEventsAsync(); | 63 document.timeline()->dispatchEventsAsync(); |
| 66 document.transitionTimeline()->dispatchEventsAsync(); | 64 document.transitionTimeline()->dispatchEventsAsync(); |
| 67 } | 65 } |
| 68 | 66 |
| 69 } // namespace | 67 } // namespace |
| 70 | 68 |
| 71 void DocumentAnimations::serviceOnAnimationFrame(Document& document, double mono tonicAnimationStartTime) | 69 void DocumentAnimations::serviceOnFrameStart(Document& document, double monotoni cAnimationStartTime) |
| 72 { | 70 { |
| 71 // FIXME: This seems fragile. Do we need a separate frame lifecycle? | |
| 72 ASSERT(document.lifecycle().state() == DocumentLifecycle::StyleClean || docu ment.lifecycle().state() == DocumentLifecycle::StyleRecalcPending || document.li fecycle().state() == DocumentLifecycle::LayoutClean || document.lifecycle().stat e() == DocumentLifecycle::CompositingClean); | |
|
abarth-chromium
2014/02/20 17:52:00
What are you trying to assert here? As written, t
dstockwell
2014/02/20 18:22:01
I was looking at what we know about the beginning
| |
| 73 document.animationClock().updateTime(monotonicAnimationStartTime); | 73 document.animationClock().updateTime(monotonicAnimationStartTime); |
| 74 updateAnimationTiming(document); | 74 updateAnimationTiming(document); |
| 75 dispatchAnimationEvents(document); | 75 dispatchAnimationEvents(document); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void DocumentAnimations::serviceBeforeGetComputedStyle(Node& node, CSSPropertyID property) | 78 void DocumentAnimations::serviceBeforeGetComputedStyle(Node& node, CSSPropertyID property) |
| 79 { | 79 { |
| 80 if (!node.isElementNode()) | 80 if (!node.isElementNode()) |
| 81 return; | 81 return; |
| 82 const Element& element = toElement(node); | 82 const Element& element = toElement(node); |
| 83 if (element.document().timeline()->hasOutdatedPlayer()) { | 83 if (element.document().timeline()->hasOutdatedPlayer()) { |
| 84 updateAnimationTiming(element.document()); | 84 updateAnimationTiming(element.document()); |
| 85 return; | 85 return; |
| 86 } | 86 } |
| 87 if (const ActiveAnimations* activeAnimations = element.activeAnimations()) { | 87 if (const ActiveAnimations* activeAnimations = element.activeAnimations()) { |
| 88 if (activeAnimations->hasActiveAnimationsOnCompositor(property)) | 88 if (activeAnimations->hasActiveAnimationsOnCompositor(property)) |
| 89 updateAnimationTiming(element.document()); | 89 updateAnimationTiming(element.document()); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 void DocumentAnimations::serviceAfterStyleRecalc(Document& document) | 93 void DocumentAnimations::serviceOnFrameEnd(Document& document) |
| 94 { | 94 { |
| 95 ASSERT(document.lifecycle().state() == DocumentLifecycle::CompositingClean); | |
| 95 if (document.cssPendingAnimations().startPendingAnimations() && document.vie w()) | 96 if (document.cssPendingAnimations().startPendingAnimations() && document.vie w()) |
| 96 document.view()->scheduleAnimation(); | 97 document.view()->scheduleAnimation(); |
| 97 | 98 |
| 98 document.animationClock().unfreeze(); | 99 document.animationClock().unfreeze(); |
| 99 dispatchAnimationEventsAsync(document); | 100 dispatchAnimationEventsAsync(document); |
| 100 } | 101 } |
| 101 | 102 |
| 102 } // namespace WebCore | 103 } // namespace WebCore |
| OLD | NEW |