Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: Source/core/animation/DocumentAnimations.cpp

Issue 135693003: Defer starting of animations until after compositing update (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move some AnimationClock functions to cpp. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 } // namespace
56
57 void DocumentAnimations::dispatchAnimationEvents(Document& document)
58 { 58 {
59 document.timeline()->dispatchEvents(); 59 document.timeline()->dispatchEvents();
60 document.transitionTimeline()->dispatchEvents(); 60 document.transitionTimeline()->dispatchEvents();
61 } 61 }
62 62
63 void dispatchAnimationEventsAsync(Document& document) 63 void DocumentAnimations::dispatchAnimationEventsAsync(Document& document)
64 { 64 {
65 document.timeline()->dispatchEventsAsync(); 65 document.timeline()->dispatchEventsAsync();
66 document.transitionTimeline()->dispatchEventsAsync(); 66 document.transitionTimeline()->dispatchEventsAsync();
67 } 67 }
68 68
69 } // namespace 69 void DocumentAnimations::updateAnimationTimingForAnimationFrame(Document& docume nt, double monotonicAnimationStartTime)
70
71 void DocumentAnimations::serviceOnAnimationFrame(Document& document, double mono tonicAnimationStartTime)
72 { 70 {
73 document.animationClock().updateTime(monotonicAnimationStartTime); 71 document.animationClock().updateTime(monotonicAnimationStartTime);
74 updateAnimationTiming(document); 72 updateAnimationTiming(document);
75 dispatchAnimationEvents(document);
76 } 73 }
77 74
78 void DocumentAnimations::serviceBeforeGetComputedStyle(Node& node, CSSPropertyID property) 75 void DocumentAnimations::updateAnimationTimingForGetComputedStyle(Node& node, CS SPropertyID property)
79 { 76 {
80 if (!node.isElementNode()) 77 if (!node.isElementNode())
81 return; 78 return;
82 const Element& element = toElement(node); 79 const Element& element = toElement(node);
83 if (element.document().timeline()->hasOutdatedPlayer()) { 80 if (element.document().timeline()->hasOutdatedPlayer()) {
84 updateAnimationTiming(element.document()); 81 updateAnimationTiming(element.document());
85 return; 82 return;
86 } 83 }
87 if (const ActiveAnimations* activeAnimations = element.activeAnimations()) { 84 if (const ActiveAnimations* activeAnimations = element.activeAnimations()) {
88 if (activeAnimations->hasActiveAnimationsOnCompositor(property)) 85 if (activeAnimations->hasActiveAnimationsOnCompositor(property))
89 updateAnimationTiming(element.document()); 86 updateAnimationTiming(element.document());
90 } 87 }
91 } 88 }
92 89
93 void DocumentAnimations::serviceAfterStyleRecalc(Document& document) 90 void DocumentAnimations::startPendingAnimations(Document& document)
94 { 91 {
92 ASSERT(document.lifecycle().state() == DocumentLifecycle::CompositingClean);
95 if (document.cssPendingAnimations().startPendingAnimations() && document.vie w()) 93 if (document.cssPendingAnimations().startPendingAnimations() && document.vie w())
esprehn 2014/02/25 00:00:48 You should ASSERT(document().view()) here, it can'
dstockwell 2014/02/25 00:52:03 Done.
96 document.view()->scheduleAnimation(); 94 document.view()->scheduleAnimation();
97 95
98 document.animationClock().unfreeze(); 96 document.animationClock().unfreeze();
99 dispatchAnimationEventsAsync(document);
100 } 97 }
101 98
102 } // namespace WebCore 99 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698