[Cocoa] Unify "font:" CSS shorthand values between macOS and iOS family
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Jun 2020 07:04:36 +0000 (07:04 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Jun 2020 07:04:36 +0000 (07:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=213332
<rdar://problem/64479189>

Reviewed by Tim Horton and Darin Adler.

Source/WebCore:

They exist on all Cocoa platforms, so we might as well hook them up.

This unifies the shorthand CSS value handling from RenderThemeMac and
RenderThemeIOS into RenderThemeCocoa. This has two effects:

- It hooks up the -apple-system keywords on macOS (they previously were
  only implemented for the iOS family).
- It hooks up the CSS2 keywords (caption, menu, etc.) on the iOS family
  (they previously were only implemented on Mac).

All these fonts have been around since Mojave, so there is no need to
introduce any new platform guards.

Tests: fast/text/text-styles/-apple-system/-apple-system-body.html
       fast/text/text-styles/-apple-system/-apple-system-caption1.html
       fast/text/text-styles/-apple-system/-apple-system-caption2.html
       fast/text/text-styles/-apple-system/-apple-system-footnote.html
       fast/text/text-styles/-apple-system/-apple-system-headline.html
       fast/text/text-styles/-apple-system/-apple-system-short-body.html
       fast/text/text-styles/-apple-system/-apple-system-short-caption1.html
       fast/text/text-styles/-apple-system/-apple-system-short-footnote.html
       fast/text/text-styles/-apple-system/-apple-system-short-headline.html
       fast/text/text-styles/-apple-system/-apple-system-short-subheadline.html
       fast/text/text-styles/-apple-system/-apple-system-subheadline.html
       fast/text/text-styles/-apple-system/-apple-system-tall-body.html
       fast/text/text-styles/-apple-system/-apple-system-title0.html
       fast/text/text-styles/-apple-system/-apple-system-title1.html
       fast/text/text-styles/-apple-system/-apple-system-title2.html
       fast/text/text-styles/-apple-system/-apple-system-title3.html
       fast/text/text-styles/-apple-system/-apple-system-title4.html
       fast/text/text-styles/-webkit-control.html
       fast/text/text-styles/-webkit-mini-control.html
       fast/text/text-styles/-webkit-small-control.html
       fast/text/text-styles/bogus.html
       fast/text/text-styles/caption.html
       fast/text/text-styles/icon.html
       fast/text/text-styles/menu.html
       fast/text/text-styles/message-box.html
       fast/text/text-styles/small-caption.html
       fast/text/text-styles/status-bar.html

* css/CSSValueKeywords.in: All Cocoa ports should be able to parse these values
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::fontWithFamilySpecialCase): Move code that used to be in the Mac and
iOS implementations of platformFontWithFamilySpecialCase() (inside FontCacheMac.mm
and FontCacheIOS.mm) to be shared to be shared inside fontWithFamilySpecialCase().
* platform/graphics/cocoa/FontDescriptionCocoa.cpp: Remove platform guards.
(WebCore::convertArray):
(WebCore::matchSystemFontUse):
* platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: Ditto.
(WebCore::SystemFontDatabaseCoreText::createTextStyleFont):
* platform/graphics/ios/FontCacheIOS.mm: Move code from here into FontCacheCoreText.
(WebCore::platformFontWithFamilySpecialCase):
* platform/graphics/mac/FontCacheMac.mm: Ditto.
(WebCore::platformFontWithFamilySpecialCase):
* platform/mac/ThemeMac.h: Delete systemFontSizeFor(NSControlSize) because
<rdar://problem/60350699> is fixed.
* platform/mac/ThemeMac.mm: Ditto.
(WebCore::ThemeMac::controlFont const):
(WebCore::ThemeMac::systemFontSizeFor): Deleted.
* rendering/RenderThemeCocoa.h: Previously, code was calling
RenderThemeIOS::contentSizeCategory(), which was a static function. Now, both Mac
and iOS need to be able to call this. However, the implementation of this function
is different between Mac and iOS. So, turn it from a static function in RenderThemeIOS
into a method in RenderThemeCocoa, and give RenderThemeCocoa a singleton() function
that downcasts the return of RenderTheme::singleton(). This way, instead of calling
RenderThemeIOS::contentSizeCategory(), code can call
RenderThemeCocoa::singleton().contentSizeCategory().
* rendering/RenderThemeCocoa.mm: Move code from RenderThemeIOS and RenderThemeMac
into RenderThemeCocoa.
(WebCore::RenderThemeCocoa::singleton):
(WebCore::RenderThemeCocoa::cachedSystemFontDescription const):
(WebCore::cssWeightOfSystemFont):
(WebCore::RenderThemeCocoa::updateCachedSystemFontDescription const):
* rendering/RenderThemeIOS.h: Ditto.
* rendering/RenderThemeIOS.mm: Ditto.
(WebCore::RenderThemeIOS::contentSizeCategory const):
(WebCore::attachmentActionFont):
(WebCore::attachmentTitleFont):
(WebCore::RenderThemeIOS::contentSizeCategory): Deleted.
(WebCore::RenderThemeIOS::cachedSystemFontDescription const): Deleted.
(WebCore::cssWeightOfSystemFont): Deleted.
(WebCore::RenderThemeIOS::updateCachedSystemFontDescription const): Deleted.
* rendering/RenderThemeMac.h: Ditto.
* rendering/RenderThemeMac.mm: Ditto.
(WebCore::RenderThemeMac::contentSizeCategory const):
(WebCore::RenderThemeMac::setFontFromControlSize const):
(WebCore::RenderThemeMac::controlSizeForSystemFont const):
(WebCore::toFontWeight): Deleted.
(WebCore::RenderThemeMac::updateCachedSystemFontDescription const): Deleted.

Source/WebCore/PAL:

* pal/spi/cocoa/CoreTextSPI.h:

The implementation of RenderThemeMac::contentSizeCategory() needs to use
kCTFontContentSizeCategoryL.

Source/WTF:

All Cocoa platforms support kCTUIFontTextStyleTitle0 and kCTUIFontTextStyleTitle4.

* wtf/PlatformHave.h:

LayoutTests:

* TestExpectations:
* fast/text/text-styles/-apple-system/-apple-system-body-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-body.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-caption1-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-caption1.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-caption2-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-caption2.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-footnote-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-footnote.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-headline-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-headline.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-short-body-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-short-body.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-short-caption1-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-short-caption1.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-short-footnote-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-short-footnote.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-short-headline-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-short-headline.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-short-subheadline-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-short-subheadline.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-subheadline-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-subheadline.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-tall-body-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-tall-body.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-title0-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-title0.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-title1-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-title1.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-title2-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-title2.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-title3-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-title3.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-title4-expected-mismatch.html: Added.
* fast/text/text-styles/-apple-system/-apple-system-title4.html: Added.
* fast/text/text-styles/-webkit-control-expected-mismatch.html: Added.
* fast/text/text-styles/-webkit-control.html: Added.
* fast/text/text-styles/-webkit-mini-control-expected-mismatch.html: Added.
* fast/text/text-styles/-webkit-mini-control.html: Added.
* fast/text/text-styles/-webkit-small-control-expected-mismatch.html: Added.
* fast/text/text-styles/-webkit-small-control.html: Added.
* fast/text/text-styles/bogus-expected.html: Added.
* fast/text/text-styles/bogus.html: Added.
* fast/text/text-styles/caption-expected-mismatch.html: Added.
* fast/text/text-styles/caption.html: Added.
* fast/text/text-styles/icon-expected-mismatch.html: Added.
* fast/text/text-styles/icon.html: Added.
* fast/text/text-styles/menu-expected-mismatch.html: Added.
* fast/text/text-styles/menu.html: Added.
* fast/text/text-styles/message-box-expected-mismatch.html: Added.
* fast/text/text-styles/message-box.html: Added.
* fast/text/text-styles/small-caption-expected-mismatch.html: Added.
* fast/text/text-styles/small-caption.html: Added.
* fast/text/text-styles/status-bar-expected-mismatch.html: Added.
* fast/text/text-styles/status-bar.html: Added.
* platform/ios/TestExpectations:
* platform/ios/fast/css/css2-system-fonts-expected.txt:
* platform/mac/TestExpectations:
* platform/mac/fast/text/international/system-language/system-font-punctuation-expected.txt:
* platform/mac-mojave/fast/text/international/system-language/system-font-punctuation-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263255 268f45cc-cd09-0410-ab3c-d52691b4dbfc

80 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-body-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-body.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-caption1-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-caption1.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-caption2-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-caption2.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-footnote-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-footnote.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-headline-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-headline.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-body-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-body.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-caption1-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-caption1.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-footnote-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-footnote.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-headline-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-headline.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-subheadline-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-subheadline.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-subheadline-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-subheadline.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-tall-body-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-tall-body.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title0-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title0.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title1-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title1.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title2-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title2.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title3-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title3.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title4-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title4.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-webkit-control-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-webkit-control.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-webkit-mini-control-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-webkit-mini-control.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-webkit-small-control-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/-webkit-small-control.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/bogus-expected.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/bogus.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/caption-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/caption.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/icon-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/icon.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/menu-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/menu.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/message-box-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/message-box.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/small-caption-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/small-caption.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/status-bar-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/text-styles/status-bar.html [new file with mode: 0644]
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/ios/fast/css/css2-system-fonts-expected.txt
LayoutTests/platform/mac-mojave/fast/text/international/system-language/system-font-punctuation-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/mac/fast/text/international/system-language/system-font-punctuation-expected.txt
Source/WTF/ChangeLog
Source/WTF/wtf/PlatformHave.h
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp
Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp
Source/WebCore/platform/graphics/ios/FontCacheIOS.mm
Source/WebCore/platform/graphics/mac/FontCacheMac.mm
Source/WebCore/platform/mac/ThemeMac.h
Source/WebCore/platform/mac/ThemeMac.mm
Source/WebCore/rendering/RenderThemeCocoa.h
Source/WebCore/rendering/RenderThemeCocoa.mm
Source/WebCore/rendering/RenderThemeIOS.h
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RenderThemeMac.h
Source/WebCore/rendering/RenderThemeMac.mm

index f590d11..0a3f80d 100644 (file)
@@ -1,3 +1,72 @@
+2020-06-19  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] Unify "font:" CSS shorthand values between macOS and iOS family
+        https://bugs.webkit.org/show_bug.cgi?id=213332
+        <rdar://problem/64479189>
+
+        Reviewed by Tim Horton and Darin Adler.
+
+        * TestExpectations:
+        * fast/text/text-styles/-apple-system/-apple-system-body-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-body.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-caption1-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-caption1.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-caption2-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-caption2.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-footnote-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-footnote.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-headline-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-headline.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-short-body-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-short-body.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-short-caption1-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-short-caption1.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-short-footnote-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-short-footnote.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-short-headline-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-short-headline.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-short-subheadline-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-short-subheadline.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-subheadline-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-subheadline.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-tall-body-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-tall-body.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-title0-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-title0.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-title1-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-title1.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-title2-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-title2.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-title3-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-title3.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-title4-expected-mismatch.html: Added.
+        * fast/text/text-styles/-apple-system/-apple-system-title4.html: Added.
+        * fast/text/text-styles/-webkit-control-expected-mismatch.html: Added.
+        * fast/text/text-styles/-webkit-control.html: Added.
+        * fast/text/text-styles/-webkit-mini-control-expected-mismatch.html: Added.
+        * fast/text/text-styles/-webkit-mini-control.html: Added.
+        * fast/text/text-styles/-webkit-small-control-expected-mismatch.html: Added.
+        * fast/text/text-styles/-webkit-small-control.html: Added.
+        * fast/text/text-styles/bogus-expected.html: Added.
+        * fast/text/text-styles/bogus.html: Added.
+        * fast/text/text-styles/caption-expected-mismatch.html: Added.
+        * fast/text/text-styles/caption.html: Added.
+        * fast/text/text-styles/icon-expected-mismatch.html: Added.
+        * fast/text/text-styles/icon.html: Added.
+        * fast/text/text-styles/menu-expected-mismatch.html: Added.
+        * fast/text/text-styles/menu.html: Added.
+        * fast/text/text-styles/message-box-expected-mismatch.html: Added.
+        * fast/text/text-styles/message-box.html: Added.
+        * fast/text/text-styles/small-caption-expected-mismatch.html: Added.
+        * fast/text/text-styles/small-caption.html: Added.
+        * fast/text/text-styles/status-bar-expected-mismatch.html: Added.
+        * fast/text/text-styles/status-bar.html: Added.
+        * platform/ios/TestExpectations:
+        * platform/ios/fast/css/css2-system-fonts-expected.txt:
+        * platform/mac/TestExpectations:
+        * platform/mac/fast/text/international/system-language/system-font-punctuation-expected.txt:
+        * platform/mac-mojave/fast/text/international/system-language/system-font-punctuation-expected.txt: Added.
+
 2020-06-18  Diego Pino Garcia  <dpino@igalia.com>
 
         [GTK] Unreviewed test gardening. Update test expectations after r263222.
index 4b6b7c1..b055094 100644 (file)
@@ -4315,3 +4315,7 @@ webkit.org/b/212246 imported/w3c/web-platform-tests/css/css-grid/grid-model/grid
 webkit.org/b/212246 imported/w3c/web-platform-tests/css/css-grid/grid-model/grid-overflow-padding-001.html [ ImageOnlyFailure ]
 webkit.org/b/212246 imported/w3c/web-platform-tests/css/css-grid/grid-model/grid-overflow-padding-002.html [ ImageOnlyFailure ]
 webkit.org/b/212267 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-item-self-baseline-001.html [ Skip ]
+
+# Only Cocoa ports support the -apple-system font keywords
+fast/text/text-styles/-apple-system [ ImageOnlyFailure ]
+
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-body-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-body-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-body.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-body.html
new file mode 100644 (file)
index 0000000..219d6db
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-body;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-caption1-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-caption1-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-caption1.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-caption1.html
new file mode 100644 (file)
index 0000000..17dfa91
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-caption1;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-caption2-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-caption2-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-caption2.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-caption2.html
new file mode 100644 (file)
index 0000000..7e2dcd0
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-caption2;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-footnote-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-footnote-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-footnote.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-footnote.html
new file mode 100644 (file)
index 0000000..a5d23d8
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-footnote;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-headline-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-headline-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-headline.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-headline.html
new file mode 100644 (file)
index 0000000..b9c80ad
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-headline;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-body-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-body-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-body.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-body.html
new file mode 100644 (file)
index 0000000..0540bb3
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-short-body;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-caption1-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-caption1-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-caption1.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-caption1.html
new file mode 100644 (file)
index 0000000..4e7c2dc
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-short-caption1;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-footnote-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-footnote-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-footnote.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-footnote.html
new file mode 100644 (file)
index 0000000..04de74c
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-short-footnote;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-headline-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-headline-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-headline.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-headline.html
new file mode 100644 (file)
index 0000000..5050304
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-short-headline;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-subheadline-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-subheadline-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-subheadline.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-short-subheadline.html
new file mode 100644 (file)
index 0000000..3916e6a
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-short-subheadline;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-subheadline-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-subheadline-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-subheadline.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-subheadline.html
new file mode 100644 (file)
index 0000000..f69f7ec
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-subheadline;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-tall-body-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-tall-body-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-tall-body.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-tall-body.html
new file mode 100644 (file)
index 0000000..382ffa3
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-tall-body;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title0-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title0-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title0.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title0.html
new file mode 100644 (file)
index 0000000..bb2e5d1
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-title0;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title1-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title1-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title1.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title1.html
new file mode 100644 (file)
index 0000000..18a4bbb
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-title1;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title2-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title2-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title2.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title2.html
new file mode 100644 (file)
index 0000000..429ffd7
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-title2;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title3-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title3-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title3.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title3.html
new file mode 100644 (file)
index 0000000..a435381
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-title3;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title4-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title4-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title4.html b/LayoutTests/fast/text/text-styles/-apple-system/-apple-system-title4.html
new file mode 100644 (file)
index 0000000..1130d2c
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -apple-system-title4;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-webkit-control-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-webkit-control-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-webkit-control.html b/LayoutTests/fast/text/text-styles/-webkit-control.html
new file mode 100644 (file)
index 0000000..ab1da61
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -webkit-control;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-webkit-mini-control-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-webkit-mini-control-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-webkit-mini-control.html b/LayoutTests/fast/text/text-styles/-webkit-mini-control.html
new file mode 100644 (file)
index 0000000..b6d666e
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -webkit-mini-control;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-webkit-small-control-expected-mismatch.html b/LayoutTests/fast/text/text-styles/-webkit-small-control-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/-webkit-small-control.html b/LayoutTests/fast/text/text-styles/-webkit-small-control.html
new file mode 100644 (file)
index 0000000..7877cc9
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: -webkit-small-control;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/bogus-expected.html b/LayoutTests/fast/text/text-styles/bogus-expected.html
new file mode 100644 (file)
index 0000000..d4414a9
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that "font: bogus" is not a valid font keyword.
+<div style="transform: scale(10); transform-origin: left top; font-family: fantasy;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/bogus.html b/LayoutTests/fast/text/text-styles/bogus.html
new file mode 100644 (file)
index 0000000..e16d655
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that "font: bogus" is not a valid font keyword.
+<div style="transform: scale(10); transform-origin: left top; font-family: fantasy;">
+<div style="font: bogus">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/caption-expected-mismatch.html b/LayoutTests/fast/text/text-styles/caption-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/caption.html b/LayoutTests/fast/text/text-styles/caption.html
new file mode 100644 (file)
index 0000000..0b16934
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: caption;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/icon-expected-mismatch.html b/LayoutTests/fast/text/text-styles/icon-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/icon.html b/LayoutTests/fast/text/text-styles/icon.html
new file mode 100644 (file)
index 0000000..dcf6979
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: icon;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/menu-expected-mismatch.html b/LayoutTests/fast/text/text-styles/menu-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/menu.html b/LayoutTests/fast/text/text-styles/menu.html
new file mode 100644 (file)
index 0000000..58bfe80
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: menu;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/message-box-expected-mismatch.html b/LayoutTests/fast/text/text-styles/message-box-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/message-box.html b/LayoutTests/fast/text/text-styles/message-box.html
new file mode 100644 (file)
index 0000000..abd30ef
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: message-box;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/small-caption-expected-mismatch.html b/LayoutTests/fast/text/text-styles/small-caption-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/small-caption.html b/LayoutTests/fast/text/text-styles/small-caption.html
new file mode 100644 (file)
index 0000000..3efd20e
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: small-caption;">Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/status-bar-expected-mismatch.html b/LayoutTests/fast/text/text-styles/status-bar-expected-mismatch.html
new file mode 100644 (file)
index 0000000..17c5600
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div>Hello, World</div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/text-styles/status-bar.html b/LayoutTests/fast/text/text-styles/status-bar.html
new file mode 100644 (file)
index 0000000..27c57ac
--- /dev/null
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="transform: scale(5); transform-origin: left top;">
+<div style="font: status-bar;">Hello, World</div>
+</div>
+</body>
+</html>
index eeeb58c..97226ab 100644 (file)
@@ -3492,3 +3492,5 @@ webkit.org/b/212493 imported/w3c/web-platform-tests/css/css-grid/grid-items/grid
 
 # This test requires an update to system decoders
 webkit.org/b/212565 imported/w3c/web-platform-tests/encoding/single-byte-decoder.html [ Failure ]
