Skip to content

Truly independent web browser

LibWeb: Resolve pseudo-elements over their element's animated values

Andreas Kling30f70fad8bc0
diff --git a/Libraries/LibWeb/Rust/src/css/style/publication/pseudo.rs b/Libraries/LibWeb/Rust/src/css/style/publication/pseudo.rs
index 2fe1e858b13..5c6fec1a5ea 100644
--- a/Libraries/LibWeb/Rust/src/css/style/publication/pseudo.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/publication/pseudo.rs
@@ -252,12 +252,13 @@ impl RetainedState {
.style_record_custom_property_environment(new_element_record.raw())
});
// The element's new record names the environment its pseudo-elements resolve against,
- // whether or not the host installed it yet.
+ // whether or not the host installed it yet, with what the element's animations sampled
+ // into its custom properties laid over it, as its own values read them.
let element_environment = self
.computed_group_sets
.style_record_custom_property_environment(new_element_record.raw());
debug_assert!(element_environment.is_some(), "an element record holds an environment");
- let element_environment = element_environment.unwrap_or(0);
+ let element_environment = self.sampled_custom_property_environment(node, element_environment.unwrap_or(0));
// The kinds the node's match answer has rules for: a winner row is published for each
// the engine cascaded itself, and a kind with rules but no row is not decided.
let kinds_with_rules = self.pseudo_kinds_with_rules(node, settlement)?;
diff --git a/Tests/LibWeb/Text/expected/css/animated-custom-property-read-by-own-custom-properties.txt b/Tests/LibWeb/Text/expected/css/animated-custom-property-read-by-own-custom-properties.txt
index 1a8ce563a2d..f1e60cd6f6e 100644
--- a/Tests/LibWeb/Text/expected/css/animated-custom-property-read-by-own-custom-properties.txt
+++ b/Tests/LibWeb/Text/expected/css/animated-custom-property-read-by-own-custom-properties.txt
@@ -4,8 +4,8 @@ an eighth of a turn:
--double-turn: 90deg
--unrelated: 1px
background-image: linear-gradient(45deg, rgb(255, 0, 0), rgb(0, 0, 255))
- ::before rotate: 0deg
- ::before background-image: linear-gradient(0deg, rgb(255, 0, 0), rgb(0, 0, 255))
+ ::before rotate: 45deg
+ ::before background-image: linear-gradient(45deg, rgb(255, 0, 0), rgb(0, 0, 255))
child background-image: linear-gradient(45deg, rgb(255, 0, 0), rgb(0, 0, 255))
child --rotations: rotate(45deg) rotate(45deg)
three eighths of a turn:
@@ -14,8 +14,8 @@ three eighths of a turn:
--double-turn: 270deg
--unrelated: 1px
background-image: linear-gradient(135deg, rgb(255, 0, 0), rgb(0, 0, 255))
- ::before rotate: 0deg
- ::before background-image: linear-gradient(0deg, rgb(255, 0, 0), rgb(0, 0, 255))
+ ::before rotate: 135deg
+ ::before background-image: linear-gradient(135deg, rgb(255, 0, 0), rgb(0, 0, 255))
child background-image: linear-gradient(135deg, rgb(255, 0, 0), rgb(0, 0, 255))
child --rotations: rotate(135deg) rotate(135deg)
cancelled: