Closed Bug 2023898 Opened 2 months ago Closed 1 month ago

[wpt-sync] Sync PR 58523 - [Fonts] Serialize font-family as space-separated idents when possible

Categories

(Core :: Layout: Text and Fonts, task, P4)

task

Tracking

()

RESOLVED FIXED
151 Branch
Tracking Status
firefox151 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 58523 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/58523
Details from upstream follow.

Gaurav Kumar <gauravkum@microsoft.com> wrote:

[Fonts] Serialize font-family as space-separated idents when possible

Per the CSSWG resolution in [1], font-family \<family-name> values should
serialize as unquoted space-separated idents when the name consists of
valid CSS identifiers joined by single spaces.

Currently, Blink quotes all multi-word family names:

element.style.fontFamily = "Twisty Tie";
element.style.fontFamily; // → ""Twisty Tie"" (quoted)

After this CL (with the flag enabled):

element.style.fontFamily; // → "Twisty Tie" (unquoted)

Quoting is still applied when the name:

  • Matches a CSS-wide keyword (initial, inherit, unset, revert, etc.)
  • Matches a generic family (serif, sans-serif, monospace, etc.)
  • Matches the "default" keyword
  • Cannot be represented as space-separated idents (starts with a
    digit, contains special characters, has consecutive spaces, etc.)

The root cause was that IsInvalidFontFamily() called
IsCSSTokenizerIdentifier(), which validates a single CSS ident token.
Multi-word names contain spaces, which fail the single-ident check,
causing all multi-word names to be quoted.

This CL adds IsCSSTokenizerIdentSequence() which validates a sequence
of one or more space-separated CSS idents. When the
CSSFontFamilySerialization flag is enabled, IsInvalidFontFamily() uses
this new function instead.

This applies to both specified and computed value serialization,
consistent with the CSSWG resolution.

CSSWG resolution :
[1]https://github.com/w3c/csswg-drafts/issues/5846#issuecomment-3885672626

Bug: 483689942
Change-Id: I3501846aecded342cc949cae84e3a4075e263484
Reviewed-on: https://chromium-review.googlesource.com/7610633
WPT-Export-Revision: 75641f17308abc44670df628591c2bda8fd0a4ae

Component: web-platform-tests → Layout: Text and Fonts
Product: Testing → Core

CI Results

Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 287 tests and 1 subtests

Status Summary

Firefox

