Skip to content

Commit

Permalink
[css-typed-om] update CSSUnparsedValue.idl
Browse files Browse the repository at this point in the history
1. replace "DOMString or CSSVariableReferenceValue" with
 CSSUnparsedSegment using typedf keyword.
2. using sequence<> keyword instead of "..." in constructor

w3c/css-houdini-drafts#619

Bug: 807525
Change-Id: I99c11c26dd2235e46e259e63991d0192a025bcb4
Reviewed-on: https://chromium-review.googlesource.com/904582
Reviewed-by: Darren Shen <shend@chromium.org>
Commit-Queue: Hwanseung Lee <hs1217.lee@samsung.com>
Cr-Commit-Position: refs/heads/master@{#534906}
  • Loading branch information
hwanseung authored and chromium-wpt-export-bot committed Feb 7, 2018
1 parent 3197bbb commit 384cb6d
Show file tree
Hide file tree
Showing 19 changed files with 49 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,34 @@
{
value: 'var(--A, 1em)',
expectedResult: [
new CSSVariableReferenceValue('--A', new CSSUnparsedValue(' 1em')),
new CSSVariableReferenceValue('--A', new CSSUnparsedValue([' 1em'])),
]
},
{
value: 'var(--A, var(--B))',
expectedResult: [
new CSSVariableReferenceValue('--A', new CSSUnparsedValue(' ', new CSSVariableReferenceValue('--B'))),
new CSSVariableReferenceValue('--A', new CSSUnparsedValue([' ', new CSSVariableReferenceValue('--B')])),
]
},
{
value: 'calc(42px + var(--foo, 15em) + var(--bar, var(--far) + 15px))',
expectedResult: [
'calc(42px + ',
new CSSVariableReferenceValue('--foo', new CSSUnparsedValue(' 15em')),
new CSSVariableReferenceValue('--foo', new CSSUnparsedValue([' 15em'])),
' + ',
new CSSVariableReferenceValue('--bar', new CSSUnparsedValue(' ', new CSSVariableReferenceValue('--far'), ' + 15px')),
new CSSVariableReferenceValue('--bar', new CSSUnparsedValue([' ', new CSSVariableReferenceValue('--far'), ' + 15px'])),
')',
]
},
];

for (const {value, expectedResult} of gTestCases) {
test(t => {
assert_string_normalizes_to(t, 'color', value, new CSSUnparsedValue(...expectedResult));
assert_string_normalizes_to(t, 'color', value, new CSSUnparsedValue(expectedResult));
}, 'Normalizing "' + value + '" on a CSS property returns correct CSSUnparsedValue');

test(t => {
assert_string_normalizes_to(t, '--X', value, new CSSUnparsedValue(...expectedResult));
assert_string_normalizes_to(t, '--X', value, new CSSUnparsedValue(expectedResult));
}, 'Normalizing "' + value + '" on a custom property returns correct CSSUnparsedValue');
}

Expand Down
16 changes: 8 additions & 8 deletions css/css-typed-om/stylevalue-serialization/cssUnparsedValue.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@
'use strict';

test(() => {
assert_equals(new CSSUnparsedValue('lem', 'on', 'ade').toString(), 'lemonade');
assert_equals(new CSSUnparsedValue(['lem', 'on', 'ade']).toString(), 'lemonade');
}, 'CSSUnparsedValue containing strings serializes to its concatenated contents');

test(() => {
assert_equals(new CSSUnparsedValue(
assert_equals(new CSSUnparsedValue([
new CSSVariableReferenceValue('--A',
new CSSUnparsedValue(new CSSVariableReferenceValue('--B'))),
new CSSVariableReferenceValue('--C')).toString(),
new CSSUnparsedValue([new CSSVariableReferenceValue('--B')])),
new CSSVariableReferenceValue('--C')]).toString(),
'var(--A,var(--B))var(--C)');
}, 'CSSUnparsedValue containing variable references serializes its ' +
'concatenated contents');

test(() => {
assert_equals(new CSSUnparsedValue('foo', 'bar ',
assert_equals(new CSSUnparsedValue(['foo', 'bar ',
new CSSVariableReferenceValue('--A',
new CSSUnparsedValue('baz ',
new CSSVariableReferenceValue('--B'), 'lemon')),
new CSSUnparsedValue(['baz ',
new CSSVariableReferenceValue('--B'), 'lemon'])),
new CSSVariableReferenceValue('--C',
new CSSUnparsedValue('ade'))).toString(),
new CSSUnparsedValue(['ade']))]).toString(),
'foobar var(--A,baz var(--B)lemon)var(--C,ade)');
}, 'CSSUnparsedValue containing mix of strings and variable references ' +
'serializes to its concatenated contents');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

