OLD | NEW |
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" | |
16 | 15 |
17 namespace WebCore { | 16 namespace WebCore { |
18 | 17 |
19 PageAnimator::PageAnimator(Page* page) | 18 PageAnimator::PageAnimator(Page* page) |
20 : m_page(page) | 19 : m_page(page) |
21 , m_animationFramePending(false) | 20 , m_animationFramePending(false) |
22 , m_servicingAnimations(false) | 21 , m_servicingAnimations(false) |
23 { | 22 { |
24 } | 23 } |
25 | 24 |
26 void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime) | 25 void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime) |
27 { | 26 { |
28 m_animationFramePending = false; | 27 m_animationFramePending = false; |
29 TemporaryChange<bool> servicing(m_servicingAnimations, true); | 28 TemporaryChange<bool> servicing(m_servicingAnimations, true); |
30 | 29 |
31 for (RefPtr<LocalFrame> frame = m_page->mainFrame(); frame; frame = frame->t
ree().traverseNext()) { | 30 for (RefPtr<LocalFrame> frame = m_page->mainFrame(); frame; frame = frame->t
ree().traverseNext()) { |
32 frame->view()->serviceScrollAnimations(); | 31 frame->view()->serviceScrollAnimations(); |
33 DocumentAnimations::updateAnimationTimingForAnimationFrame(*frame->docum
ent(), monotonicAnimationStartTime); | 32 DocumentAnimations::updateAnimationTimingForAnimationFrame(*frame->docum
ent(), monotonicAnimationStartTime); |
34 SVGDocumentExtensions::serviceOnAnimationFrame(*frame->document(), monot
onicAnimationStartTime); | |
35 } | 33 } |
36 | 34 |
37 Vector<RefPtr<Document> > documents; | 35 Vector<RefPtr<Document> > documents; |
38 for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().t
raverseNext()) | 36 for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().t
raverseNext()) |
39 documents.append(frame->document()); | 37 documents.append(frame->document()); |
40 | 38 |
41 for (size_t i = 0; i < documents.size(); ++i) | 39 for (size_t i = 0; i < documents.size(); ++i) |
42 documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime); | 40 documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime); |
43 } | 41 } |
44 | 42 |
45 void PageAnimator::scheduleVisualUpdate() | 43 void PageAnimator::scheduleVisualUpdate() |
46 { | 44 { |
47 if (m_animationFramePending || m_servicingAnimations) | 45 if (m_animationFramePending || m_servicingAnimations) |
48 return; | 46 return; |
49 m_page->chrome().scheduleAnimation(); | 47 m_page->chrome().scheduleAnimation(); |
50 ASSERT(m_animationFramePending); | 48 ASSERT(m_animationFramePending); |
51 } | 49 } |
52 | 50 |
53 } | 51 } |
OLD | NEW |