Files
sousa-gecko/dom/webidl/BaseKeyframeTypes.webidl
T
Boris Chiou 9029bddf36 Bug 2016574 - Define KeyframeOffset mixin, TimelineRangeOffset dict, and parse them. r=webidl,firefox-style-system-reviewers,layout-scroll-driven-animation-reviewers,smaug,dshin
In this patch, we do these things:
1. Define the mixin and dictionary based on [1]. Note that we have to
   make the entire mixin nullable to build IDL bindings properly.
2. Implement the parser for the keyframe offset. This includes the
   UTF8String, TimelineRangeOffset, and CSSNumericValue.

For the tests:
1. view-timelines/get-keyframes-with-timeline-offset.html, and
   view-timelines/timeline-offset-in-keyframe.html depend on
   Bug 1810248. I have verified it by hacking the rangeStart and
   rangeEnd APIs on my side.
2. css/timeline-offset-keyframes-hidden-subject.html, and
   css/timeline-offset-keyframes-with-document-timeline.html are failed
   becase we don't handle the missing initial/final keyframes properly.
   Bug 2037642 should take care of this.
3. css/merge-timeline-offset-keyframes.html will be fixed in the
   following patch.

[1] https://drafts.csswg.org/web-animations-2/#keyframe-offset-type

Differential Revision: https://phabricator.services.mozilla.com/D306379
2026-07-09 20:23:51 +00:00

68 lines
2.8 KiB
Plaintext

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* https://drafts.csswg.org/web-animations/#the-compositeoperation-enumeration
* https://drafts.csswg.org/web-animations/#dictdef-basepropertyindexedkeyframe
* https://drafts.csswg.org/web-animations/#dictdef-basekeyframe
* https://drafts.csswg.org/web-animations/#dictdef-basecomputedkeyframe
* https://drafts.csswg.org/web-animations-2/#keyframe-offset-type
*
* Copyright © 2016 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
enum CompositeOperation { "replace", "add", "accumulate" };
// NOTE: The order of the values in this enum are important.
//
// We assume that CompositeOperation is a subset of CompositeOperationOrAuto so
// that we can cast between the two types (provided the value is not "auto").
//
// If that assumption ceases to hold we will need to update the conversion
// in KeyframeUtils::GetAnimationPropertiesFromKeyframes.
enum CompositeOperationOrAuto { "replace", "add", "accumulate", "auto" };
// The following dictionary types are not referred to by other .webidl files,
// but we use it for manual JS->IDL and IDL->JS conversions in KeyframeEffect's
// implementation.
// We use this only for the keyframe offset type below. Per the spec, the
// reference type is: "(CSSNumberish? or TimelineRangeOffset or DOMString)".
// However, we cannot put a nullable dictionary type in the union, so we make
// the entire union nullable (see below).
typedef (CSSNumberish or TimelineRangeOffset or UTF8String) KeyframeOffset;
[GenerateInit]
dictionary BasePropertyIndexedKeyframe {
(KeyframeOffset or sequence<KeyframeOffset?>)? offset = [];
(UTF8String or sequence<UTF8String>) easing = [];
(CompositeOperationOrAuto or sequence<CompositeOperationOrAuto>) composite = [];
};
[GenerateInit]
dictionary BaseKeyframe {
KeyframeOffset? offset = null;
UTF8String easing = "linear";
CompositeOperationOrAuto composite = "auto";
// Non-standard extensions
// Member to allow testing when StyleAnimationValue::ComputeValues fails.
//
// Note that we currently only apply this to shorthand properties since
// it's easier to annotate shorthand property values and because we have
// only ever observed ComputeValues failing on shorthand values.
//
// Bug 1216844 should remove this member since after that bug is fixed we will
// have a well-defined behavior to use when animation endpoints are not
// available.
[ChromeOnly] boolean simulateComputeValuesFailure = false;
};
[GenerateConversionToJS]
dictionary BaseComputedKeyframe : BaseKeyframe {
double computedOffset;
};