mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This CL generated by |sed -i '/sky\/engine\/config.h/d'| and a manual sweep to catch some oddballs. TBR=eseidel@chromium.org Review URL: https://codereview.chromium.org/1206763002.
62 lines
1.9 KiB
C++
62 lines
1.9 KiB
C++
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "sky/engine/core/page/PageAnimator.h"
|
|
|
|
#include "sky/engine/core/animation/DocumentAnimations.h"
|
|
#include "sky/engine/core/dom/Document.h"
|
|
#include "sky/engine/core/frame/FrameView.h"
|
|
#include "sky/engine/core/frame/LocalFrame.h"
|
|
#include "sky/engine/core/page/ChromeClient.h"
|
|
#include "sky/engine/core/page/Page.h"
|
|
#include "sky/engine/core/painting/PaintingTasks.h"
|
|
#include "sky/engine/platform/Logging.h"
|
|
|
|
namespace blink {
|
|
|
|
PageAnimator::PageAnimator(Page* page)
|
|
: m_page(page)
|
|
, m_servicingAnimations(false)
|
|
, m_updatingLayoutAndStyleForPainting(false)
|
|
{
|
|
}
|
|
|
|
void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime)
|
|
{
|
|
TemporaryChange<bool> servicing(m_servicingAnimations, true);
|
|
|
|
RefPtr<Document> document = m_page->mainFrame()->document();
|
|
|
|
DocumentAnimations::updateAnimationTimingForAnimationFrame(*document, monotonicAnimationStartTime);
|
|
document->serviceScriptedAnimations(monotonicAnimationStartTime);
|
|
}
|
|
|
|
void PageAnimator::scheduleVisualUpdate()
|
|
{
|
|
if (m_servicingAnimations || m_updatingLayoutAndStyleForPainting)
|
|
return;
|
|
m_page->scheduleVisualUpdate();
|
|
}
|
|
|
|
void PageAnimator::updateLayoutAndStyleForPainting(LocalFrame* rootFrame)
|
|
{
|
|
RefPtr<FrameView> view = rootFrame->view();
|
|
|
|
TemporaryChange<bool> servicing(m_updatingLayoutAndStyleForPainting, true);
|
|
|
|
view->setFrameRect(view->frameRect());
|
|
view->updateLayoutAndStyleForPainting();
|
|
|
|
// TODO(abarth): Remove these calls to updateLayoutAndStyleForPainting
|
|
// once requestPaint callbacks can't dirty layout.
|
|
while (PaintingTasks::serviceRequests())
|
|
view->updateLayoutAndStyleForPainting();
|
|
|
|
PaintingTasks::drainCommits();
|
|
|
|
ASSERT(m_page->mainFrame()->document()->lifecycle().state() == DocumentLifecycle::StyleAndLayoutClean);
|
|
}
|
|
|
|
}
|