15 files changed
@@ -536,18 +536,13 @@ function postParseDimension(dimension, { definition: { max, min, name } }) { | |||
| 536 | 536 | ||
| 537 | 537 | /** | |
| 538 | 538 | * @param {object|object[]} name | |
| 539 | - * @param {object} node | ||
| 540 | 539 | * @returns {object|object[]|null} | |
| 541 | 540 | * @see {@link https://drafts.csswg.org/css-fonts-4/#family-name-value} | |
| 542 | - * @see {@link https://drafts.csswg.org/css-speech-1/#valdef-voice-family-family-name} | ||
| 543 | 541 | * | |
| 544 | 542 | * It aborts parsing the name when it is invalid in the context. | |
| 545 | 543 | */ | |
| 546 | - function postParseFamilyName(name, node) { | ||
| 547 | - const invalid = isDeclaredBy(node, 'voice-family') | ||
| 548 | - ? reserved.voiceFamilyName | ||
| 549 | - : reserved.fontFamilyName | ||
| 550 | - if (name.types.includes('<string>') || 1 < name.length || !invalid.includes(toLowerCase(name[0].value))) { | ||
| 544 | + function postParseFontFamilyName(name) { | ||
| 545 | + if (name.types.includes('<string>') || 1 < name.length || !reserved.fontFamilyName.includes(toLowerCase(name[0].value))) { | ||
| 551 | 546 | return name | |
| 552 | 547 | } | |
| 553 | 548 | return null | |
@@ -1895,6 +1890,20 @@ function postParseViewTransitionName(name, node) { | |||
| 1895 | 1890 | return reserved.viewTransitionName.includes(toLowerCase(name.value)) ? error(node) : name | |
| 1896 | 1891 | } | |
| 1897 | 1892 | ||
| 1893 | + /** | ||
| 1894 | + * @param {object|object[]} name | ||
| 1895 | + * @returns {object|object[]|null} | ||
| 1896 | + * @see {@link https://drafts.csswg.org/css-speech-1/#valdef-voice-family-family-name} | ||
| 1897 | + * | ||
| 1898 | + * It aborts parsing the name when it is invalid in the context. | ||
| 1899 | + */ | ||
| 1900 | + function postParseVoiceFamilyName(name) { | ||
| 1901 | + if (name.types.includes('<string>') || 1 < name.length || !reserved.voiceFamilyName.includes(toLowerCase(name[0].value))) { | ||
| 1902 | + return name | ||
| 1903 | + } | ||
| 1904 | + return null | ||
| 1905 | + } | ||
| 1906 | + | ||
| 1898 | 1907 | /** | |
| 1899 | 1908 | * @param {object[]} value | |
| 1900 | 1909 | * @param {object} node | |
@@ -1966,7 +1975,7 @@ export default { | |||
| 1966 | 1975 | '<dashed-ident>': postParseDashedIdent, | |
| 1967 | 1976 | '<dashndashdigit-ident>': postParseDashNDashDigitIdentifier, | |
| 1968 | 1977 | '<decibel>': postParseDimension, | |
| 1969 | - '<family-name>': postParseFamilyName, | ||
| 1978 | + '<family-name>': postParseFontFamilyName, | ||
| 1970 | 1979 | '<first-valid()>': postParseFirstValid, | |
| 1971 | 1980 | '<flex>': postParseDimension, | |
| 1972 | 1981 | '<font-format>': postParseFontFormat, | |
@@ -2025,6 +2034,7 @@ export default { | |||
| 2025 | 2034 | '<transform-interpolate()>': postParseInterpolate, | |
| 2026 | 2035 | '<try-tactic>': postParseListToSpecifiedOrder, | |
| 2027 | 2036 | '<urange>': postParseUnicodeRange, | |
| 2037 | + '<voice-family-name>': postParseVoiceFamilyName, | ||
| 2028 | 2038 | '<whole-value>': postParseWholeValue, | |
| 2029 | 2039 | '<zero>': postParseZero, | |
| 2030 | 2040 | '@font-palette-values': postParseFontPaletteValues, | |
@@ -885,7 +885,7 @@ function parseRule(rules, longhands, shorthand) { | |||
| 885 | 885 | const declarations = longhands.map(longhand => [longhand, rules.get(longhand.replace('column', 'row'))]) | |
| 886 | 886 | return new Map(declarations) | |
| 887 | 887 | } | |
| 888 | - const declarations = new Map(longhands.map(longhand => [longhand, list()])) | ||
| 888 | + const declarations = new Map(longhands.map(longhand => [longhand, list([], ',')])) | ||
| 889 | 889 | rules.forEach(rule => { | |
| 890 | 890 | if (isList(rule)) { | |
| 891 | 891 | const [width, style, color] = rule | |
@@ -910,6 +910,33 @@ function parseRule(rules, longhands, shorthand) { | |||
| 910 | 910 | return declarations | |
| 911 | 911 | } | |
| 912 | 912 | ||
| 913 | + /** | ||
| 914 | + * @param {object[]} insets | ||
| 915 | + * @param {string[]} longhands | ||
| 916 | + * @param {string} shorthand | ||
| 917 | + * @returns {Map} | ||
| 918 | + * @see {@link https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-edge-inset} | ||
| 919 | + * @see {@link https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-inset} | ||
| 920 | + * @see {@link https://drafts.csswg.org/css-gaps-1/#propdef-column-rule-interior-inset} | ||
| 921 | + * @see {@link https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-edge-inset} | ||
| 922 | + * @see {@link https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-inset} | ||
| 923 | + * @see {@link https://drafts.csswg.org/css-gaps-1/#propdef-row-rule-interior-inset} | ||
| 924 | + * @see {@link https://drafts.csswg.org/css-gaps-1/#propdef-rule-edge-inset} | ||
| 925 | + * @see {@link https://drafts.csswg.org/css-gaps-1/#propdef-rule-inset} | ||
| 926 | + * @see {@link https://drafts.csswg.org/css-gaps-1/#propdef-rule-interior-inset} | ||
| 927 | + */ | ||
| 928 | + function parseRuleInset(insets, longhands, name) { | ||
| 929 | + if (name.endsWith('rule-inset')) { | ||
| 930 | + insets = insets.flat() | ||
| 931 | + insets.splice(2, 1) | ||
| 932 | + } | ||
| 933 | + const divisor = name.startsWith('rule') ? 2 : 1 | ||
| 934 | + return new Map(longhands.map((longhand, index) => { | ||
| 935 | + const value = insets[Math.floor(index / divisor)] | ||
| 936 | + return [longhand, (!value || isOmitted(value)) ? properties[longhand].initial.parsed : value] | ||
| 937 | + })) | ||
| 938 | + } | ||
| 939 | + | ||
| 913 | 940 | /** | |
| 914 | 941 | * @param {object[]} values | |
| 915 | 942 | * @param {string[]} longhands | |
@@ -1076,6 +1103,8 @@ function parse(value, name, subProperties) { | |||
| 1076 | 1103 | case 'border-clip': | |
| 1077 | 1104 | case 'border-inline-clip': | |
| 1078 | 1105 | case 'color-adjust': | |
| 1106 | + case 'column-rule-inset-end': | ||
| 1107 | + case 'column-rule-inset-start': | ||
| 1079 | 1108 | case 'glyph-orientation-vertical': | |
| 1080 | 1109 | case 'marker': | |
| 1081 | 1110 | case 'overflow-clip-margin': | |
@@ -1084,9 +1113,12 @@ function parse(value, name, subProperties) { | |||
| 1084 | 1113 | case 'page-break-after': | |
| 1085 | 1114 | case 'page-break-before': | |
| 1086 | 1115 | case 'page-break-inside': | |
| 1116 | + case 'row-rule-inset-end': | ||
| 1117 | + case 'row-rule-inset-start': | ||
| 1087 | 1118 | case 'rule-break': | |
| 1088 | 1119 | case 'rule-color': | |
| 1089 | - case 'rule-outset': | ||
| 1120 | + case 'rule-inset-end': | ||
| 1121 | + case 'rule-inset-start': | ||
| 1090 | 1122 | case 'rule-style': | |
| 1091 | 1123 | case 'rule-width': | |
| 1092 | 1124 | return setLonghands(value, longhands) | |
@@ -1100,6 +1132,16 @@ function parse(value, name, subProperties) { | |||
| 1100 | 1132 | case 'row-rule': | |
| 1101 | 1133 | case 'rule': | |
| 1102 | 1134 | return parseRule(value, longhands, name) | |
| 1135 | + case 'column-rule-edge-inset': | ||
| 1136 | + case 'column-rule-inset': | ||
| 1137 | + case 'column-rule-interior-inset': | ||
| 1138 | + case 'row-rule-edge-inset': | ||
| 1139 | + case 'row-rule-inset': | ||
| 1140 | + case 'row-rule-interior-inset': | ||
| 1141 | + case 'rule-edge-inset': | ||
| 1142 | + case 'rule-inset': | ||
| 1143 | + case 'rule-interior-inset': | ||
| 1144 | + return parseRuleInset(value, longhands, name) | ||
| 1103 | 1145 | case 'columns': | |
| 1104 | 1146 | return parseColumns(value, longhands) | |
| 1105 | 1147 | case 'container': | |
0 commit comments