From 10aa06f16fbbf73e1cc5a55d8963dc0965442f38 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Fri, 3 Dec 2021 12:02:44 +0000 Subject: [PATCH] Base: Add more test cases to CSS var() test page --- Base/res/html/misc/custom-properties.html | 159 ++++++++++++++++++++++ 1 file changed, 159 insertions(+) diff --git a/Base/res/html/misc/custom-properties.html b/Base/res/html/misc/custom-properties.html index 8ff9584355b..b4766b2be46 100644 --- a/Base/res/html/misc/custom-properties.html +++ b/Base/res/html/misc/custom-properties.html @@ -6,6 +6,12 @@ @@ -63,6 +130,98 @@ This should be pink + +

Fallback Values

+
+        .test-fallback {
+            background-color: var(--fallback, lime);
+        }
+
+        .test-fallback.with {
+            --fallback: cyan;
+        }
+    
+ +
+
.test-fallback
+ This should be green +
+ +
+
.test-fallback.with
+ This should be cyan +
+ +

Nested var()

+
+        :root {
+            --width: 10px;
+            --color: orange;
+            --style: solid;
+            --border: var(--width) var(--color) var(--style);
+        }
+        .test-nested {
+            border: var(--border);
+        }
+    
+ +
+
.test-nested
+ This should have a 10px solid orange border +
+ +

Mixed var()

+
+        :root {
+            --background-color: yellow;
+            --background-position: top 10px right 5px;
+        }
+
+        .test-mixed {
+            background: var(--background-color) url("background-repeat.png") var(--background-position) no-repeat;
+        }
+    
+ +
+
.test-mixed
+ This should have a yellow background with a smiley face in the top-right corner +
+ +

Billion laughs attack

+
+        .billion-laughs {
+            --prop1: lol;
+            --prop2: var(--prop1) var(--prop1);
+            --prop3: var(--prop2) var(--prop2);
+
+            /* ... */
+
+            --prop30: var(--prop29) var(--prop29);
+
+            background: var(--prop30);
+        }
+    
+
+
.billion-laughs
+ This box tests that we handle the billion laughs attack. If we don't crash, it worked! +
+ +

Dependency cycles

+
+        .dependency-cycle {
+            --recursive: var(--recursive);
+
+            --a: var(--b);
+            --b: var(--a);
+
+            background: var(--a);
+            color: var(--recursive);
+        }
+    
+
+
.dependency-cycle
+ This box tests that we handle dependency cycles correctly. If we don't crash, it worked! +