chromium/third_party/blink/renderer/modules/animationworklet/worklet_animation.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/modules/animationworklet/worklet_animation.h"

#include <optional>

#include "cc/animation/animation_timeline.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_animationeffect_animationeffectsequence.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_documenttimeline_scrolltimeline.h"
#include "third_party/blink/renderer/core/animation/document_timeline.h"
#include "third_party/blink/renderer/core/animation/element_animations.h"
#include "third_party/blink/renderer/core/animation/keyframe_effect_model.h"
#include "third_party/blink/renderer/core/animation/scroll_timeline_util.h"
#include "third_party/blink/renderer/core/animation/timing.h"
#include "third_party/blink/renderer/core/animation/worklet_animation_controller.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/frame/frame_console.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/layout/layout_box.h"
#include "third_party/blink/renderer/modules/animationworklet/css_animation_worklet.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"

namespace blink {

namespace {

bool ConvertAnimationEffects(
    const V8UnionAnimationEffectOrAnimationEffectSequence* effects,
    HeapVector<Member<KeyframeEffect>>& keyframe_effects,
    String& error_string) {}

bool IsActive(const Animation::AnimationPlayState& state) {}

bool ValidateTimeline(const V8UnionDocumentTimelineOrScrollTimeline* timeline,
                      String& error_string) {}

AnimationTimeline* ConvertAnimationTimeline(
    const Document& document,
    const V8UnionDocumentTimelineOrScrollTimeline* timeline) {}

void StartEffectOnCompositor(CompositorAnimation* animation,
                             KeyframeEffect* effect) {}

unsigned NextSequenceNumber() {}

double ToMilliseconds(std::optional<base::TimeDelta> time) {}

// Calculates start time backwards from the current time and
// timeline.currentTime.
std::optional<base::TimeDelta> CalculateStartTime(base::TimeDelta current_time,
                                                  double playback_rate,
                                                  AnimationTimeline& timeline) {}

}  // namespace

WorkletAnimation* WorkletAnimation::Create(
    ScriptState* script_state,
    const String& animator_name,
    const V8UnionAnimationEffectOrAnimationEffectSequence* effects,
    ExceptionState& exception_state) {}

WorkletAnimation* WorkletAnimation::Create(
    ScriptState* script_state,
    const String& animator_name,
    const V8UnionAnimationEffectOrAnimationEffectSequence* effects,
    const V8UnionDocumentTimelineOrScrollTimeline* timeline,
    ExceptionState& exception_state) {}

WorkletAnimation* WorkletAnimation::Create(
    ScriptState* script_state,
    const String& animator_name,
    const V8UnionAnimationEffectOrAnimationEffectSequence* effects,
    const V8UnionDocumentTimelineOrScrollTimeline* timeline,
    const ScriptValue& options,
    ExceptionState& exception_state) {}

WorkletAnimation::WorkletAnimation(
    WorkletAnimationId id,
    const String& animator_name,
    Document& document,
    const HeapVector<Member<KeyframeEffect>>& effects,
    AnimationTimeline* timeline,
    scoped_refptr<SerializedScriptValue> options)
    :{}

String WorkletAnimation::playState() {}

void WorkletAnimation::play(ExceptionState& exception_state) {}

std::optional<double> WorkletAnimation::currentTime() {}

std::optional<double> WorkletAnimation::startTime() {}

void WorkletAnimation::pause(ExceptionState& exception_state) {}

void WorkletAnimation::cancel() {}

bool WorkletAnimation::Playing() const {}

void WorkletAnimation::UpdateIfNecessary() {}

double WorkletAnimation::playbackRate(ScriptState* script_state) const {}

void WorkletAnimation::setPlaybackRate(ScriptState* script_state,
                                       double playback_rate) {}

void WorkletAnimation::SetPlaybackRateInternal(double playback_rate) {}

void WorkletAnimation::EffectInvalidated() {}

void WorkletAnimation::Update(TimingUpdateReason reason) {}

bool WorkletAnimation::CheckCanStart(String* failure_message) {}

void WorkletAnimation::SetCurrentTime(
    std::optional<base::TimeDelta> current_time) {}

void WorkletAnimation::UpdateCompositingState() {}

void WorkletAnimation::InvalidateCompositingState() {}

void WorkletAnimation::StartOnMain() {}

bool WorkletAnimation::CanStartOnCompositor() {}

bool WorkletAnimation::StartOnCompositor() {}

bool WorkletAnimation::UpdateOnCompositor() {}

void WorkletAnimation::DestroyCompositorAnimation() {}

KeyframeEffect* WorkletAnimation::GetEffect() const {}

bool WorkletAnimation::IsActiveAnimation() const {}

bool WorkletAnimation::IsTimelineActive() const {}

bool WorkletAnimation::IsCurrentTimeInitialized() const {}

// Returns initial current time of an animation. This method is called when
// calculating initial start time.
// Document-linked animations are initialized with the current time of zero
// and start time of the document timeline current time.
// Scroll-linked animations are initialized with the start time of
// zero (i.e., scroll origin) and the current time corresponding to the current
// scroll position adjusted by the playback rate.
//
// More information at AnimationTimeline::InitialStartTimeForAnimations
//
// TODO(https://crbug.com/986925): The playback rate should be taken into
// consideration when calculating the initial current time.
// https://drafts.csswg.org/web-animations/#playing-an-animation-section
std::optional<base::TimeDelta> WorkletAnimation::InitialCurrentTime() const {}

void WorkletAnimation::UpdateCurrentTimeIfNeeded() {}

std::optional<base::TimeDelta> WorkletAnimation::CurrentTime() {}

std::optional<base::TimeDelta> WorkletAnimation::CurrentTimeInternal() const {}

void WorkletAnimation::UpdateInputState(
    AnimationWorkletDispatcherInput* input_state) {}

void WorkletAnimation::SetOutputState(
    const AnimationWorkletOutput::AnimationState& state) {}

void WorkletAnimation::NotifyLocalTimeUpdated(
    std::optional<base::TimeDelta> local_time) {}

void WorkletAnimation::Dispose() {}

void WorkletAnimation::Trace(Visitor* visitor) const {}

}  // namespace blink