+
+fast/text/text-styles/-apple-system [ Pass ]
index ba3e03e..475a435 100644 (file)
@@ -1,10 +1,10 @@
 This tests platform specific system font styles. If any of the styles appear in monospace the test fails.
-caption: normal normal normal normal 13px/normal CTFontEmphasizedUsage
-icon: normal normal normal normal 13px/normal CTFontEmphasizedUsage
-menu: normal normal normal normal 13px/normal CTFontEmphasizedUsage
-message-box: normal normal normal normal 13px/normal CTFontEmphasizedUsage
-small-caption: normal normal normal normal 13px/normal CTFontEmphasizedUsage
-status-bar: normal normal normal normal 13px/normal CTFontEmphasizedUsage
--webkit-mini-control: normal normal normal normal 13px/normal CTFontEmphasizedUsage
--webkit-small-control: normal normal normal normal 13px/normal CTFontEmphasizedUsage
--webkit-control: normal normal normal normal 13px/normal CTFontEmphasizedUsage
+caption: normal normal normal normal 13px/normal system-ui
+icon: normal normal normal normal 13px/normal system-ui
+menu: normal normal normal normal 14px/normal -apple-menu
+message-box: normal normal normal normal 13px/normal system-ui
+small-caption: normal normal normal normal 12px/normal system-ui
+status-bar: normal normal normal normal 17px/normal -apple-status-bar
+-webkit-mini-control: normal normal normal normal 9px/normal system-ui
+-webkit-small-control: normal normal normal normal 11px/normal system-ui
+-webkit-control: normal normal normal normal 13px/normal system-ui
diff --git a/LayoutTests/platform/mac-mojave/fast/text/international/system-language/system-font-punctuation-expected.txt b/LayoutTests/platform/mac-mojave/fast/text/international/system-language/system-font-punctuation-expected.txt
new file mode 100644 (file)
index 0000000..5037909
--- /dev/null
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x112
+  RenderBlock {HTML} at (0,0) size 800x112
+    RenderBody {BODY} at (8,8) size 784x96
+      RenderBlock (anonymous) at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 720x36
+          text run at (0,0) width 720: "This test makes sure punctuation laid out with the system font does not use vertical glyphs. The test passes if the"
+          text run at (0,18) width 527: "semicolon below looks like a regular horizontal semicolon (;) and is not sideways."
+      RenderBlock {DIV} at (0,36) size 784x60
+        RenderText {#text} at (0,0) size 14x59
+          text run at (0,0) width 14: ";"
index a8007fa..a838b62 100644 (file)
@@ -1942,3 +1942,5 @@ webkit.org/b/212488 [ Catalina ] media/video-play-audio-require-user-gesture.htm
 
 # This test requires an update to system decoders
 webkit.org/b/212565 [ Catalina Mojave ] imported/w3c/web-platform-tests/encoding/single-byte-decoder.html [ Failure ]
+
+fast/text/text-styles/-apple-system [ Pass ]
index cacb5b2..48695dc 100644 (file)
@@ -1,12 +1,12 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x111
-  RenderBlock {HTML} at (0,0) size 800x111
-    RenderBody {BODY} at (8,8) size 784x95
+layer at (0,0) size 800x117
+  RenderBlock {HTML} at (0,0) size 800x117
+    RenderBody {BODY} at (8,8) size 784x101
       RenderBlock (anonymous) at (0,0) size 784x36
         RenderText {#text} at (0,0) size 720x36
           text run at (0,0) width 720: "This test makes sure punctuation laid out with the system font does not use vertical glyphs. The test passes if the"
           text run at (0,18) width 527: "semicolon below looks like a regular horizontal semicolon (;) and is not sideways."
-      RenderBlock {DIV} at (0,36) size 784x59
-        RenderText {#text} at (0,0) size 14x59
-          text run at (0,0) width 14: ";"
+      RenderBlock {DIV} at (0,36) size 784x65
+        RenderText {#text} at (0,3) size 14x59
+          text run at (0,3) width 14: ";"
index afd3a84..b1b85c1 100644 (file)
@@ -1,3 +1,15 @@
+2020-06-19  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] Unify "font:" CSS shorthand values between macOS and iOS family
+        https://bugs.webkit.org/show_bug.cgi?id=213332
+        <rdar://problem/64479189>
+
+        Reviewed by Tim Horton and Darin Adler.
+
+        All Cocoa platforms support kCTUIFontTextStyleTitle0 and kCTUIFontTextStyleTitle4.
+
+        * wtf/PlatformHave.h:
+
 2020-06-18  Mark Lam  <mark.lam@apple.com>
 
         Unify Bitmap math loops in MarkedBlock::Handle::specializedSweep().
index 55bd8a1..c73987c 100644 (file)
 #define HAVE_AVASSETWRITERDELEGATE 1
 #endif
 
-#if PLATFORM(IOS_FAMILY) && !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
-#define HAVE_SYSTEM_FONT_STYLE_TITLE_0 1
-#define HAVE_SYSTEM_FONT_STYLE_TITLE_4 1
-#endif
-
 #if PLATFORM(COCOA) && !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
 #define HAVE_CG_PATH_UNEVEN_CORNERS_ROUNDEDRECT 1
 #endif
index 49a3e4e..768e623 100644 (file)
@@ -1,3 +1,102 @@
+2020-06-19  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] Unify "font:" CSS shorthand values between macOS and iOS family
+        https://bugs.webkit.org/show_bug.cgi?id=213332
+        <rdar://problem/64479189>
+
+        Reviewed by Tim Horton and Darin Adler.
+
+        They exist on all Cocoa platforms, so we might as well hook them up.
+
+        This unifies the shorthand CSS value handling from RenderThemeMac and
+        RenderThemeIOS into RenderThemeCocoa. This has two effects:
+
+        - It hooks up the -apple-system keywords on macOS (they previously were
+          only implemented for the iOS family).
+        - It hooks up the CSS2 keywords (caption, menu, etc.) on the iOS family
+          (they previously were only implemented on Mac).
+
+        All these fonts have been around since Mojave, so there is no need to
+        introduce any new platform guards.
+
+        Tests: fast/text/text-styles/-apple-system/-apple-system-body.html
+               fast/text/text-styles/-apple-system/-apple-system-caption1.html
+               fast/text/text-styles/-apple-system/-apple-system-caption2.html
+               fast/text/text-styles/-apple-system/-apple-system-footnote.html
+               fast/text/text-styles/-apple-system/-apple-system-headline.html
+               fast/text/text-styles/-apple-system/-apple-system-short-body.html
+               fast/text/text-styles/-apple-system/-apple-system-short-caption1.html
+               fast/text/text-styles/-apple-system/-apple-system-short-footnote.html
+               fast/text/text-styles/-apple-system/-apple-system-short-headline.html
+               fast/text/text-styles/-apple-system/-apple-system-short-subheadline.html
+               fast/text/text-styles/-apple-system/-apple-system-subheadline.html
+               fast/text/text-styles/-apple-system/-apple-system-tall-body.html
+               fast/text/text-styles/-apple-system/-apple-system-title0.html
+               fast/text/text-styles/-apple-system/-apple-system-title1.html
+               fast/text/text-styles/-apple-system/-apple-system-title2.html
+               fast/text/text-styles/-apple-system/-apple-system-title3.html
+               fast/text/text-styles/-apple-system/-apple-system-title4.html
+               fast/text/text-styles/-webkit-control.html
+               fast/text/text-styles/-webkit-mini-control.html
+               fast/text/text-styles/-webkit-small-control.html
+               fast/text/text-styles/bogus.html
+               fast/text/text-styles/caption.html
+               fast/text/text-styles/icon.html
+               fast/text/text-styles/menu.html
+               fast/text/text-styles/message-box.html
+               fast/text/text-styles/small-caption.html
+               fast/text/text-styles/status-bar.html
+
+        * css/CSSValueKeywords.in: All Cocoa ports should be able to parse these values
+        * platform/graphics/cocoa/FontCacheCoreText.cpp:
+        (WebCore::fontWithFamilySpecialCase): Move code that used to be in the Mac and
+        iOS implementations of platformFontWithFamilySpecialCase() (inside FontCacheMac.mm
+        and FontCacheIOS.mm) to be shared to be shared inside fontWithFamilySpecialCase().
+        * platform/graphics/cocoa/FontDescriptionCocoa.cpp: Remove platform guards.
+        (WebCore::convertArray):
+        (WebCore::matchSystemFontUse):
+        * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: Ditto.
+        (WebCore::SystemFontDatabaseCoreText::createTextStyleFont):
+        * platform/graphics/ios/FontCacheIOS.mm: Move code from here into FontCacheCoreText.
+        (WebCore::platformFontWithFamilySpecialCase):
+        * platform/graphics/mac/FontCacheMac.mm: Ditto.
+        (WebCore::platformFontWithFamilySpecialCase):
+        * platform/mac/ThemeMac.h: Delete systemFontSizeFor(NSControlSize) because
+        <rdar://problem/60350699> is fixed.
+        * platform/mac/ThemeMac.mm: Ditto.
+        (WebCore::ThemeMac::controlFont const):
+        (WebCore::ThemeMac::systemFontSizeFor): Deleted.
+        * rendering/RenderThemeCocoa.h: Previously, code was calling
+        RenderThemeIOS::contentSizeCategory(), which was a static function. Now, both Mac
+        and iOS need to be able to call this. However, the implementation of this function
+        is different between Mac and iOS. So, turn it from a static function in RenderThemeIOS
+        into a method in RenderThemeCocoa, and give RenderThemeCocoa a singleton() function
+        that downcasts the return of RenderTheme::singleton(). This way, instead of calling
+        RenderThemeIOS::contentSizeCategory(), code can call
+        RenderThemeCocoa::singleton().contentSizeCategory().
+        * rendering/RenderThemeCocoa.mm: Move code from RenderThemeIOS and RenderThemeMac
+        into RenderThemeCocoa.
+        (WebCore::RenderThemeCocoa::singleton):
+        (WebCore::RenderThemeCocoa::cachedSystemFontDescription const):
+        (WebCore::cssWeightOfSystemFont):
+        (WebCore::RenderThemeCocoa::updateCachedSystemFontDescription const):
+        * rendering/RenderThemeIOS.h: Ditto.
+        * rendering/RenderThemeIOS.mm: Ditto.
+        (WebCore::RenderThemeIOS::contentSizeCategory const):
+        (WebCore::attachmentActionFont):
+        (WebCore::attachmentTitleFont):
+        (WebCore::RenderThemeIOS::contentSizeCategory): Deleted.
+        (WebCore::RenderThemeIOS::cachedSystemFontDescription const): Deleted.
+        (WebCore::cssWeightOfSystemFont): Deleted.
+        (WebCore::RenderThemeIOS::updateCachedSystemFontDescription const): Deleted.
+        * rendering/RenderThemeMac.h: Ditto.
+        * rendering/RenderThemeMac.mm: Ditto.
+        (WebCore::RenderThemeMac::contentSizeCategory const):
+        (WebCore::RenderThemeMac::setFontFromControlSize const):
+        (WebCore::RenderThemeMac::controlSizeForSystemFont const):
+        (WebCore::toFontWeight): Deleted.
+        (WebCore::RenderThemeMac::updateCachedSystemFontDescription const): Deleted.
+
 2020-06-18  Doug Kelly  <dougk@apple.com>
 
         Use paintCellAndSetFocusedElementNeedsRepaintIfNecessary() for search field buttons
index 926154f..1e6711f 100644 (file)
@@ -1,3 +1,16 @@
+2020-06-19  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] Unify "font:" CSS shorthand values between macOS and iOS family
+        https://bugs.webkit.org/show_bug.cgi?id=213332
+        <rdar://problem/64479189>
+
+        Reviewed by Tim Horton and Darin Adler.
+
+        * pal/spi/cocoa/CoreTextSPI.h:
+
+        The implementation of RenderThemeMac::contentSizeCategory() needs to use
+        kCTFontContentSizeCategoryL.
+
 2020-06-17  Andy Estes  <aestes@apple.com>
 
         Another unreviewed build fix after r263150
index d0f81c2..b90d186 100644 (file)
@@ -129,9 +129,7 @@ extern const CFStringRef kCTFrameMaximumNumberOfLinesAttributeName;
 bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
 CTFontRef CTFontCreateForCSS(CFStringRef name, uint16_t weight, CTFontSymbolicTraits, CGFloat size);
 CTFontRef CTFontCreateForCharactersWithLanguage(CTFontRef currentFont, const UTF16Char *characters, CFIndex length, CFStringRef language, CFIndex *coveredLength);
-#if HAVE(CTFONTCREATEFORCHARACTERSWITHLANGUAGEANDOPTION)
 CTFontRef CTFontCreateForCharactersWithLanguageAndOption(CTFontRef currentFont, const UTF16Char *characters, CFIndex length, CFStringRef language, CTFontFallbackOption option, CFIndex *coveredLength);
-#endif
 CTFontRef CTFontCopyPhysicalFont(CTFontRef);
 
 extern const CFStringRef kCTUIFontTextStyleShortHeadline;
@@ -150,6 +148,8 @@ extern const CFStringRef kCTUIFontTextStyleCaption2;
 
 extern const CFStringRef kCTFontDescriptorTextStyleEmphasized;
 
+extern const CFStringRef kCTFontContentSizeCategoryL;
+
 extern const CGFloat kCTFontWeightUltraLight;
 extern const CGFloat kCTFontWeightThin;
 extern const CGFloat kCTFontWeightLight;
index f67599f..ab0df7c 100644 (file)
@@ -35,7 +35,7 @@ small-caption
 -webkit-small-control
 -webkit-control
 
-#if defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY
+#if defined(WTF_PLATFORM_COCOA) && WTF_PLATFORM_COCOA
 -apple-system-headline
 -apple-system-body
 -apple-system-subheadline
index 889b6a1..ddf3ccc 100644 (file)
@@ -29,6 +29,7 @@
 #include "Font.h"
 #include "FontCascadeDescription.h"
 #include "FontFamilySpecificationCoreText.h"
+#include "RenderThemeCocoa.h"
 #include "SystemFontDatabaseCoreText.h"
 #include <pal/spi/cocoa/CoreTextSPI.h>
 
@@ -1268,8 +1269,28 @@ static RetainPtr<CTFontRef> fontWithFamilySpecialCase(const AtomString& family,
 
     if (systemDesign) {
         auto cascadeList = SystemFontDatabaseCoreText::singleton().cascadeList(fontDescription, family, *systemDesign, allowUserInstalledFonts);
-        if (!cascadeList.isEmpty())
-            return createFontForInstalledFonts(cascadeList[0].get(), size, allowUserInstalledFonts);
+        if (cascadeList.isEmpty())
+            return nullptr;
+        return createFontForInstalledFonts(cascadeList[0].get(), size, allowUserInstalledFonts);
+    }
+
+    if (family.startsWith("UICTFontTextStyle")) {
+        const auto& request = fontDescription.fontSelectionRequest();
+        CTFontSymbolicTraits traits = (isFontWeightBold(request.weight) || FontCache::singleton().shouldMockBoldSystemFontForAccessibility() ? kCTFontTraitBold : 0) | (isItalic(request.slope) ? kCTFontTraitItalic : 0);
+        auto descriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(family.string().createCFString().get(), RenderThemeCocoa::singleton().contentSizeCategory(), fontDescription.computedLocale().string().createCFString().get()));
+        if (traits)
+            descriptor = adoptCF(CTFontDescriptorCreateCopyWithSymbolicTraits(descriptor.get(), traits, traits));
+        return createFontForInstalledFonts(descriptor.get(), size, allowUserInstalledFonts);
+    }
+
+    if (equalLettersIgnoringASCIICase(family, "-apple-menu")) {
+        auto result = adoptCF(CTFontCreateUIFontForLanguage(kCTFontUIFontMenuItem, size, fontDescription.computedLocale().string().createCFString().get()));
+        return createFontForInstalledFonts(result.get(), allowUserInstalledFonts);
+    }
+
+    if (equalLettersIgnoringASCIICase(family, "-apple-status-bar")) {
+        auto result = adoptCF(CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, size, fontDescription.computedLocale().string().createCFString().get()));
+        return createFontForInstalledFonts(result.get(), allowUserInstalledFonts);
     }
 
     return nullptr;
