From 06074260747a0d5ef7de3d4a1c613ea240f322bc Mon Sep 17 00:00:00 2001 From: Anders Hartvoll Ruud Date: Thu, 30 Aug 2018 06:04:39 -0700 Subject: [PATCH] [css-properties-values-api] Support string values in StylePropertyMap.set. When producing a CSSStyleValue from a string for a registered custom property, parse the value according to the syntax instead of always creating a CSSUnparsedValue. Note that and are still not supported, because CSSUnsupportedProperty does not work properly for registered custom properties (yet). R=futhark@chromium.org Bug: 641877 Change-Id: I806eb5b0c5112956e34457808791367423587c76 Reviewed-on: https://chromium-review.googlesource.com/1177755 Commit-Queue: Anders Ruud Reviewed-by: Rune Lillesveen Cr-Commit-Position: refs/heads/master@{#587537} --- .../typedom.tentative.html | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/css/css-properties-values-api/typedom.tentative.html b/css/css-properties-values-api/typedom.tentative.html index 69ebf7a13d8cf3..c28f1869bc2c03 100644 --- a/css/css-properties-values-api/typedom.tentative.html +++ b/css/css-properties-values-api/typedom.tentative.html @@ -341,99 +341,99 @@ test_style_property_map_set({ syntax: '', initialValue: '0deg', - shouldAccept: [CSS.deg(42), CSS.turn(2)], - shouldReject: [unparsed('42deg'), CSS.px(15)], + shouldAccept: [CSS.deg(42), CSS.turn(2), '42deg'], + shouldReject: [unparsed('42deg'), CSS.px(15), '50px'], }); test_style_property_map_set({ syntax: '', initialValue: 'none', - shouldAccept: [keyword('foo')], - shouldReject: [unparsed('foo'), CSS.px(15)], + shouldAccept: [keyword('foo'), 'foo'], + shouldReject: [unparsed('foo'), CSS.px(15), '15px'], }); test_style_property_map_set({ syntax: '', initialValue: 'url(a)', - shouldAccept: [url_image('url(b)')], - shouldReject: [unparsed('url(b)'), CSS.px(100)], + shouldAccept: [url_image('url(b)'), 'url(b)'], + shouldReject: [unparsed('url(b)'), CSS.px(100), '50px'], }); test_style_property_map_set({ syntax: '', initialValue: '0', - shouldAccept: [CSS.number(1), CSS.number(-42)], - shouldReject: [unparsed('42'), CSS.px(100)], + shouldAccept: [CSS.number(1), CSS.number(-42), '1', '-42'], + shouldReject: [unparsed('42'), CSS.px(100), '50px'], }); test_style_property_map_set({ syntax: '', initialValue: '0px', - shouldAccept: [CSS.percent(10), CSS.px(1), CSS.em(1)], - shouldReject: [unparsed('10%'), unparsed('10px'), CSS.dpi(1)], + shouldAccept: [CSS.percent(10), CSS.px(1), CSS.em(1), '10px', '10%'], + shouldReject: [unparsed('10%'), unparsed('10px'), CSS.dpi(1), 'url(b)'], }); test_style_property_map_set({ syntax: '', initialValue: '0px', - shouldAccept: [CSS.px(10), CSS.em(10), CSS.vh(200), sum(CSS.px(10), CSS.em(20))], - shouldReject: [unparsed('10px'), CSS.percent(1)], + shouldAccept: [CSS.px(10), CSS.em(10), CSS.vh(200), sum(CSS.px(10), CSS.em(20)), '10em', 'calc(10px + 10em)'], + shouldReject: [unparsed('10px'), CSS.percent(1), 'url(b)'], }); test_style_property_map_set({ syntax: '', initialValue: '0', - shouldAccept: [CSS.number(1337), CSS.number(-42.5)], - shouldReject: [unparsed('42'), CSS.px(15)], + shouldAccept: [CSS.number(1337), CSS.number(-42.5), '1337', '-42.5'], + shouldReject: [unparsed('42'), CSS.px(15), '#fef'], }); test_style_property_map_set({ syntax: '', initialValue: '0%', - shouldAccept: [CSS.percent(10)], - shouldReject: [unparsed('10%'), CSS.px(1)], + shouldAccept: [CSS.percent(10), '10%'], + shouldReject: [unparsed('10%'), CSS.px(1), '#fef'], }); test_style_property_map_set({ syntax: '', initialValue: '0dpi', - shouldAccept: [CSS.dpi(100), CSS.dpcm(10), CSS.dppx(50)], - shouldReject: [unparsed('42'), CSS.px(15)], + shouldAccept: [CSS.dpi(100), CSS.dpcm(10), CSS.dppx(50), '100dpi'], + shouldReject: [unparsed('42'), CSS.px(15), '#fef'], }); test_style_property_map_set({ syntax: '