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

Side by Side Diff: third_party/WebKit/LayoutTests/custom-properties/registered-property-initial.html

Issue 2622403006: Compute initial values for registered custom properties. (Closed)
Patch Set: initialise CSSToLengthConversionData nicer Created 3 years, 11 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/CSSToLengthConversionData.h » ('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 #target { 5 #target {
6 background: var(--inherited-color); 6 background: var(--inherited-color);
7 color: var(--non-inherited-color); 7 color: var(--non-inherited-color);
8 } 8 }
9 </style> 9 </style>
10 <div id=target></div> 10 <div id=target></div>
11 <script> 11 <script>
12 CSS.registerProperty({name: '--length', syntax: '<length>', initialValue: 'calc( 10px + 15px)'});
13 CSS.registerProperty({name: '--length-percentage', syntax: '<length-percentage>' , initialValue: 'calc(1in + 10% + 4px)'});
12 CSS.registerProperty({name: '--inherited-color', syntax: '<color>', initialValue : 'pink', inherits: true}); 14 CSS.registerProperty({name: '--inherited-color', syntax: '<color>', initialValue : 'pink', inherits: true});
13 CSS.registerProperty({name: '--non-inherited-color', syntax: '<color>', initialV alue: 'purple'}); 15 CSS.registerProperty({name: '--non-inherited-color', syntax: '<color>', initialV alue: 'purple'});
14 16
15 test(function() { 17 test(function() {
16 computedStyle = getComputedStyle(target); 18 computedStyle = getComputedStyle(target);
19 assert_equals(computedStyle.getPropertyValue('--length'), '25px');
20 assert_equals(computedStyle.getPropertyValue('--length-percentage'), 'calc(1 00px + 10%)');
17 assert_equals(computedStyle.getPropertyValue('--inherited-color'), 'pink'); 21 assert_equals(computedStyle.getPropertyValue('--inherited-color'), 'pink');
18 assert_equals(computedStyle.getPropertyValue('--non-inherited-color'), 'purp le'); 22 assert_equals(computedStyle.getPropertyValue('--non-inherited-color'), 'purp le');
19 23
20 assert_equals(computedStyle.backgroundColor, 'rgb(255, 192, 203)'); 24 assert_equals(computedStyle.backgroundColor, 'rgb(255, 192, 203)');
21 assert_equals(computedStyle.color, 'rgb(128, 0, 128)'); 25 assert_equals(computedStyle.color, 'rgb(128, 0, 128)');
22 }, "Initial values of registered properties can be referenced when no custom pro perties are explicitly set."); 26 }, "Initial values of registered properties can be referenced when no custom pro perties are explicitly set.");
23 </script> 27 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSToLengthConversionData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698