Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f54c865dc43d2fd134b3d9797e999a0d301d52a8
      
https://github.com/WebKit/WebKit/commit/f54c865dc43d2fd134b3d9797e999a0d301d52a8
  Author: Razvan Caliman <[email protected]>
  Date:   2026-09-28 (Mon, 28 Sep 2026)

  Changed paths:
    A LayoutTests/inspector/unit-tests/css-tokenizer-expected.txt
    A LayoutTests/inspector/unit-tests/css-tokenizer.html
    M Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js

  Log Message:
  -----------
  Web Inspector: Styles: var() with a non-ASCII custom property name (var(--色)) 
is shown as invalid although it resolves
https://bugs.webkit.org/show_bug.cgi?id=324935
rdar://188169850

Reviewed by Devin Rousso and Qianlang Chen.

CodeMirror's CSS tokenizer only accepts ASCII word characters in custom property
names, so `--色` is split into `--` and `色`. `WI.CSSProperty.isVariable("--")` is
false, so `WI.SpreadsheetStyleProperty` flags the
value as invalid even though
WebCore resolves it.

Fix this with a `-` tokenHook on the `text/css` MIME spec instead of patching 
the
vendored `External/CodeMirror/css.js`. `tokenHooks` is CodeMirror's supported 
extension
point for the CSS mode (already used for comments in text/css and for the SCSS 
and LESS).

Keeping the change in CodeMirrorAdditions.js follows the existing
practice of extending CodeMirror modes there via CodeMirror.extendMode(),
and avoids a change that would be overwritten when updating CodeMirror.

The hook only claims `--` names and returns false otherwise, so negative 
numbers,
vendor prefixes, and minus still use CodeMirror's default handling.

Test: inspector/unit-tests/css-tokenizer.html
Canonical link: 
https://flagged.apple.com:443/proxy?t2=dG9K8B6If6&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzIyMDc2QG1haW4=&emid=f43a2d79-0f1e-4172-a61e-5691c2b6508a&c=11



To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to