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

Side by Side Diff: Source/core/page/PageAnimator.cpp

Issue 190963003: Drive SVG Animations via requestAnimationFrame (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/core/animation/DocumentTimeline.h ('k') | Source/core/svg/SVGDocumentExtensions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/page/PageAnimator.h" 6 #include "core/page/PageAnimator.h"
7 7
8 #include "core/animation/DocumentAnimations.h" 8 #include "core/animation/DocumentAnimations.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
11 #include "core/frame/LocalFrame.h" 11 #include "core/frame/LocalFrame.h"
12 #include "core/page/Chrome.h" 12 #include "core/page/Chrome.h"
13 #include "core/page/ChromeClient.h" 13 #include "core/page/ChromeClient.h"
14 #include "core/page/Page.h" 14 #include "core/page/Page.h"
15 #include "core/svg/SVGDocumentExtensions.h"
15 16
16 namespace WebCore { 17 namespace WebCore {
17 18
18 PageAnimator::PageAnimator(Page* page) 19 PageAnimator::PageAnimator(Page* page)
19 : m_page(page) 20 : m_page(page)
20 , m_animationFramePending(false) 21 , m_animationFramePending(false)
21 , m_servicingAnimations(false) 22 , m_servicingAnimations(false)
22 { 23 {
23 } 24 }
24 25
25 void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime) 26 void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime)
26 { 27 {
27 m_animationFramePending = false; 28 m_animationFramePending = false;
28 TemporaryChange<bool> servicing(m_servicingAnimations, true); 29 TemporaryChange<bool> servicing(m_servicingAnimations, true);
29 30
30 for (RefPtr<LocalFrame> frame = m_page->mainFrame(); frame; frame = frame->t ree().traverseNext()) { 31 for (RefPtr<LocalFrame> frame = m_page->mainFrame(); frame; frame = frame->t ree().traverseNext()) {
31 frame->view()->serviceScrollAnimations(); 32 frame->view()->serviceScrollAnimations();
32 DocumentAnimations::updateAnimationTimingForAnimationFrame(*frame->docum ent(), monotonicAnimationStartTime); 33 DocumentAnimations::updateAnimationTimingForAnimationFrame(*frame->docum ent(), monotonicAnimationStartTime);
34 SVGDocumentExtensions::serviceOnAnimationFrame(*frame->document(), monot onicAnimationStartTime);
33 } 35 }
34 36
35 Vector<RefPtr<Document> > documents; 37 Vector<RefPtr<Document> > documents;
36 for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().t raverseNext()) 38 for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().t raverseNext())
37 documents.append(frame->document()); 39 documents.append(frame->document());
38 40
39 for (size_t i = 0; i < documents.size(); ++i) 41 for (size_t i = 0; i < documents.size(); ++i)
40 documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime); 42 documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime);
41 } 43 }
42 44
43 void PageAnimator::scheduleVisualUpdate() 45 void PageAnimator::scheduleVisualUpdate()
44 { 46 {
45 if (m_animationFramePending || m_servicingAnimations) 47 if (m_animationFramePending || m_servicingAnimations)
46 return; 48 return;
47 m_page->chrome().scheduleAnimation(); 49 m_page->chrome().scheduleAnimation();
48 ASSERT(m_animationFramePending); 50 ASSERT(m_animationFramePending);
49 } 51 }
50 52
51 } 53 }
OLDNEW
« no previous file with comments | « Source/core/animation/DocumentTimeline.h ('k') | Source/core/svg/SVGDocumentExtensions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698