Bug 1877383 - Preserve computed registered custom property types. r=firefox-style-system-reviewers,emilio

Add a TODO for bug 1883255, since D203361 fixes bug 1870348.

Add a TODO for bug 1884606, since WPTs for interpolating custom
properties with syntax `<transform-function>` and with value `none` now
fail.

Differential Revision: https://phabricator.services.mozilla.com/D203361
This commit is contained in:
Zach Hoffman 2024-03-11 04:51:35 +00:00
parent 7dc40b169a
commit 45d3aedb0d
40 changed files with 22 additions and 313 deletions

View File

@ -1847,14 +1847,13 @@ fn compute_value(
let mut input = ParserInput::new(&css);
let mut input = Parser::new(&mut input);
let value = SpecifiedRegisteredValue::compute(
SpecifiedRegisteredValue::compute(
&mut input,
registration,
url_data,
computed_context,
AllowComputationallyDependent::Yes,
)?;
Ok(ComputedRegisteredValue::universal(Arc::new(value)))
)
}
/// Removes the named registered custom property and inserts its uncomputed initial value.
@ -1961,6 +1960,7 @@ fn substitute_one_reference<'a>(
if reference.is_var {
registration = stylist.get_custom_property_registration(&reference.name);
if let Some(v) = custom_properties.get(registration, &reference.name) {
debug_assert!(v.is_parsed(registration), "Should be already computed");
if registration.syntax.is_universal() {
// Skip references that are inside the outer variable (in fallback for example).
while references

View File

@ -239,7 +239,7 @@ impl PropertyRegistration {
computed_context,
AllowComputationallyDependent::No,
) {
Ok(computed) => Ok(ComputedRegisteredValue::universal(Arc::new(computed))),
Ok(computed) => Ok(computed),
Err(_) => Err(()),
}
}

View File

@ -131,11 +131,13 @@ pub enum GenericValueComponent<
/// A <resolution> value
Resolution(Resolution),
/// A <transform-function> value
/// TODO(bug 1884606): <transform-function> `none` should not interpolate.
TransformFunction(TransformFunction),
/// A <custom-ident> value
#[animation(error)]
CustomIdent(CustomIdent),
/// A <transform-list> value, equivalent to <transform-function>+
/// TODO(bug 1884606): <transform-list> `none` should not interpolate.
TransformList(ComponentList<Self>),
/// A <string> value
#[animation(error)]
@ -268,27 +270,9 @@ impl ToComputedValue for SpecifiedValue {
pub type ComputedValue = Value<ComputedValueComponent>;
impl SpecifiedValue {
/// Convert a Computed custom property value to a VariableValue.
pub fn compute<'i, 't>(
input: &mut CSSParser<'i, 't>,
registration: &PropertyRegistrationData,
url_data: &UrlExtraData,
context: &computed::Context,
allow_computationally_dependent: AllowComputationallyDependent,
) -> Result<ComputedPropertyValue, ()> {
let value = Self::get_computed_value(
input,
registration,
url_data,
context,
allow_computationally_dependent,
)?;
Ok(value.to_variable_value())
}
/// Convert a registered custom property to a Computed custom property value, given input and a
/// property registration.
pub fn get_computed_value<'i, 't>(
pub fn compute<'i, 't>(
input: &mut CSSParser<'i, 't>,
registration: &PropertyRegistrationData,
url_data: &UrlExtraData,
@ -373,6 +357,12 @@ impl ComputedValue {
}
}
/// Returns whether the the property is computed.
#[cfg(debug_assertions)]
pub fn is_parsed(&self, registration: &PropertyRegistrationData) -> bool {
registration.syntax.is_universal() || !matches!(self.v, ValueInner::Universal(_))
}
/// Convert to an untyped variable value.
pub fn to_variable_value(&self) -> ComputedPropertyValue {
if let ValueInner::Universal(ref value) = self.v {
@ -664,7 +654,7 @@ impl CustomAnimatedValue {
} else {
let mut input = cssparser::ParserInput::new(&value.css);
let mut input = CSSParser::new(&mut input);
SpecifiedValue::get_computed_value(
SpecifiedValue::compute(
&mut input,
registration,
&value.url_data,

View File

@ -6215,8 +6215,8 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(
let mut seen = PropertyDeclarationIdSet::default();
let mut iter = PrioritizedPropertyIter::new(&keyframe.mPropertyValues);
// FIXME: This is pretty much a hack. Instead, the AnimatedValue should be better
// integrated in the cascade. This would allow us to fix revert() too.
// FIXME (bug 1883255): This is pretty much a hack. Instead, the AnimatedValue should be
// better integrated in the cascade.
{
let mut builder = CustomPropertiesBuilder::new_with_properties(
&data.stylist,

View File

@ -1,2 +0,0 @@
[revert-layer-011.html]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-angle-comma-list.html]
[Animating a custom property of type <angle># with a single keyframe]
expected: FAIL
[Animating a custom property of type <angle># with additivity]
expected: FAIL
[Animating a custom property of type <angle># with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-angle-space-list.html]
[Animating a custom property of type <angle>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <angle>+ with additivity]
expected: FAIL
[Animating a custom property of type <angle>+ with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-angle.html]
[Animating a custom property of type <angle> with a single keyframe]
expected: FAIL
[Animating a custom property of type <angle> with additivity]
expected: FAIL
[Animating a custom property of type <angle> with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-color-comma-list.html]
[Animating a custom property of type <color># with a single keyframe]
expected: FAIL
[Animating a custom property of type <color># with additivity]
expected: FAIL
[Animating a custom property of type <color># with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-color-space-list.html]
[Animating a custom property of type <color>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <color>+ with additivity]
expected: FAIL
[Animating a custom property of type <color>+ with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-color.html]
[Animating a custom property of type <color> with a single keyframe]
expected: FAIL
[Animating a custom property of type <color> with additivity]
expected: FAIL
[Animating a custom property of type <color> with a single keyframe and additivity]
expected: FAIL

View File

@ -1,3 +0,0 @@
[custom-property-animation-inherited-used-by-standard-property.html]
[Animating an inherited CSS variable on a parent is reflected on a standard property using that variable as a value on a child]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-integer-comma-list.html]
[Animating a custom property of type <integer># with a single keyframe]
expected: FAIL
[Animating a custom property of type <integer># with additivity]
expected: FAIL
[Animating a custom property of type <integer># with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-integer-space-list.html]
[Animating a custom property of type <integer>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <integer>+ with additivity]
expected: FAIL
[Animating a custom property of type <integer>+ with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-integer.html]
[Animating a custom property of type <integer> with a single keyframe]
expected: FAIL
[Animating a custom property of type <integer> with additivity]
expected: FAIL
[Animating a custom property of type <integer> with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-length-comma-list.html]
[Animating a custom property of type <length># with a single keyframe]
expected: FAIL
[Animating a custom property of type <length># with additivity]
expected: FAIL
[Animating a custom property of type <length># with a single keyframe and additivity]
expected: FAIL

View File

@ -1,12 +1,3 @@
[custom-property-animation-length-percentage-comma-list.html]
[Animating a custom property of type <length-percentage># with a single keyframe]
expected: FAIL
[Animating a custom property of type <length-percentage># with additivity]
expected: FAIL
[Animating a custom property of type <length-percentage># with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <length-percentage># with iterationComposite]
expected: FAIL

View File

@ -1,12 +1,3 @@
[custom-property-animation-length-percentage-space-list.html]
[Animating a custom property of type <length-percentage>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <length-percentage>+ with additivity]
expected: FAIL
[Animating a custom property of type <length-percentage>+ with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <length-percentage>+ with iterationComposite]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-length-percentage.html]
[Animating a custom property of type <length-percentage> with a single keyframe]
expected: FAIL
[Animating a custom property of type <length-percentage> with additivity]
expected: FAIL
[Animating a custom property of type <length-percentage> with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-length-space-list.html]
[Animating a custom property of type <length>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <length>+ with additivity]
expected: FAIL
[Animating a custom property of type <length>+ with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-length.html]
[Animating a custom property of type <length> with a single keyframe]
expected: FAIL
[Animating a custom property of type <length> with additivity]
expected: FAIL
[Animating a custom property of type <length> with a single keyframe and additivity]
expected: FAIL

View File

@ -1,3 +0,0 @@
[custom-property-animation-non-inherited-used-by-standard-property.html]
[Animating a non-inherited CSS variable is reflected on a standard property using that variable as a value]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-number-comma-list.html]
[Animating a custom property of type <number># with a single keyframe]
expected: FAIL
[Animating a custom property of type <number># with additivity]
expected: FAIL
[Animating a custom property of type <number># with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-number-space-list.html]
[Animating a custom property of type <number>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <number>+ with additivity]
expected: FAIL
[Animating a custom property of type <number>+ with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-number.html]
[Animating a custom property of type <number> with a single keyframe]
expected: FAIL
[Animating a custom property of type <number> with additivity]
expected: FAIL
[Animating a custom property of type <number> with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-percentage-comma-list.html]
[Animating a custom property of type <percentage># with a single keyframe]
expected: FAIL
[Animating a custom property of type <percentage># with additivity]
expected: FAIL
[Animating a custom property of type <percentage># with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-percentage-space-list.html]
[Animating a custom property of type <percentage>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <percentage>+ with additivity]
expected: FAIL
[Animating a custom property of type <percentage>+ with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-percentage.html]
[Animating a custom property of type <percentage> with a single keyframe]
expected: FAIL
[Animating a custom property of type <percentage> with additivity]
expected: FAIL
[Animating a custom property of type <percentage> with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-resolution-comma-list.html]
[Animating a custom property of type <resolution># with a single keyframe]
expected: FAIL
[Animating a custom property of type <resolution># with additivity]
expected: FAIL
[Animating a custom property of type <resolution># with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-resolution-space-list.html]
[Animating a custom property of type <resolution>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <resolution>+ with additivity]
expected: FAIL
[Animating a custom property of type <resolution>+ with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-resolution.html]
[Animating a custom property of type <resolution> with a single keyframe]
expected: FAIL
[Animating a custom property of type <resolution> with additivity]
expected: FAIL
[Animating a custom property of type <resolution> with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-time-comma-list.html]
[Animating a custom property of type <time># with a single keyframe]
expected: FAIL
[Animating a custom property of type <time># with additivity]
expected: FAIL
[Animating a custom property of type <time># with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-time-space-list.html]
[Animating a custom property of type <time>+ with a single keyframe]
expected: FAIL
[Animating a custom property of type <time>+ with additivity]
expected: FAIL
[Animating a custom property of type <time>+ with a single keyframe and additivity]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-time.html]
[Animating a custom property of type <time> with a single keyframe]
expected: FAIL
[Animating a custom property of type <time> with additivity]
expected: FAIL
[Animating a custom property of type <time> with a single keyframe and additivity]
expected: FAIL

View File

@ -1,7 +1,4 @@
[custom-property-animation-transform-function.html]
[Animating a custom property of type <transform-function> with a single keyframe]
expected: FAIL
[Animating a custom property of type <transform-function> with additivity]
expected: FAIL

View File

@ -1,13 +1,4 @@
[custom-property-animation-transform-list-multiple-values.html]
[Animating a custom property of type <transform-list> containing multiple values with a single keyframe]
expected: FAIL
[Animating a custom property of type <transform-list> containing multiple values with additivity]
expected: FAIL
[Animating a custom property of type <transform-list> containing multiple values with a single keyframe and additivity]
expected: FAIL
[Animating a custom property of type <transform-list> containing multiple values with iterationComposite]
expected: FAIL

View File

@ -1,9 +0,0 @@
[custom-property-animation-transform-list-single-values.html]
[Animating a custom property of type <transform-list> containing a single value with a single keyframe]
expected: FAIL
[Animating a custom property of type <transform-list> containing a single value with additivity]
expected: FAIL
[Animating a custom property of type <transform-list> containing a single value with a single keyframe and additivity]
expected: FAIL

View File

@ -0,0 +1,6 @@
[custom-property-animation-transform-none.tentative.html]
[Animating a custom property of type "<transform-list>|none" from "none" to <transform-list> value]
expected: FAIL
[Animating a custom property of type "<transform-function>|none" from "none" to <transform-function> value]
expected: FAIL

View File

@ -1,13 +1,4 @@
[at-property-animation.html]
[Ongoing animation picks up redeclared intial value]
expected: FAIL
[Ongoing animation picks up redeclared inherits flag]
expected: FAIL
[Ongoing animation picks up redeclared meaning of 'unset']
expected: FAIL
[Transition triggered by initial value change]
expected: FAIL

View File

@ -1,6 +0,0 @@
[registered-property-revert.html]
[Non-inherited registered custom property can be reverted in animation]
expected: FAIL
[Inherited registered custom property can be reverted in animation]
expected: FAIL