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

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

Issue 176903004: Have Document::timeline() / Document::transitionTimeline() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 30 matching lines...) Expand all
41 #include "core/frame/LocalFrame.h" 41 #include "core/frame/LocalFrame.h"
42 #include "core/rendering/RenderView.h" 42 #include "core/rendering/RenderView.h"
43 #include "core/rendering/compositing/RenderLayerCompositor.h" 43 #include "core/rendering/compositing/RenderLayerCompositor.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 } 53 }
54 54
55 } // namespace 55 } // namespace
56 56
57 void DocumentAnimations::dispatchAnimationEvents(Document& document) 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 DocumentAnimations::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 void DocumentAnimations::updateAnimationTimingForAnimationFrame(Document& docume nt, double monotonicAnimationStartTime) 69 void DocumentAnimations::updateAnimationTimingForAnimationFrame(Document& docume nt, double monotonicAnimationStartTime)
70 { 70 {
71 document.animationClock().updateTime(monotonicAnimationStartTime); 71 document.animationClock().updateTime(monotonicAnimationStartTime);
72 updateAnimationTiming(document); 72 updateAnimationTiming(document);
73 } 73 }
74 74
75 void DocumentAnimations::updateAnimationTimingForGetComputedStyle(Node& node, CS SPropertyID property) 75 void DocumentAnimations::updateAnimationTimingForGetComputedStyle(Node& node, CS SPropertyID property)
76 { 76 {
77 if (!node.isElementNode()) 77 if (!node.isElementNode())
78 return; 78 return;
79 const Element& element = toElement(node); 79 const Element& element = toElement(node);
80 if (element.document().timeline()->hasOutdatedPlayer()) { 80 if (element.document().timeline().hasOutdatedPlayer()) {
81 updateAnimationTiming(element.document()); 81 updateAnimationTiming(element.document());
82 return; 82 return;
83 } 83 }
84 if (const ActiveAnimations* activeAnimations = element.activeAnimations()) { 84 if (const ActiveAnimations* activeAnimations = element.activeAnimations()) {
85 if (activeAnimations->hasActiveAnimationsOnCompositor(property)) 85 if (activeAnimations->hasActiveAnimationsOnCompositor(property))
86 updateAnimationTiming(element.document()); 86 updateAnimationTiming(element.document());
87 } 87 }
88 } 88 }
89 89
90 void DocumentAnimations::startPendingAnimations(Document& document) 90 void DocumentAnimations::startPendingAnimations(Document& document)
91 { 91 {
92 ASSERT(document.lifecycle().state() == DocumentLifecycle::CompositingClean); 92 ASSERT(document.lifecycle().state() == DocumentLifecycle::CompositingClean);
93 if (document.cssPendingAnimations().startPendingAnimations()) { 93 if (document.cssPendingAnimations().startPendingAnimations()) {
94 ASSERT(document.view()); 94 ASSERT(document.view());
95 document.view()->scheduleAnimation(); 95 document.view()->scheduleAnimation();
96 } 96 }
97 97
98 document.animationClock().unfreeze(); 98 document.animationClock().unfreeze();
99 } 99 }
100 100
101 } // namespace WebCore 101 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/animation/DocumentAnimation.h ('k') | Source/core/animation/DocumentTimelineTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698