Truly independent web browser
LibWeb: Report failures to resolve custom properties during sampling
Callum Law249daa86d2b2
diff --git a/Libraries/LibWeb/Rust/src/css/style/custom_property_cascade.rs b/Libraries/LibWeb/Rust/src/css/style/custom_property_cascade.rsindex 468d5f6572f..d3b600d6585 100644--- a/Libraries/LibWeb/Rust/src/css/style/custom_property_cascade.rs+++ b/Libraries/LibWeb/Rust/src/css/style/custom_property_cascade.rs@@ -1968,7 +1968,7 @@ impl RetainedState {/// against the animated values. Answers each such declaration whose value moved from the one/// it holds in `base`, the element's environment beneath its animations. `inheritance` is the/// environment the element inherits, and `finalization` computes registered values against the- /// element's lengths.+ /// element's lengths. Returns an error when the declarations or their functions cannot be prepared.pub(crate) fn resolve_custom_properties_reading_animated_values(&mut self,node: StyleNodeID,@@ -1980,15 +1980,18 @@ impl RetainedState {RetainedStyleValueData,)],finalization: CustomPropertyFinalization<'_>,- ) -> Vec<(- crate::css::retained_fly_string::RetainedUtf16FlyString,- RetainedStyleValueData,- )> {+ ) -> Result<+ Vec<(+ crate::css::retained_fly_string::RetainedUtf16FlyString,+ RetainedStyleValueData,+ )>,+ (),+ > {if animated.is_empty() || !self.any_custom_property_is_declared() {- return Vec::new();+ return Ok(Vec::new());}let Some(cascaded) = self.cascaded_custom_declarations_of(node, pseudo) else {- return Vec::new();+ return Err(());};let mut moved: HashSet<Arc<[u16]>> = animated.iter()@@ -2020,7 +2023,7 @@ impl RetainedState {readers.push((name.clone(), declared, value));}if readers.is_empty() {- return Vec::new();+ return Ok(Vec::new());}let functions = if readers@@ -2029,7 +2032,7 @@ impl RetainedState {{// A container condition the engine cannot decide leaves the declarations as they resolved.let Some(functions) = self.prepare_custom_functions(&self.document_functions, node, pseudo) else {- return Vec::new();+ return Err(());};Some(functions)} else {@@ -2109,9 +2112,9 @@ impl RetainedState {finalization,);let Some(resolved) = resolved else {- return Vec::new();+ return Ok(Vec::new());};- readers+ let readers = readers.iter().filter_map(|(name, _, _)| {let name_raw = name.raw.raw();@@ -2125,7 +2128,8 @@ impl RetainedState {value,))})- .collect()+ .collect();+ Ok(readers)}/// What a keyframe's written value substitutes to on the element being sampled, against thediff --git a/Libraries/LibWeb/Rust/src/css/style_compute.rs b/Libraries/LibWeb/Rust/src/css/style_compute.rsindex d70760e48b2..4186f583e6d 100644--- a/Libraries/LibWeb/Rust/src/css/style_compute.rs+++ b/Libraries/LibWeb/Rust/src/css/style_compute.rs@@ -7064,7 +7064,9 @@ fn finish_animation_sample(&retained,finalization,);- retained.extend(readers);+ if let Ok(readers) = readers {+ retained.extend(readers);+ }let rows = retained.iter().map(|(name, value)| FfiAnimatedCustomPropertyResult {