Skip to content

Commit 9d3c991

Browse files
yisiblDevtools-frontend LUCI CQ
authored andcommitted
Mark border-inline/block as a color property
- Fixes an issue that previously prevented ColorSwatch from being displayed - Make these properties show the Color keyword when Autocomplete. Added the following properties: - 'border-inline', - 'border-inline-color', - 'border-block', - 'border-block-color', and complementary SVG-related color properties: - 'flood-color', - 'lighting-color', - 'stop-color' pfaffe@ has previously added some other border properties, see: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5667297 Bug: 389048232 Change-Id: Ibef893f7154458d9552dfaf6180ab6c9ee93d452 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6371612 Reviewed-by: Philip Pfaffe <[email protected]> Commit-Queue: 一丝 <[email protected]>
1 parent aad3e2e commit 9d3c991

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

front_end/core/sdk/CSSMetadata.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,14 @@ const colorAwareProperties = new Set<string>([
547547
'border-right-color',
548548
'border-top',
549549
'border-top-color',
550+
'border-block',
551+
'border-block-color',
550552
'border-block-end',
551553
'border-block-end-color',
552554
'border-block-start',
553555
'border-block-start-color',
556+
'border-inline',
557+
'border-inline-color',
554558
'border-inline-end',
555559
'border-inline-end-color',
556560
'border-inline-start',
@@ -597,6 +601,10 @@ const colorAwareProperties = new Set<string>([
597601
'-webkit-text-fill-color',
598602
'-webkit-text-stroke',
599603
'-webkit-text-stroke-color',
604+
// For SVG
605+
'flood-color',
606+
'lighting-color',
607+
'stop-color',
600608
]);
601609

602610
// In addition to `_colorAwareProperties`, the following properties contain CSS <angle> units.

front_end/core/sdk/CSSPropertyParserMatchers.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,18 @@ describe('Matchers for SDK.CSSPropertyParser.BottomUpTreeMatching', () => {
9494

9595
it('parses colors in logical border properties', () => {
9696
for (const success
97-
of ['border-block-end', 'border-block-end-color', 'border-block-start', 'border-block-start-color',
98-
'border-inline-end', 'border-inline-end-color', 'border-inline-start', 'border-inline-start-color']) {
97+
of ['border-inline', 'border-block', 'border-inline-color', 'border-block-color', 'border-block-end',
98+
'border-block-end-color', 'border-block-start', 'border-block-start-color', 'border-inline-end',
99+
'border-inline-end-color', 'border-inline-start', 'border-inline-start-color']) {
100+
const {ast, match, text} = matchSingleValue(success, 'red', new SDK.CSSPropertyParserMatchers.ColorMatcher());
101+
assert.exists(match, text);
102+
assert.strictEqual(match.text, 'red');
103+
assert.strictEqual(ast?.propertyName, success);
104+
}
105+
});
106+
107+
it('parses colors in SVG color properties', () => {
108+
for (const success of ['flood-color', 'lighting-color', 'stop-color']) {
99109
const {ast, match, text} = matchSingleValue(success, 'red', new SDK.CSSPropertyParserMatchers.ColorMatcher());
100110
assert.exists(match, text);
101111
assert.strictEqual(match.text, 'red');

0 commit comments

Comments
 (0)