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

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

Issue 1945623002: Make sure computed style is up-to-date for custom properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 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 4
5 <style> 5 <style>
6 #color { 6 #color {
7 --color-value: blue; 7 --color-value: blue;
8 background-color: var(--color-value); 8 background-color: var(--color-value);
9 } 9 }
10 10
11 #float_pixel { 11 #float_pixel {
12 --float-pixel-value: 10.5px; 12 --float-pixel-value: 10.5px;
13 border-width: var(--float-pixel-value); 13 border-width: var(--float-pixel-value);
14 } 14 }
15 15
16 #em { 16 #em {
17 --em-value: 1.5em; 17 --em-value: 1.5em;
18 font-size: var(--em-value); 18 font-size: var(--em-value);
19 } 19 }
20 20
21 #percentage { 21 #percentage {
22 --percentage-value: 75%; 22 --percentage-value: 75%;
23 width: var(--percentage-value); 23 width: var(--percentage-value);
24 } 24 }
25
26 #dynamic.dynamic {
27 --custom-value:pass;
28 }
25 </style> 29 </style>
26 30
27 <body> 31 <body>
28 <div id="color"></div> 32 <div id="color"></div>
29 <div id="float_pixel"></div> 33 <div id="float_pixel"></div>
30 <div id="em"></div> 34 <div id="em"></div>
31 <div id="percentage"></div> 35 <div id="percentage"></div>
36 <div id="dynamic"></div>
32 </body> 37 </body>
33 38
34 <script> 39 <script>
35 test(function() { 40 test(function() {
36 assert_equals(getComputedStyle(color).backgroundColor, 'rgb(0, 0, 255)'); 41 assert_equals(getComputedStyle(color).backgroundColor, 'rgb(0, 0, 255)');
37 }, 'background-color property, color value'); 42 }, 'background-color property, color value');
38 43
39 test(function() { 44 test(function() {
40 assert_equals(getComputedStyle(float_pixel).borderWidth, '0px'); 45 assert_equals(getComputedStyle(float_pixel).borderWidth, '0px');
41 }, 'border-width property, border-style = none'); 46 }, 'border-width property, border-style = none');
42 47
43 float_pixel.style.borderStyle = "solid"; 48 float_pixel.style.borderStyle = "solid";
44 test(function() { 49 test(function() {
45 assert_equals(getComputedStyle(float_pixel).borderWidth, '10px'); 50 assert_equals(getComputedStyle(float_pixel).borderWidth, '10px');
46 }, 'border-width property, border-style = solid, floating point pixel value'); 51 }, 'border-width property, border-style = solid, floating point pixel value');
47 52
48 test(function() { 53 test(function() {
49 assert_equals(getComputedStyle(em).fontSize, '24px'); 54 assert_equals(getComputedStyle(em).fontSize, '24px');
50 }, 'font-size property, em value'); 55 }, 'font-size property, em value');
51 56
52 test(function() { 57 test(function() {
53 assert_equals( 58 assert_equals(
54 getComputedStyle(percentage).width, parseInt(getComputedStyle(document.body) .width) * 0.75 + 'px'); 59 getComputedStyle(percentage).width, parseInt(getComputedStyle(document.body) .width) * 0.75 + 'px');
55 }, 'width property, percentage value'); 60 }, 'width property, percentage value');
61
62 test(function() {
63 assert_equals(getComputedStyle(dynamic).getPropertyValue("--custom-value"), "" );
64 dynamic.className = "dynamic";
65 assert_equals(getComputedStyle(dynamic).getPropertyValue("--custom-value"), "p ass");
66 }, 'custom property, forced style recalc');
56 </script> 67 </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