diff --git a/layout/style/ServoBindings.toml b/layout/style/ServoBindings.toml index 1650716742995..872ffba7aaec3 100644 --- a/layout/style/ServoBindings.toml +++ b/layout/style/ServoBindings.toml @@ -464,6 +464,7 @@ cbindgen-types = [ { gecko = "StyleScrollSnapStop", servo = "crate::values::computed::ScrollSnapStop" }, { gecko = "StyleScrollSnapStrictness", servo = "crate::values::computed::ScrollSnapStrictness" }, { gecko = "StyleScrollSnapType", servo = "crate::values::computed::ScrollSnapType" }, + { gecko = "StyleAnimationName", servo = "crate::values::computed::AnimationName" }, { gecko = "StyleScrollTimelineName", servo = "crate::values::computed::ScrollTimelineName" }, { gecko = "StyleScrollAxis", servo = "crate::values::computed::ScrollAxis" }, { gecko = "StyleViewTimelineInset", servo = "crate::values::computed::ViewTimelineInset" }, diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 1ab15c57aca8a..5f86ffe7126de 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -13652,6 +13652,7 @@ if (IsCSSPropertyPrefEnabled("layout.css.scroll-driven-animations.enabled")) { initial_values: ["none"], other_values: [ "all", + "auto", "ball", "mall", "color", @@ -13664,13 +13665,7 @@ if (IsCSSPropertyPrefEnabled("layout.css.scroll-driven-animations.enabled")) { "\\2bounce", "-\\2bounce", ], - invalid_values: [ - "auto", - "bounce, abc", - "abc bounce", - "10px", - "rgb(1, 2, 3)", - ], + invalid_values: ["bounce, abc", "abc bounce", "10px", "rgb(1, 2, 3)"], }; gCSSProperties["scroll-timeline-axis"] = { @@ -13689,6 +13684,7 @@ if (IsCSSPropertyPrefEnabled("layout.css.scroll-driven-animations.enabled")) { subproperties: ["scroll-timeline-name", "scroll-timeline-axis"], initial_values: ["none block", "block none", "block", "none"], other_values: [ + "auto inline", "bounce inline", "bounce vertical", "horizontal bounce", @@ -13707,6 +13703,7 @@ if (IsCSSPropertyPrefEnabled("layout.css.scroll-driven-animations.enabled")) { initial_values: ["none"], other_values: [ "all", + "auto", "ball", "mall", "color", @@ -13721,7 +13718,7 @@ if (IsCSSPropertyPrefEnabled("layout.css.scroll-driven-animations.enabled")) { "bounce, abc", "none, none", ], - invalid_values: ["auto", "abc bounce", "10px", "rgb(1, 2, 3)"], + invalid_values: ["abc bounce", "10px", "rgb(1, 2, 3)"], }; gCSSProperties["view-timeline-axis"] = { @@ -13749,6 +13746,7 @@ if (IsCSSPropertyPrefEnabled("layout.css.scroll-driven-animations.enabled")) { subproperties: ["view-timeline-name", "view-timeline-axis"], initial_values: ["none block", "none"], other_values: [ + "auto inline", "bounce inline", "bounce vertical", "\\32bounce inline", diff --git a/servo/components/style/values/mod.rs b/servo/components/style/values/mod.rs index 3dd31a75876f2..5959a4c2a3a7b 100644 --- a/servo/components/style/values/mod.rs +++ b/servo/components/style/values/mod.rs @@ -600,13 +600,6 @@ impl TimelineOrKeyframesName { impl Eq for TimelineOrKeyframesName {} -/// A trait that returns whether a given type is the `auto` value or not. So far -/// only needed for background-size serialization, which special-cases `auto`. -pub trait IsAuto { - /// Returns whether the value is the `auto` value. - fn is_auto(&self) -> bool; -} - /// The typedef of . #[repr(transparent)] #[derive( @@ -659,6 +652,7 @@ impl ToCss for TimelineName { } /// The typedef of . +#[repr(transparent)] #[derive( Clone, Debug, diff --git a/servo/components/style/values/specified/box.rs b/servo/components/style/values/specified/box.rs index 1b5662549eb1b..5f03c78780e00 100644 --- a/servo/components/style/values/specified/box.rs +++ b/servo/components/style/values/specified/box.rs @@ -692,6 +692,7 @@ impl AnimationIterationCount { ToShmem, )] #[value_info(other_values = "none")] +#[repr(C)] pub struct AnimationName(pub KeyframesName); impl AnimationName { @@ -825,8 +826,9 @@ fn is_default(value: &T) -> bool { pub enum AnimationTimeline { /// Use default timeline. The animation’s timeline is a DocumentTimeline. Auto, - /// The scroll-timeline name. + /// The scroll-timeline name or view-timeline-name. /// https://drafts.csswg.org/scroll-animations-1/#scroll-timelines-named + /// https://drafts.csswg.org/scroll-animations-1/#view-timeline-name Timeline(TimelineName), /// The scroll() notation. /// https://drafts.csswg.org/scroll-animations-1/#scroll-notation @@ -854,15 +856,6 @@ impl Parse for AnimationTimeline { context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - // We are using the same parser for TimelineName and KeyframesName, but animation-timeline - // accepts "auto", so need to manually parse this. (We can not derive - // Parse because TimelineName excludes only the "none" keyword). - // - // FIXME: Bug 1733260: we may drop None based on the spec issue: - // https://github.com/w3c/csswg-drafts/issues/6674 - // - // If `none` is removed, then we could potentially shrink this the same - // way we deal with animation-name. if input.try_parse(|i| i.expect_ident_matching("auto")).is_ok() { return Ok(Self::Auto); } @@ -871,7 +864,7 @@ impl Parse for AnimationTimeline { return Ok(AnimationTimeline::Timeline(TimelineName::none())); } - // https://drafts.csswg.org/scroll-animations-1/rewrite#scroll-notation + // https://drafts.csswg.org/scroll-animations-1/#scroll-notation if input .try_parse(|i| i.expect_function_matching("scroll")) .is_ok() @@ -888,48 +881,8 @@ impl Parse for AnimationTimeline { } } -/// A value for the scroll-timeline-name. -/// -/// Note: The spec doesn't mention `auto` for scroll-timeline-name. However, `auto` is a keyword in -/// animation-timeline, so we reject `auto` for scroll-timeline-name now. -/// -/// https://drafts.csswg.org/scroll-animations-1/#scroll-timeline-name -#[derive( - Clone, - Debug, - Eq, - Hash, - MallocSizeOf, - PartialEq, - SpecifiedValueInfo, - ToComputedValue, - ToCss, - ToResolvedValue, - ToShmem, -)] -#[repr(C)] -pub struct ScrollTimelineName(pub TimelineName); - -impl ScrollTimelineName { - /// Returns the `none` value. - pub fn none() -> Self { - Self(TimelineName::none()) - } -} - -impl Parse for ScrollTimelineName { - fn parse<'i, 't>( - context: &ParserContext, - input: &mut Parser<'i, 't>, - ) -> Result> { - if let Ok(name) = input.try_parse(|input| TimelineName::parse(context, input)) { - return Ok(Self(name)); - } - - input.expect_ident_matching("none")?; - Ok(Self(TimelineName::none())) - } -} +/// A value for the scroll-timeline-name or view-timeline-name. +pub type ScrollTimelineName = AnimationName; /// https://drafts.csswg.org/css-scroll-snap-1/#snap-axis #[allow(missing_docs)] diff --git a/servo/ports/geckolib/cbindgen.toml b/servo/ports/geckolib/cbindgen.toml index 0a223425c55e4..2825e7078cc9a 100644 --- a/servo/ports/geckolib/cbindgen.toml +++ b/servo/ports/geckolib/cbindgen.toml @@ -949,9 +949,9 @@ renaming_overrides_prefixing = true SERVO_FIXED_POINT_HELPERS(StyleFontStretch, uint16_t, StyleFONT_STRETCH_FRACTION_BITS); """ -"ScrollTimelineName" = """ +"AnimationName" = """ public: - StyleScrollTimelineName(): _0(RefPtr(nsGkAtoms::_empty).forget()) {} + StyleAnimationName(): _0(RefPtr(nsGkAtoms::_empty).forget()) {} """ "GenericViewTimelineInset" = """ diff --git a/testing/web-platform/meta/scroll-animations/css/scroll-timeline-axis-computed.tentative.html.ini b/testing/web-platform/meta/scroll-animations/css/scroll-timeline-axis-computed.tentative.html.ini deleted file mode 100644 index ebe70f9c12625..0000000000000 --- a/testing/web-platform/meta/scroll-animations/css/scroll-timeline-axis-computed.tentative.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[scroll-timeline-axis-computed.tentative.html] - expected: - if (os == "android") and fission: [OK, TIMEOUT] diff --git a/testing/web-platform/meta/scroll-animations/css/scroll-timeline-axis-parsing.tentative.html.ini b/testing/web-platform/meta/scroll-animations/css/scroll-timeline-axis-parsing.tentative.html.ini deleted file mode 100644 index e421b16fe1f5c..0000000000000 --- a/testing/web-platform/meta/scroll-animations/css/scroll-timeline-axis-parsing.tentative.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[scroll-timeline-axis-parsing.tentative.html] - expected: - if (os == "android") and fission: [OK, TIMEOUT] diff --git a/testing/web-platform/meta/scroll-animations/css/scroll-timeline-name-computed.tentative.html.ini b/testing/web-platform/meta/scroll-animations/css/scroll-timeline-name-computed.tentative.html.ini deleted file mode 100644 index 534ed5c98d2a6..0000000000000 --- a/testing/web-platform/meta/scroll-animations/css/scroll-timeline-name-computed.tentative.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[scroll-timeline-name-computed.tentative.html] - expected: - if (os == "android") and fission: [OK, TIMEOUT] diff --git a/testing/web-platform/meta/scroll-animations/css/scroll-timeline-name-parsing.tentative.html.ini b/testing/web-platform/meta/scroll-animations/css/scroll-timeline-name-parsing.tentative.html.ini deleted file mode 100644 index b0244b6802ad4..0000000000000 --- a/testing/web-platform/meta/scroll-animations/css/scroll-timeline-name-parsing.tentative.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[scroll-timeline-name-parsing.tentative.html] - expected: - if (os == "android") and fission: [OK, TIMEOUT] - [e.style['scroll-timeline-name'\] = "auto" should set the property value] - expected: FAIL diff --git a/testing/web-platform/meta/scroll-animations/css/view-timeline-name-parsing.html.ini b/testing/web-platform/meta/scroll-animations/css/view-timeline-name-parsing.html.ini deleted file mode 100644 index e537cac601c81..0000000000000 --- a/testing/web-platform/meta/scroll-animations/css/view-timeline-name-parsing.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[view-timeline-name-parsing.html] - [e.style['view-timeline-name'\] = "auto" should set the property value] - expected: FAIL - diff --git a/testing/web-platform/meta/scroll-animations/css/view-timeline-shorthand.tentative.html.ini b/testing/web-platform/meta/scroll-animations/css/view-timeline-shorthand.tentative.html.ini deleted file mode 100644 index 343b5c7c52123..0000000000000 --- a/testing/web-platform/meta/scroll-animations/css/view-timeline-shorthand.tentative.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[view-timeline-shorthand.tentative.html] - [e.style['view-timeline'\] = "auto" should set the property value] - expected: FAIL