diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /servo/components/style/properties/shorthands/ui.mako.rs | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/components/style/properties/shorthands/ui.mako.rs')
-rw-r--r-- | servo/components/style/properties/shorthands/ui.mako.rs | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/servo/components/style/properties/shorthands/ui.mako.rs b/servo/components/style/properties/shorthands/ui.mako.rs index 1fdb5965fc..4a27d5e003 100644 --- a/servo/components/style/properties/shorthands/ui.mako.rs +++ b/servo/components/style/properties/shorthands/ui.mako.rs @@ -22,10 +22,10 @@ macro_rules! try_parse_one { extra_prefixes="moz:layout.css.prefixes.transitions webkit" sub_properties="transition-property transition-duration transition-timing-function - transition-delay" + transition-delay transition-behavior" spec="https://drafts.csswg.org/css-transitions/#propdef-transition"> use crate::parser::Parse; - % for prop in "delay duration property timing_function".split(): + % for prop in "delay duration property timing_function behavior".split(): use crate::properties::longhands::transition_${prop}; % endfor use crate::values::specified::TransitionProperty; @@ -35,7 +35,7 @@ macro_rules! try_parse_one { input: &mut Parser<'i, 't>, ) -> Result<Longhands, ParseError<'i>> { struct SingleTransition { - % for prop in "property duration timing_function delay".split(): + % for prop in "property duration timing_function delay behavior".split(): transition_${prop}: transition_${prop}::SingleSpecifiedValue, % endfor } @@ -45,7 +45,7 @@ macro_rules! try_parse_one { input: &mut Parser<'i, 't>, first: bool, ) -> Result<SingleTransition,ParseError<'i>> { - % for prop in "property duration timing_function delay".split(): + % for prop in "property duration timing_function delay behavior".split(): let mut ${prop} = None; % endfor @@ -56,6 +56,9 @@ macro_rules! try_parse_one { try_parse_one!(context, input, duration, transition_duration); try_parse_one!(context, input, timing_function, transition_timing_function); try_parse_one!(context, input, delay, transition_delay); + if static_prefs::pref!("layout.css.transition-behavior.enabled") { + try_parse_one!(context, input, behavior, transition_behavior); + } // Must check 'transition-property' after 'transition-timing-function' since // 'transition-property' accepts any keyword. if property.is_none() { @@ -78,7 +81,7 @@ macro_rules! try_parse_one { if parsed != 0 { Ok(SingleTransition { - % for prop in "property duration timing_function delay".split(): + % for prop in "property duration timing_function delay behavior".split(): transition_${prop}: ${prop}.unwrap_or_else(transition_${prop}::single_value ::get_initial_specified_value), % endfor @@ -88,7 +91,7 @@ macro_rules! try_parse_one { } } - % for prop in "property duration timing_function delay".split(): + % for prop in "property duration timing_function delay behavior".split(): let mut ${prop}s = Vec::new(); % endfor @@ -105,13 +108,13 @@ macro_rules! try_parse_one { Ok(transition) })?; for result in results { - % for prop in "property duration timing_function delay".split(): + % for prop in "property duration timing_function delay behavior".split(): ${prop}s.push(result.transition_${prop}); % endfor } Ok(expanded! { - % for prop in "property duration timing_function delay".split(): + % for prop in "property duration timing_function delay behavior".split(): transition_${prop}: transition_${prop}::SpecifiedValue(${prop}s.into()), % endfor }) @@ -133,12 +136,24 @@ macro_rules! try_parse_one { return Ok(()); } % endfor + + if let Some(behavior) = self.transition_behavior { + if behavior.0.len() != 1 { + return Ok(()); + } + } } else { % for name in "duration delay timing_function".split(): if self.transition_${name}.0.len() != property_len { return Ok(()); } % endfor + + if let Some(behavior) = self.transition_behavior { + if behavior.0.len() != property_len { + return Ok(()); + } + } } // Representative length. @@ -152,7 +167,11 @@ macro_rules! try_parse_one { let has_duration = !self.transition_duration.0[i].is_zero(); let has_timing = !self.transition_timing_function.0[i].is_ease(); let has_delay = !self.transition_delay.0[i].is_zero(); - let has_any = has_duration || has_timing || has_delay; + let has_behavior = match self.transition_behavior { + Some(behavior) => !behavior.0[i].is_normal(), + _ => false, + }; + let has_any = has_duration || has_timing || has_delay || has_behavior; let mut writer = SequenceWriter::new(dest, " "); @@ -174,6 +193,10 @@ macro_rules! try_parse_one { if has_delay { writer.item(&self.transition_delay.0[i])?; } + + if has_behavior { + writer.item(&self.transition_behavior.unwrap().0[i])?; + } } Ok(()) } |