Skip to content

Truly independent web browser

2.2 KB
Raw Blame
// https://drafts.csswg.org/web-animations-1/#the-animation-interface
[Exposed=Window, ImplementedIn=Rust]
interface Animation : EventTarget {
    constructor(optional AnimationEffect? effect = null, optional AnimationTimeline? timeline);

    attribute DOMString id;
    attribute AnimationEffect? effect;
    attribute AnimationTimeline? timeline;
    attribute CSSNumberish? startTime;
    attribute CSSNumberish? currentTime;
    attribute double playbackRate;
    attribute TimelineRangeValue rangeStart;
    attribute TimelineRangeValue rangeEnd;
    readonly attribute AnimationPlayState playState;
    readonly attribute AnimationReplaceState replaceState;
    readonly attribute boolean pending;
    readonly attribute Promise<Animation> ready;
    readonly attribute Promise<Animation> finished;

    attribute EventHandler onfinish;
    attribute EventHandler oncancel;
    attribute EventHandler onremove;

    undefined cancel();
    undefined finish();
    undefined play();
    undefined pause();
    undefined updatePlaybackRate(double playbackRate);
    undefined reverse();
    undefined persist();
    [CEReactions] undefined commitStyles();
};

// AD-HOC: The union of the edges of an attachment range that script sets, which the spec names no typedef of.
typedef (TimelineRangeOffset or CSSNumericValue or CSSKeywordValue or DOMString) TimelineRangeValue;

// https://drafts.csswg.org/web-animations-2/#dictdef-timelinerangeoffset
dictionary TimelineRangeOffset {
    CSSOMString? rangeName;
    CSSNumericValue offset;
};

// https://drafts.csswg.org/web-animations-1/#the-animationplaystate-enumeration
enum AnimationPlayState { "idle", "running", "paused", "finished" };

// https://drafts.csswg.org/web-animations-1/#the-animationreplacestate-enumeration
enum AnimationReplaceState { "active", "removed", "persisted" };

// https://drafts.csswg.org/web-animations-1/#extensions-to-the-document-interface
partial interface Document {
    [ImplementedIn=Rust] readonly attribute DocumentTimeline timeline;
};

// https://drafts.csswg.org/web-animations-1/#extensions-to-the-documentorshadowroot-interface-mixin
partial interface mixin DocumentOrShadowRoot {
    [ImplementedIn=Rust] sequence<Animation> getAnimations();
};