Title: [272288] branches/safari-611-branch
Revision
272288
Author
[email protected]
Date
2021-02-02 17:41:53 -0800 (Tue, 02 Feb 2021)

Log Message

Cherry-pick r272073. rdar://problem/73847891

    font-stretch is not applied to system-ui
    https://bugs.webkit.org/show_bug.cgi?id=221103
    <rdar://problem/73719139>

    Reviewed by Darin Adler.

    Source/WebCore:

    We just never hooked it up.

    Tests: fast/text/system-font-width-2.html
           fast/text/system-font-width-3.html
           fast/text/system-font-width-4.html
           fast/text/system-font-width-5.html
           fast/text/system-font-width-6.html
           fast/text/system-font-width-7.html
           fast/text/system-font-width-8.html
           fast/text/system-font-width-9.html
           fast/text/system-font-width.html

    * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
    (WebCore::SystemFontDatabaseCoreText::createSystemUIFont):
    (WebCore::SystemFontDatabaseCoreText::createSystemDesignFont):
    (WebCore::SystemFontDatabaseCoreText::createTextStyleFont):
    (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightWidthItalicsAndFallbackBehavior):
    (WebCore::mapWeight):
    (WebCore::mapWidth):
    (WebCore::SystemFontDatabaseCoreText::systemFontParameters):
    (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightItalicsAndFallbackBehavior): Deleted.
    * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
    (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::operator== const):
    (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::hash const):

    Source/WebCore/PAL:

    * pal/spi/cocoa/CoreTextSPI.h:

    Source/WTF:

    * wtf/PlatformHave.h:

    LayoutTests:

    * fast/text/system-font-width-2-expected-mismatch.html: Added.
    * fast/text/system-font-width-2.html: Added.
    * fast/text/system-font-width-3-expected-mismatch.html: Added.
    * fast/text/system-font-width-3.html: Added.
    * fast/text/system-font-width-4-expected-mismatch.html: Added.
    * fast/text/system-font-width-4.html: Added.
    * fast/text/system-font-width-5-expected.html: Added.
    * fast/text/system-font-width-5.html: Added.
    * fast/text/system-font-width-6-expected-mismatch.html: Added.
    * fast/text/system-font-width-6.html: Added.
    * fast/text/system-font-width-7-expected-mismatch.html: Added.
    * fast/text/system-font-width-7.html: Added.
    * fast/text/system-font-width-8-expected-mismatch.html: Added.
    * fast/text/system-font-width-8.html: Added.
    * fast/text/system-font-width-9-expected-mismatch.html: Added.
    * fast/text/system-font-width-9.html: Added.
    * fast/text/system-font-width-expected-mismatch.html: Added.
    * fast/text/system-font-width.html: Added.
    * platform/ios/TestExpectations:
    * platform/mac/TestExpectations:
    * platform/win/TestExpectations:

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-611-branch/LayoutTests/ChangeLog (272287 => 272288)


--- branches/safari-611-branch/LayoutTests/ChangeLog	2021-02-03 01:41:44 UTC (rev 272287)
+++ branches/safari-611-branch/LayoutTests/ChangeLog	2021-02-03 01:41:53 UTC (rev 272288)
@@ -1,5 +1,106 @@
 2021-02-02  Alan Coon  <[email protected]>
 
