Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 162fa7be0a43015bc1dcf9242dba114007d2e282
      
https://github.com/WebKit/WebKit/commit/162fa7be0a43015bc1dcf9242dba114007d2e282
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-09-30 (Wed, 30 Sep 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/inheritance-expected.txt
    M Source/WebCore/style/StyleBuilderCustom.h

  Log Message:
  -----------
  'font-family: initial' acts like 'font-family: inherit' instead of getting 
the initial value
https://bugs.webkit.org/show_bug.cgi?id=200709
rdar://54306281

Reviewed by Vitor Roriz.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

BuilderCustom::applyInitialFontFamily constructed a default 
FontCascadeDescription
and only reset the family when its first family name was non-empty. A default
FontCascadeDescription always has a single, empty first family, so the guard
`if (!initialDesc.firstFamily().name.isEmpty())` was never true and
setFontDescriptionFamilies was never called. As a result 'font-family: initial'
left the inherited family in place, making it behave like 'font-family: 
inherit'.

The initial value of 'font-family' is user-agent defined
(https://drafts.csswg.org/css-fonts-4/#font-family-prop), and as discussed in
https://github.com/w3c/csswg-drafts/issues/4192 it should resolve to the
user-agent default family rather than the inherited value. Reset the family to
that default instead: the generic 'standardFamily' ("-webkit-standard"), which 
is
resolved to the standard font from the settings when the font is built. This
matches the family installed by Resolver::defaultStyleForElement and
StyleResolveForDocument. The existing monospace-to-non-monospace keyword size
adjustment is preserved.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/inheritance-expected.txt:
 Progression
* Source/WebCore/style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInitialFontFamily):

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



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

Reply via email to