Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 430b0c73b84ed73df07e1647d00babf69adac351
      
https://github.com/WebKit/WebKit/commit/430b0c73b84ed73df07e1647d00babf69adac351
  Author: Daniel Guerrero <[email protected]>
  Date:   2026-07-10 (Fri, 10 Jul 2026)

  Changed paths:
    A LayoutTests/editing/style/font-face-numeric-family-expected.txt
    A LayoutTests/editing/style/font-face-numeric-family.html
    M Source/WebCore/css/CSSValuePool.cpp
    M Source/WebCore/css/parser/CSSParserContext.cpp
    M Source/WebCore/css/parser/CSSParserContext.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Font.cpp

  Log Message:
  -----------
  <font face> with a numeric-token family name (e.g. "Bodoni 72") reverts to 
the default font
https://bugs.webkit.org/show_bug.cgi?id=318776
rdar://51409819

Reviewed by Ryosuke Niwa.

The <font face> attribute accepts literal font family names (HTML legacy
semantics), but CSSValuePool::createFontFaceValue parsed it with the strict CSS
<family-name> grammar. Family names that are not valid unquoted CSS identifiers
-- notably names containing a numeric token such as "Bodoni 72" -- were 
rejected,
so font-family was never applied and the text silently reverted to the default
font.

Relax the family-name grammar to accept a numeric token as part of a literal
family name, but only for the <font face> attribute: add a
legacyFontFaceAttributeMode flag to CSSParserContext, enable it from
createFontFaceValue, and honor it in the font-family consumer. Regular CSS
font-family parsing is unaffected and still rejects such names, so
"font-family: Bodoni 72" (unquoted) remains invalid.

The value reaches the face attribute unquoted because 
StyleChange::extractTextStyles
unconditionally strips every quote from the serialized font-family for Outlook 
2007
compatibility (EditingStyle.cpp, webkit.org/b/79448). That is broader than 79448
intended -- it meant to drop only superfluous quotes and keep them for names 
that
genuinely need them -- so the quotes "Bodoni 72" actually requires are stripped 
too.
Fixing the reader here also covers static or pasted <font face> values from any
source; tightening the emitter to strip quotes selectively could be a 
follow-up, but
it touches the 79448 compatibility behavior and is intentionally out of scope 
here.

* Source/WebCore/css/CSSValuePool.cpp:
(WebCore::CSSValuePool::createFontFaceValue):
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::add):
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Font.cpp:
(WebCore::CSSPropertyParserHelpers::concatenateFamilyName):
(WebCore::CSSPropertyParserHelpers::consumeFamilyNameUnresolved):
(WebCore::CSSPropertyParserHelpers::consumeFamilyName):
* LayoutTests/editing/style/font-face-numeric-family.html: Added.
* LayoutTests/editing/style/font-face-numeric-family-expected.txt: Added.

Canonical link: https://commits.webkit.org/316948@main



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

Reply via email to