for (const {args, description} of gTestArguments) {
test(() => {
const result = new CSSUnparsedValue(...args);
const result = new CSSUnparsedValue(args);

assert_not_equals(result, null,
'A CSSUnparsedValue should be created');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@

test(() => {
const result = new CSSVariableReferenceValue('--foo',
new CSSUnparsedValue('lemon'));
new CSSUnparsedValue(['lemon']));

assert_not_equals(result, null,
'A CSSVariableReferenceValue should be created');
assert_equals(result.variable, '--foo',
'Variable member should be same as passed in the constructor');
assert_not_equals(result.fallback, null,
'Fallback member should not be null');
assert_style_value_equals(result.fallback, new CSSUnparsedValue('lemon'),
assert_style_value_equals(result.fallback, new CSSUnparsedValue(['lemon']),
'Fallback member should be as same as passed in the constructor');
}, 'CSSVariableReferenceValue can be constructed with fallback');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

test(() => {
const result = styleMap.get('--foo');
assert_style_value_equals(result, new CSSUnparsedValue(' auto'));
assert_style_value_equals(result, new CSSUnparsedValue([' auto']));
}, 'Computed StylePropertyMap contains custom property declarations in style rules');

test(() => {
Expand All @@ -48,7 +48,7 @@

test(() => {
const result = styleMap.get('--bar');
assert_style_value_equals(result, new CSSUnparsedValue(' 5'));
assert_style_value_equals(result, new CSSUnparsedValue([' 5']));
}, 'Computed StylePropertyMap contains custom property declarations in inline rules');

test(() => {
Expand Down
2 changes: 1 addition & 1 deletion css/css-typed-om/the-stylepropertymap/computed/get.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
test(t => {
const styleMap = createComputedStyleMap(t, '--foo: auto; --bar: 10px');
assert_style_value_equals(styleMap.get('--foo'),
new CSSUnparsedValue(' auto'));
new CSSUnparsedValue([' auto']));
}, 'Getting a valid custom property from computed style returns the ' +
'correct entry');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

test(t => {
const styleMap = createComputedStyleMap(t, '--foo: auto; --bar: 10px');
assert_style_value_array_equals(styleMap.getAll('--foo'), [new CSSUnparsedValue(' auto')]);
assert_style_value_array_equals(styleMap.getAll('--foo'), [new CSSUnparsedValue([' auto'])]);
}, 'Calling StylePropertyMap.getAll with a valid custom property returns a single element list with the correct entry');

test(t => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

test(t => {
const styleMap = createComputedStyleMap(t, '--A: A; --C: C; color: red; --B: B;');
assert_style_value_equals(findInStyleMap(styleMap, '--A'), new CSSUnparsedValue(' A'));
assert_style_value_equals(findInStyleMap(styleMap, '--B'), new CSSUnparsedValue(' B'));
assert_style_value_equals(findInStyleMap(styleMap, '--C'), new CSSUnparsedValue(' C'));
assert_style_value_equals(findInStyleMap(styleMap, '--A'), new CSSUnparsedValue([' A']));
assert_style_value_equals(findInStyleMap(styleMap, '--B'), new CSSUnparsedValue([' B']));
assert_style_value_equals(findInStyleMap(styleMap, '--C'), new CSSUnparsedValue([' C']));
}, 'StylePropertyMap iterator returns custom properties with the correct CSSStyleValue');

</script>
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}, 'Declared StylePropertyMap does not contain inline styles');

test(() => {
assert_style_value_equals(styleMap.get('--foo'), new CSSUnparsedValue(' auto'));
assert_style_value_equals(styleMap.get('--foo'), new CSSUnparsedValue([' auto']));
}, 'Declared StylePropertyMap contains custom property declarations');

test(() => {
Expand Down
2 changes: 1 addition & 1 deletion css/css-typed-om/the-stylepropertymap/declared/get.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
test(t => {
const styleMap = createDeclaredStyleMap(t, '--foo: auto; --bar: 10px');
assert_style_value_equals(styleMap.get('--foo'),
new CSSUnparsedValue(' auto'));
new CSSUnparsedValue([' auto']));
}, 'Getting a valid custom property from CSS rule returns the ' +
'correct entry');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

test(t => {
const styleMap = createDeclaredStyleMap(t, '--foo: auto; --bar: 10px');
assert_style_value_array_equals(styleMap.getAll('--foo'), [new CSSUnparsedValue(' auto')]);
assert_style_value_array_equals(styleMap.getAll('--foo'), [new CSSUnparsedValue([' auto'])]);
}, 'Calling StylePropertyMap.getAll with a valid custom property returns a single element list with the correct entry');

test(t => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@

assert_array_equals(keys, ['--A', '--B', '--C']);
assert_style_value_array_equals(values, [
new CSSUnparsedValue(' A'),
new CSSUnparsedValue(' B'),
new CSSUnparsedValue(' C'),
new CSSUnparsedValue([' A']),
new CSSUnparsedValue([' B']),
new CSSUnparsedValue([' C']),
])
}, 'StylePropertyMap iterator returns custom properties with the correct CSSStyleValue');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@
test(t => {
let styleMap = createDeclaredStyleMap(t, '');

styleMap.set('--foo', new CSSUnparsedValue('auto'));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue('auto'));
styleMap.set('--foo', new CSSUnparsedValue(['auto']));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue(['auto']));

styleMap.set('--foo', '20px');
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue('20px'));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue(['20px']));
}, 'Setting a custom property with CSSStyleValue or String updates its value');

test(t => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
test(t => {
let styleMap = createDeclaredStyleMap(t, '');

styleMap.update('--foo', () => new CSSUnparsedValue('auto'));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue('auto'));
styleMap.update('--foo', () => new CSSUnparsedValue(['auto']));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue(['auto']));

styleMap.update('--foo', () => new CSSUnparsedValue('20px'));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue('20px'));
styleMap.update('--foo', () => new CSSUnparsedValue(['20px']));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue(['20px']));
}, 'Updating a custom property with CSSStyleValue updates its value');

