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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 , m_servicingAnimations(false) | 22 , m_servicingAnimations(false) |
23 , m_updatingLayoutAndStyleForPainting(false) | 23 , m_updatingLayoutAndStyleForPainting(false) |
24 { | 24 { |
25 } | 25 } |
26 | 26 |
27 void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime) | 27 void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime) |
28 { | 28 { |
29 m_animationFramePending = false; | 29 m_animationFramePending = false; |
30 TemporaryChange<bool> servicing(m_servicingAnimations, true); | 30 TemporaryChange<bool> servicing(m_servicingAnimations, true); |
31 | 31 |
32 WillBeHeapVector<RefPtrWillBeMember<Document> > documents; | |
33 for (RefPtr<Frame> frame = m_page->mainFrame(); frame; frame = frame->tree()
.traverseNext()) { | 32 for (RefPtr<Frame> frame = m_page->mainFrame(); frame; frame = frame->tree()
.traverseNext()) { |
34 if (frame->isLocalFrame()) | 33 if (frame->isLocalFrame()) { |
35 documents.append(toLocalFrame(frame.get())->document()); | 34 RefPtr<LocalFrame> localFrame = toLocalFrame(frame.get()); |
36 } | 35 localFrame->view()->serviceScrollAnimations(); |
37 | 36 |
38 for (size_t i = 0; i < documents.size(); ++i) { | 37 DocumentAnimations::updateAnimationTimingForAnimationFrame(*localFra
me->document(), monotonicAnimationStartTime); |
39 if (documents[i]->frame()) { | 38 SVGDocumentExtensions::serviceOnAnimationFrame(*localFrame->document
(), monotonicAnimationStartTime); |
40 documents[i]->view()->serviceScrollAnimations(); | |
41 | |
42 if (const FrameView::ScrollableAreaSet* scrollableAreas = documents[
i]->view()->scrollableAreas()) { | |
43 for (FrameView::ScrollableAreaSet::iterator it = scrollableAreas
->begin(); it != scrollableAreas->end(); ++it) | |
44 (*it)->serviceScrollAnimations(); | |
45 } | |
46 } | 39 } |
47 } | 40 } |
48 | 41 |
49 for (size_t i = 0; i < documents.size(); ++i) { | 42 Vector<RefPtr<Document> > documents; |
50 DocumentAnimations::updateAnimationTimingForAnimationFrame(*documents[i]
, monotonicAnimationStartTime); | 43 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver
seNext()) { |
51 SVGDocumentExtensions::serviceOnAnimationFrame(*documents[i], monotonicA
nimationStartTime); | 44 if (frame->isLocalFrame()) |
| 45 documents.append(toLocalFrame(frame)->document()); |
52 } | 46 } |
53 | 47 |
54 for (size_t i = 0; i < documents.size(); ++i) | 48 for (size_t i = 0; i < documents.size(); ++i) |
55 documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime); | 49 documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime); |
56 } | 50 } |
57 | 51 |
58 void PageAnimator::scheduleVisualUpdate() | 52 void PageAnimator::scheduleVisualUpdate() |
59 { | 53 { |
60 // FIXME: also include m_animationFramePending here. It is currently not the
re due to crbug.com/353756. | 54 // FIXME: also include m_animationFramePending here. It is currently not the
re due to crbug.com/353756. |
61 if (m_servicingAnimations || m_updatingLayoutAndStyleForPainting) | 55 if (m_servicingAnimations || m_updatingLayoutAndStyleForPainting) |
(...skipping 17 matching lines...) Expand all Loading... |
79 // setFrameRect(). This will be a quick operation for most frames, but the | 73 // setFrameRect(). This will be a quick operation for most frames, but the |
80 // NativeWindowWidgets will update a proper clipping region. | 74 // NativeWindowWidgets will update a proper clipping region. |
81 view->setFrameRect(view->frameRect()); | 75 view->setFrameRect(view->frameRect()); |
82 | 76 |
83 // setFrameRect may have the side-effect of causing existing page layout to | 77 // setFrameRect may have the side-effect of causing existing page layout to |
84 // be invalidated, so layout needs to be called last. | 78 // be invalidated, so layout needs to be called last. |
85 view->updateLayoutAndStyleForPainting(); | 79 view->updateLayoutAndStyleForPainting(); |
86 } | 80 } |
87 | 81 |
88 } | 82 } |
OLD | NEW |