Truly independent web browser
LibWeb: Read sampled custom properties in a self-check's cold pass
Andreas Kling158cdeb6fb93
diff --git a/Libraries/LibWeb/Rust/src/css/style/pipeline/records.rs b/Libraries/LibWeb/Rust/src/css/style/pipeline/records.rsindex 719a59c0274..975091f58ae 100644--- a/Libraries/LibWeb/Rust/src/css/style/pipeline/records.rs+++ b/Libraries/LibWeb/Rust/src/css/style/pipeline/records.rs@@ -1707,6 +1707,13 @@ impl<'a> Records<'a> {if sets.holds_record(node, record) {return true;}+ // NB: A cold pass builds its stores anew, chained differently from those an element kept across its updates. The+ // values are what it compares against the record the host sampled over, as it does for the composition.+ if let Some(equal) = self.composes_over_equal_records+ && sets.held_record(node).is_some_and(|held| equal(held, record))+ {+ return true;+ }let same_store =|a: Option<&Arc<crate::css::custom_properties::CustomPropertyStore>>,b: Option<&Arc<crate::css::custom_properties::CustomPropertyStore>>| match (a, b) {diff --git a/Tests/LibWeb/Text/expected/css/style-engine/paused-animation-below-non-inherited-custom-property.txt b/Tests/LibWeb/Text/expected/css/style-engine/paused-animation-below-non-inherited-custom-property.txtnew file mode 100644index 00000000000..b14bc738580--- /dev/null+++ b/Tests/LibWeb/Text/expected/css/style-engine/paused-animation-below-non-inherited-custom-property.txt@@ -0,0 +1,3 @@+36.000001deg -36.000001deg+36.000001deg -36.000001deg+36.000001deg -36.000001degdiff --git a/Tests/LibWeb/Text/input/css/style-engine/paused-animation-below-non-inherited-custom-property.html b/Tests/LibWeb/Text/input/css/style-engine/paused-animation-below-non-inherited-custom-property.htmlnew file mode 100644index 00000000000..4f485d5f847--- /dev/null+++ b/Tests/LibWeb/Text/input/css/style-engine/paused-animation-below-non-inherited-custom-property.html@@ -0,0 +1,51 @@+<!DOCTYPE html>+<style>+ @property --spin {+ syntax: "<angle>";+ inherits: true;+ initial-value: 0deg;+ }+ @property --not-inherited {+ syntax: "<length>";+ inherits: false;+ initial-value: 0px;+ }+ @keyframes spin {+ to {+ --spin: 360deg;+ }+ }+ #animated {+ animation: spin 100s linear infinite paused -10s;+ }+ #ancestor {+ --declared: 1;+ }+ #reader {+ rotate: calc(-1 * var(--spin));+ }+</style>+<div id="ancestor">+ <div id="declarer">+ <div>+ <div id="animated"><div><div id="reader"></div></div></div>+ </div>+ </div>+</div>+<script src="../../include.js"></script>+<script>+ // Under the style self-check, a cold pass must read the sampled value on the animated element, however+ // differently from the live one it built the stores above it.+ asyncTest(async done => {+ const read = () => `${getComputedStyle(reader).getPropertyValue("--spin")} ${getComputedStyle(reader).rotate}`;+ println(read());++ await animationFrame();+ declarer.style.setProperty("--not-inherited", "9px");+ println(read());++ await animationFrame();+ println(read());+ done();+ });+</script>