Truly independent web browser
Tests/LibWeb: Test custom properties reading an animated one
Andreas Kling0bb0f30562d3
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.txtnew file mode 100644index 00000000000..c8f05ab8aa3--- /dev/null+++ b/Tests/LibWeb/Text/expected/css/animated-custom-property-read-by-own-custom-properties.txt@@ -0,0 +1,30 @@+an eighth of a turn:+ --gradient: linear-gradient(0deg, red, blue)+ --rotations: rotate(0deg) rotate(0deg)+ --double-turn: 0deg+ --unrelated: 1px+ background-image: linear-gradient(0deg, 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))+ child background-image: linear-gradient(0deg, rgb(255, 0, 0), rgb(0, 0, 255))+ child --rotations: rotate(0deg) rotate(0deg)+three eighths of a turn:+ --gradient: linear-gradient(0deg, red, blue)+ --rotations: rotate(0deg) rotate(0deg)+ --double-turn: 0deg+ --unrelated: 1px+ background-image: linear-gradient(0deg, 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))+ child background-image: linear-gradient(0deg, rgb(255, 0, 0), rgb(0, 0, 255))+ child --rotations: rotate(0deg) rotate(0deg)+cancelled:+ --gradient: linear-gradient(0deg, red, blue)+ --rotations: rotate(0deg) rotate(0deg)+ --double-turn: 0deg+ --unrelated: 1px+ background-image: linear-gradient(0deg, 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))+ child background-image: linear-gradient(0deg, rgb(255, 0, 0), rgb(0, 0, 255))+ child --rotations: rotate(0deg) rotate(0deg)diff --git a/Tests/LibWeb/Text/input/css/animated-custom-property-read-by-own-custom-properties.html b/Tests/LibWeb/Text/input/css/animated-custom-property-read-by-own-custom-properties.htmlnew file mode 100644index 00000000000..23b250b4e55--- /dev/null+++ b/Tests/LibWeb/Text/input/css/animated-custom-property-read-by-own-custom-properties.html@@ -0,0 +1,64 @@+<!DOCTYPE html>+<script src="../include.js"></script>+<style>+ @property --turn {+ syntax: "<angle>";+ inherits: true;+ initial-value: 0deg;+ }+ @property --double-turn {+ syntax: "<angle>";+ inherits: true;+ initial-value: 0deg;+ }+ @keyframes turn {+ from { --turn: 0deg; }+ to { --turn: 360deg; }+ }+ #target {+ animation: turn 1s linear infinite paused;+ --gradient: linear-gradient(var(--turn), red, blue);+ --rotation: rotate(var(--turn));+ --rotations: var(--rotation) var(--rotation);+ --double-turn: calc(var(--turn) * 2);+ --unrelated: 1px;+ background-image: var(--gradient);+ }+ #target::before {+ content: "";+ rotate: var(--turn);+ background-image: var(--gradient);+ }+ #child {+ background-image: var(--gradient);+ }+</style>+<div id="target"><div id="child"></div></div>+<script>+ test(() => {+ const target = document.getElementById("target");+ const child = document.getElementById("child");+ const animation = target.getAnimations()[0];+ const print = label => {+ const style = getComputedStyle(target);+ println(`${label}:`);+ println(` --gradient: ${style.getPropertyValue("--gradient")}`);+ println(` --rotations: ${style.getPropertyValue("--rotations")}`);+ println(` --double-turn: ${style.getPropertyValue("--double-turn")}`);+ println(` --unrelated: ${style.getPropertyValue("--unrelated")}`);+ println(` background-image: ${style.backgroundImage}`);+ const before = getComputedStyle(target, "::before");+ println(` ::before rotate: ${before.rotate}`);+ println(` ::before background-image: ${before.backgroundImage}`);+ println(` child background-image: ${getComputedStyle(child).backgroundImage}`);+ println(` child --rotations: ${getComputedStyle(child).getPropertyValue("--rotations")}`);+ };++ animation.currentTime = 125;+ print("an eighth of a turn");+ animation.currentTime = 375;+ print("three eighths of a turn");+ animation.cancel();+ print("cancelled");+ });+</script>