+        Cherry-pick r272073. rdar://problem/73847891
+
+    font-stretch is not applied to system-ui
+    https://bugs.webkit.org/show_bug.cgi?id=221103
+    <rdar://problem/73719139>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebCore:
+    
+    We just never hooked it up.
+    
+    Tests: fast/text/system-font-width-2.html
+           fast/text/system-font-width-3.html
+           fast/text/system-font-width-4.html
+           fast/text/system-font-width-5.html
+           fast/text/system-font-width-6.html
+           fast/text/system-font-width-7.html
+           fast/text/system-font-width-8.html
+           fast/text/system-font-width-9.html
+           fast/text/system-font-width.html
+    
+    * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
+    (WebCore::SystemFontDatabaseCoreText::createSystemUIFont):
+    (WebCore::SystemFontDatabaseCoreText::createSystemDesignFont):
+    (WebCore::SystemFontDatabaseCoreText::createTextStyleFont):
+    (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightWidthItalicsAndFallbackBehavior):
+    (WebCore::mapWeight):
+    (WebCore::mapWidth):
+    (WebCore::SystemFontDatabaseCoreText::systemFontParameters):
+    (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightItalicsAndFallbackBehavior): Deleted.
+    * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
+    (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::operator== const):
+    (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::hash const):
+    
+    Source/WebCore/PAL:
+    
+    * pal/spi/cocoa/CoreTextSPI.h:
+    
+    Source/WTF:
+    
+    * wtf/PlatformHave.h:
+    
+    LayoutTests:
+    
+    * fast/text/system-font-width-2-expected-mismatch.html: Added.
+    * fast/text/system-font-width-2.html: Added.
+    * fast/text/system-font-width-3-expected-mismatch.html: Added.
+    * fast/text/system-font-width-3.html: Added.
+    * fast/text/system-font-width-4-expected-mismatch.html: Added.
+    * fast/text/system-font-width-4.html: Added.
+    * fast/text/system-font-width-5-expected.html: Added.
+    * fast/text/system-font-width-5.html: Added.
+    * fast/text/system-font-width-6-expected-mismatch.html: Added.
+    * fast/text/system-font-width-6.html: Added.
+    * fast/text/system-font-width-7-expected-mismatch.html: Added.
+    * fast/text/system-font-width-7.html: Added.
+    * fast/text/system-font-width-8-expected-mismatch.html: Added.
+    * fast/text/system-font-width-8.html: Added.
+    * fast/text/system-font-width-9-expected-mismatch.html: Added.
+    * fast/text/system-font-width-9.html: Added.
+    * fast/text/system-font-width-expected-mismatch.html: Added.
+    * fast/text/system-font-width.html: Added.
+    * platform/ios/TestExpectations:
+    * platform/mac/TestExpectations:
+    * platform/win/TestExpectations:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-29  Myles C. Maxfield  <[email protected]>
+
+            font-stretch is not applied to system-ui
+            https://bugs.webkit.org/show_bug.cgi?id=221103
+            <rdar://problem/73719139>
+
+            Reviewed by Darin Adler.
+
+            * fast/text/system-font-width-2-expected-mismatch.html: Added.
+            * fast/text/system-font-width-2.html: Added.
+            * fast/text/system-font-width-3-expected-mismatch.html: Added.
+            * fast/text/system-font-width-3.html: Added.
+            * fast/text/system-font-width-4-expected-mismatch.html: Added.
+            * fast/text/system-font-width-4.html: Added.
+            * fast/text/system-font-width-5-expected.html: Added.
+            * fast/text/system-font-width-5.html: Added.
+            * fast/text/system-font-width-6-expected-mismatch.html: Added.
+            * fast/text/system-font-width-6.html: Added.
+            * fast/text/system-font-width-7-expected-mismatch.html: Added.
+            * fast/text/system-font-width-7.html: Added.
+            * fast/text/system-font-width-8-expected-mismatch.html: Added.
+            * fast/text/system-font-width-8.html: Added.
+            * fast/text/system-font-width-9-expected-mismatch.html: Added.
+            * fast/text/system-font-width-9.html: Added.
+            * fast/text/system-font-width-expected-mismatch.html: Added.
+            * fast/text/system-font-width.html: Added.
+            * platform/ios/TestExpectations:
+            * platform/mac/TestExpectations:
+            * platform/win/TestExpectations:
+
+2021-02-02  Alan Coon  <[email protected]>
+
         Cherry-pick r272024. rdar://problem/73847822
 
     AX: Long narrow tables should not be made in data tables unnecessarily

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-2-expected-mismatch.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-2-expected-mismatch.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-2-expected-mismatch.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-2.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-2.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-2.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: extra-condensed 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-3-expected-mismatch.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-3-expected-mismatch.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-3-expected-mismatch.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-3.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-3.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-3.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: condensed 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-4-expected-mismatch.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-4-expected-mismatch.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-4-expected-mismatch.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-4.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-4.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-4.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: semi-condensed 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-5-expected.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-5-expected.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-5-expected.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-5.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-5.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-5.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: normal 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-6-expected-mismatch.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-6-expected-mismatch.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-6-expected-mismatch.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-6.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-6.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-6.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: semi-expanded 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-7-expected-mismatch.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-7-expected-mismatch.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-7-expected-mismatch.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-7.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-7.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-7.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: expanded 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-8-expected-mismatch.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-8-expected-mismatch.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-8-expected-mismatch.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-8.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-8.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-8.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: extra-expanded 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-9-expected-mismatch.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-9-expected-mismatch.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-9-expected-mismatch.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-9.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-9.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-9.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: ultra-expanded 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width-expected-mismatch.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width-expected-mismatch.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width-expected-mismatch.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: 48px system-ui;">Hellohello</div>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/text/system-font-width.html (0 => 272288)


--- branches/safari-611-branch/LayoutTests/fast/text/system-font-width.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/text/system-font-width.html	2021-02-03 01:41:53 UTC (rev 272288)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="font: ultra-condensed 48px system-ui;">Hellohello</div>
+</body>
+</html>

Modified: branches/safari-611-branch/LayoutTests/platform/ios/TestExpectations (272287 => 272288)


--- branches/safari-611-branch/LayoutTests/platform/ios/TestExpectations	2021-02-03 01:41:44 UTC (rev 272287)
+++ branches/safari-611-branch/LayoutTests/platform/ios/TestExpectations	2021-02-03 01:41:53 UTC (rev 272288)
@@ -3484,3 +3484,9 @@
 
 webkit.org/b/219460 [ Release ] imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation.https.html [ Pass Failure ]
 
