#include "third_party/blink/renderer/core/inspector/inspector_animation_agent.h"
#include <memory>
#include "base/location.h"
#include "base/memory/scoped_refptr.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_computed_effect_timing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_optional_effect_timing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_typedefs.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_cssnumericvalue_string_unrestricteddouble.h"
#include "third_party/blink/renderer/core/animation/animation.h"
#include "third_party/blink/renderer/core/animation/animation_effect.h"
#include "third_party/blink/renderer/core/animation/css/css_animation.h"
#include "third_party/blink/renderer/core/animation/css/css_animations.h"
#include "third_party/blink/renderer/core/animation/css/css_transition.h"
#include "third_party/blink/renderer/core/animation/document_animations.h"
#include "third_party/blink/renderer/core/animation/document_timeline.h"
#include "third_party/blink/renderer/core/animation/effect_model.h"
#include "third_party/blink/renderer/core/animation/element_animations.h"
#include "third_party/blink/renderer/core/animation/scroll_snapshot_timeline.h"
#include "third_party/blink/renderer/core/animation/string_keyframe.h"
#include "third_party/blink/renderer/core/animation/view_timeline.h"
#include "third_party/blink/renderer/core/css/css_keyframe_rule.h"
#include "third_party/blink/renderer/core/css/css_keyframes_rule.h"
#include "third_party/blink/renderer/core/css/css_primitive_value.h"
#include "third_party/blink/renderer/core/css/css_rule_list.h"
#include "third_party/blink/renderer/core/css/css_style_rule.h"
#include "third_party/blink/renderer/core/css/cssom/css_unit_value.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/inspector/identifiers_factory.h"
#include "third_party/blink/renderer/core/inspector/inspected_frames.h"
#include "third_party/blink/renderer/core/inspector/inspector_css_agent.h"
#include "third_party/blink/renderer/core/inspector/inspector_style_sheet.h"
#include "third_party/blink/renderer/core/inspector/protocol/animation.h"
#include "third_party/blink/renderer/core/inspector/v8_inspector_string.h"
#include "third_party/blink/renderer/platform/animation/timing_function.h"
#include "third_party/blink/renderer/platform/crypto.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/wtf/hash_traits.h"
#include "third_party/blink/renderer/platform/wtf/text/base64.h"
#include "third_party/blink/renderer/platform/wtf/wtf_size_t.h"
namespace blink {
namespace {
protocol::DOM::ScrollOrientation ToScrollOrientation(
ScrollSnapshotTimeline::ScrollAxis scroll_axis_enum,
bool is_horizontal_writing_mode) { … }
double NormalizedDuration(
V8UnionCSSNumericValueOrStringOrUnrestrictedDouble* duration) { … }
double AsDoubleOrZero(Timing::V8Delay* value) { … }
}
InspectorAnimationAgent::InspectorAnimationAgent(
InspectedFrames* inspected_frames,
InspectorCSSAgent* css_agent,
v8_inspector::V8InspectorSession* v8_session)
: … { … }
String InspectorAnimationAgent::AnimationDisplayName(
const Animation& animation) { … }
void InspectorAnimationAgent::Restore() { … }
void InspectorAnimationAgent::InvalidateInternalState() { … }
protocol::Response InspectorAnimationAgent::enable() { … }
protocol::Response InspectorAnimationAgent::disable() { … }
void InspectorAnimationAgent::DidCommitLoadForLocalFrame(LocalFrame* frame) { … }
static std::unique_ptr<protocol::Animation::ViewOrScrollTimeline>
BuildObjectForViewOrScrollTimeline(AnimationTimeline* timeline) { … }
static std::unique_ptr<protocol::Animation::AnimationEffect>
BuildObjectForAnimationEffect(KeyframeEffect* effect) { … }
static std::unique_ptr<protocol::Animation::KeyframeStyle>
BuildObjectForStringKeyframe(const StringKeyframe* keyframe,
double computed_offset) { … }
static std::unique_ptr<protocol::Animation::KeyframesRule>
BuildObjectForAnimationKeyframes(const KeyframeEffect* effect) { … }
std::unique_ptr<protocol::Animation::Animation>
InspectorAnimationAgent::BuildObjectForAnimation(blink::Animation& animation) { … }
protocol::Response InspectorAnimationAgent::getPlaybackRate(
double* playback_rate) { … }
protocol::Response InspectorAnimationAgent::setPlaybackRate(
double playback_rate) { … }
protocol::Response InspectorAnimationAgent::getCurrentTime(
const String& id,
double* current_time) { … }
protocol::Response InspectorAnimationAgent::setPaused(
std::unique_ptr<protocol::Array<String>> animation_ids,
bool paused) { … }
protocol::Response InspectorAnimationAgent::seekAnimations(
std::unique_ptr<protocol::Array<String>> animation_ids,
double current_time) { … }
protocol::Response InspectorAnimationAgent::releaseAnimations(
std::unique_ptr<protocol::Array<String>> animation_ids) { … }
protocol::Response InspectorAnimationAgent::setTiming(
const String& animation_id,
double duration,
double delay) { … }
protocol::Response InspectorAnimationAgent::resolveAnimation(
const String& animation_id,
std::unique_ptr<v8_inspector::protocol::Runtime::API::RemoteObject>*
result) { … }
String InspectorAnimationAgent::CreateCSSId(blink::Animation& animation) { … }
void InspectorAnimationAgent::DidCreateAnimation(unsigned sequence_number) { … }
void InspectorAnimationAgent::NotifyAnimationUpdated(
const String& animation_id) { … }
bool InspectorAnimationAgent::CompareAndUpdateKeyframesSnapshot(
KeyframeEffect* keyframe_effect,
HeapVector<Member<AnimationKeyframeSnapshot>>*
animation_snapshot_keyframes) { … }
bool InspectorAnimationAgent::CompareAndUpdateInternalSnapshot(
blink::Animation& animation,
AnimationSnapshot* snapshot) { … }
void InspectorAnimationAgent::AnimationUpdated(blink::Animation* animation) { … }
void InspectorAnimationAgent::DidClearDocumentOfWindowObject(
LocalFrame* frame) { … }
protocol::Response InspectorAnimationAgent::AssertAnimation(
const String& id,
blink::Animation*& result) { … }
DocumentTimeline& InspectorAnimationAgent::ReferenceTimeline() { … }
double InspectorAnimationAgent::NormalizedStartTime(
blink::Animation& animation) { … }
void InspectorAnimationAgent::Trace(Visitor* visitor) const { … }
}