Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Unified Diff: third_party/WebKit/LayoutTests/animations/custom-properties/registered-var-to-registered-transitioning.html

Issue 2809063002: WIP Support var() references in registered custom property keyframes (Closed)
Patch Set: Rebased Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/animations/custom-properties/registered-var-to-registered-transitioning.html
diff --git a/third_party/WebKit/LayoutTests/animations/custom-properties/registered-var-to-registered-transitioning.html b/third_party/WebKit/LayoutTests/animations/custom-properties/registered-var-to-registered-transitioning.html
new file mode 100644
index 0000000000000000000000000000000000000000..9ab31a63c56cca1471c8581ecde32ccaef0afd12
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/animations/custom-properties/registered-var-to-registered-transitioning.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<style>
+#target {
+ transition-property: --transition;
+ transition-duration: 1s;
+ transition-delay: -0.5s;
+ transition-timing-function: linear;
+ --transition: 100;
+}
+</style>
+<div id="target">target</div>
+<script>
+for (let name of ['--transition', '--test']) {
+ CSS.registerProperty({
+ name,
+ syntax: '<number>',
+ initialValue: '0',
+ });
+}
+
+test(() => {
+ assert_equals(getComputedStyle(target).getPropertyValue('--test'), '0', '--test at initial value');
+ assert_equals(getComputedStyle(target).getPropertyValue('--transition'), '100', '--transition at initial value');
+
+ let animation = target.animate({'--test': ['50', 'var(--transition)']}, {duration: 100, fill: 'forwards'});
+
+ animation.currentTime = 0;
+ assert_equals(getComputedStyle(target).getPropertyValue('--test'), '50', '--test at 0% with no transition');
+ animation.currentTime = 50;
+ assert_equals(getComputedStyle(target).getPropertyValue('--test'), '75', '--test at 50% with no transition');
+ animation.currentTime = 100;
+ assert_equals(getComputedStyle(target).getPropertyValue('--test'), '100', '--test at 100% with no transition');
+
+ target.style.setProperty('--transition', '200');
+ assert_equals(getComputedStyle(target).getPropertyValue('--transition'), '150', '--transition at initial transitioning value');
+
+ animation.currentTime = 0;
+ assert_equals(getComputedStyle(target).getPropertyValue('--test'), '50', '--test at 0% with transition');
+ animation.currentTime = 50;
+ assert_equals(getComputedStyle(target).getPropertyValue('--test'), '100', '--test at 50% with transition');
+ animation.currentTime = 100;
+ assert_equals(getComputedStyle(target).getPropertyValue('--test'), '150', '--test at 50% with transition');
+}, 'Registered custom property animation keyframes with var() references to animating unregistered custom properties');
+</script>

Powered by Google App Engine
This is Rietveld 408576698