+# The system font does not handle all the various width values on iOS.
+fast/text/system-font-width-4.html [ ImageOnlyFailure ]
+fast/text/system-font-width-6.html [ ImageOnlyFailure ]
+fast/text/system-font-width-7.html [ ImageOnlyFailure ]
+fast/text/system-font-width-8.html [ ImageOnlyFailure ]
+fast/text/system-font-width-9.html [ ImageOnlyFailure ]

Modified: branches/safari-611-branch/LayoutTests/platform/mac/TestExpectations (272287 => 272288)


--- branches/safari-611-branch/LayoutTests/platform/mac/TestExpectations	2021-02-03 01:41:44 UTC (rev 272287)
+++ branches/safari-611-branch/LayoutTests/platform/mac/TestExpectations	2021-02-03 01:41:53 UTC (rev 272288)
@@ -2257,3 +2257,18 @@
 
 webkit.org/b/220332 [ BigSur+ ] imported/w3c/web-platform-tests/mimesniff/mime-types/charset-parameter.window.html [ Pass Failure ]
 
+# The system font does not handle all the various width values on older OSes.
+[ BigSur ] fast/text/system-font-width-4.html [ ImageOnlyFailure ]
+[ BigSur ] fast/text/system-font-width-6.html [ ImageOnlyFailure ]
+[ BigSur ] fast/text/system-font-width-7.html [ ImageOnlyFailure ]
+[ BigSur ] fast/text/system-font-width-8.html [ ImageOnlyFailure ]
+[ BigSur ] fast/text/system-font-width-9.html [ ImageOnlyFailure ]
+[ Catalina Mojave ] fast/text/system-font-width.html [ ImageOnlyFailure ]
+[ Catalina Mojave ] fast/text/system-font-width-2.html [ ImageOnlyFailure ]
+[ Catalina Mojave ] fast/text/system-font-width-3.html [ ImageOnlyFailure ]
+[ Catalina Mojave ] fast/text/system-font-width-4.html [ ImageOnlyFailure ]
+[ Catalina Mojave ] fast/text/system-font-width-6.html [ ImageOnlyFailure ]
+[ Catalina Mojave ] fast/text/system-font-width-7.html [ ImageOnlyFailure ]
+[ Catalina Mojave ] fast/text/system-font-width-8.html [ ImageOnlyFailure ]
+[ Catalina Mojave ] fast/text/system-font-width-9.html [ ImageOnlyFailure ]
+

Modified: branches/safari-611-branch/LayoutTests/platform/win/TestExpectations (272287 => 272288)


--- branches/safari-611-branch/LayoutTests/platform/win/TestExpectations	2021-02-03 01:41:44 UTC (rev 272287)
+++ branches/safari-611-branch/LayoutTests/platform/win/TestExpectations	2021-02-03 01:41:53 UTC (rev 272288)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2007-2015 Apple Inc. All rights reserved.
+# Copyright (C) 2007-2021 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -4621,3 +4621,13 @@
 webkit.org/b/220653 webanimations/combining-transform-animations-with-different-acceleration-capabilities-2.html [ Skip ]
 webkit.org/b/220653 webanimations/combining-transform-animations-with-different-acceleration-capabilities-3.html [ Skip ]
 webkit.org/b/220653 webanimations/combining-transform-animations-with-different-acceleration-capabilities.html [ Skip ]
+
+# The system font does not handle all the various width values on Windows.
+fast/text/system-font-width.html [ ImageOnlyFailure ]
+fast/text/system-font-width-2.html [ ImageOnlyFailure ]
+fast/text/system-font-width-3.html [ ImageOnlyFailure ]
+fast/text/system-font-width-4.html [ ImageOnlyFailure ]
+fast/text/system-font-width-6.html [ ImageOnlyFailure ]
+fast/text/system-font-width-7.html [ ImageOnlyFailure ]
+fast/text/system-font-width-8.html [ ImageOnlyFailure ]
+fast/text/system-font-width-9.html [ ImageOnlyFailure ]

Modified: branches/safari-611-branch/Source/WTF/ChangeLog (272287 => 272288)


--- branches/safari-611-branch/Source/WTF/ChangeLog	2021-02-03 01:41:44 UTC (rev 272287)
+++ branches/safari-611-branch/Source/WTF/ChangeLog	2021-02-03 01:41:53 UTC (rev 272288)
@@ -1,5 +1,86 @@
 2021-02-02  Alan Coon  <[email protected]>
 
+        Cherry-pick r272073. rdar://problem/73847891
+
+    font-stretch is not applied to system-ui
+    https://bugs.webkit.org/show_bug.cgi?id=221103
+    <rdar://problem/73719139>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebCore:
+    
+    We just never hooked it up.
+    
+    Tests: fast/text/system-font-width-2.html
+           fast/text/system-font-width-3.html
+           fast/text/system-font-width-4.html
+           fast/text/system-font-width-5.html
+           fast/text/system-font-width-6.html
+           fast/text/system-font-width-7.html
+           fast/text/system-font-width-8.html
+           fast/text/system-font-width-9.html
+           fast/text/system-font-width.html
+    
+    * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
+    (WebCore::SystemFontDatabaseCoreText::createSystemUIFont):
+    (WebCore::SystemFontDatabaseCoreText::createSystemDesignFont):
+    (WebCore::SystemFontDatabaseCoreText::createTextStyleFont):
+    (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightWidthItalicsAndFallbackBehavior):
+    (WebCore::mapWeight):
+    (WebCore::mapWidth):
+    (WebCore::SystemFontDatabaseCoreText::systemFontParameters):
+    (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightItalicsAndFallbackBehavior): Deleted.
+    * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
+    (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::operator== const):
+    (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::hash const):
+    
+    Source/WebCore/PAL:
+    
+    * pal/spi/cocoa/CoreTextSPI.h:
+    
+    Source/WTF:
+    
+    * wtf/PlatformHave.h:
+    
+    LayoutTests:
+    
+    * fast/text/system-font-width-2-expected-mismatch.html: Added.
+    * fast/text/system-font-width-2.html: Added.
+    * fast/text/system-font-width-3-expected-mismatch.html: Added.
+    * fast/text/system-font-width-3.html: Added.
+    * fast/text/system-font-width-4-expected-mismatch.html: Added.
+    * fast/text/system-font-width-4.html: Added.
+    * fast/text/system-font-width-5-expected.html: Added.
+    * fast/text/system-font-width-5.html: Added.
+    * fast/text/system-font-width-6-expected-mismatch.html: Added.
+    * fast/text/system-font-width-6.html: Added.
+    * fast/text/system-font-width-7-expected-mismatch.html: Added.
+    * fast/text/system-font-width-7.html: Added.
+    * fast/text/system-font-width-8-expected-mismatch.html: Added.
+    * fast/text/system-font-width-8.html: Added.
+    * fast/text/system-font-width-9-expected-mismatch.html: Added.
+    * fast/text/system-font-width-9.html: Added.
+    * fast/text/system-font-width-expected-mismatch.html: Added.
+    * fast/text/system-font-width.html: Added.
+    * platform/ios/TestExpectations:
+    * platform/mac/TestExpectations:
+    * platform/win/TestExpectations:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-29  Myles C. Maxfield  <[email protected]>
+
+            font-stretch is not applied to system-ui
+            https://bugs.webkit.org/show_bug.cgi?id=221103
+            <rdar://problem/73719139>
+
+            Reviewed by Darin Adler.
+
+            * wtf/PlatformHave.h:
+
+2021-02-02  Alan Coon  <[email protected]>
+
         Cherry-pick r271926. rdar://problem/73889676
 
     REGRESSION(r267641): WebKitDeveloperExtras preference has no effect for WebKitLegacy clients

Modified: branches/safari-611-branch/Source/WTF/wtf/PlatformHave.h (272287 => 272288)


--- branches/safari-611-branch/Source/WTF/wtf/PlatformHave.h	2021-02-03 01:41:44 UTC (rev 272287)
+++ branches/safari-611-branch/Source/WTF/wtf/PlatformHave.h	2021-02-03 01:41:53 UTC (rev 272288)
@@ -819,3 +819,15 @@
     || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140400)
 #define HAVE_AVCONTENTKEYREQUEST_PENDING_PROTECTION_STATUS 1
 #endif
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000) \
+    || ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000) \
+    || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 80000) \
+    || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 150000)
+#define HAVE_LEVEL_3_SYSTEM_FONT_WIDTH_VALUES 1
+#elif (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000) \
+    || ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000) \
+    || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 70000) \
+    || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 140000)
+#define HAVE_LEVEL_2_SYSTEM_FONT_WIDTH_VALUES 1
+#endif

Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (272287 => 272288)


--- branches/safari-611-branch/Source/WebCore/ChangeLog	2021-02-03 01:41:44 UTC (rev 272287)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog	2021-02-03 01:41:53 UTC (rev 272288)
@@ -1,5 +1,109 @@
 2021-02-02  Alan Coon  <[email protected]>
 
+        Cherry-pick r272073. rdar://problem/73847891
+
+    font-stretch is not applied to system-ui
+    https://bugs.webkit.org/show_bug.cgi?id=221103
+    <rdar://problem/73719139>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebCore:
+    
+    We just never hooked it up.
+    
+    Tests: fast/text/system-font-width-2.html
+           fast/text/system-font-width-3.html
+           fast/text/system-font-width-4.html
+           fast/text/system-font-width-5.html
+           fast/text/system-font-width-6.html
+           fast/text/system-font-width-7.html
+           fast/text/system-font-width-8.html
+           fast/text/system-font-width-9.html
+           fast/text/system-font-width.html
+    
+    * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
+    (WebCore::SystemFontDatabaseCoreText::createSystemUIFont):
+    (WebCore::SystemFontDatabaseCoreText::createSystemDesignFont):
+    (WebCore::SystemFontDatabaseCoreText::createTextStyleFont):
+    (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightWidthItalicsAndFallbackBehavior):
+    (WebCore::mapWeight):
+    (WebCore::mapWidth):
+    (WebCore::SystemFontDatabaseCoreText::systemFontParameters):
+    (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightItalicsAndFallbackBehavior): Deleted.
+    * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
+    (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::operator== const):
+    (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::hash const):
+    
+    Source/WebCore/PAL:
+    
+    * pal/spi/cocoa/CoreTextSPI.h:
+    
+    Source/WTF:
+    
+    * wtf/PlatformHave.h:
+    
+    LayoutTests:
+    
+    * fast/text/system-font-width-2-expected-mismatch.html: Added.
+    * fast/text/system-font-width-2.html: Added.
+    * fast/text/system-font-width-3-expected-mismatch.html: Added.
+    * fast/text/system-font-width-3.html: Added.
+    * fast/text/system-font-width-4-expected-mismatch.html: Added.
+    * fast/text/system-font-width-4.html: Added.
+    * fast/text/system-font-width-5-expected.html: Added.
+    * fast/text/system-font-width-5.html: Added.
+    * fast/text/system-font-width-6-expected-mismatch.html: Added.
+    * fast/text/system-font-width-6.html: Added.
+    * fast/text/system-font-width-7-expected-mismatch.html: Added.
+    * fast/text/system-font-width-7.html: Added.
+    * fast/text/system-font-width-8-expected-mismatch.html: Added.
+    * fast/text/system-font-width-8.html: Added.
+    * fast/text/system-font-width-9-expected-mismatch.html: Added.
+    * fast/text/system-font-width-9.html: Added.
+    * fast/text/system-font-width-expected-mismatch.html: Added.
+    * fast/text/system-font-width.html: Added.
+    * platform/ios/TestExpectations:
+    * platform/mac/TestExpectations:
+    * platform/win/TestExpectations:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-29  Myles C. Maxfield  <[email protected]>
+
+            font-stretch is not applied to system-ui
+            https://bugs.webkit.org/show_bug.cgi?id=221103
+            <rdar://problem/73719139>
+
+            Reviewed by Darin Adler.
+
+            We just never hooked it up.
+
+            Tests: fast/text/system-font-width-2.html
+                   fast/text/system-font-width-3.html
+                   fast/text/system-font-width-4.html
+                   fast/text/system-font-width-5.html
+                   fast/text/system-font-width-6.html
+                   fast/text/system-font-width-7.html
+                   fast/text/system-font-width-8.html
+                   fast/text/system-font-width-9.html
+                   fast/text/system-font-width.html
+
+            * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
+            (WebCore::SystemFontDatabaseCoreText::createSystemUIFont):
+            (WebCore::SystemFontDatabaseCoreText::createSystemDesignFont):
+            (WebCore::SystemFontDatabaseCoreText::createTextStyleFont):
+            (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightWidthItalicsAndFallbackBehavior):
+            (WebCore::mapWeight):
+            (WebCore::mapWidth):
+            (WebCore::SystemFontDatabaseCoreText::systemFontParameters):
+            (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightItalicsAndFallbackBehavior): Deleted.
+            * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
+            (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::operator== const):
+            (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::hash const):
+
+2021-02-02  Alan Coon  <[email protected]>
+
         Cherry-pick r272024. rdar://problem/73847822
 
     AX: Long narrow tables should not be made in data tables unnecessarily

Modified: branches/safari-611-branch/Source/WebCore/PAL/ChangeLog (272287 => 272288)


--- branches/safari-611-branch/Source/WebCore/PAL/ChangeLog	2021-02-03 01:41:44 UTC (rev 272287)
+++ branches/safari-611-branch/Source/WebCore/PAL/ChangeLog	2021-02-03 01:41:53 UTC (rev 272288)
@@ -1,3 +1,84 @@
+2021-02-02  Alan Coon  <[email protected]>
+
+        Cherry-pick r272073. rdar://problem/73847891
+
+    font-stretch is not applied to system-ui
+    https://bugs.webkit.org/show_bug.cgi?id=221103
+    <rdar://problem/73719139>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebCore:
+    
+    We just never hooked it up.
+    
+    Tests: fast/text/system-font-width-2.html
+           fast/text/system-font-width-3.html
+           fast/text/system-font-width-4.html
+           fast/text/system-font-width-5.html
+           fast/text/system-font-width-6.html
+           fast/text/system-font-width-7.html
+           fast/text/system-font-width-8.html
+           fast/text/system-font-width-9.html
+           fast/text/system-font-width.html
+    
+    * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
+    (WebCore::SystemFontDatabaseCoreText::createSystemUIFont):
+    (WebCore::SystemFontDatabaseCoreText::createSystemDesignFont):
+    (WebCore::SystemFontDatabaseCoreText::createTextStyleFont):
+    (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightWidthItalicsAndFallbackBehavior):
+    (WebCore::mapWeight):
+    (WebCore::mapWidth):
+    (WebCore::SystemFontDatabaseCoreText::systemFontParameters):
+    (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightItalicsAndFallbackBehavior): Deleted.
+    * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
+    (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::operator== const):
+    (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::hash const):
+    
+    Source/WebCore/PAL:
+    
+    * pal/spi/cocoa/CoreTextSPI.h:
+    
+    Source/WTF:
+    
+    * wtf/PlatformHave.h:
+    
+    LayoutTests:
+    
+    * fast/text/system-font-width-2-expected-mismatch.html: Added.
+    * fast/text/system-font-width-2.html: Added.
+    * fast/text/system-font-width-3-expected-mismatch.html: Added.
+    * fast/text/system-font-width-3.html: Added.
+    * fast/text/system-font-width-4-expected-mismatch.html: Added.
+    * fast/text/system-font-width-4.html: Added.
+    * fast/text/system-font-width-5-expected.html: Added.
+    * fast/text/system-font-width-5.html: Added.
+    * fast/text/system-font-width-6-expected-mismatch.html: Added.
+    * fast/text/system-font-width-6.html: Added.
+    * fast/text/system-font-width-7-expected-mismatch.html: Added.
+    * fast/text/system-font-width-7.html: Added.
+    * fast/text/system-font-width-8-expected-mismatch.html: Added.
+    * fast/text/system-font-width-8.html: Added.
+    * fast/text/system-font-width-9-expected-mismatch.html: Added.
+    * fast/text/system-font-width-9.html: Added.
+    * fast/text/system-font-width-expected-mismatch.html: Added.
+    * fast/text/system-font-width.html: Added.
+    * platform/ios/TestExpectations:
+    * platform/mac/TestExpectations:
+    * platform/win/TestExpectations:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272073 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-29  Myles C. Maxfield  <[email protected]>
+
+            font-stretch is not applied to system-ui
+            https://bugs.webkit.org/show_bug.cgi?id=221103
+            <rdar://problem/73719139>
+
+            Reviewed by Darin Adler.
+
+            * pal/spi/cocoa/CoreTextSPI.h:
+
 2021-01-25  Alan Coon  <[email protected]>
 
         Cherry-pick r271417. rdar://problem/73376369

Modified: branches/safari-611-branch/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h (272287 => 272288)


--- branches/safari-611-branch/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h	2021-02-03 01:41:44 UTC (rev 272287)
+++ branches/safari-611-branch/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h	2021-02-03 01:41:53 UTC (rev 272288)
@@ -179,6 +179,17 @@
 extern const CGFloat kCTFontWeightHeavy;
 extern const CGFloat kCTFontWeightBlack;
 
+extern const CGFloat kCTFontWidthUltraCompressed;
+extern const CGFloat kCTFontWidthExtraCompressed;
+extern const CGFloat kCTFontWidthCompressed;
+extern const CGFloat kCTFontWidthExtraCondensed;
+extern const CGFloat kCTFontWidthCondensed;
+extern const CGFloat kCTFontWidthSemiCondensed;
+extern const CGFloat kCTFontWidthStandard;
+extern const CGFloat kCTFontWidthSemiExpanded;
+extern const CGFloat kCTFontWidthExpanded;
+extern const CGFloat kCTFontWidthExtraExpanded;
+
 extern const CFStringRef kCTUIFontTextStyleTitle0;
 extern const CFStringRef kCTUIFontTextStyleTitle1;
 extern const CFStringRef kCTUIFontTextStyleTitle2;

Modified: branches/safari-611-branch/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp (272287 => 272288)


--- branches/safari-611-branch/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp	2021-02-03 01:41:44 UTC (rev 272287)
+++ branches/safari-611-branch/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp	2021-02-03 01:41:53 UTC (rev 272288)
@@ -54,7 +54,7 @@
         locale = nullptr;
     auto result = adoptCF(CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, parameters.size, locale));
     ASSERT(result);
-    return createFontByApplyingWeightItalicsAndFallbackBehavior(result.get(), parameters.weight, parameters.italic, parameters.size, parameters.allowUserInstalledFonts);
+    return createFontByApplyingWeightWidthItalicsAndFallbackBehavior(result.get(), parameters.weight, parameters.width, parameters.italic, parameters.size, parameters.allowUserInstalledFonts);
 }
 
 #if HAVE(DESIGN_SYSTEM_UI_FONTS)
@@ -74,7 +74,7 @@
     default:
         ASSERT_NOT_REACHED();
     }
-    return createFontByApplyingWeightItalicsAndFallbackBehavior(nullptr, parameters.weight, parameters.italic, parameters.size, parameters.allowUserInstalledFonts, design);
+    return createFontByApplyingWeightWidthItalicsAndFallbackBehavior(nullptr, parameters.weight, parameters.width, parameters.italic, parameters.size, parameters.allowUserInstalledFonts, design);
 }
 #endif
 
@@ -81,8 +81,16 @@
 RetainPtr<CTFontRef> SystemFontDatabaseCoreText::createTextStyleFont(const CascadeListParameters& parameters)
 {
     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);
+    // FIXME: Use createFontByApplyingWeightWidthItalicsAndFallbackBehavior().
+    CTFontSymbolicTraits traits = (parameters.weight >= kCTFontWeightSemibold ? kCTFontTraitBold : 0)
+#if HAVE(LEVEL_2_SYSTEM_FONT_WIDTH_VALUES) || HAVE(LEVEL_3_SYSTEM_FONT_WIDTH_VALUES)
+        | (parameters.width >= kCTFontWidthSemiExpanded ? kCTFontTraitExpanded : 0)
+        | (parameters.width <= kCTFontWidthSemiCondensed ? kCTFontTraitCondensed : 0)
+#else
+        | (parameters.width >= kCTFontWidthExpanded ? kCTFontTraitExpanded : 0)
+        | (parameters.width <= kCTFontWidthCondensed ? kCTFontTraitCondensed : 0)
+#endif
+        | (parameters.italic ? kCTFontTraitItalic : 0);
     if (traits)
         descriptor = adoptCF(CTFontDescriptorCreateCopyWithSymbolicTraits(descriptor.get(), traits, traits));
     return createFontForInstalledFonts(descriptor.get(), parameters.size, parameters.allowUserInstalledFonts);
@@ -126,14 +134,15 @@
     m_monospaceFamilies.clear();
 }
 
-RetainPtr<CTFontRef> SystemFontDatabaseCoreText::createFontByApplyingWeightItalicsAndFallbackBehavior(CTFontRef font, CGFloat weight, bool italic, float size, AllowUserInstalledFonts allowUserInstalledFonts, CFStringRef design)
+RetainPtr<CTFontRef> SystemFontDatabaseCoreText::createFontByApplyingWeightWidthItalicsAndFallbackBehavior(CTFontRef font, CGFloat weight, CGFloat width, bool italic, float size, AllowUserInstalledFonts allowUserInstalledFonts, CFStringRef design)
 {
     auto weightNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &weight));
+    auto widthNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &width));
     const float systemFontItalicSlope = 0.07;
     float italicsRawNumber = italic ? systemFontItalicSlope : 0;
     auto italicsNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &italicsRawNumber));
-    CFTypeRef traitsKeys[] = { kCTFontWeightTrait, kCTFontSlantTrait, kCTFontUIFontDesignTrait };
-    CFTypeRef traitsValues[] = { weightNumber.get(), italicsNumber.get(), design ? static_cast<CFTypeRef>(design) : static_cast<CFTypeRef>(kCTFontUIFontDesignDefault) };
+    CFTypeRef traitsKeys[] = { kCTFontWeightTrait, kCTFontWidthTrait, kCTFontSlantTrait, kCTFontUIFontDesignTrait };
+    CFTypeRef traitsValues[] = { weightNumber.get(), widthNumber.get(), italicsNumber.get(), design ? static_cast<CFTypeRef>(design) : static_cast<CFTypeRef>(kCTFontUIFontDesignDefault) };
     auto traitsDictionary = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, traitsKeys, traitsValues, WTF_ARRAY_LENGTH(traitsKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
     auto attributes = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
     CFDictionaryAddValue(attributes.get(), kCTFontTraitsAttribute, traitsDictionary.get());
@@ -170,6 +179,66 @@
     return result;
 }
 
