mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
style: Support scroll-timeline-name longhand in style system
Implement "scroll-timeline-name: none | <custom-ident>". Differential Revision: https://phabricator.services.mozilla.com/D146018
This commit is contained in:
parent
105050d46d
commit
8d8594ef86
6 changed files with 65 additions and 6 deletions
|
@ -304,3 +304,14 @@ ${helpers.predefined_type(
|
||||||
spec="https://drafts.csswg.org/css-animations-2/#propdef-animation-timeline",
|
spec="https://drafts.csswg.org/css-animations-2/#propdef-animation-timeline",
|
||||||
rule_types_allowed=DEFAULT_RULES_EXCEPT_KEYFRAME,
|
rule_types_allowed=DEFAULT_RULES_EXCEPT_KEYFRAME,
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
${helpers.predefined_type(
|
||||||
|
"scroll-timeline-name",
|
||||||
|
"ScrollTimelineName",
|
||||||
|
"computed::ScrollTimelineName::none()",
|
||||||
|
engines="gecko",
|
||||||
|
animation_value_type="none",
|
||||||
|
gecko_pref="layout.css.scroll-linked-animations.enabled",
|
||||||
|
spec="https://github.com/w3c/csswg-drafts/issues/6674",
|
||||||
|
rule_types_allowed=DEFAULT_RULES_EXCEPT_KEYFRAME,
|
||||||
|
)}
|
||||||
|
|
|
@ -14,10 +14,9 @@ use crate::values::specified::box_ as specified;
|
||||||
pub use crate::values::specified::box_::{
|
pub use crate::values::specified::box_::{
|
||||||
AnimationName, AnimationTimeline, Appearance, BreakBetween, BreakWithin,
|
AnimationName, AnimationTimeline, Appearance, BreakBetween, BreakWithin,
|
||||||
Clear as SpecifiedClear, Contain, ContainerName, ContainerType, ContentVisibility, Display,
|
Clear as SpecifiedClear, Contain, ContainerName, ContainerType, ContentVisibility, Display,
|
||||||
Float as SpecifiedFloat, Overflow, OverflowAnchor, OverflowClipBox,
|
Float as SpecifiedFloat, Overflow, OverflowAnchor, OverflowClipBox, OverscrollBehavior,
|
||||||
OverscrollBehavior, ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop,
|
ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop, ScrollSnapStrictness, ScrollSnapType,
|
||||||
ScrollSnapStrictness, ScrollSnapType, ScrollbarGutter, TouchAction,
|
ScrollTimelineName, ScrollbarGutter, TouchAction, TransitionProperty, WillChange,
|
||||||
TransitionProperty, WillChange,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A computed value for the `vertical-align` property.
|
/// A computed value for the `vertical-align` property.
|
||||||
|
|
|
@ -50,7 +50,7 @@ pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, ContentVisibi
|
||||||
pub use self::box_::{Display, Overflow, OverflowAnchor, TransitionProperty};
|
pub use self::box_::{Display, Overflow, OverflowAnchor, TransitionProperty};
|
||||||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize, ScrollbarGutter};
|
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize, ScrollbarGutter};
|
||||||
pub use self::box_::{ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop};
|
pub use self::box_::{ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop};
|
||||||
pub use self::box_::{ScrollSnapStrictness, ScrollSnapType};
|
pub use self::box_::{ScrollSnapStrictness, ScrollSnapType, ScrollTimelineName};
|
||||||
pub use self::box_::{TouchAction, VerticalAlign, WillChange};
|
pub use self::box_::{TouchAction, VerticalAlign, WillChange};
|
||||||
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue, ColorScheme, PrintColorAdjust};
|
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue, ColorScheme, PrintColorAdjust};
|
||||||
pub use self::column::ColumnCount;
|
pub use self::column::ColumnCount;
|
||||||
|
|
|
@ -586,6 +586,12 @@ pub trait IsAuto {
|
||||||
pub struct TimelineName(TimelineOrKeyframesName);
|
pub struct TimelineName(TimelineOrKeyframesName);
|
||||||
|
|
||||||
impl TimelineName {
|
impl TimelineName {
|
||||||
|
/// Create a new TimelineName from Atom.
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
pub fn from_atom(atom: Atom) -> Self {
|
||||||
|
Self(TimelineOrKeyframesName::from_atom(atom))
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the `none` value.
|
/// Returns the `none` value.
|
||||||
pub fn none() -> Self {
|
pub fn none() -> Self {
|
||||||
Self(TimelineOrKeyframesName::none())
|
Self(TimelineOrKeyframesName::none())
|
||||||
|
|
|
@ -874,6 +874,49 @@ 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/rewrite#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<Self, ParseError<'i>> {
|
||||||
|
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()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-scroll-snap-1/#snap-axis
|
/// https://drafts.csswg.org/css-scroll-snap-1/#snap-axis
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||||
|
|
|
@ -41,7 +41,7 @@ pub use self::box_::{Appearance, BreakBetween, BreakWithin, ContainerName, Conta
|
||||||
pub use self::box_::{Clear, ContentVisibility, Float, Overflow, OverflowAnchor};
|
pub use self::box_::{Clear, ContentVisibility, Float, Overflow, OverflowAnchor};
|
||||||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize, ScrollbarGutter};
|
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize, ScrollbarGutter};
|
||||||
pub use self::box_::{ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop};
|
pub use self::box_::{ScrollSnapAlign, ScrollSnapAxis, ScrollSnapStop};
|
||||||
pub use self::box_::{ScrollSnapStrictness, ScrollSnapType};
|
pub use self::box_::{ScrollSnapStrictness, ScrollSnapType, ScrollTimelineName};
|
||||||
pub use self::box_::{TouchAction, TransitionProperty, VerticalAlign, WillChange};
|
pub use self::box_::{TouchAction, TransitionProperty, VerticalAlign, WillChange};
|
||||||
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue, ColorScheme, PrintColorAdjust};
|
pub use self::color::{Color, ColorOrAuto, ColorPropertyValue, ColorScheme, PrintColorAdjust};
|
||||||
pub use self::column::ColumnCount;
|
pub use self::column::ColumnCount;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue