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

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

Issue 1298253003: Merge the multiple frame tree walks in PageAnimator::serviceScriptedAnimations. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 | « no previous file | no next file » | 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/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 25 matching lines...) Expand all
36 { 36 {
37 RefPtrWillBeRawPtr<PageAnimator> protector(this); 37 RefPtrWillBeRawPtr<PageAnimator> protector(this);
38 TemporaryChange<bool> servicing(m_servicingAnimations, true); 38 TemporaryChange<bool> servicing(m_servicingAnimations, true);
39 39
40 WillBeHeapVector<RefPtrWillBeMember<Document>> documents; 40 WillBeHeapVector<RefPtrWillBeMember<Document>> documents;
41 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) { 41 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) {
42 if (frame->isLocalFrame()) 42 if (frame->isLocalFrame())
43 documents.append(toLocalFrame(frame)->document()); 43 documents.append(toLocalFrame(frame)->document());
44 } 44 }
45 45
46 for (size_t i = 0; i < documents.size(); ++i) { 46 for (auto& document : documents) {
47 if (documents[i]->view()) { 47 if (document->view()) {
48 documents[i]->view()->scrollableArea()->serviceScrollAnimations(mono tonicAnimationStartTime); 48 document->view()->scrollableArea()->serviceScrollAnimations(monotoni cAnimationStartTime);
49 49
50 if (const FrameView::ScrollableAreaSet* animatingScrollableAreas = d ocuments[i]->view()->animatingScrollableAreas()) { 50 if (const FrameView::ScrollableAreaSet* animatingScrollableAreas = d ocument->view()->animatingScrollableAreas()) {
51 // Iterate over a copy, since ScrollableAreas may deregister 51 // Iterate over a copy, since ScrollableAreas may deregister
52 // themselves during the iteration. 52 // themselves during the iteration.
53 Vector<ScrollableArea*> animatingScrollableAreasCopy; 53 Vector<ScrollableArea*> animatingScrollableAreasCopy;
54 copyToVector(*animatingScrollableAreas, animatingScrollableAreas Copy); 54 copyToVector(*animatingScrollableAreas, animatingScrollableAreas Copy);
55 for (ScrollableArea* scrollableArea : animatingScrollableAreasCo py) 55 for (ScrollableArea* scrollableArea : animatingScrollableAreasCo py)
56 scrollableArea->serviceScrollAnimations(monotonicAnimationSt artTime); 56 scrollableArea->serviceScrollAnimations(monotonicAnimationSt artTime);
57 } 57 }
58 } 58 }
59 DocumentAnimations::updateAnimationTimingForAnimationFrame(*document, mo notonicAnimationStartTime);
60 SVGDocumentExtensions::serviceOnAnimationFrame(*document, monotonicAnima tionStartTime);
61 document->serviceScriptedAnimations(monotonicAnimationStartTime);
59 } 62 }
60 63
61 for (size_t i = 0; i < documents.size(); ++i) {
62 DocumentAnimations::updateAnimationTimingForAnimationFrame(*documents[i] , monotonicAnimationStartTime);
63 SVGDocumentExtensions::serviceOnAnimationFrame(*documents[i], monotonicA nimationStartTime);
64 }
65
66 for (size_t i = 0; i < documents.size(); ++i)
67 documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime);
68
69 #if ENABLE(OILPAN) 64 #if ENABLE(OILPAN)
65 // TODO(esprehn): Why is this here? It doesn't make sense to explicitly
66 // clear a stack allocated vector.
70 documents.clear(); 67 documents.clear();
71 #endif 68 #endif
72 } 69 }
73 70
74 void PageAnimator::scheduleVisualUpdate(LocalFrame* frame) 71 void PageAnimator::scheduleVisualUpdate(LocalFrame* frame)
75 { 72 {
76 if (m_servicingAnimations || m_updatingLayoutAndStyleForPainting) 73 if (m_servicingAnimations || m_updatingLayoutAndStyleForPainting)
77 return; 74 return;
78 // FIXME: The frame-specific version of scheduleAnimation() is for 75 // FIXME: The frame-specific version of scheduleAnimation() is for
79 // out-of-process iframes. Passing 0 or the top-level frame to this method 76 // out-of-process iframes. Passing 0 or the top-level frame to this method
(...skipping 11 matching lines...) Expand all
91 RefPtrWillBeRawPtr<FrameView> view = rootFrame->view(); 88 RefPtrWillBeRawPtr<FrameView> view = rootFrame->view();
92 89
93 TemporaryChange<bool> servicing(m_updatingLayoutAndStyleForPainting, true); 90 TemporaryChange<bool> servicing(m_updatingLayoutAndStyleForPainting, true);
94 91
95 // setFrameRect may have the side-effect of causing existing page layout to 92 // setFrameRect may have the side-effect of causing existing page layout to
96 // be invalidated, so layout needs to be called last. 93 // be invalidated, so layout needs to be called last.
97 view->updateAllLifecyclePhases(); 94 view->updateAllLifecyclePhases();
98 } 95 }
99 96
100 } 97 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698