+static CGFloat mapWeight(FontSelectionValue weight)
+{
+    if (weight < FontSelectionValue(150))
+        return kCTFontWeightUltraLight;
+    if (weight < FontSelectionValue(250))
+        return kCTFontWeightThin;
+    if (weight < FontSelectionValue(350))
+        return kCTFontWeightLight;
+    if (weight < FontSelectionValue(450))
+        return kCTFontWeightRegular;
+    if (weight < FontSelectionValue(550))
+        return kCTFontWeightMedium;
+    if (weight < FontSelectionValue(650))
+        return kCTFontWeightSemibold;
+    if (weight < FontSelectionValue(750))
+        return kCTFontWeightBold;
+    if (weight < FontSelectionValue(850))
+        return kCTFontWeightHeavy;
+    return kCTFontWeightBlack;
+}
+
+static CGFloat mapWidth(FontSelectionValue width)
+{
+    struct {
+        FontSelectionValue input;
+        CGFloat output;
+    } piecewisePoints[] = {
+#if HAVE(LEVEL_3_SYSTEM_FONT_WIDTH_VALUES)
+        {FontSelectionValue(37.5f), kCTFontWidthUltraCompressed},
+        {FontSelectionValue(50), kCTFontWidthExtraCompressed}, // ultra condensed
+        {FontSelectionValue(62.5f), kCTFontWidthExtraCondensed},
+        {FontSelectionValue(75), kCTFontWidthCondensed},
+        {FontSelectionValue(87.5f), kCTFontWidthSemiCondensed},
+        {FontSelectionValue(100), kCTFontWidthStandard},
+        {FontSelectionValue(112.5f), kCTFontWidthSemiExpanded},
+        {FontSelectionValue(125), kCTFontWidthExpanded},
+        {FontSelectionValue(150), kCTFontWidthExtraExpanded},
+#elif HAVE(LEVEL_2_SYSTEM_FONT_WIDTH_VALUES)
+        {FontSelectionValue(62.5f), kCTFontWidthExtraCondensed},
+        {FontSelectionValue(75), kCTFontWidthCondensed},
+        {FontSelectionValue(87.5f), kCTFontWidthSemiCondensed},
+        {FontSelectionValue(100), kCTFontWidthStandard},
+        {FontSelectionValue(112.5f), kCTFontWidthSemiExpanded},
+        {FontSelectionValue(125), kCTFontWidthExpanded}
+#else // level 1
+        {FontSelectionValue(75), kCTFontWidthCondensed},
+        {FontSelectionValue(100), kCTFontWidthStandard},
+        {FontSelectionValue(125), kCTFontWidthExpanded}
+#endif
+    };
+    for (size_t i = 0; i < std::size(piecewisePoints) - 1; ++i) {
+        auto& previous = piecewisePoints[i];
+        auto& next = piecewisePoints[i + 1];
+        auto middleInput = (previous.input + next.input) / 2;
+        if (width < middleInput)
+            return previous.output;
+    }
+    return piecewisePoints[std::size(piecewisePoints) - 1].output;
+}
+
 SystemFontDatabaseCoreText::CascadeListParameters SystemFontDatabaseCoreText::systemFontParameters(const FontDescription& description, const AtomString& familyName, SystemFontKind systemFontKind, AllowUserInstalledFonts allowUserInstalledFonts)
 {
     CascadeListParameters result;
@@ -182,24 +251,8 @@
     if (FontCache::singleton().shouldMockBoldSystemFontForAccessibility())
         weight = weight + FontSelectionValue(200);
 
-    if (weight < FontSelectionValue(150))
-        result.weight = kCTFontWeightUltraLight;
-    else if (weight < FontSelectionValue(250))
-        result.weight = kCTFontWeightThin;
-    else if (weight < FontSelectionValue(350))
-        result.weight = kCTFontWeightLight;
-    else if (weight < FontSelectionValue(450))
-        result.weight = kCTFontWeightRegular;
-    else if (weight < FontSelectionValue(550))
-        result.weight = kCTFontWeightMedium;
-    else if (weight < FontSelectionValue(650))
-        result.weight = kCTFontWeightSemibold;
-    else if (weight < FontSelectionValue(750))
-        result.weight = kCTFontWeightBold;
-    else if (weight < FontSelectionValue(850))
-        result.weight = kCTFontWeightHeavy;
-    else
-        result.weight = kCTFontWeightBlack;
+    result.weight = mapWeight(weight);
+    result.width = mapWidth(description.stretch());
 
     switch (systemFontKind) {
     case SystemFontKind::SystemUI: {

Modified: branches/safari-611-branch/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h (272287 => 272288)


--- branches/safari-611-branch/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h	2021-02-03 01:41:44 UTC (rev 272287)
+++ branches/safari-611-branch/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h	2021-02-03 01:41:53 UTC (rev 272288)
@@ -64,6 +64,7 @@
             return fontName == other.fontName
                 && locale == other.locale
                 && weight == other.weight
+                && width == other.width
                 && size == other.size
                 && allowUserInstalledFonts == other.allowUserInstalledFonts
                 && italic == other.italic;
@@ -76,6 +77,7 @@
             hasher.add(locale.existingHash());
             hasher.add(locale.isNull() ? 0 : locale.existingHash());
             hasher.add(weight);
+            hasher.add(width);
             hasher.add(size);
             hasher.add(static_cast<unsigned>(allowUserInstalledFonts));
             hasher.add(italic);
@@ -97,6 +99,7 @@
         AtomString fontName;
         AtomString locale;
         CGFloat weight { 0 };
+        CGFloat width { 0 };
         float size { 0 };
         AllowUserInstalledFonts allowUserInstalledFonts { AllowUserInstalledFonts::No };
         bool italic { false };
@@ -123,7 +126,7 @@
     RetainPtr<CTFontRef> createSystemDesignFont(SystemFontKind, const CascadeListParameters&);
     RetainPtr<CTFontRef> createTextStyleFont(const CascadeListParameters&);
 
-    static RetainPtr<CTFontRef> createFontByApplyingWeightItalicsAndFallbackBehavior(CTFontRef, CGFloat weight, bool italic, float size, AllowUserInstalledFonts, CFStringRef design = nullptr);
+    static RetainPtr<CTFontRef> createFontByApplyingWeightWidthItalicsAndFallbackBehavior(CTFontRef, CGFloat weight, CGFloat width, bool italic, float size, AllowUserInstalledFonts, CFStringRef design = nullptr);
     static RetainPtr<CTFontDescriptorRef> removeCascadeList(CTFontDescriptorRef);
     static Vector<RetainPtr<CTFontDescriptorRef>> computeCascadeList(CTFontRef, CFStringRef locale);
     static CascadeListParameters systemFontParameters(const FontDescription&, const AtomString& familyName, SystemFontKind, AllowUserInstalledFonts);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to