index 517a7e9..eb59b83 100644 (file)
@@ -33,8 +33,6 @@ namespace WebCore {
 
 #if USE(PLATFORM_SYSTEM_FALLBACK_LIST)
 
-#if PLATFORM(IOS_FAMILY)
-
 template<typename T, typename U, std::size_t size, std::size_t... indices> std::array<T, size> convertArray(U (&array)[size], std::index_sequence<indices...>)
 {
     return { { array[indices]... } };
@@ -44,7 +42,6 @@ template<typename T, typename U, std::size_t size> inline std::array<T, size> co
 {
     return convertArray<T>(array, std::make_index_sequence<size> { });
 }
-#endif
 
 static inline Optional<SystemFontKind> matchSystemFontUse(const AtomString& string)
 {
@@ -64,7 +61,6 @@ static inline Optional<SystemFontKind> matchSystemFontUse(const AtomString& stri
         return SystemFontKind::UIRounded;
 #endif
 
-#if PLATFORM(IOS_FAMILY)
     static const CFStringRef styles[] = {
         kCTUIFontTextStyleHeadline,
         kCTUIFontTextStyleBody,
@@ -81,18 +77,13 @@ static inline Optional<SystemFontKind> matchSystemFontUse(const AtomString& stri
         kCTUIFontTextStyleShortFootnote,
         kCTUIFontTextStyleShortCaption1,
         kCTUIFontTextStyleTallBody,
-#if HAVE(SYSTEM_FONT_STYLE_TITLE_0)
         kCTUIFontTextStyleTitle0,
-#endif
-#if HAVE(SYSTEM_FONT_STYLE_TITLE_4)
         kCTUIFontTextStyleTitle4,
-#endif
     };
     
     static auto strings { makeNeverDestroyed(convertArray<AtomString>(styles)) };
     if (std::find(strings.get().begin(), strings.get().end(), string) != strings.get().end())
         return SystemFontKind::TextStyle;
-#endif
 
     return WTF::nullopt;
 }
index 2f0b44f..e897589 100644 (file)
 
 #include "FontCache.h"
 #include "FontCascadeDescription.h"
-#include <wtf/cf/TypeCastsCF.h>
+#include "RenderThemeCocoa.h"
 
-#if PLATFORM(IOS_FAMILY)
-#include "RenderThemeIOS.h"
-#endif
+#include <wtf/cf/TypeCastsCF.h>
 
 namespace WebCore {
 
@@ -84,18 +82,12 @@ RetainPtr<CTFontRef> SystemFontDatabaseCoreText::createSystemDesignFont(SystemFo
 
 RetainPtr<CTFontRef> SystemFontDatabaseCoreText::createTextStyleFont(const CascadeListParameters& parameters)
 {
-#if PLATFORM(IOS_FAMILY)
-    auto fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(parameters.fontName.string().createCFString().get(), RenderThemeIOS::contentSizeCategory(), parameters.locale.string().createCFString().get()));
+    auto descriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(parameters.fontName.string().createCFString().get(), RenderThemeCocoa::singleton().contentSizeCategory(), parameters.locale.string().createCFString().get()));
     // FIXME: Use createFontByApplyingWeightItalicsAndFallbackBehavior() once <rdar://problem/33046041> is fixed.
     CTFontSymbolicTraits traits = (parameters.weight >= kCTFontWeightSemibold ? kCTFontTraitBold : 0) | (parameters.italic ? kCTFontTraitItalic : 0);
     if (traits)
-        fontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithSymbolicTraits(fontDescriptor.get(), traits, traits));
-    return createFontForInstalledFonts(fontDescriptor.get(), parameters.size, parameters.allowUserInstalledFonts);
-#else
-    UNUSED_PARAM(parameters);
-    ASSERT_NOT_REACHED();
-    return nullptr;
-#endif
+        descriptor = adoptCF(CTFontDescriptorCreateCopyWithSymbolicTraits(descriptor.get(), traits, traits));
+    return createFontForInstalledFonts(descriptor.get(), parameters.size, parameters.allowUserInstalledFonts);
 }
 
 Vector<RetainPtr<CTFontDescriptorRef>> SystemFontDatabaseCoreText::cascadeList(const CascadeListParameters& parameters, SystemFontKind systemFontKind)
index ed1bdc8..d1541fe 100644 (file)
@@ -134,15 +134,6 @@ RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomString& family,
     // FIXME: See comment in FontCascadeDescription::effectiveFamilyAt() in FontDescriptionCocoa.cpp
     const auto& request = fontDescription.fontSelectionRequest();
 
-    if (family.startsWith("UICTFontTextStyle")) {
-        CTFontSymbolicTraits traits = (isFontWeightBold(request.weight) || FontCache::singleton().shouldMockBoldSystemFontForAccessibility() ? kCTFontTraitBold : 0) | (isItalic(request.slope) ? kCTFontTraitItalic : 0);
-        RetainPtr<CFStringRef> familyNameStr = family.string().createCFString();
-        RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(familyNameStr.get(), RenderThemeIOS::contentSizeCategory(), nullptr));
-        if (traits)
-            fontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithSymbolicTraits(fontDescriptor.get(), traits, traits));
-        return createFontForInstalledFonts(fontDescriptor.get(), size, allowUserInstalledFonts);
-    }
-
     // FIXME: Migrate this to use SystemFontDatabaseCoreText like the design system-ui block below.
     if (equalLettersIgnoringASCIICase(family, "-webkit-system-font") || equalLettersIgnoringASCIICase(family, "-apple-system") || equalLettersIgnoringASCIICase(family, "-apple-system-font") || equalLettersIgnoringASCIICase(family, "system-ui")) {
         auto fontDescriptor = systemFontDescriptor(request.weight, isFontWeightBold(request.weight), isItalic(request.slope), size);
index a0ac6d3..03b7bf3 100644 (file)
@@ -110,16 +110,6 @@ RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomString& family,
         return adoptCF(CTFontCreateCopyWithAttributes(result.get(), size, nullptr, modification.get()));
     }
 
-    if (equalLettersIgnoringASCIICase(family, "-apple-menu")) {
-        RetainPtr<CTFontRef> result = toCTFont([NSFont menuFontOfSize:size]);
-        return createFontForInstalledFonts(result.get(), allowUserInstalledFonts);
-    }
-
-    if (equalLettersIgnoringASCIICase(family, "-apple-status-bar")) {
-        RetainPtr<CTFontRef> result = toCTFont([NSFont labelFontOfSize:size]);
-        return createFontForInstalledFonts(result.get(), allowUserInstalledFonts);
-    }
-
     if (equalLettersIgnoringASCIICase(family, "lastresort")) {
         static const CTFontDescriptorRef lastResort = CTFontDescriptorCreateLastResort();
         return adoptCF(CTFontCreateWithFontDescriptor(lastResort, size, nullptr));
index bf655d7..d41b4ef 100644 (file)
@@ -36,7 +36,6 @@ public:
 #if HAVE(LARGE_CONTROL_SIZE)
     static bool supportsLargeFormControls();
 #endif
-    static double systemFontSizeFor(NSControlSize);
 
     static NSView *ensuredView(ScrollView*, const ControlStates&, bool useUnparentedView = false);
     static void setFocusRingClipRect(const FloatRect&);
index 79cb227..3a3bb6b 100644 (file)
@@ -802,19 +802,6 @@ int ThemeMac::baselinePositionAdjustment(ControlPart part) const
     return Theme::baselinePositionAdjustment(part);
 }
 
-double ThemeMac::systemFontSizeFor(NSControlSize size)
-{
-#if HAVE(LARGE_CONTROL_SIZE)
-    if (size == NSControlSizeLarge) {
-        // This is a workaround for <rdar://problem/60350699>. Once this is fixed,
-        // we should remove ThemeMac::systemFontSizeFor as well as this hard-coded
-        // value.
-        return 15;
-    }
-#endif
-    return [NSFont systemFontSizeForControlSize:size];
-}
-
 Optional<FontCascadeDescription> ThemeMac::controlFont(ControlPart part, const FontCascade& font, float zoomFactor) const
 {
     switch (part) {
@@ -822,7 +809,7 @@ Optional<FontCascadeDescription> ThemeMac::controlFont(ControlPart part, const F
         FontCascadeDescription fontDescription;
         fontDescription.setIsAbsoluteSize(true);
 
-        NSFont* nsFont = [NSFont systemFontOfSize:ThemeMac::systemFontSizeFor(controlSizeForFont(font))];
+        NSFont* nsFont = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:controlSizeForFont(font)]];
         fontDescription.setOneFamily(AtomString("-apple-system", AtomString::ConstructFromLiteral));
         fontDescription.setComputedSize([nsFont pointSize] * zoomFactor);
         fontDescription.setSpecifiedSize([nsFont pointSize] * zoomFactor);
index 19bc392..73b0e99 100644 (file)
@@ -33,6 +33,11 @@ OBJC_CLASS NSDateComponentsFormatter;
 namespace WebCore {
 
 class RenderThemeCocoa : public RenderTheme {
+public:
+    static RenderThemeCocoa& singleton();
+
+    virtual CFStringRef contentSizeCategory() const = 0;
+
 private:
     bool shouldHaveCapsLockIndicator(const HTMLInputElement&) const final;
 
@@ -41,6 +46,9 @@ private:
     bool paintApplePayButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
 #endif
 
+    FontCascadeDescription& cachedSystemFontDescription(CSSValueID systemFontID) const override;
+    void updateCachedSystemFontDescription(CSSValueID systemFontID, FontCascadeDescription&) const override;
+
 protected:
     String mediaControlsFormattedStringForDuration(double) override;
     RetainPtr<NSDateComponentsFormatter> m_durationFormatter;
index ffb0fb1..88ae727 100644 (file)
 #import "GraphicsContextCG.h"
 #import "HTMLInputElement.h"
 #import "RenderText.h"
-
-#if ENABLE(APPLE_PAY)
-
-#import <pal/cocoa/PassKitSoftLink.h>
-
-#endif // ENABLE(APPLE_PAY)
+#import <pal/spi/cocoa/CoreTextSPI.h>
 
 #if ENABLE(VIDEO)
 #import "LocalizedStrings.h"
 #import <wtf/BlockObjCExceptions.h>
 #endif
 
+#if PLATFORM(MAC)
+#import <AppKit/NSFont.h>
+#else
+#import <UIKit/UIFont.h>
+#import <pal/ios/UIKitSoftLink.h>
+#endif
+
+#if ENABLE(APPLE_PAY)
+#import <pal/cocoa/PassKitSoftLink.h>
+#endif
+
 namespace WebCore {
 
+RenderThemeCocoa& RenderThemeCocoa::singleton()
+{
+    return static_cast<RenderThemeCocoa&>(RenderTheme::singleton());
+}
+
 bool RenderThemeCocoa::shouldHaveCapsLockIndicator(const HTMLInputElement& element) const
 {
     return element.isPasswordField();
@@ -160,4 +171,245 @@ String RenderThemeCocoa::mediaControlsFormattedStringForDuration(const double du
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
+FontCascadeDescription& RenderThemeCocoa::cachedSystemFontDescription(CSSValueID valueID) const
+{
+    static NeverDestroyed<FontCascadeDescription> systemFont;
+    static NeverDestroyed<FontCascadeDescription> headlineFont;
+    static NeverDestroyed<FontCascadeDescription> bodyFont;
+    static NeverDestroyed<FontCascadeDescription> subheadlineFont;
+    static NeverDestroyed<FontCascadeDescription> footnoteFont;
+    static NeverDestroyed<FontCascadeDescription> caption1Font;
+    static NeverDestroyed<FontCascadeDescription> caption2Font;
+    static NeverDestroyed<FontCascadeDescription> shortHeadlineFont;
+    static NeverDestroyed<FontCascadeDescription> shortBodyFont;
+    static NeverDestroyed<FontCascadeDescription> shortSubheadlineFont;
+    static NeverDestroyed<FontCascadeDescription> shortFootnoteFont;
+    static NeverDestroyed<FontCascadeDescription> shortCaption1Font;
+    static NeverDestroyed<FontCascadeDescription> tallBodyFont;
+    static NeverDestroyed<FontCascadeDescription> title0Font;
+    static NeverDestroyed<FontCascadeDescription> title1Font;
+    static NeverDestroyed<FontCascadeDescription> title2Font;
+    static NeverDestroyed<FontCascadeDescription> title3Font;
+    static NeverDestroyed<FontCascadeDescription> title4Font;
+
+    static CFStringRef userTextSize = contentSizeCategory();
+
+    if (userTextSize != contentSizeCategory()) {
+        userTextSize = contentSizeCategory();
+
+        headlineFont.get().setIsAbsoluteSize(false);
+        bodyFont.get().setIsAbsoluteSize(false);
+        subheadlineFont.get().setIsAbsoluteSize(false);
+        footnoteFont.get().setIsAbsoluteSize(false);
+        caption1Font.get().setIsAbsoluteSize(false);
+        caption2Font.get().setIsAbsoluteSize(false);
+        shortHeadlineFont.get().setIsAbsoluteSize(false);
+        shortBodyFont.get().setIsAbsoluteSize(false);
+        shortSubheadlineFont.get().setIsAbsoluteSize(false);
+        shortFootnoteFont.get().setIsAbsoluteSize(false);
+        shortCaption1Font.get().setIsAbsoluteSize(false);
+        tallBodyFont.get().setIsAbsoluteSize(false);
+    }
+
+    switch (valueID) {
+    case CSSValueAppleSystemHeadline:
+        return headlineFont;
+    case CSSValueAppleSystemBody:
+        return bodyFont;
+    case CSSValueAppleSystemTitle0:
+        return title0Font;
+    case CSSValueAppleSystemTitle1:
+        return title1Font;
+    case CSSValueAppleSystemTitle2:
+        return title2Font;
+    case CSSValueAppleSystemTitle3:
+        return title3Font;
+    case CSSValueAppleSystemTitle4:
+        return title4Font;
+    case CSSValueAppleSystemSubheadline:
+        return subheadlineFont;
+    case CSSValueAppleSystemFootnote:
+        return footnoteFont;
+    case CSSValueAppleSystemCaption1:
+        return caption1Font;
+    case CSSValueAppleSystemCaption2:
+        return caption2Font;
+        // Short version.
+    case CSSValueAppleSystemShortHeadline:
+        return shortHeadlineFont;
+    case CSSValueAppleSystemShortBody:
+        return shortBodyFont;
+    case CSSValueAppleSystemShortSubheadline:
+        return shortSubheadlineFont;
+    case CSSValueAppleSystemShortFootnote:
+        return shortFootnoteFont;
+    case CSSValueAppleSystemShortCaption1:
+        return shortCaption1Font;
+        // Tall version.
+    case CSSValueAppleSystemTallBody:
+        return tallBodyFont;
+    default:
+        return RenderTheme::cachedSystemFontDescription(valueID);
+    }
+}
+
+static inline FontSelectionValue cssWeightOfSystemFont(CTFontRef font)
+{
+    auto traits = adoptCF(CTFontCopyTraits(font));
+    CFNumberRef resultRef = (CFNumberRef)CFDictionaryGetValue(traits.get(), kCTFontWeightTrait);
+    float result = 0;
+    CFNumberGetValue(resultRef, kCFNumberFloatType, &result);
+    // These numbers were experimentally gathered from weights of the system font.
+    static constexpr const float weightThresholds[] = { -0.6, -0.365, -0.115, 0.130, 0.235, 0.350, 0.5, 0.7 };
+    for (unsigned i = 0; i < WTF_ARRAY_LENGTH(weightThresholds); ++i) {
+        if (result < weightThresholds[i])
+            return FontSelectionValue((static_cast<int>(i) + 1) * 100);
+    }
+    return FontSelectionValue(900);
+}
+
+void RenderThemeCocoa::updateCachedSystemFontDescription(CSSValueID valueID, FontCascadeDescription& fontDescription) const
+{
+    auto cocoaFontClass = [] {
+#if PLATFORM(IOS_FAMILY)
+        return PAL::getUIFontClass();
+#else
+        return NSFont.class;
+#endif
+    };
+    // FIXME: Hook up locale strings.
+    RetainPtr<CTFontDescriptorRef> fontDescriptor;
+    CFStringRef textStyle = nullptr;
+    AtomString style;
+    switch (valueID) {
+    case CSSValueAppleSystemHeadline:
+        textStyle = kCTUIFontTextStyleHeadline;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemBody:
+        textStyle = kCTUIFontTextStyleBody;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemTitle0:
+        textStyle = kCTUIFontTextStyleTitle0;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemTitle1:
+        textStyle = kCTUIFontTextStyleTitle1;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemTitle2:
+        textStyle = kCTUIFontTextStyleTitle2;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemTitle3:
+        textStyle = kCTUIFontTextStyleTitle3;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemTitle4:
+        textStyle = kCTUIFontTextStyleTitle4;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemSubheadline:
+        textStyle = kCTUIFontTextStyleSubhead;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemFootnote:
+        textStyle = kCTUIFontTextStyleFootnote;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemCaption1:
+        textStyle = kCTUIFontTextStyleCaption1;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemCaption2:
+        textStyle = kCTUIFontTextStyleCaption2;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemShortHeadline:
+        textStyle = kCTUIFontTextStyleShortHeadline;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemShortBody:
+        textStyle = kCTUIFontTextStyleShortBody;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemShortSubheadline:
+        textStyle = kCTUIFontTextStyleShortSubhead;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemShortFootnote:
+        textStyle = kCTUIFontTextStyleShortFootnote;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemShortCaption1:
+        textStyle = kCTUIFontTextStyleShortCaption1;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueAppleSystemTallBody:
+        textStyle = kCTUIFontTextStyleTallBody;
+        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
+        break;
+    case CSSValueSmallCaption: {
+        style = AtomString("system-ui", AtomString::ConstructFromLiteral);
+        auto font = [cocoaFontClass() systemFontOfSize:[cocoaFontClass() smallSystemFontSize]];
+        fontDescriptor = static_cast<CTFontDescriptorRef>(font.fontDescriptor);
+        break;
+    }
+    case CSSValueMenu:
+        style = AtomString("-apple-menu", AtomString::ConstructFromLiteral);
+        fontDescriptor = adoptCF(CTFontDescriptorCreateForUIType(kCTFontUIFontMenuItem, [cocoaFontClass() systemFontSize], nullptr));
+        break;
+    case CSSValueStatusBar: {
+        style = AtomString("-apple-status-bar", AtomString::ConstructFromLiteral);
+        fontDescriptor = adoptCF(CTFontDescriptorCreateForUIType(kCTFontUIFontSystem, [cocoaFontClass() labelFontSize], nullptr));
+        break;
+    }
+    case CSSValueWebkitMiniControl: {
+        style = AtomString("system-ui", AtomString::ConstructFromLiteral);
+#if PLATFORM(IOS_FAMILY)
+        fontDescriptor = adoptCF(CTFontDescriptorCreateForUIType(kCTFontUIFontMiniSystem, 0, nullptr));
+#else
+        auto font = [cocoaFontClass() systemFontOfSize:[cocoaFontClass() systemFontSizeForControlSize:NSControlSizeMini]];
+        fontDescriptor = static_cast<CTFontDescriptorRef>(font.fontDescriptor);
+#endif
+        break;
+    }
+    case CSSValueWebkitSmallControl: {
+        style = AtomString("system-ui", AtomString::ConstructFromLiteral);
+#if PLATFORM(IOS_FAMILY)
+        fontDescriptor = adoptCF(CTFontDescriptorCreateForUIType(kCTFontUIFontSmallSystem, 0, nullptr));
+#else
+        auto font = [cocoaFontClass() systemFontOfSize:[cocoaFontClass() systemFontSizeForControlSize:NSControlSizeSmall]];
+        fontDescriptor = static_cast<CTFontDescriptorRef>(font.fontDescriptor);
+#endif
+        break;
+    }
+    case CSSValueWebkitControl: {
+        style = AtomString("system-ui", AtomString::ConstructFromLiteral);
+#if PLATFORM(IOS_FAMILY)
+        fontDescriptor = adoptCF(CTFontDescriptorCreateForUIType(kCTFontUIFontSystem, 0, nullptr));
+#else
+        auto font = [cocoaFontClass() systemFontOfSize:[cocoaFontClass() systemFontSizeForControlSize:NSControlSizeRegular]];
+        fontDescriptor = static_cast<CTFontDescriptorRef>(font.fontDescriptor);
+#endif
+        break;
+    }
+    default:
+        style = AtomString("system-ui", AtomString::ConstructFromLiteral);
+        fontDescriptor = adoptCF(CTFontDescriptorCreateForUIType(kCTFontUIFontSystem, 0, nullptr));
+    }
+
+    if (style.isNull())
+        style = textStyle;
+
+    ASSERT(fontDescriptor);
+    RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), 0, nullptr));
+    fontDescription.setIsAbsoluteSize(true);
+    fontDescription.setOneFamily(style);
+    fontDescription.setSpecifiedSize(CTFontGetSize(font.get()));
+    fontDescription.setWeight(cssWeightOfSystemFont(font.get()));
+    fontDescription.setItalic(normalItalicValue());
+}
+
 }
index 35faad2..f0a300a 100644 (file)
@@ -50,7 +50,7 @@ public:
 
     static void adjustRoundBorderRadius(RenderStyle&, RenderBox&);
 
-    static CFStringRef contentSizeCategory();
+    CFStringRef contentSizeCategory() const final;
 
     WEBCORE_EXPORT static void setContentSizeCategory(const String&);
 
@@ -67,9 +67,7 @@ public:
 
 private:
     LengthBox popupInternalPaddingBox(const RenderStyle&) const override;
-    
-    FontCascadeDescription& cachedSystemFontDescription(CSSValueID systemFontID) const override;
-    void updateCachedSystemFontDescription(CSSValueID, FontCascadeDescription&) const override;
+
     int baselinePosition(const RenderBox&) const override;
 
     bool isControlStyled(const RenderStyle&, const RenderStyle& userAgentStyle) const override;
index 7fe28df..cdfb3a6 100644 (file)
@@ -74,7 +74,6 @@
 #import <CoreImage/CoreImage.h>
 #import <objc/runtime.h>
 #import <pal/ios/UIKitSoftLink.h>
-#import <pal/spi/cocoa/CoreTextSPI.h>
 #import <pal/spi/ios/UIKitSPI.h>
 #import <wtf/NeverDestroyed.h>
 #import <wtf/ObjCRuntimeExtras.h>
@@ -305,7 +304,7 @@ static String& _contentSizeCategory()
     return _contentSizeCategory.get();
 }
 
-CFStringRef RenderThemeIOS::contentSizeCategory()
+CFStringRef RenderThemeIOS::contentSizeCategory() const
 {
     if (!_contentSizeCategory().isNull())
         return (__bridge CFStringRef)static_cast<NSString*>(_contentSizeCategory());
@@ -1166,207 +1165,6 @@ bool RenderThemeIOS::supportsFocusRing(const RenderStyle&) const
     return false;
 }
 
-FontCascadeDescription& RenderThemeIOS::cachedSystemFontDescription(CSSValueID valueID) const
-{
-    static NeverDestroyed<FontCascadeDescription> systemFont;
-    static NeverDestroyed<FontCascadeDescription> headlineFont;
-    static NeverDestroyed<FontCascadeDescription> bodyFont;
-    static NeverDestroyed<FontCascadeDescription> subheadlineFont;
-    static NeverDestroyed<FontCascadeDescription> footnoteFont;
-    static NeverDestroyed<FontCascadeDescription> caption1Font;
-    static NeverDestroyed<FontCascadeDescription> caption2Font;
-    static NeverDestroyed<FontCascadeDescription> shortHeadlineFont;
-    static NeverDestroyed<FontCascadeDescription> shortBodyFont;
-    static NeverDestroyed<FontCascadeDescription> shortSubheadlineFont;
-    static NeverDestroyed<FontCascadeDescription> shortFootnoteFont;
-    static NeverDestroyed<FontCascadeDescription> shortCaption1Font;
-    static NeverDestroyed<FontCascadeDescription> tallBodyFont;
-#if HAVE(SYSTEM_FONT_STYLE_TITLE_0)
-    static NeverDestroyed<FontCascadeDescription> title0Font;
-#endif
-    static NeverDestroyed<FontCascadeDescription> title1Font;
-    static NeverDestroyed<FontCascadeDescription> title2Font;
-    static NeverDestroyed<FontCascadeDescription> title3Font;
-#if HAVE(SYSTEM_FONT_STYLE_TITLE_4)
-    static NeverDestroyed<FontCascadeDescription> title4Font;
-#endif
-
-    static CFStringRef userTextSize = contentSizeCategory();
-
-    if (userTextSize != contentSizeCategory()) {
-        userTextSize = contentSizeCategory();
-
-        headlineFont.get().setIsAbsoluteSize(false);
-        bodyFont.get().setIsAbsoluteSize(false);
-        subheadlineFont.get().setIsAbsoluteSize(false);
-        footnoteFont.get().setIsAbsoluteSize(false);
-        caption1Font.get().setIsAbsoluteSize(false);
-        caption2Font.get().setIsAbsoluteSize(false);
-        shortHeadlineFont.get().setIsAbsoluteSize(false);
-        shortBodyFont.get().setIsAbsoluteSize(false);
-        shortSubheadlineFont.get().setIsAbsoluteSize(false);
-        shortFootnoteFont.get().setIsAbsoluteSize(false);
-        shortCaption1Font.get().setIsAbsoluteSize(false);
-        tallBodyFont.get().setIsAbsoluteSize(false);
-    }
-
-    switch (valueID) {
-    case CSSValueAppleSystemHeadline:
-        return headlineFont;
-    case CSSValueAppleSystemBody:
-        return bodyFont;
-#if HAVE(SYSTEM_FONT_STYLE_TITLE_0)
-    case CSSValueAppleSystemTitle0:
-        return title0Font;
-#endif
-    case CSSValueAppleSystemTitle1:
-        return title1Font;
-    case CSSValueAppleSystemTitle2:
-        return title2Font;
-    case CSSValueAppleSystemTitle3:
-        return title3Font;
-#if HAVE(SYSTEM_FONT_STYLE_TITLE_4)
-    case CSSValueAppleSystemTitle4:
-        return title4Font;
-#endif
-    case CSSValueAppleSystemSubheadline:
-        return subheadlineFont;
-    case CSSValueAppleSystemFootnote:
-        return footnoteFont;
-    case CSSValueAppleSystemCaption1:
-        return caption1Font;
-    case CSSValueAppleSystemCaption2:
-        return caption2Font;
-        // Short version.
-    case CSSValueAppleSystemShortHeadline:
-        return shortHeadlineFont;
-    case CSSValueAppleSystemShortBody:
-        return shortBodyFont;
-    case CSSValueAppleSystemShortSubheadline:
-        return shortSubheadlineFont;
-    case CSSValueAppleSystemShortFootnote:
-        return shortFootnoteFont;
-    case CSSValueAppleSystemShortCaption1:
-        return shortCaption1Font;
-        // Tall version.
-    case CSSValueAppleSystemTallBody:
-        return tallBodyFont;
-    default:
-        return systemFont;
-    }
-}
-
-static inline FontSelectionValue cssWeightOfSystemFont(CTFontRef font)
-{
-    RetainPtr<CFDictionaryRef> traits = adoptCF(CTFontCopyTraits(font));
-    CFNumberRef resultRef = (CFNumberRef)CFDictionaryGetValue(traits.get(), kCTFontWeightTrait);
-    float result = 0;
-    CFNumberGetValue(resultRef, kCFNumberFloatType, &result);
-    // These numbers were experimentally gathered from weights of the system font.
-    static float weightThresholds[] = { -0.6, -0.365, -0.115, 0.130, 0.235, 0.350, 0.5, 0.7 };
-    for (unsigned i = 0; i < WTF_ARRAY_LENGTH(weightThresholds); ++i) {
-        if (result < weightThresholds[i])
-            return FontSelectionValue((static_cast<int>(i) + 1) * 100);
-    }
-    return FontSelectionValue(900);
-}
-
-void RenderThemeIOS::updateCachedSystemFontDescription(CSSValueID valueID, FontCascadeDescription& fontDescription) const
-{
-    RetainPtr<CTFontDescriptorRef> fontDescriptor;
-    CFStringRef textStyle;
-    switch (valueID) {
-    case CSSValueAppleSystemHeadline:
-        textStyle = kCTUIFontTextStyleHeadline;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-    case CSSValueAppleSystemBody:
-        textStyle = kCTUIFontTextStyleBody;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-#if HAVE(SYSTEM_FONT_STYLE_TITLE_0)
-    case CSSValueAppleSystemTitle0:
-        textStyle = kCTUIFontTextStyleTitle0;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-#endif
-    case CSSValueAppleSystemTitle1:
-        textStyle = kCTUIFontTextStyleTitle1;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-    case CSSValueAppleSystemTitle2:
-        textStyle = kCTUIFontTextStyleTitle2;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-    case CSSValueAppleSystemTitle3:
-        textStyle = kCTUIFontTextStyleTitle3;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-#if HAVE(SYSTEM_FONT_STYLE_TITLE_4)
-    case CSSValueAppleSystemTitle4:
-        textStyle = kCTUIFontTextStyleTitle4;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-#endif
-    case CSSValueAppleSystemSubheadline:
-        textStyle = kCTUIFontTextStyleSubhead;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-    case CSSValueAppleSystemFootnote:
-        textStyle = kCTUIFontTextStyleFootnote;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-    case CSSValueAppleSystemCaption1:
-        textStyle = kCTUIFontTextStyleCaption1;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-    case CSSValueAppleSystemCaption2:
-        textStyle = kCTUIFontTextStyleCaption2;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-
-    // Short version.
-    case CSSValueAppleSystemShortHeadline:
-        textStyle = kCTUIFontTextStyleShortHeadline;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-    case CSSValueAppleSystemShortBody:
-        textStyle = kCTUIFontTextStyleShortBody;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-    case CSSValueAppleSystemShortSubheadline:
-        textStyle = kCTUIFontTextStyleShortSubhead;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-    case CSSValueAppleSystemShortFootnote:
-        textStyle = kCTUIFontTextStyleShortFootnote;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-    case CSSValueAppleSystemShortCaption1:
-        textStyle = kCTUIFontTextStyleShortCaption1;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-
-    // Tall version.
-    case CSSValueAppleSystemTallBody:
-        textStyle = kCTUIFontTextStyleTallBody;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), nullptr));
-        break;
-
-    default:
-        textStyle = kCTFontDescriptorTextStyleEmphasized;
-        fontDescriptor = adoptCF(CTFontDescriptorCreateForUIType(kCTFontUIFontSystem, 0, nullptr));
-    }
-
-    ASSERT(fontDescriptor);
-    RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), 0, nullptr));
-    fontDescription.setIsAbsoluteSize(true);
-    fontDescription.setOneFamily(textStyle);
-    fontDescription.setSpecifiedSize(CTFontGetSize(font.get()));
-    fontDescription.setWeight(cssWeightOfSystemFont(font.get()));
-    fontDescription.setItalic(normalItalicValue());
-}
-
 String RenderThemeIOS::mediaControlsStyleSheet()
 {
     if (m_legacyMediaControlsStyleSheet.isEmpty())
@@ -1592,7 +1390,7 @@ const CFIndex attachmentWrappingTextMaximumLineCount = 2;
 
 static RetainPtr<CTFontRef> attachmentActionFont()
 {
-    RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(kCTUIFontTextStyleShortFootnote, RenderThemeIOS::contentSizeCategory(), 0));
+    RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(kCTUIFontTextStyleShortFootnote, RenderThemeIOS::singleton().contentSizeCategory(), 0));
     RetainPtr<CTFontDescriptorRef> emphasizedFontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithAttributes(fontDescriptor.get(),
         (CFDictionaryRef)@{
             (id)kCTFontDescriptorTextStyleAttribute: (id)kCTFontDescriptorTextStyleEmphasized
@@ -1607,7 +1405,7 @@ static UIColor *attachmentActionColor(const RenderAttachment& attachment)
 
 static RetainPtr<CTFontRef> attachmentTitleFont()
 {
-    RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(kCTUIFontTextStyleShortCaption1, RenderThemeIOS::contentSizeCategory(), 0));
+    RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(kCTUIFontTextStyleShortCaption1, RenderThemeIOS::singleton().contentSizeCategory(), 0));
     return adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), 0, nullptr));
 }
 
