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

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

Issue 1510963002: Ensure we don't crash when asking for variables that don't exist from the computed style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dammit tim 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script> 2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script> 3 <script src="../../../resources/testharnessreport.js"></script>
4 <style> 4 <style>
5 #container { 5 #container {
6 --a: it was the best of times; 6 --a: it was the best of times;
7 --b: it was the worst of times; 7 --b: it was the worst of times;
8 --c: also the blurst of times; 8 --c: also the blurst of times;
9 } 9 }
10 10
11 #b { 11 #b {
12 --c: it was the age of wisdom; 12 --c: it was the age of wisdom;
13 } 13 }
14 </style> 14 </style>
15 15
16 <div id="container"> 16 <div id="container">
17 <div id="a"></div> 17 <div id="a"></div>
18 <div id="b"><div id="c"></div></div> 18 <div id="b"><div id="c"></div></div>
19 </div> 19 </div>
20 20
21 <script> 21 <script>
22 test(function() { 22 test(function() {
23 assert_equals(getComputedStyle(container).getPropertyValue("--a"), " it was th e best of times"); 23 assert_equals(getComputedStyle(container).getPropertyValue("--a"), " it was th e best of times");
24 assert_equals(getComputedStyle(container).getPropertyValue("--b"), " it was th e worst of times"); 24 assert_equals(getComputedStyle(container).getPropertyValue("--b"), " it was th e worst of times");
25 assert_equals(getComputedStyle(container).getPropertyValue("--c"), " also the blurst of times"); 25 assert_equals(getComputedStyle(container).getPropertyValue("--c"), " also the blurst of times");
26 assert_equals(getComputedStyle(container).getPropertyValue("--d"), "");
26 }, 'Directly declared custom properties appear in computed style.'); 27 }, 'Directly declared custom properties appear in computed style.');
27 28
28 test(function() { 29 test(function() {
29 assert_equals(getComputedStyle(a).getPropertyValue("--a"), " it was the best o f times"); 30 assert_equals(getComputedStyle(a).getPropertyValue("--a"), " it was the best o f times");
30 assert_equals(getComputedStyle(a).getPropertyValue("--b"), " it was the worst of times"); 31 assert_equals(getComputedStyle(a).getPropertyValue("--b"), " it was the worst of times");
31 assert_equals(getComputedStyle(a).getPropertyValue("--c"), " also the blurst o f times"); 32 assert_equals(getComputedStyle(a).getPropertyValue("--c"), " also the blurst o f times");
33 assert_equals(getComputedStyle(a).getPropertyValue("--d"), "");
32 }, 'Inherited custom properties appear in computed style.'); 34 }, 'Inherited custom properties appear in computed style.');
33 35
34 test(function() { 36 test(function() {
35 assert_equals(getComputedStyle(b).getPropertyValue("--a"), " it was the best o f times"); 37 assert_equals(getComputedStyle(b).getPropertyValue("--a"), " it was the best o f times");
36 assert_equals(getComputedStyle(b).getPropertyValue("--b"), " it was the worst of times"); 38 assert_equals(getComputedStyle(b).getPropertyValue("--b"), " it was the worst of times");
37 assert_equals(getComputedStyle(b).getPropertyValue("--c"), " it was the age of wisdom"); 39 assert_equals(getComputedStyle(b).getPropertyValue("--c"), " it was the age of wisdom");
40 assert_equals(getComputedStyle(b).getPropertyValue("--d"), "");
38 }, 'Inherited custom properties overidden values appear correctly in computed st yle.'); 41 }, 'Inherited custom properties overidden values appear correctly in computed st yle.');
39 42
40 test(function() { 43 test(function() {
41 assert_equals(getComputedStyle(c).getPropertyValue("--a"), " it was the best o f times"); 44 assert_equals(getComputedStyle(c).getPropertyValue("--a"), " it was the best o f times");
42 assert_equals(getComputedStyle(c).getPropertyValue("--b"), " it was the worst of times"); 45 assert_equals(getComputedStyle(c).getPropertyValue("--b"), " it was the worst of times");
43 assert_equals(getComputedStyle(c).getPropertyValue("--c"), " it was the age of wisdom"); 46 assert_equals(getComputedStyle(c).getPropertyValue("--c"), " it was the age of wisdom");
47 assert_equals(getComputedStyle(c).getPropertyValue("--d"), "");
44 }, 'Overidden and inherited custom properties appear in computed style.'); 48 }, 'Overidden and inherited custom properties appear in computed style.');
45 </script> 49 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698