| 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/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| 11 #include "core/page/Chrome.h" | 11 #include "core/page/Chrome.h" |
| 12 #include "core/page/ChromeClient.h" | 12 #include "core/page/ChromeClient.h" |
| 13 #include "core/page/Page.h" | 13 #include "core/page/Page.h" |
| 14 #include "core/svg/SVGDocumentExtensions.h" | 14 #include "core/svg/SVGDocumentExtensions.h" |
| 15 #include "public/platform/WebFrameTime.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 , m_updatingLayoutAndStyleForPainting(false) | 23 , m_updatingLayoutAndStyleForPainting(false) |
| 23 { | 24 { |
| 24 } | 25 } |
| 25 | 26 |
| 26 void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime) | 27 void PageAnimator::serviceScriptedAnimations(blink::WebFrameTime frameTime) |
| 27 { | 28 { |
| 28 m_animationFramePending = false; | 29 m_animationFramePending = false; |
| 29 TemporaryChange<bool> servicing(m_servicingAnimations, true); | 30 TemporaryChange<bool> servicing(m_servicingAnimations, true); |
| 30 | 31 |
| 31 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()) { |
| 32 if (frame->isLocalFrame()) { | 33 if (frame->isLocalFrame()) { |
| 33 RefPtr<LocalFrame> localFrame = toLocalFrame(frame.get()); | 34 RefPtr<LocalFrame> localFrame = toLocalFrame(frame.get()); |
| 34 localFrame->view()->serviceScrollAnimations(); | 35 localFrame->view()->serviceScrollAnimations(); |
| 35 | 36 |
| 36 DocumentAnimations::updateAnimationTimingForAnimationFrame(*localFra
me->document(), monotonicAnimationStartTime); | 37 DocumentAnimations::updateAnimationTimingForAnimationFrame(*localFra
me->document(), frameTime); |
| 37 SVGDocumentExtensions::serviceOnAnimationFrame(*localFrame->document
(), monotonicAnimationStartTime); | 38 SVGDocumentExtensions::serviceOnAnimationFrame(*localFrame->document
(), frameTime); |
| 38 } | 39 } |
| 39 } | 40 } |
| 40 | 41 |
| 41 WillBeHeapVector<RefPtrWillBeMember<Document> > documents; | 42 WillBeHeapVector<RefPtrWillBeMember<Document> > documents; |
| 42 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver
seNext()) { | 43 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver
seNext()) { |
| 43 if (frame->isLocalFrame()) | 44 if (frame->isLocalFrame()) |
| 44 documents.append(toLocalFrame(frame)->document()); | 45 documents.append(toLocalFrame(frame)->document()); |
| 45 } | 46 } |
| 46 | 47 |
| 47 for (size_t i = 0; i < documents.size(); ++i) | 48 for (size_t i = 0; i < documents.size(); ++i) |
| 48 documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime); | 49 documents[i]->serviceScriptedAnimations(frameTime); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void PageAnimator::scheduleVisualUpdate() | 52 void PageAnimator::scheduleVisualUpdate() |
| 52 { | 53 { |
| 53 // 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. |
| 54 if (m_servicingAnimations || m_updatingLayoutAndStyleForPainting) | 55 if (m_servicingAnimations || m_updatingLayoutAndStyleForPainting) |
| 55 return; | 56 return; |
| 56 m_page->chrome().scheduleAnimation(); | 57 m_page->chrome().scheduleAnimation(); |
| 57 } | 58 } |
| 58 | 59 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 72 // 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 |
| 73 // NativeWindowWidgets will update a proper clipping region. | 74 // NativeWindowWidgets will update a proper clipping region. |
| 74 view->setFrameRect(view->frameRect()); | 75 view->setFrameRect(view->frameRect()); |
| 75 | 76 |
| 76 // 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 |
| 77 // be invalidated, so layout needs to be called last. | 78 // be invalidated, so layout needs to be called last. |
| 78 view->updateLayoutAndStyleForPainting(); | 79 view->updateLayoutAndStyleForPainting(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 } | 82 } |
| OLD | NEW |