test(t => {
Expand Down
2 changes: 1 addition & 1 deletion css/css-typed-om/the-stylepropertymap/inline/get.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
test(t => {
const styleMap = createInlineStyleMap(t, '--foo: auto; --bar: 10px');
assert_style_value_equals(styleMap.get('--foo'),
new CSSUnparsedValue(' auto'));
new CSSUnparsedValue([' auto']));
}, 'Getting a valid custom property from inline style returns the ' +
'correct entry');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

test(t => {
const styleMap = createInlineStyleMap(t, '--foo: auto; --bar: 10px');
assert_style_value_array_equals(styleMap.getAll('--foo'), [new CSSUnparsedValue(' auto')]);
assert_style_value_array_equals(styleMap.getAll('--foo'), [new CSSUnparsedValue([' auto'])]);
}, 'Calling StylePropertyMap.getAll with a valid custom property returns a single element list with the correct entry');

test(t => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@

assert_array_equals(keys, ['--A', '--B', '--C']);
assert_style_value_array_equals(values, [
new CSSUnparsedValue(' A'),
new CSSUnparsedValue(' B'),
new CSSUnparsedValue(' C'),
new CSSUnparsedValue([' A']),
new CSSUnparsedValue([' B']),
new CSSUnparsedValue([' C']),
])
}, 'StylePropertyMap iterator returns custom properties with the correct CSSStyleValue');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@
test(t => {
let styleMap = createInlineStyleMap(t, '');

styleMap.set('--foo', new CSSUnparsedValue('auto'));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue('auto'));
styleMap.set('--foo', new CSSUnparsedValue(['auto']));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue(['auto']));

styleMap.set('--foo', '20px');
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue('20px'));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue(['20px']));
}, 'Setting a custom property with CSSStyleValue or String updates its value');

test(t => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
test(t => {
let styleMap = createInlineStyleMap(t, '');

styleMap.update('--foo', () => new CSSUnparsedValue('auto'));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue('auto'));
styleMap.update('--foo', () => new CSSUnparsedValue(['auto']));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue(['auto']));

styleMap.update('--foo', () => new CSSUnparsedValue('20px'));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue('20px'));
styleMap.update('--foo', () => new CSSUnparsedValue(['20px']));
assert_style_value_array_equals(styleMap.get('--foo'), new CSSUnparsedValue(['20px']));
}, 'Updating a custom property with CSSStyleValue updates its value');

test(t => {
Expand Down

0 comments on commit 384cb6d

Please sign in to comment.