index 23eee54..925593d 100644 (file)
@@ -41,6 +41,8 @@ class RenderThemeMac final : public RenderThemeCocoa {
 public:
     friend NeverDestroyed<RenderThemeMac>;
 
+    CFStringRef contentSizeCategory() const final;
+
     // A method asking if the control changes its tint when the window has focus or not.
     bool controlSupportsTints(const RenderObject&) const final;
 
@@ -101,9 +103,6 @@ public:
 private:
     RenderThemeMac();
 
-    // System fonts.
-    void updateCachedSystemFontDescription(CSSValueID, FontCascadeDescription&) const final;
-
     String extraDefaultStyleSheet() final;
 
 #if ENABLE(VIDEO)
index 41a2ed6..7499fd1 100644 (file)
@@ -283,6 +283,11 @@ RenderTheme& RenderTheme::singleton()
     return theme;
 }
 
+CFStringRef RenderThemeMac::contentSizeCategory() const
+{
+    return kCTFontContentSizeCategoryL;
+}
+
 RenderThemeMac::RenderThemeMac()
     : m_notificationObserver(adoptNS([[WebCoreRenderThemeNotificationObserver alloc] init]))
 {
@@ -478,79 +483,6 @@ Color RenderThemeMac::platformTextSearchHighlightColor(OptionSet<StyleColor::Opt
     return colorFromNSColor([NSColor findHighlightColor]);
 }
 
-static FontSelectionValue toFontWeight(NSInteger appKitFontWeight)
-{
-    ASSERT(appKitFontWeight > 0 && appKitFontWeight < 15);
-    if (appKitFontWeight > 14)
-        appKitFontWeight = 14;
-    else if (appKitFontWeight < 1)
-        appKitFontWeight = 1;
-
-    static const FontSelectionValue fontWeights[] = {
-        FontSelectionValue(100),
-        FontSelectionValue(100),
-        FontSelectionValue(200),
-        FontSelectionValue(300),
-        FontSelectionValue(400),
-        FontSelectionValue(500),
-        FontSelectionValue(600),
-        FontSelectionValue(600),
-        FontSelectionValue(700),
-        FontSelectionValue(800),
-        FontSelectionValue(800),
-        FontSelectionValue(900),
-        FontSelectionValue(900),
-        FontSelectionValue(900)
-    };
-    return fontWeights[appKitFontWeight - 1];
-}
-
-void RenderThemeMac::updateCachedSystemFontDescription(CSSValueID cssValueId, FontCascadeDescription& fontDescription) const
-{
-    NSFont* font;
-    // System-font-ness can't be encapsulated by simply a font name. Instead, we must use a token
-    // which FontCache will look for.
-    // Make sure we keep this list of possible tokens in sync with FontCascade::primaryFontIsSystemFont()
-    AtomString fontName;
-    switch (cssValueId) {
-        case CSSValueSmallCaption:
-            font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
-            break;
-        case CSSValueMenu:
-            font = [NSFont menuFontOfSize:[NSFont systemFontSize]];
-            fontName = AtomString("-apple-menu", AtomString::ConstructFromLiteral);
-            break;
-        case CSSValueStatusBar:
-            font = [NSFont labelFontOfSize:[NSFont labelFontSize]];
-            fontName = AtomString("-apple-status-bar", AtomString::ConstructFromLiteral);
-            break;
-        case CSSValueWebkitMiniControl:
-            font = [NSFont systemFontOfSize:ThemeMac::systemFontSizeFor(NSControlSizeMini)];
-            break;
-        case CSSValueWebkitSmallControl:
-            font = [NSFont systemFontOfSize:ThemeMac::systemFontSizeFor(NSControlSizeSmall)];
-            break;
-        case CSSValueWebkitControl:
-            font = [NSFont systemFontOfSize:ThemeMac::systemFontSizeFor(NSControlSizeRegular)];
-            break;
-        default:
-            font = [NSFont systemFontOfSize:[NSFont systemFontSize]];
-    }
-
-    if (!font)
-        return;
-
-    if (fontName.isNull())
-        fontName = AtomString("system-ui", AtomString::ConstructFromLiteral);
-
-    NSFontManager *fontManager = [NSFontManager sharedFontManager];
-    fontDescription.setIsAbsoluteSize(true);
-    fontDescription.setOneFamily(fontName);
-    fontDescription.setSpecifiedSize([font pointSize]);
-    fontDescription.setWeight(toFontWeight([fontManager weightOfFont:font]));
-    fontDescription.setIsItalic([fontManager traitsOfFont:font] & NSItalicFontMask);
-}
-
 static SimpleColor menuBackgroundColor()
 {
     RetainPtr<NSBitmapImageRep> offscreenRep = adoptNS([[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil pixelsWide:1 pixelsHigh:1
@@ -1087,7 +1019,7 @@ void RenderThemeMac::setFontFromControlSize(RenderStyle& style, NSControlSize co
     FontCascadeDescription fontDescription;
     fontDescription.setIsAbsoluteSize(true);
 
-    NSFont* font = [NSFont systemFontOfSize:ThemeMac::systemFontSizeFor(controlSize)];
+    NSFont* font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:controlSize]];
     fontDescription.setOneFamily(AtomString("-apple-system", AtomString::ConstructFromLiteral));
     fontDescription.setComputedSize([font pointSize] * style.effectiveZoom());
     fontDescription.setSpecifiedSize([font pointSize] * style.effectiveZoom());
@@ -1103,12 +1035,12 @@ NSControlSize RenderThemeMac::controlSizeForSystemFont(const RenderStyle& style)
 {
     int fontSize = style.computedFontPixelSize();
 #if HAVE(LARGE_CONTROL_SIZE)
-    if (fontSize >= ThemeMac::systemFontSizeFor(NSControlSizeLarge) && ThemeMac::supportsLargeFormControls())
+    if (fontSize >= [NSFont systemFontSizeForControlSize:NSControlSizeLarge] && ThemeMac::supportsLargeFormControls())
         return NSControlSizeLarge;
 #endif
-    if (fontSize >= ThemeMac::systemFontSizeFor(NSControlSizeRegular))
+    if (fontSize >= [NSFont systemFontSizeForControlSize:NSControlSizeRegular])
         return NSControlSizeRegular;
-    if (fontSize >= ThemeMac::systemFontSizeFor(NSControlSizeSmall))
+    if (fontSize >= [NSFont systemFontSizeForControlSize:NSControlSizeSmall])
         return NSControlSizeSmall;
     return NSControlSizeMini;
 }