In PageAnimator iterate through collected documents instead of frames

In PageAnimator, it's possible frame tree has been mutated by
Javascript. To avoid this, we iterator through documents collection
instead, and check whether they are still present in their frames.

This was part of CL 214953004, which got reverted in 335103004 when it
caused crbug.com/383946. So I am adding back the reverted CL in parts.
This part should be only related to crbug.com/359028.

BUG=359028

Review URL: https://codereview.chromium.org/463493004

git-svn-id: svn://svn.chromium.org/blink/trunk@179992 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 94d7db17
......@@ -28,22 +28,22 @@ void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime)
m_animationFramePending = false;
TemporaryChange<bool> servicing(m_servicingAnimations, true);
for (RefPtr<Frame> frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
if (frame->isLocalFrame()) {
RefPtr<LocalFrame> localFrame = toLocalFrame(frame.get());
localFrame->view()->serviceScrollAnimations(monotonicAnimationStartTime);
DocumentAnimations::updateAnimationTimingForAnimationFrame(*localFrame->document(), monotonicAnimationStartTime);
SVGDocumentExtensions::serviceOnAnimationFrame(*localFrame->document(), monotonicAnimationStartTime);
}
}
WillBeHeapVector<RefPtrWillBeMember<Document> > documents;
for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
if (frame->isLocalFrame())
documents.append(toLocalFrame(frame)->document());
}
for (size_t i = 0; i < documents.size(); ++i) {
if (documents[i]->frame())
documents[i]->view()->serviceScrollAnimations(monotonicAnimationStartTime);
}
for (size_t i = 0; i < documents.size(); ++i) {
DocumentAnimations::updateAnimationTimingForAnimationFrame(*documents[i], monotonicAnimationStartTime);
SVGDocumentExtensions::serviceOnAnimationFrame(*documents[i], monotonicAnimationStartTime);
}
for (size_t i = 0; i < documents.size(); ++i)
documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment