New York font erroneously gets synthetic bold
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jul 2019 01:08:29 +0000 (01:08 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jul 2019 01:08:29 +0000 (01:08 +0000)
commit5598b8a511d508073190cfa2ae836ef5b569c1f1
treeb0855fe2bde14955679bca46f55a1437f7e50a92
parent6f8a4af80b72ce066f04839a38f1232ad0dc5c4e
New York font erroneously gets synthetic bold
https://bugs.webkit.org/show_bug.cgi?id=199653
<rdar://problem/51692592>

Reviewed by Simon Fraser.

Source/WebCore:

This patch adds support for -apple-system-ui-serif, -apple-system-ui-monospaced,
and -apple-system-ui-rounded, behind an SPI that is off-by-default. We don't want
to expose these fonts to the web because we don't a standardization story for them
yet, but we do want some apps to be able to use them.

WebKit clients who want to use these fonts can set
-[WKPreferences _shouldAllowDesignSystemUIFonts] = YES.

The patch generalizes our existing system-ui infrastructure to handle these three
additional fonts. It also explicitly disables the unsupported dot-prefixed names
so they don't leak out into Web content.

Tests: fast/text/design-system-ui-10.html
       fast/text/design-system-ui-11.html
       fast/text/design-system-ui-12.html
       fast/text/design-system-ui-13.html
       fast/text/design-system-ui-14.html
       fast/text/design-system-ui-15.html
       fast/text/design-system-ui-16.html
       fast/text/design-system-ui-2.html
       fast/text/design-system-ui-3.html
       fast/text/design-system-ui-4.html
       fast/text/design-system-ui-5.html
       fast/text/design-system-ui-6.html
       fast/text/design-system-ui-7.html
       fast/text/design-system-ui-8.html
       fast/text/design-system-ui-9.html
       fast/text/design-system-ui.html

* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::shouldAllowDesignSystemUIFonts const):
* css/CSSFontFace.h:
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::load):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::initializeFontStyle):
* page/Settings.yaml:
* platform/graphics/FontDescription.cpp:
(WebCore::m_shouldAllowDesignSystemUIFonts):
(WebCore::m_shouldAllowUserInstalledFonts): Deleted.
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::shouldAllowDesignSystemUIFonts const):
(WebCore::FontDescription::setShouldAllowDesignSystemUIFonts):
(WebCore::FontDescription::operator== const):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::platformFontLookupWithFamily):
(WebCore::fontWithFamily):
* platform/graphics/cocoa/FontCacheCoreText.h:
* platform/graphics/cocoa/FontDescriptionCocoa.cpp:
(WebCore::systemFontUse):
(WebCore::systemFontCascadeList):
(WebCore::FontCascadeDescription::effectiveFamilyCount const):
(WebCore::FontCascadeDescription::effectiveFamilyAt const):
(WebCore::isSystemFontString): Deleted.
(WebCore::isUIFontTextStyle): Deleted.
* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::ctFont const):
* platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
(WebCore::SystemFontDatabaseCoreText::createSystemUI):
(WebCore::SystemFontDatabaseCoreText::createDesignSystemUI):
(WebCore::SystemFontDatabaseCoreText::createTextStyle):
(WebCore::SystemFontDatabaseCoreText::cascadeList):
(WebCore::SystemFontDatabaseCoreText::applyWeightItalicsAndFallbackBehavior):
(WebCore::SystemFontDatabaseCoreText::systemFontParameters):
* platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
* platform/graphics/ios/FontCacheIOS.mm:
(WebCore::platformFontWithFamilySpecialCase):
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::platformFontWithFamilySpecialCase):
* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::setShouldAllowDesignSystemUIFonts):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

Source/WebCore/PAL:

* pal/spi/cocoa/CoreTextSPI.h:

Source/WebKit:

Add the SPI to enable the new fonts.

* Shared/WebPreferences.yaml:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetShouldAllowDesignSystemUIFonts):
(WKPreferencesGetShouldAllowDesignSystemUIFonts):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _shouldAllowDesignSystemUIFonts]):
(-[WKPreferences _setShouldAllowDesignSystemUIFonts:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

Source/WTF:

* wtf/Platform.h:

LayoutTests:

* TestExpectations:
* fast/text/design-system-ui-10-expected-mismatch.html: Added.
* fast/text/design-system-ui-10.html: Added.
* fast/text/design-system-ui-11-expected-mismatch.html: Added.
* fast/text/design-system-ui-11.html: Added.
* fast/text/design-system-ui-12-expected-mismatch.html: Added.
* fast/text/design-system-ui-12.html: Added.
* fast/text/design-system-ui-13-expected-mismatch.html: Added.
* fast/text/design-system-ui-13.html: Added.
* fast/text/design-system-ui-14-expected-mismatch.html: Added.
* fast/text/design-system-ui-14.html: Added.
* fast/text/design-system-ui-15-expected-mismatch.html: Added.
* fast/text/design-system-ui-15.html: Added.
* fast/text/design-system-ui-16-expected-mismatch.html: Added.
* fast/text/design-system-ui-16.html: Added.
* fast/text/design-system-ui-2-expected.html: Added.
* fast/text/design-system-ui-2.html: Added.
* fast/text/design-system-ui-3-expected-mismatch.html: Added.
* fast/text/design-system-ui-3.html: Added.
* fast/text/design-system-ui-4-expected-mismatch.html: Added.
* fast/text/design-system-ui-4.html: Added.
* fast/text/design-system-ui-5-expected-mismatch.html: Added.
* fast/text/design-system-ui-5.html: Added.
* fast/text/design-system-ui-6-expected.html: Added.
* fast/text/design-system-ui-6.html: Added.
* fast/text/design-system-ui-7-expected.html: Added.
* fast/text/design-system-ui-7.html: Added.
* fast/text/design-system-ui-8-expected-mismatch.html: Added.
* fast/text/design-system-ui-8.html: Added.
* fast/text/design-system-ui-9-expected-mismatch.html: Added.
* fast/text/design-system-ui-9.html: Added.
* fast/text/design-system-ui-expected.html: Added.
* fast/text/design-system-ui.html: Added.
* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247377 268f45cc-cd09-0410-ab3c-d52691b4dbfc
62 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/text/design-system-ui-10-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-10.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-11-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-11.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-12-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-12.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-13-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-13.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-14-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-14.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-15-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-15.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-16-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-16.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-2-expected.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-2.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-3-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-3.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-4-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-4.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-5-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-5.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-6-expected.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-6.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-7-expected.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-7.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-8-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-8.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-9-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-9.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui-expected.html [new file with mode: 0644]
LayoutTests/fast/text/design-system-ui.html [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h
Source/WebCore/css/CSSFontFace.cpp
Source/WebCore/css/CSSFontFace.h
Source/WebCore/css/CSSFontFaceSource.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/page/Settings.yaml
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontDescription.cpp
Source/WebCore/platform/graphics/FontDescription.h
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h
Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp
Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp
Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h
Source/WebCore/platform/graphics/ios/FontCacheIOS.mm
Source/WebCore/platform/graphics/mac/FontCacheMac.mm
Source/WebCore/style/StyleResolveForDocument.cpp
Source/WebCore/svg/graphics/SVGImage.cpp
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h