Truly independent web browser
LibWeb: Report whether custom property interval values are retained
Callum Lawdd1ddf2eda42
diff --git a/Libraries/LibWeb/Rust/src/css/animation.rs b/Libraries/LibWeb/Rust/src/css/animation.rsindex 7eaecd286b3..31d1cd75b28 100644--- a/Libraries/LibWeb/Rust/src/css/animation.rs+++ b/Libraries/LibWeb/Rust/src/css/animation.rs@@ -8083,6 +8083,8 @@ pub(crate) struct AnimatedCustomProperties {stores: KeyframeStores,names: Vec<crate::css::retained_fly_string::RetainedUtf16FlyString>,units: Vec<Vec<u16>>,+ /// Whether any interval values are resolved afresh rather than retained across samples.+ pub(crate) has_uncached_interval_values: bool,}type Registry = crate::css::custom_properties::CustomPropertyRegistry;@@ -8332,6 +8334,7 @@ pub(crate) fn resolve_published_animation_declarations(stores,names: Vec::new(),units: Vec::new(),+ has_uncached_interval_values: false,};let substitution_marks = std::cell::Cell::new(0_u8);let style_query_references = std::cell::RefCell::new(None);@@ -8506,7 +8509,7 @@ pub(crate) fn resolve_published_animation_declarations(}let name = custom_properties.units(name_id);let interval_span = select_custom_property_interval_span(effect, &keyframe_lookups, selection.current_key);- let interval_values = effect.resolve_custom_property_interval_values(+ let (interval_values, values_are_retained) = effect.resolve_custom_property_interval_values(interval_span.map(|lookup| lookup.declaration_index),registry.name_has_interpolable_syntax(name),|| {@@ -8538,6 +8541,7 @@ pub(crate) fn resolve_published_animation_declarations(is_transition,});}+ custom_properties.has_uncached_interval_values |= !values_are_retained;}effects.push(FfiAnimationEffect {first_keyframe_index,diff --git a/Libraries/LibWeb/Rust/src/css/style/effect_descriptions.rs b/Libraries/LibWeb/Rust/src/css/style/effect_descriptions.rsindex 690c842165d..e7f6f191310 100644--- a/Libraries/LibWeb/Rust/src/css/style/effect_descriptions.rs+++ b/Libraries/LibWeb/Rust/src/css/style/effect_descriptions.rs@@ -273,29 +273,32 @@ impl PublishedEffect {}/// Resolve interval values afresh for interpolable syntaxes or neutral keyframes; retain them otherwise.+ /// Also report whether the values are retained across samples.pub(crate) fn resolve_custom_property_interval_values(&self,declaration_indices: [usize; 2],has_interpolable_syntax: bool,resolve_values: impl FnOnce() -> [RetainedStyleValueData; 2],- ) -> [RetainedStyleValueData; 2] {+ ) -> ([RetainedStyleValueData; 2], bool) {let has_neutral_endpoint = declaration_indices.iter().any(|&index| matches!(self.custom_declarations[index].value, PublishedValue::ElementValue));if has_interpolable_syntax || has_neutral_endpoint {- return resolve_values();+ return (resolve_values(), false);}// AD-HOC: Match Chromium's retention of substituted interval values for discrete interpolations// without checking substitution dependencies. Chromium also does this for some standard// properties via CSSDefaultInterpolationType; we currently limit it to custom properties.- self.custom_property_interval_values+ let values = self+ .custom_property_interval_values.lock().unwrap().entry(declaration_indices).or_insert_with(resolve_values)- .clone()+ .clone();+ (values, true)}}