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

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

Issue 2366313006: CSS Properties and Values API: Support non-inherited custom properties (Closed)
Patch Set: use de morgan's law Created 4 years, 2 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/ComputedStyleCSSValueMapping.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <style>
5 #outer {
6 --inherited-length-1: 10px;
7 --inherited-length-2: var(--non-inherited-length-1);
8 --inherited-length-3: 30px;
9 --non-inherited-length-1: 22px;
10 --non-inherited-length-3: calc(var(--non-inherited-length-2) * 10);
11 }
12
13 #inner {
14 --inherited-length-3: 15px;
15 --non-inherited-length-1: 40px;
16 --non-inherited-length-2: 90px;
17 }
18 </style>
19 <div id=outer><div id=inner></div></div>
20 <script>
21 CSS.registerProperty({name: '--inherited-length-1', syntax: '<length>', initialV alue: '1px', inherits: true});
22 CSS.registerProperty({name: '--inherited-length-2', syntax: '<length>', initialV alue: '2px', inherits: true});
23 CSS.registerProperty({name: '--inherited-length-3', syntax: '<length>', initialV alue: '3px', inherits: true});
24 CSS.registerProperty({name: '--non-inherited-length-1', syntax: '<length>', init ialValue: '4px'});
25 CSS.registerProperty({name: '--non-inherited-length-2', syntax: '<length>', init ialValue: '5px'});
26 CSS.registerProperty({name: '--non-inherited-length-3', syntax: '<length>', init ialValue: '6px'});
27
28 test(function() {
29 outerComputedStyle = getComputedStyle(outer);
30 assert_equals(outerComputedStyle.getPropertyValue('--inherited-length-1'), ' 10px');
31 assert_equals(outerComputedStyle.getPropertyValue('--inherited-length-2'), ' 22px');
32 assert_equals(outerComputedStyle.getPropertyValue('--inherited-length-3'), ' 30px');
33 assert_equals(outerComputedStyle.getPropertyValue('--non-inherited-length-1' ), '22px');
34 assert_equals(outerComputedStyle.getPropertyValue('--non-inherited-length-2' ), '5px');
35 assert_equals(outerComputedStyle.getPropertyValue('--non-inherited-length-3' ), '50px');
36
37 innerComputedStyle = getComputedStyle(inner);
38 assert_equals(innerComputedStyle.getPropertyValue('--inherited-length-1'), ' 10px');
39 assert_equals(innerComputedStyle.getPropertyValue('--inherited-length-2'), ' 22px');
40 assert_equals(innerComputedStyle.getPropertyValue('--inherited-length-3'), ' 15px');
41 assert_equals(innerComputedStyle.getPropertyValue('--non-inherited-length-1' ), '40px');
42 assert_equals(innerComputedStyle.getPropertyValue('--non-inherited-length-2' ), '90px');
43 assert_equals(innerComputedStyle.getPropertyValue('--non-inherited-length-3' ), '6px');
44 }, "Registered properties are correctly inherited (or not) depending on the inhe rits flag.");
45 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698