Changeset 272073 in webkit
- Timestamp:
- Jan 29, 2021 12:19:59 PM (18 months ago)
- Location:
- trunk
- Files:
-
- 18 added
- 11 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/text/system-font-width-2-expected-mismatch.html (added)
-
LayoutTests/fast/text/system-font-width-2.html (added)
-
LayoutTests/fast/text/system-font-width-3-expected-mismatch.html (added)
-
LayoutTests/fast/text/system-font-width-3.html (added)
-
LayoutTests/fast/text/system-font-width-4-expected-mismatch.html (added)
-
LayoutTests/fast/text/system-font-width-4.html (added)
-
LayoutTests/fast/text/system-font-width-5-expected.html (added)
-
LayoutTests/fast/text/system-font-width-5.html (added)
-
LayoutTests/fast/text/system-font-width-6-expected-mismatch.html (added)
-
LayoutTests/fast/text/system-font-width-6.html (added)
-
LayoutTests/fast/text/system-font-width-7-expected-mismatch.html (added)
-
LayoutTests/fast/text/system-font-width-7.html (added)
-
LayoutTests/fast/text/system-font-width-8-expected-mismatch.html (added)
-
LayoutTests/fast/text/system-font-width-8.html (added)
-
LayoutTests/fast/text/system-font-width-9-expected-mismatch.html (added)
-
LayoutTests/fast/text/system-font-width-9.html (added)
-
LayoutTests/fast/text/system-font-width-expected-mismatch.html (added)
-
LayoutTests/fast/text/system-font-width.html (added)
-
LayoutTests/platform/ios/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/mac/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/win/TestExpectations (modified) (2 diffs)
-
Source/WTF/ChangeLog (modified) (1 diff)
-
Source/WTF/wtf/PlatformHave.h (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/PAL/ChangeLog (modified) (1 diff)
-
Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp (modified) (6 diffs)
-
Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r272067 r272073 1 2021-01-29 Myles C. Maxfield <mmaxfield@apple.com> 2 3 font-stretch is not applied to system-ui 4 https://bugs.webkit.org/show_bug.cgi?id=221103 5 <rdar://problem/73719139> 6 7 Reviewed by Darin Adler. 8 9 * fast/text/system-font-width-2-expected-mismatch.html: Added. 10 * fast/text/system-font-width-2.html: Added. 11 * fast/text/system-font-width-3-expected-mismatch.html: Added. 12 * fast/text/system-font-width-3.html: Added. 13 * fast/text/system-font-width-4-expected-mismatch.html: Added. 14 * fast/text/system-font-width-4.html: Added. 15 * fast/text/system-font-width-5-expected.html: Added. 16 * fast/text/system-font-width-5.html: Added. 17 * fast/text/system-font-width-6-expected-mismatch.html: Added. 18 * fast/text/system-font-width-6.html: Added. 19 * fast/text/system-font-width-7-expected-mismatch.html: Added. 20 * fast/text/system-font-width-7.html: Added. 21 * fast/text/system-font-width-8-expected-mismatch.html: Added. 22 * fast/text/system-font-width-8.html: Added. 23 * fast/text/system-font-width-9-expected-mismatch.html: Added. 24 * fast/text/system-font-width-9.html: Added. 25 * fast/text/system-font-width-expected-mismatch.html: Added. 26 * fast/text/system-font-width.html: Added. 27 * platform/ios/TestExpectations: 28 * platform/mac/TestExpectations: 29 * platform/win/TestExpectations: 30 1 31 2021-01-29 Andres Gonzalez <andresg_22@apple.com> 2 32 -
trunk/LayoutTests/platform/ios/TestExpectations
r272067 r272073 3487 3487 webkit.org/b/219460 [ Release ] imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-perfect-negotiation.https.html [ Pass Failure ] 3488 3488 3489 # The system font does not handle all the various width values on iOS. 3490 fast/text/system-font-width-4.html [ ImageOnlyFailure ] 3491 fast/text/system-font-width-6.html [ ImageOnlyFailure ] 3492 fast/text/system-font-width-7.html [ ImageOnlyFailure ] 3493 fast/text/system-font-width-8.html [ ImageOnlyFailure ] 3494 fast/text/system-font-width-9.html [ ImageOnlyFailure ] -
trunk/LayoutTests/platform/mac/TestExpectations
r272043 r272073 2257 2257 2258 2258 webkit.org/b/220332 [ BigSur+ ] imported/w3c/web-platform-tests/mimesniff/mime-types/charset-parameter.window.html [ Pass Failure ] 2259 2260 # The system font does not handle all the various width values on older OSes. 2261 [ BigSur ] fast/text/system-font-width-4.html [ ImageOnlyFailure ] 2262 [ BigSur ] fast/text/system-font-width-6.html [ ImageOnlyFailure ] 2263 [ BigSur ] fast/text/system-font-width-7.html [ ImageOnlyFailure ] 2264 [ BigSur ] fast/text/system-font-width-8.html [ ImageOnlyFailure ] 2265 [ BigSur ] fast/text/system-font-width-9.html [ ImageOnlyFailure ] 2266 [ Catalina Mojave ] fast/text/system-font-width.html [ ImageOnlyFailure ] 2267 [ Catalina Mojave ] fast/text/system-font-width-2.html [ ImageOnlyFailure ] 2268 [ Catalina Mojave ] fast/text/system-font-width-3.html [ ImageOnlyFailure ] 2269 [ Catalina Mojave ] fast/text/system-font-width-4.html [ ImageOnlyFailure ] 2270 [ Catalina Mojave ] fast/text/system-font-width-6.html [ ImageOnlyFailure ] 2271 [ Catalina Mojave ] fast/text/system-font-width-7.html [ ImageOnlyFailure ] 2272 [ Catalina Mojave ] fast/text/system-font-width-8.html [ ImageOnlyFailure ] 2273 [ Catalina Mojave ] fast/text/system-font-width-9.html [ ImageOnlyFailure ] -
trunk/LayoutTests/platform/win/TestExpectations
r272067 r272073 1 1 # 2 # Copyright (C) 2007-20 15Apple Inc. All rights reserved.2 # Copyright (C) 2007-2021 Apple Inc. All rights reserved. 3 3 # 4 4 # Redistribution and use in source and binary forms, with or without … … 4625 4625 webkit.org/b/220653 webanimations/combining-transform-animations-with-different-acceleration-capabilities-3.html [ Skip ] 4626 4626 webkit.org/b/220653 webanimations/combining-transform-animations-with-different-acceleration-capabilities.html [ Skip ] 4627 4628 # The system font does not handle all the various width values on Windows. 4629 fast/text/system-font-width.html [ ImageOnlyFailure ] 4630 fast/text/system-font-width-2.html [ ImageOnlyFailure ] 4631 fast/text/system-font-width-3.html [ ImageOnlyFailure ] 4632 fast/text/system-font-width-4.html [ ImageOnlyFailure ] 4633 fast/text/system-font-width-6.html [ ImageOnlyFailure ] 4634 fast/text/system-font-width-7.html [ ImageOnlyFailure ] 4635 fast/text/system-font-width-8.html [ ImageOnlyFailure ] 4636 fast/text/system-font-width-9.html [ ImageOnlyFailure ] -
trunk/Source/WTF/ChangeLog
r272046 r272073 1 2021-01-29 Myles C. Maxfield <mmaxfield@apple.com> 2 3 font-stretch is not applied to system-ui 4 https://bugs.webkit.org/show_bug.cgi?id=221103 5 <rdar://problem/73719139> 6 7 Reviewed by Darin Adler. 8 9 * wtf/PlatformHave.h: 10 1 11 2021-01-28 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/Source/WTF/wtf/PlatformHave.h
r271989 r272073 845 845 #endif 846 846 #endif 847 848 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000) \ 849 || ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000) \ 850 || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 80000) \ 851 || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 150000) 852 #define HAVE_LEVEL_3_SYSTEM_FONT_WIDTH_VALUES 1 853 #elif (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000) \ 854 || ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000) \ 855 || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 70000) \ 856 || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 140000) 857 #define HAVE_LEVEL_2_SYSTEM_FONT_WIDTH_VALUES 1 858 #endif -
trunk/Source/WebCore/ChangeLog
r272067 r272073 1 2021-01-29 Myles C. Maxfield <mmaxfield@apple.com> 2 3 font-stretch is not applied to system-ui 4 https://bugs.webkit.org/show_bug.cgi?id=221103 5 <rdar://problem/73719139> 6 7 Reviewed by Darin Adler. 8 9 We just never hooked it up. 10 11 Tests: fast/text/system-font-width-2.html 12 fast/text/system-font-width-3.html 13 fast/text/system-font-width-4.html 14 fast/text/system-font-width-5.html 15 fast/text/system-font-width-6.html 16 fast/text/system-font-width-7.html 17 fast/text/system-font-width-8.html 18 fast/text/system-font-width-9.html 19 fast/text/system-font-width.html 20 21 * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: 22 (WebCore::SystemFontDatabaseCoreText::createSystemUIFont): 23 (WebCore::SystemFontDatabaseCoreText::createSystemDesignFont): 24 (WebCore::SystemFontDatabaseCoreText::createTextStyleFont): 25 (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightWidthItalicsAndFallbackBehavior): 26 (WebCore::mapWeight): 27 (WebCore::mapWidth): 28 (WebCore::SystemFontDatabaseCoreText::systemFontParameters): 29 (WebCore::SystemFontDatabaseCoreText::createFontByApplyingWeightItalicsAndFallbackBehavior): Deleted. 30 * platform/graphics/cocoa/SystemFontDatabaseCoreText.h: 31 (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::operator== const): 32 (WebCore::SystemFontDatabaseCoreText::CascadeListParameters::hash const): 33 1 34 2021-01-29 Andres Gonzalez <andresg_22@apple.com> 2 35 -
trunk/Source/WebCore/PAL/ChangeLog
r272017 r272073 1 2021-01-29 Myles C. Maxfield <mmaxfield@apple.com> 2 3 font-stretch is not applied to system-ui 4 https://bugs.webkit.org/show_bug.cgi?id=221103 5 <rdar://problem/73719139> 6 7 Reviewed by Darin Adler. 8 9 * pal/spi/cocoa/CoreTextSPI.h: 10 1 11 2021-01-28 Per Arne <pvollan@apple.com> 2 12 -
trunk/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h
r266693 r272073 180 180 extern const CGFloat kCTFontWeightBlack; 181 181 182 extern const CGFloat kCTFontWidthUltraCompressed; 183 extern const CGFloat kCTFontWidthExtraCompressed; 184 extern const CGFloat kCTFontWidthCompressed; 185 extern const CGFloat kCTFontWidthExtraCondensed; 186 extern const CGFloat kCTFontWidthCondensed; 187 extern const CGFloat kCTFontWidthSemiCondensed; 188 extern const CGFloat kCTFontWidthStandard; 189 extern const CGFloat kCTFontWidthSemiExpanded; 190 extern const CGFloat kCTFontWidthExpanded; 191 extern const CGFloat kCTFontWidthExtraExpanded; 192 182 193 extern const CFStringRef kCTUIFontTextStyleTitle0; 183 194 extern const CFStringRef kCTUIFontTextStyleTitle1; -
trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp
r266672 r272073 55 55 auto result = adoptCF(CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, parameters.size, locale)); 56 56 ASSERT(result); 57 return createFontByApplyingWeight ItalicsAndFallbackBehavior(result.get(), parameters.weight, parameters.italic, parameters.size, parameters.allowUserInstalledFonts);57 return createFontByApplyingWeightWidthItalicsAndFallbackBehavior(result.get(), parameters.weight, parameters.width, parameters.italic, parameters.size, parameters.allowUserInstalledFonts); 58 58 } 59 59 … … 75 75 ASSERT_NOT_REACHED(); 76 76 } 77 return createFontByApplyingWeight ItalicsAndFallbackBehavior(nullptr, parameters.weight, parameters.italic, parameters.size, parameters.allowUserInstalledFonts, design);77 return createFontByApplyingWeightWidthItalicsAndFallbackBehavior(nullptr, parameters.weight, parameters.width, parameters.italic, parameters.size, parameters.allowUserInstalledFonts, design); 78 78 } 79 79 #endif … … 82 82 { 83 83 auto descriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(parameters.fontName.string().createCFString().get(), RenderThemeCocoa::singleton().contentSizeCategory(), parameters.locale.string().createCFString().get())); 84 // FIXME: Use createFontByApplyingWeightItalicsAndFallbackBehavior() once <rdar://problem/33046041> is fixed. 85 CTFontSymbolicTraits traits = (parameters.weight >= kCTFontWeightSemibold ? kCTFontTraitBold : 0) | (parameters.italic ? kCTFontTraitItalic : 0); 84 // FIXME: Use createFontByApplyingWeightWidthItalicsAndFallbackBehavior(). 85 CTFontSymbolicTraits traits = (parameters.weight >= kCTFontWeightSemibold ? kCTFontTraitBold : 0) 86 #if HAVE(LEVEL_2_SYSTEM_FONT_WIDTH_VALUES) || HAVE(LEVEL_3_SYSTEM_FONT_WIDTH_VALUES) 87 | (parameters.width >= kCTFontWidthSemiExpanded ? kCTFontTraitExpanded : 0) 88 | (parameters.width <= kCTFontWidthSemiCondensed ? kCTFontTraitCondensed : 0) 89 #else 90 | (parameters.width >= kCTFontWidthExpanded ? kCTFontTraitExpanded : 0) 91 | (parameters.width <= kCTFontWidthCondensed ? kCTFontTraitCondensed : 0) 92 #endif 93 | (parameters.italic ? kCTFontTraitItalic : 0); 86 94 if (traits) 87 95 descriptor = adoptCF(CTFontDescriptorCreateCopyWithSymbolicTraits(descriptor.get(), traits, traits)); … … 127 135 } 128 136 129 RetainPtr<CTFontRef> SystemFontDatabaseCoreText::createFontByApplyingWeight ItalicsAndFallbackBehavior(CTFontRef font, CGFloat weight, bool italic, float size, AllowUserInstalledFonts allowUserInstalledFonts, CFStringRef design)137 RetainPtr<CTFontRef> SystemFontDatabaseCoreText::createFontByApplyingWeightWidthItalicsAndFallbackBehavior(CTFontRef font, CGFloat weight, CGFloat width, bool italic, float size, AllowUserInstalledFonts allowUserInstalledFonts, CFStringRef design) 130 138 { 131 139 auto weightNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &weight)); 140 auto widthNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &width)); 132 141 const float systemFontItalicSlope = 0.07; 133 142 float italicsRawNumber = italic ? systemFontItalicSlope : 0; 134 143 auto italicsNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &italicsRawNumber)); 135 CFTypeRef traitsKeys[] = { kCTFontWeightTrait, kCTFont SlantTrait, kCTFontUIFontDesignTrait };136 CFTypeRef traitsValues[] = { weightNumber.get(), italicsNumber.get(), design ? static_cast<CFTypeRef>(design) : static_cast<CFTypeRef>(kCTFontUIFontDesignDefault) };144 CFTypeRef traitsKeys[] = { kCTFontWeightTrait, kCTFontWidthTrait, kCTFontSlantTrait, kCTFontUIFontDesignTrait }; 145 CFTypeRef traitsValues[] = { weightNumber.get(), widthNumber.get(), italicsNumber.get(), design ? static_cast<CFTypeRef>(design) : static_cast<CFTypeRef>(kCTFontUIFontDesignDefault) }; 137 146 auto traitsDictionary = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, traitsKeys, traitsValues, WTF_ARRAY_LENGTH(traitsKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); 138 147 auto attributes = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); … … 171 180 } 172 181 182 static CGFloat mapWeight(FontSelectionValue weight) 183 { 184 if (weight < FontSelectionValue(150)) 185 return kCTFontWeightUltraLight; 186 if (weight < FontSelectionValue(250)) 187 return kCTFontWeightThin; 188 if (weight < FontSelectionValue(350)) 189 return kCTFontWeightLight; 190 if (weight < FontSelectionValue(450)) 191 return kCTFontWeightRegular; 192 if (weight < FontSelectionValue(550)) 193 return kCTFontWeightMedium; 194 if (weight < FontSelectionValue(650)) 195 return kCTFontWeightSemibold; 196 if (weight < FontSelectionValue(750)) 197 return kCTFontWeightBold; 198 if (weight < FontSelectionValue(850)) 199 return kCTFontWeightHeavy; 200 return kCTFontWeightBlack; 201 } 202 203 static CGFloat mapWidth(FontSelectionValue width) 204 { 205 struct { 206 FontSelectionValue input; 207 CGFloat output; 208 } piecewisePoints[] = { 209 #if HAVE(LEVEL_3_SYSTEM_FONT_WIDTH_VALUES) 210 {FontSelectionValue(37.5f), kCTFontWidthUltraCompressed}, 211 {FontSelectionValue(50), kCTFontWidthExtraCompressed}, // ultra condensed 212 {FontSelectionValue(62.5f), kCTFontWidthExtraCondensed}, 213 {FontSelectionValue(75), kCTFontWidthCondensed}, 214 {FontSelectionValue(87.5f), kCTFontWidthSemiCondensed}, 215 {FontSelectionValue(100), kCTFontWidthStandard}, 216 {FontSelectionValue(112.5f), kCTFontWidthSemiExpanded}, 217 {FontSelectionValue(125), kCTFontWidthExpanded}, 218 {FontSelectionValue(150), kCTFontWidthExtraExpanded}, 219 #elif HAVE(LEVEL_2_SYSTEM_FONT_WIDTH_VALUES) 220 {FontSelectionValue(62.5f), kCTFontWidthExtraCondensed}, 221 {FontSelectionValue(75), kCTFontWidthCondensed}, 222 {FontSelectionValue(87.5f), kCTFontWidthSemiCondensed}, 223 {FontSelectionValue(100), kCTFontWidthStandard}, 224 {FontSelectionValue(112.5f), kCTFontWidthSemiExpanded}, 225 {FontSelectionValue(125), kCTFontWidthExpanded} 226 #else // level 1 227 {FontSelectionValue(75), kCTFontWidthCondensed}, 228 {FontSelectionValue(100), kCTFontWidthStandard}, 229 {FontSelectionValue(125), kCTFontWidthExpanded} 230 #endif 231 }; 232 for (size_t i = 0; i < std::size(piecewisePoints) - 1; ++i) { 233 auto& previous = piecewisePoints[i]; 234 auto& next = piecewisePoints[i + 1]; 235 auto middleInput = (previous.input + next.input) / 2; 236 if (width < middleInput) 237 return previous.output; 238 } 239 return piecewisePoints[std::size(piecewisePoints) - 1].output; 240 } 241 173 242 SystemFontDatabaseCoreText::CascadeListParameters SystemFontDatabaseCoreText::systemFontParameters(const FontDescription& description, const AtomString& familyName, SystemFontKind systemFontKind, AllowUserInstalledFonts allowUserInstalledFonts) 174 243 { … … 183 252 weight = weight + FontSelectionValue(200); 184 253 185 if (weight < FontSelectionValue(150)) 186 result.weight = kCTFontWeightUltraLight; 187 else if (weight < FontSelectionValue(250)) 188 result.weight = kCTFontWeightThin; 189 else if (weight < FontSelectionValue(350)) 190 result.weight = kCTFontWeightLight; 191 else if (weight < FontSelectionValue(450)) 192 result.weight = kCTFontWeightRegular; 193 else if (weight < FontSelectionValue(550)) 194 result.weight = kCTFontWeightMedium; 195 else if (weight < FontSelectionValue(650)) 196 result.weight = kCTFontWeightSemibold; 197 else if (weight < FontSelectionValue(750)) 198 result.weight = kCTFontWeightBold; 199 else if (weight < FontSelectionValue(850)) 200 result.weight = kCTFontWeightHeavy; 201 else 202 result.weight = kCTFontWeightBlack; 254 result.weight = mapWeight(weight); 255 result.width = mapWidth(description.stretch()); 203 256 204 257 switch (systemFontKind) { -
trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h
r252806 r272073 65 65 && locale == other.locale 66 66 && weight == other.weight 67 && width == other.width 67 68 && size == other.size 68 69 && allowUserInstalledFonts == other.allowUserInstalledFonts … … 77 78 hasher.add(locale.isNull() ? 0 : locale.existingHash()); 78 79 hasher.add(weight); 80 hasher.add(width); 79 81 hasher.add(size); 80 82 hasher.add(static_cast<unsigned>(allowUserInstalledFonts)); … … 98 100 AtomString locale; 99 101 CGFloat weight { 0 }; 102 CGFloat width { 0 }; 100 103 float size { 0 }; 101 104 AllowUserInstalledFonts allowUserInstalledFonts { AllowUserInstalledFonts::No }; … … 124 127 RetainPtr<CTFontRef> createTextStyleFont(const CascadeListParameters&); 125 128 126 static RetainPtr<CTFontRef> createFontByApplyingWeight ItalicsAndFallbackBehavior(CTFontRef, CGFloat weight, bool italic, float size, AllowUserInstalledFonts, CFStringRef design = nullptr);129 static RetainPtr<CTFontRef> createFontByApplyingWeightWidthItalicsAndFallbackBehavior(CTFontRef, CGFloat weight, CGFloat width, bool italic, float size, AllowUserInstalledFonts, CFStringRef design = nullptr); 127 130 static RetainPtr<CTFontDescriptorRef> removeCascadeList(CTFontDescriptorRef); 128 131 static Vector<RetainPtr<CTFontDescriptorRef>> computeCascadeList(CTFontRef, CFStringRef locale);
Note: See TracChangeset
for help on using the changeset viewer.