chromium/third_party/blink/renderer/core/animation/timeline_range.h

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

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_TIMELINE_RANGE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_TIMELINE_RANGE_H_

#include "cc/animation/scroll_timeline.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_timeline_range.h"
#include "third_party/blink/renderer/core/core_export.h"

namespace blink {

struct TimelineOffset;

// A TimelineRange represents a given scroll range within an associated
// scroller's minimum/maximum scroll. This is useful for ViewTimelines
// in particular, because they represent exactly that: a segment of a (non-view)
// ScrollTimeline.
//
// The primary job of TimelineRange is to convert offsets within an animation
// attachment range [1] (represented by TimelineOffset values) to fractional
// offsets within the TimelineRange. See TimelineRange::ToFractionalOffset.
//
// It may be helpful to think about a TimelineRange (which is timeline-specific)
// as a sub-range of the scroller's full range, and an animation attachment
// range (which is animation specific) as a sub-range of that TimelineRange.
//
// - For ViewTimelines, the start/end offsets will correspond to the scroll
//   range that would cause the scrollport to intersect with the subject
//   element's box.
// - For (non-view) ScrollTimelines, the start/end offset is always the
//   same as the minimum/maximum scroll.
// - For monotonic timelines, the TimelineRange is always empty.
//
// [1]
// https://drafts.csswg.org/scroll-animations-1/#named-range-animation-declaration
class CORE_EXPORT TimelineRange {};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_TIMELINE_RANGE_H_