OK : 6[GitHub] 264[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-24h2-debug, Gecko-windows11-32-24h2-opt, Gecko-windows11-64-24h2-debug, Gecko-windows11-64-24h2-opt]
PASS : 12[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 1354[GitHub] 5407[Gecko-windows11-32-24h2-debug, Gecko-windows11-32-24h2-opt] 5418[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-24h2-debug, Gecko-windows11-64-24h2-opt]
FAIL : 18[GitHub] 149[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-24h2-debug, Gecko-windows11-32-24h2-opt, Gecko-windows11-64-24h2-debug, Gecko-windows11-64-24h2-opt]
PRECONDITION_FAILED: 2

Chrome

OK : 6
PASS : 1261
FAIL : 111

Safari

OK : 6
PASS : 1246
FAIL : 126

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

Firefox-only Failures

New Tests That Don't Pass

  • /css/css-fonts/parsing/font-family-computed.html [wpt.fyi]
    • Property font-family value '"New Century Schoolbook", serif': FAIL (Chrome: FAIL, Safari: FAIL)
  • /css/css-fonts/parsing/font-family-valid.html [wpt.fyi]
    • e.style['font-family'] = ""New Century Schoolbook", serif" should set the property value: FAIL (Chrome: FAIL, Safari: FAIL)
  • /css/css-fonts/parsing/font-feature-settings-computed.html [wpt.fyi]
    • Property font-feature-settings value '"liga" calc(10 + (sign(2cqw - 10px) * 5))': FAIL
    • Property font-feature-settings value '"liga" calc(10 + (sign(2cqw - 10px) * 5)), "dlig" calc(20 + (sign(2cqw - 10px) * 5))': FAIL
  • /css/css-fonts/parsing/font-size-adjust-computed.html [wpt.fyi]
    • Property font-size-adjust value 'cap-height calc(10 + (sign(20cqw - 10px) * 5))': FAIL
  • /css/css-fonts/parsing/font-size-adjust-valid.html [wpt.fyi]
    • e.style['font-size-adjust'] = "cap-height calc(10 + (sign(20cqw - 10px) * 5))" should set the property value: FAIL
  • /css/css-fonts/parsing/font-stretch-alias.html [wpt.fyi]
    • font-stretch is a legacy name alias for font-width: FAIL
  • /css/css-fonts/parsing/font-style-computed.html [wpt.fyi]
    • Property font-style value 'oblique calc(30deg + (sign(20cqw - 10px) * 5deg))': FAIL
  • /css/css-fonts/parsing/font-style-valid.html [wpt.fyi]
    • e.style['font-style'] = "oblique 14deg" should set the property value: FAIL
    • e.style['font-style'] = "oblique calc(30deg + (sign(2cqw - 10px) * 5deg))" should set the property value: FAIL
  • /css/css-fonts/parsing/font-weight-computed.html [wpt.fyi]
    • Property font-weight value 'calc(100 + (sign(20cqw - 10px) * 5))': FAIL
  • /css/css-fonts/parsing/font-weight-valid.html [wpt.fyi]
    • e.style['font-weight'] = "calc(100 + (sign(20cqw - 10px) * 5))" should set the property value: FAIL
  • /css/css-fonts/parsing/font-width-computed.html [wpt.fyi]
    • Property font-width value 'ultra-condensed': FAIL
    • Property font-width value 'extra-condensed': FAIL
    • Property font-width value 'condensed': FAIL
    • Property font-width value 'semi-condensed': FAIL
    • Property font-width value 'normal': FAIL
    • Property font-width value 'semi-expanded': FAIL
    • Property font-width value 'expanded': FAIL
    • Property font-width value 'extra-expanded': FAIL
    • Property font-width value 'ultra-expanded': FAIL
    • Property font-width value '234.5%': FAIL
    • Property font-width value 'calc(100%)': FAIL
    • Property font-width value 'calc(0%)': FAIL
    • Property font-width value 'calc(-100%)': FAIL
    • Property font-width value 'calc(100% + 100%)': FAIL
    • Property font-width value 'calc(100% + (sign(20cqw - 10px) * 5%))': FAIL
    • Property font-stretch value 'calc(100% + (sign(20cqw - 10px) * 5%))': FAIL
  • /css/css-fonts/parsing/font-width-valid.html [wpt.fyi]
    • e.style['font-width'] = "normal" should set the property value: FAIL
    • e.style['font-width'] = "ultra-condensed" should set the property value: FAIL
    • e.style['font-width'] = "extra-condensed" should set the property value: FAIL
    • e.style['font-width'] = "condensed" should set the property value: FAIL
    • e.style['font-width'] = "semi-condensed" should set the property value: FAIL
    • e.style['font-width'] = "semi-expanded" should set the property value: FAIL
    • e.style['font-width'] = "expanded" should set the property value: FAIL
    • e.style['font-width'] = "extra-expanded" should set the property value: FAIL
    • e.style['font-width'] = "ultra-expanded" should set the property value: FAIL
    • e.style['font-width'] = "234.5%" should set the property value: FAIL
    • e.style['font-width'] = "calc(100%)" should set the property value: FAIL
    • e.style['font-width'] = "calc(0%)" should set the property value: FAIL
    • e.style['font-width'] = "calc(-100%)" should set the property value: FAIL
    • e.style['font-width'] = "calc(100% + 100%)" should set the property value: FAIL
    • e.style['font-width'] = "calc(100% + (sign(20cqw - 10px) * 5%))" should set the property value: FAIL
    • e.style['font-stretch'] = "calc(100% + (sign(20cqw - 10px) * 5%))" should set the property value: FAIL
  • /css/cssom/CSSFontFeatureValuesRule.html [wpt.fyi]
    • CSSFontFeatureValuesRule is correctly parsed and accessible via CSSOM.: FAIL
    • CSSFontFeatureValuesRule family is settable and readable.: FAIL
    • CSSFontFeatureValuesMap entries are settable to single values.: FAIL
    • CSSFontFeatureValuesMap entries are settable to sequences of numbers.: FAIL
    • New rules can be added.: FAIL
    • Deleting single entries is possible.: FAIL
    • Clearing all entries is possible.: FAIL
    • Multiple rules for the same family are kept separate in CSSOM.: FAIL
  • /css/cssom/caretPositionFromPoint-audioVideo.html [wpt.fyi]
    • document.caretPositionFromPoint() should return a CaretPosition over audio elements: FAIL
    • document.caretPositionFromPoint() should return a CaretPosition over video elements: FAIL
  • /css/cssom/flex-serialization.html [wpt.fyi]
    • Single value flex with non-CSS-wide value should serialize correctly.: FAIL
  • /css/cssom/font-family-serialization-001.html [wpt.fyi]
    • Serialization of <generic-family>: FAIL (Chrome: FAIL, Safari: FAIL)
    • Serialization of prefixed -webkit-<generic-family>: FAIL (Chrome: FAIL, Safari: FAIL)
    • Specified: quoted multi-word name normalizes to unquoted: FAIL (Chrome: FAIL, Safari: FAIL)
    • Computed: quoted multi-word name normalizes to unquoted: FAIL (Chrome: FAIL, Safari: FAIL)
    • Specified: quoted single-word name normalizes to unquoted: FAIL (Chrome: PASS, Safari: PASS)
  • /css/cssom/font-variant-shorthand-serialization.html [wpt.fyi]
    • font: menu serialization: FAIL
  • /css/cssom/getComputedStyle-detached-subtree.html [wpt.fyi]
    • getComputedStyle returns no style for element in non-rendered iframe (display: none): FAIL
  • /css/cssom/getComputedStyle-insets-relpos-inline.html [wpt.fyi]
    • OOF with left fixed right auto in relpos inline container with mixed directions: FAIL
    • OOF with left auto right fixed in relpos inline container with mixed directions: FAIL
  • /css/cssom/getComputedStyle-pseudo-checkmark.html [wpt.fyi]
    • Resolution of width is correct for pseudo-element (due to double-colon): FAIL
  • /css/cssom/getComputedStyle-pseudo-picker-icon.html [wpt.fyi]
    • Resolution of width is correct for pseudo-element (due to double-colon): FAIL
  • /css/cssom/getComputedStyle-pseudo-picker.html [wpt.fyi]
    • ::picker(select) returns picker element style: FAIL
  • /css/cssom/getComputedStyle-pseudo.html [wpt.fyi]
    • Item-based blockification of nonexistent pseudo-elements: FAIL
    • display: contents on pseudo-elements: FAIL
    • Dynamically change to display: contents on pseudo-elements: FAIL
    • Unknown pseudo-element with a known identifier: grammar-error: PRECONDITION_FAILED
    • Unknown pseudo-element with a known identifier: spelling-error: PRECONDITION_FAILED
  • /css/cssom/historical.html [wpt.fyi]
    • Historical Document member: selectedStyleSheetSet: FAIL
    • Historical Document member: lastStyleSheetSet: FAIL
    • Historical Document member: preferredStyleSheetSet: FAIL
    • Historical Document member: styleSheetSets: FAIL
    • Historical Document member: enableStyleSheetsForSet: FAIL
  • /css/cssom/idlharness.html [wpt.fyi]
    • CSSRule interface: constant MARGIN_RULE on interface object: FAIL
    • CSSRule interface: constant MARGIN_RULE on interface prototype object: FAIL
    • CSSRule interface: sheet.cssRules[4] must inherit property "MARGIN_RULE" with the proper type: FAIL
    • CSSImportRule interface: sheet.cssRules[0] must inherit property "layerName" with the proper type: FAIL
    • CSSImportRule interface: sheet.cssRules[0] must inherit property "supportsText" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[0] must inherit property "MARGIN_RULE" with the proper type: FAIL
    • CSSPageDescriptors interface: attribute marks: FAIL
    • CSSPageDescriptors interface: attribute bleed: FAIL
    • CSSPageDescriptors interface: sheet.cssRules[2].style must inherit property "marks" with the proper type: FAIL
    • CSSPageDescriptors interface: sheet.cssRules[2].style must inherit property "bleed" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[2] must inherit property "MARGIN_RULE" with the proper type: FAIL
    • CSSMarginRule interface: existence and properties of interface object: FAIL
    • CSSMarginRule interface object length: FAIL
    • CSSMarginRule interface object name: FAIL
    • CSSMarginRule interface: existence and properties of interface prototype object: FAIL
    • CSSMarginRule interface: existence and properties of interface prototype object's "constructor" property: FAIL
    • CSSMarginRule interface: existence and properties of interface prototype object's @@unscopables property: FAIL
    • CSSMarginRule interface: attribute name: FAIL
    • CSSMarginRule interface: attribute style: FAIL
    • CSSMarginRule must be primary interface of sheet.cssRules[2].cssRules[0]: FAIL
    • Stringification of sheet.cssRules[2].cssRules[0]: FAIL
    • CSSMarginRule interface: sheet.cssRules[2].cssRules[0] must inherit property "name" with the proper type: FAIL
    • CSSMarginRule interface: sheet.cssRules[2].cssRules[0] must inherit property "style" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[2].cssRules[0] must inherit property "cssText" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[2].cssRules[0] must inherit property "parentRule" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[2].cssRules[0] must inherit property "parentStyleSheet" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[2].cssRules[0] must inherit property "type" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[2].cssRules[0] must inherit property "STYLE_RULE" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[2].cssRules[0] must inherit property "CHARSET_RULE" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[2].cssRules[0] must inherit property "IMPORT_RULE" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[2].cssRules[0] must inherit property "MEDIA_RULE" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[2].cssRules[0] must inherit property "FONT_FACE_RULE" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[2].cssRules[0] must inherit property "PAGE_RULE" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[2].cssRules[0] must inherit property "MARGIN_RULE" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[2].cssRules[0] must inherit property "NAMESPACE_RULE" with the proper type: FAIL
    • CSSRule interface: sheet.cssRules[1] must inherit property "MARGIN_RULE" with the proper type: FAIL
    • CSSStyleProperties must be primary interface of sheet.cssRules[2].cssRules[0].style: FAIL
    • Stringification of sheet.cssRules[2].cssRules[0].style: FAIL
    • CSSStyleProperties interface: sheet.cssRules[2].cssRules[0].style must inherit property "cssFloat" with the proper type: FAIL
    • CSSStyleDeclaration interface: sheet.cssRules[2].cssRules[0].style must inherit property "cssText" with the proper type: FAIL
    • CSSStyleDeclaration interface: sheet.cssRules[2].cssRules[0].style must inherit property "length" with the proper type: FAIL
    • CSSStyleDeclaration interface: sheet.cssRules[2].cssRules[0].style must inherit property "item(unsigned long)" with the proper type: FAIL
    • CSSStyleDeclaration interface: calling item(unsigned long) on sheet.cssRules[2].cssRules[0].style with too few arguments must throw TypeError: FAIL
    • CSSStyleDeclaration interface: sheet.cssRules[2].cssRules[0].style must inherit property "getPropertyValue(CSSOMString)" with the proper type: FAIL
    • CSSStyleDeclaration interface: calling getPropertyValue(CSSOMString) on sheet.cssRules[2].cssRules[0].style with too few arguments must throw TypeError: FAIL
    • CSSStyleDeclaration interface: sheet.cssRules[2].cssRules[0].style must inherit property "getPropertyPriority(CSSOMString)" with the proper type: FAIL
    • CSSStyleDeclaration interface: calling getPropertyPriority(CSSOMString) on sheet.cssRules[2].cssRules[0].style with too few arguments must throw TypeError: FAIL
    • CSSStyleDeclaration interface: sheet.cssRules[2].cssRules[0].style must inherit property "setProperty(CSSOMString, CSSOMString, optional CSSOMString)" with the proper type: FAIL
    • CSSStyleDeclaration interface: calling setProperty(CSSOMString, CSSOMString, optional CSSOMString) on sheet.cssRules[2].cssRules[0].style with too few arguments must throw TypeError: FAIL
    • CSSStyleDeclaration interface: sheet.cssRules[2].cssRules[0].style must inherit property "removeProperty(CSSOMString)" with the proper type: FAIL
    • CSSStyleDeclaration interface: calling removeProperty(CSSOMString) on sheet.cssRules[2].cssRules[0].style with too few arguments must throw TypeError: FAIL
    • CSSStyleDeclaration interface: sheet.cssRules[2].cssRules[0].style must inherit property "parentRule" with the proper type: FAIL
  • /css/cssom/link-element-stylesheet-title.html [wpt.fyi]
    • Executing setAttribute('title', '') results in the title being set to null: FAIL
  • /css/cssom/property-accessors.html [wpt.fyi]
    • -apple-color-filter: FAIL
    • -apple-pay-button-style: FAIL
    • -epub-writing-mode: FAIL
    • -webkit-flex: FAIL
    • gap: FAIL
    • grid-gap: FAIL
    • overscroll-behavior: FAIL
    • src: FAIL
    • unicode-range: FAIL
  • /css/cssom/serialize-values.html [wpt.fyi]
    • alignment-baseline: alphabetic: FAIL (Chrome: PASS, Safari: PASS)
    • alignment-baseline: ideographic: FAIL (Chrome: PASS, Safari: PASS)
    • alignment-baseline: central: FAIL (Chrome: PASS, Safari: PASS)
    • alignment-baseline: mathematical: FAIL (Chrome: PASS, Safari: PASS)
    • content: attr(foo, ""): FAIL (Chrome: PASS, Safari: FAIL)
    • font-family: 'Lucida Grande': FAIL (Chrome: FAIL, Safari: FAIL)
    • orphans: 101: FAIL (Chrome: PASS, Safari: PASS)
    • orphans: inherit: FAIL (Chrome: PASS, Safari: PASS)
    • outline-color: invert: FAIL (Chrome: FAIL, Safari: FAIL)
    • widows: 101: FAIL (Chrome: PASS, Safari: PASS)
    • widows: inherit: FAIL (Chrome: PASS, Safari: PASS)
  • /css/cssom/stylesheet-same-origin.sub.html [wpt.fyi]
    • Origin-clean check in loading error CSSOM Stylesheets: FAIL
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 151 Branch
You need to log in before you can comment on or make changes to this bug.