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

Unified Diff: third_party/WebKit/LayoutTests/fast/css/variables/read-from-computed-style.html

Issue 1501313002: Expose custom property values to getComputedStyle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/css/variables/read-from-computed-style.html
diff --git a/third_party/WebKit/LayoutTests/fast/css/variables/read-from-computed-style.html b/third_party/WebKit/LayoutTests/fast/css/variables/read-from-computed-style.html
new file mode 100644
index 0000000000000000000000000000000000000000..f0d2ea26687fa165db197fe818ab3b4754aeb375
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/variables/read-from-computed-style.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<style>
+#container {
+ --a: it was the best of times;
+ --b: it was the worst of times;
+ --c: also the blurst of times;
+}
+
+#b {
+ --c: it was the age of wisdom;
+}
+</style>
+
+<div id="container">
+ <div id="a"></div>
+ <div id="b"><div id="c"></div></div>
+</div>
+
+<script>
+test(function() {
+ assert_equals(getComputedStyle(container).getPropertyValue("--a"), " it was the best of times");
+ assert_equals(getComputedStyle(container).getPropertyValue("--b"), " it was the worst of times");
+ assert_equals(getComputedStyle(container).getPropertyValue("--c"), " also the blurst of times");
+}, 'Directly declared custom properties appear in computed style.');
+
+test(function() {
+ assert_equals(getComputedStyle(a).getPropertyValue("--a"), " it was the best of times");
+ assert_equals(getComputedStyle(a).getPropertyValue("--b"), " it was the worst of times");
+ assert_equals(getComputedStyle(a).getPropertyValue("--c"), " also the blurst of times");
+}, 'Inherited custom properties appear in computed style.');
+
+test(function() {
+ assert_equals(getComputedStyle(b).getPropertyValue("--a"), " it was the best of times");
+ assert_equals(getComputedStyle(b).getPropertyValue("--b"), " it was the worst of times");
+ assert_equals(getComputedStyle(b).getPropertyValue("--c"), " it was the age of wisdom");
+}, 'Inherited custom properties overidden values appear correctly in computed style.');
+
+test(function() {
+ assert_equals(getComputedStyle(c).getPropertyValue("--a"), " it was the best of times");
+ assert_equals(getComputedStyle(c).getPropertyValue("--b"), " it was the worst of times");
+ assert_equals(getComputedStyle(c).getPropertyValue("--c"), " it was the age of wisdom");
+}, 'Overidden and inherited custom properties appear in computed style.');
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698