summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/page/page_animator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/page/page_animator.cc')
-rw-r--r--chromium/third_party/blink/renderer/core/page/page_animator.cc56
1 files changed, 40 insertions, 16 deletions
diff --git a/chromium/third_party/blink/renderer/core/page/page_animator.cc b/chromium/third_party/blink/renderer/core/page/page_animator.cc
index 4a16ce2d429..ec13847be9d 100644
--- a/chromium/third_party/blink/renderer/core/page/page_animator.cc
+++ b/chromium/third_party/blink/renderer/core/page/page_animator.cc
@@ -18,12 +18,28 @@
namespace blink {
+namespace {
+
+typedef HeapVector<Member<Document>, 32> DocumentsVector;
+
+// We walk through all the frames in DOM tree order and get all the documents
+DocumentsVector GetAllDocuments(Frame* main_frame) {
+ DocumentsVector documents;
+ for (Frame* frame = main_frame; frame; frame = frame->Tree().TraverseNext()) {
+ if (auto* local_frame = DynamicTo<LocalFrame>(frame))
+ documents.push_back(local_frame->GetDocument());
+ }
+ return documents;
+}
+
+} // namespace
+
PageAnimator::PageAnimator(Page& page)
: page_(page),
servicing_animations_(false),
updating_layout_and_style_for_painting_(false) {}
-void PageAnimator::Trace(blink::Visitor* visitor) {
+void PageAnimator::Trace(Visitor* visitor) {
visitor->Trace(page_);
}
@@ -36,17 +52,12 @@ void PageAnimator::ServiceScriptedAnimations(
Clock().SetAllowedToDynamicallyUpdateTime(false);
Clock().UpdateTime(monotonic_animation_start_time);
- HeapVector<Member<Document>, 32> documents;
- for (Frame* frame = page_->MainFrame(); frame;
- frame = frame->Tree().TraverseNext()) {
- if (auto* local_frame = DynamicTo<LocalFrame>(frame))
- documents.push_back(local_frame->GetDocument());
- }
+ DocumentsVector documents = GetAllDocuments(page_->MainFrame());
for (auto& document : documents) {
ScopedFrameBlamer frame_blamer(document->GetFrame());
TRACE_EVENT0("blink,rail", "PageAnimator::serviceScriptedAnimations");
- DocumentAnimations::UpdateAnimationTimingForAnimationFrame(*document);
+ document->GetDocumentAnimations().UpdateAnimationTimingForAnimationFrame();
if (document->View()) {
if (document->View()->ShouldThrottleRendering()) {
document->SetCurrentFrameIsThrottled(true);
@@ -89,7 +100,7 @@ void PageAnimator::ServiceScriptedAnimations(
}
void PageAnimator::PostAnimate() {
- HeapVector<Member<Document>, 32> documents;
+ DocumentsVector documents;
for (Frame* frame = page_->MainFrame(); frame;
frame = frame->Tree().TraverseNext()) {
if (frame->IsLocalFrame())
@@ -131,27 +142,40 @@ void PageAnimator::ScheduleVisualUpdate(LocalFrame* frame) {
page_->GetChromeClient().ScheduleAnimation(frame->View());
}
-void PageAnimator::UpdateAllLifecyclePhases(
- LocalFrame& root_frame,
- DocumentLifecycle::LifecycleUpdateReason reason) {
+void PageAnimator::UpdateAllLifecyclePhases(LocalFrame& root_frame,
+ DocumentUpdateReason reason) {
LocalFrameView* view = root_frame.View();
base::AutoReset<bool> servicing(&updating_layout_and_style_for_painting_,
true);
view->UpdateAllLifecyclePhases(reason);
}
-void PageAnimator::UpdateAllLifecyclePhasesExceptPaint(LocalFrame& root_frame) {
+void PageAnimator::UpdateAllLifecyclePhasesExceptPaint(
+ LocalFrame& root_frame,
+ DocumentUpdateReason reason) {
LocalFrameView* view = root_frame.View();
base::AutoReset<bool> servicing(&updating_layout_and_style_for_painting_,
true);
- view->UpdateAllLifecyclePhasesExceptPaint();
+ view->UpdateAllLifecyclePhasesExceptPaint(reason);
}
-void PageAnimator::UpdateLifecycleToLayoutClean(LocalFrame& root_frame) {
+void PageAnimator::UpdateLifecycleToLayoutClean(LocalFrame& root_frame,
+ DocumentUpdateReason reason) {
LocalFrameView* view = root_frame.View();
base::AutoReset<bool> servicing(&updating_layout_and_style_for_painting_,
true);
- view->UpdateLifecycleToLayoutClean();
+ view->UpdateLifecycleToLayoutClean(reason);
+}
+
+HeapVector<Member<Animation>> PageAnimator::GetAnimations(
+ const TreeScope& tree_scope) {
+ HeapVector<Member<Animation>> animations;
+ DocumentsVector documents = GetAllDocuments(page_->MainFrame());
+ for (auto& document : documents) {
+ document->GetDocumentAnimations().GetAnimationsTargetingTreeScope(
+ animations, tree_scope);
+ }
+ return animations;
}
} // namespace blink