Skip to content

Truly independent web browser

LibWeb: Keep auto clip offsets when adding clip rects

Andreas Kling7a9ef7aa1399
diff --git a/Libraries/LibWeb/Rust/src/css/animation.rs b/Libraries/LibWeb/Rust/src/css/animation.rs
index 2af22e71332..ddad3702af4 100644
--- a/Libraries/LibWeb/Rust/src/css/animation.rs
+++ b/Libraries/LibWeb/Rust/src/css/animation.rs
@@ -3750,6 +3750,19 @@ fn composite_scalar_value(
},
) => {
let combine = |underlying: &RetainedStyleValueData, animated: &RetainedStyleValueData| {
+ // NB: An auto offset has no amount to add, so combining it with another auto keeps it auto.
+ if let (
+ StyleValueData::Keyword {
+ keyword: underlying_keyword,
+ },
+ StyleValueData::Keyword {
+ keyword: animated_keyword,
+ },
+ ) = (underlying.data(), animated.data())
+ && underlying_keyword == animated_keyword
+ {
+ return Ok(Some(animated.clone_retained()));
+ }
let result = composite_scalar_value(underlying.data(), animated.data(), operation);
if !result.handled {
return Err(());
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-masking/animations/clip-composition.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-masking/animations/clip-composition.txt
index 12f324f6ed2..bcd8938c7b6 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-masking/animations/clip-composition.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-masking/animations/clip-composition.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 72 tests
-66 Pass
-6 Fail
+72 Pass
Pass Compositing CSS Animations: property <clip> underlying [rect(0px 10px 20px 30px)] from add [rect(40px 50px 60px 70px)] to add [rect(140px 150px 160px 170px)] at (-1) should be [rect(-60px -40px -20px 0px)]
Pass Compositing CSS Animations: property <clip> underlying [rect(0px 10px 20px 30px)] from add [rect(40px 50px 60px 70px)] to add [rect(140px 150px 160px 170px)] at (0) should be [rect(40px 60px 80px 100px)]
Pass Compositing CSS Animations: property <clip> underlying [rect(0px 10px 20px 30px)] from add [rect(40px 50px 60px 70px)] to add [rect(140px 150px 160px 170px)] at (0.25) should be [rect(65px 85px 105px 125px)]
@@ -28,15 +27,15 @@ Pass Compositing Web Animations: property <clip> underlying [auto] from add [rec
Pass Compositing Web Animations: property <clip> underlying [auto] from add [rect(0px 0px 0px 0px)] to add [rect(100px 100px 100px 100px)] at (0.75) should be [rect(75px 75px 75px 75px)]
Pass Compositing Web Animations: property <clip> underlying [auto] from add [rect(0px 0px 0px 0px)] to add [rect(100px 100px 100px 100px)] at (1) should be [rect(100px 100px 100px 100px)]
Pass Compositing Web Animations: property <clip> underlying [auto] from add [rect(0px 0px 0px 0px)] to add [rect(100px 100px 100px 100px)] at (2) should be [rect(200px 200px 200px 200px)]
-Fail Compositing CSS Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (-1) should be [rect(100px auto auto 100px)]
-Fail Compositing CSS Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (0) should be [rect(100px auto auto 100px)]
-Fail Compositing CSS Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (0.25) should be [rect(100px auto auto 100px)]
+Pass Compositing CSS Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (-1) should be [rect(100px auto auto 100px)]
+Pass Compositing CSS Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (0) should be [rect(100px auto auto 100px)]
+Pass Compositing CSS Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (0.25) should be [rect(100px auto auto 100px)]
Pass Compositing CSS Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (0.75) should be [rect(100px 100px 100px 100px)]
Pass Compositing CSS Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (1) should be [rect(100px 100px 100px 100px)]
Pass Compositing CSS Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (2) should be [rect(100px 100px 100px 100px)]
-Fail Compositing Web Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (-1) should be [rect(100px auto auto 100px)]
-Fail Compositing Web Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (0) should be [rect(100px auto auto 100px)]
-Fail Compositing Web Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (0.25) should be [rect(100px auto auto 100px)]
+Pass Compositing Web Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (-1) should be [rect(100px auto auto 100px)]
+Pass Compositing Web Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (0) should be [rect(100px auto auto 100px)]
+Pass Compositing Web Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (0.25) should be [rect(100px auto auto 100px)]
Pass Compositing Web Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (0.75) should be [rect(100px 100px 100px 100px)]
Pass Compositing Web Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (1) should be [rect(100px 100px 100px 100px)]
Pass Compositing Web Animations: property <clip> underlying [rect(50px auto auto 50px)] from add [rect(50px auto auto 50px)] to add [rect(100px 100px 100px 100px)] at (2) should be [rect(100px 100px 100px 100px)]