Changeset 247566 in webkit
- Timestamp:
- Jul 18, 2019 11:34:29 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r247564 r247566 1 2019-07-18 Youenn Fablet <youenn@apple.com> 2 3 Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts 4 https://bugs.webkit.org/show_bug.cgi?id=199769 5 <rdar://problem/49390297> 6 7 Reviewed by Myles C. Maxfield. 8 9 Tests require WTR and recent MacOS, hence why they are disabled elsewhere. 10 11 * TestExpectations: 12 * platform/mac-wk2/TestExpectations: 13 * fast/text/user-installed-fonts/extended-character-expected.html: Added. 14 * fast/text/user-installed-fonts/extended-character-with-user-font-expected-mismatch.html: Added. 15 * fast/text/user-installed-fonts/extended-character-with-user-font.html: Added. 16 * fast/text/user-installed-fonts/extended-character.html: Added. 17 1 18 2019-07-18 Truitt Savell <tsavell@apple.com> 2 19 -
trunk/LayoutTests/TestExpectations
r247528 r247566 1669 1669 webkit.org/b/190626 imported/w3c/web-platform-tests/html/semantics/forms/the-datalist-element/datalistoptions.html [ Failure ] 1670 1670 webkit.org/b/190613 imported/blink/fast/forms/datalist/slider-appearance-with-ticks-crash.html [ Skip ] 1671 1672 # Tests require WTR and disabling of user installed fonts. Reenabling them in supported platforms 1673 fast/text/user-installed-fonts/extended-character.html [ Skip ] 1674 fast/text/user-installed-fonts/extended-character-with-user-font.html [ Skip ] 1671 1675 1672 1676 # Does timeout -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r247528 r247566 774 774 webkit.org/b/185994 fast/text/user-installed-fonts/shadow-postscript-family.html [ Pass ImageOnlyFailure ] 775 775 776 # Reenabled tests for supported platforms 777 [ Mojave+ ] fast/text/user-installed-fonts/extended-character.html [ Pass ] 778 [ Mojave+ ] fast/text/user-installed-fonts/extended-character-with-user-font.html [ Pass ] 779 776 780 # <rdar://problem/25010307> 777 781 [ HighSierra+ ] http/tests/ssl/applepay/ApplePayError.html [ Pass ] -
trunk/Source/WTF/ChangeLog
r247542 r247566 1 2019-07-18 Youenn Fablet <youenn@apple.com> 2 3 Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts 4 https://bugs.webkit.org/show_bug.cgi?id=199769 5 <rdar://problem/49390297> 6 7 Reviewed by Myles C. Maxfield. 8 9 * wtf/Platform.h: 10 1 11 2019-07-17 Christopher Reid <chris.reid@sony.com> 2 12 -
trunk/Source/WTF/wtf/Platform.h
r247482 r247566 1537 1537 #endif 1538 1538 1539 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || PLATFORM(IOS_FAMILY) 1540 #define HAVE_DISALLOWABLE_USER_INSTALLED_FONTS 1 1541 #endif 1542 1539 1543 #if PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000 1540 1544 #define HAVE_ARKIT_QUICK_LOOK_PREVIEW_ITEM 1 -
trunk/Source/WebCore/ChangeLog
r247562 r247566 1 2019-07-18 Youenn Fablet <youenn@apple.com> 2 3 Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts 4 https://bugs.webkit.org/show_bug.cgi?id=199769 5 <rdar://problem/49390297> 6 7 Reviewed by Myles C. Maxfield. 8 9 When getting a system font, set the appropriate attribute so that it 10 does not fallback to a user initiated font. 11 Add an ASSERT that checks that the font in use is not a user font if 12 policy is to not use user installed fonts. 13 14 Tests: fast/text/user-installed-fonts/extended-character-with-user-font.html 15 fast/text/user-installed-fonts/extended-character.html 16 17 * platform/graphics/Font.h: 18 * platform/graphics/FontCascadeFonts.cpp: 19 (WebCore::FontCascadeFonts::glyphDataForSystemFallback): 20 * platform/graphics/cocoa/FontCacheCoreText.cpp: 21 (WebCore::preparePlatformFont): 22 (WebCore::FontDatabase::singletonAllowingUserInstalledFonts): 23 (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts): 24 (WebCore::addAttributesForInstalledFonts): 25 (WebCore::addAttributesForWebFonts): 26 (WebCore::installedFontMandatoryAttributes): 27 * platform/graphics/mac/SimpleFontDataCoreText.cpp: 28 (WebCore::Font::isUserInstalledFont const): 29 1 30 2019-07-18 Zalan Bujtas <zalan@apple.com> 2 31 -
trunk/Source/WebCore/platform/graphics/Font.h
r245393 r247566 205 205 #endif 206 206 207 #if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS) 208 bool isUserInstalledFont() const; 209 #endif 210 207 211 bool canRenderCombiningCharacterSequence(const UChar*, size_t) const; 208 212 bool applyTransforms(GlyphBufferGlyph*, GlyphBufferAdvance*, size_t glyphCount, bool enableKerning, bool requiresShaping) const; -
trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp
r246490 r247566 350 350 return GlyphData(); 351 351 352 #if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS) 353 ASSERT(!systemFallbackFont->isUserInstalledFont() || description.shouldAllowUserInstalledFonts() == AllowUserInstalledFonts::Yes); 354 #endif 355 352 356 if (systemFallbackShouldBeInvisible) 353 357 systemFallbackFont = const_cast<Font*>(&systemFallbackFont->invisibleFont()); -
trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
r247498 r247566 41 41 42 42 #define HAS_CORE_TEXT_WIDTH_ATTRIBUTE ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)) 43 #define CAN_DISALLOW_USER_INSTALLED_FONTS ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000))44 43 45 44 namespace WebCore { … … 573 572 bool fontFaceDoesntSpecifyVariations = !fontFaceVariantSettings || fontFaceVariantSettings->isAllNormal(); 574 573 if (noFontFeatureSettings && noFontVariationSettings && textRenderingModeIsAuto && variantSettingsIsNormal && dontNeedToApplyOpticalSizing && fontFaceDoesntSpecifyFeatures && fontFaceDoesntSpecifyVariations) 575 return originalFont;574 return createFontForInstalledFonts(originalFont, fontDescription.shouldAllowUserInstalledFonts()); 576 575 577 576 // This algorithm is described at http://www.w3.org/TR/css3-fonts/#feature-precedence … … 688 687 } 689 688 689 addAttributesForInstalledFonts(attributes.get(), fontDescription.shouldAllowUserInstalledFonts()); 690 690 691 auto descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get())); 691 auto result = adoptCF(CTFontCreateCopyWithAttributes(originalFont, CTFontGetSize(originalFont), nullptr, descriptor.get())); 692 return result; 692 return adoptCF(CTFontCreateCopyWithAttributes(originalFont, CTFontGetSize(originalFont), nullptr, descriptor.get())); 693 693 } 694 694 … … 841 841 class FontDatabase { 842 842 public: 843 #if ! CAN_DISALLOW_USER_INSTALLED_FONTS843 #if !HAVE(DISALLOWABLE_USER_INSTALLED_FONTS) 844 844 static FontDatabase& singleton() 845 845 { … … 851 851 static FontDatabase& singletonAllowingUserInstalledFonts() 852 852 { 853 #if CAN_DISALLOW_USER_INSTALLED_FONTS853 #if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS) 854 854 static NeverDestroyed<FontDatabase> database(AllowUserInstalledFonts::Yes); 855 855 return database; … … 861 861 static FontDatabase& singletonDisallowingUserInstalledFonts() 862 862 { 863 #if CAN_DISALLOW_USER_INSTALLED_FONTS863 #if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS) 864 864 static NeverDestroyed<FontDatabase> database(AllowUserInstalledFonts::No); 865 865 return database; … … 875 875 InstalledFont() = default; 876 876 877 InstalledFont(CTFontDescriptorRef fontDescriptor )877 InstalledFont(CTFontDescriptorRef fontDescriptor, AllowUserInstalledFonts allowUserInstalledFonts) 878 878 : fontDescriptor(fontDescriptor) 879 879 , capabilities(capabilitiesForFontDescriptor(fontDescriptor)) 880 880 { 881 if (allowUserInstalledFonts != AllowUserInstalledFonts::No) 882 return; 883 auto attributes = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); 884 addAttributesForInstalledFonts(attributes.get(), allowUserInstalledFonts); 885 this->fontDescriptor = CTFontDescriptorCreateCopyWithAttributes(fontDescriptor, attributes.get()); 881 886 } 882 887 … … 936 941 result.reserveInitialCapacity(count); 937 942 for (CFIndex i = 0; i < count; ++i) { 938 InstalledFont installedFont(static_cast<CTFontDescriptorRef>(CFArrayGetValueAtIndex(matches.get(), i)) );943 InstalledFont installedFont(static_cast<CTFontDescriptorRef>(CFArrayGetValueAtIndex(matches.get(), i)), m_allowUserInstalledFonts); 939 944 result.uncheckedAppend(WTFMove(installedFont)); 940 945 } … … 965 970 auto mandatoryAttributes = installedFontMandatoryAttributes(m_allowUserInstalledFonts); 966 971 auto match = adoptCF(CTFontDescriptorCreateMatchingFontDescriptor(fontDescriptorToMatch.get(), mandatoryAttributes.get())); 967 return InstalledFont(match.get() );972 return InstalledFont(match.get(), m_allowUserInstalledFonts); 968 973 }).iterator->value; 969 974 } … … 1509 1514 void addAttributesForInstalledFonts(CFMutableDictionaryRef attributes, AllowUserInstalledFonts allowUserInstalledFonts) 1510 1515 { 1511 #if CAN_DISALLOW_USER_INSTALLED_FONTS1516 #if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS) 1512 1517 if (allowUserInstalledFonts == AllowUserInstalledFonts::No) { 1513 1518 CFDictionaryAddValue(attributes, kCTFontUserInstalledAttribute, kCFBooleanFalse); … … 1533 1538 } 1534 1539 1540 static inline bool isFontMatchingUserInstalledFontFallback(CTFontRef font, AllowUserInstalledFonts allowUserInstalledFonts) 1541 { 1542 #if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS) 1543 bool willFallbackToSystemOnly = false; 1544 if (auto fontFallbackOptionAttributeRef = adoptCF(static_cast<CFNumberRef>(CTFontCopyAttribute(font, kCTFontFallbackOptionAttribute)))) { 1545 int64_t fontFallbackOptionAttribute; 1546 CFNumberGetValue(fontFallbackOptionAttributeRef.get(), kCFNumberSInt64Type, &fontFallbackOptionAttribute); 1547 willFallbackToSystemOnly = fontFallbackOptionAttribute == kCTFontFallbackOptionSystem; 1548 } 1549 1550 bool shouldFallbackToSystemOnly = allowUserInstalledFonts == AllowUserInstalledFonts::No; 1551 return willFallbackToSystemOnly == shouldFallbackToSystemOnly; 1552 #else 1553 UNUSED_PARAM(font); 1554 UNUSED_PARAM(allowUserInstalledFonts); 1555 return true; 1556 #endif 1557 } 1558 1535 1559 RetainPtr<CTFontRef> createFontForInstalledFonts(CTFontRef font, AllowUserInstalledFonts allowUserInstalledFonts) 1536 1560 { 1561 if (isFontMatchingUserInstalledFontFallback(font, allowUserInstalledFonts)) 1562 return font; 1563 1537 1564 auto attributes = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); 1538 1565 addAttributesForInstalledFonts(attributes.get(), allowUserInstalledFonts); … … 1546 1573 void addAttributesForWebFonts(CFMutableDictionaryRef attributes, AllowUserInstalledFonts allowUserInstalledFonts) 1547 1574 { 1548 #if CAN_DISALLOW_USER_INSTALLED_FONTS1575 #if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS) 1549 1576 if (allowUserInstalledFonts == AllowUserInstalledFonts::No) { 1550 1577 CTFontFallbackOption fallbackOption = kCTFontFallbackOptionSystem; … … 1560 1587 RetainPtr<CFSetRef> installedFontMandatoryAttributes(AllowUserInstalledFonts allowUserInstalledFonts) 1561 1588 { 1562 #if CAN_DISALLOW_USER_INSTALLED_FONTS1589 #if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS) 1563 1590 if (allowUserInstalledFonts == AllowUserInstalledFonts::No) { 1564 1591 CFTypeRef mandatoryAttributesValues[] = { kCTFontFamilyNameAttribute, kCTFontPostScriptNameAttribute, kCTFontEnabledAttribute, kCTFontUserInstalledAttribute, kCTFontFallbackOptionAttribute }; -
trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
r233851 r247566 29 29 30 30 #include <CoreText/CoreText.h> 31 #include <pal/spi/cocoa/CoreTextSPI.h> 31 32 32 33 namespace WebCore { … … 54 55 } 55 56 57 #if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS) 58 bool Font::isUserInstalledFont() const 59 { 60 auto isUserInstalledFont = adoptCF(static_cast<CFBooleanRef>(CTFontCopyAttribute(getCTFont(), kCTFontUserInstalledAttribute))); 61 return isUserInstalledFont && CFBooleanGetValue(isUserInstalledFont.get()); 62 } 63 #endif 64 56 65 } // namespace WebCore -
trunk/Tools/ChangeLog
r247561 r247566 1 2019-07-18 Youenn Fablet <youenn@apple.com> 2 3 Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts 4 https://bugs.webkit.org/show_bug.cgi?id=199769 5 <rdar://problem/49390297> 6 7 Reviewed by Myles C. Maxfield. 8 9 Add a font containing one extended character not found in system fonts. 10 11 * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: 12 * WebKitTestRunner/fonts/FakeHelvetica-SingleExtendedCharacter.ttf: Added. 13 1 14 2019-07-18 Konstantin Tokarev <annulen@yandex.ru> 2 15 -
trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
r241841 r247566 97 97 31DA8A3D1E7205CC00E1DF2F /* IOSLayoutTestCommunication.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3148A0531E6F85B600D3B316 /* IOSLayoutTestCommunication.cpp */; }; 98 98 41C5378E21F13414008B1FAD /* TestWebsiteDataStoreDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41C5378D21F1333C008B1FAD /* TestWebsiteDataStoreDelegate.mm */; }; 99 41D5B62622DD9D36000F4C4A /* FakeHelvetica-SingleExtendedCharacter.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 41D5B62522DD9D36000F4C4A /* FakeHelvetica-SingleExtendedCharacter.ttf */; }; 99 100 4430AE191F82C4FD0099915A /* GeneratedTouchesDebugWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4430AE171F82C4EE0099915A /* GeneratedTouchesDebugWindow.mm */; }; 100 101 51058AD51D678820009A538C /* libWebCoreTestSupport.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 41230E16138C78BF00BCCFCA /* libWebCoreTestSupport.dylib */; }; … … 301 302 41C5378C21F1333C008B1FAD /* TestWebsiteDataStoreDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestWebsiteDataStoreDelegate.h; path = cocoa/TestWebsiteDataStoreDelegate.h; sourceTree = "<group>"; }; 302 303 41C5378D21F1333C008B1FAD /* TestWebsiteDataStoreDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestWebsiteDataStoreDelegate.mm; path = cocoa/TestWebsiteDataStoreDelegate.mm; sourceTree = "<group>"; }; 304 41D5B62522DD9D36000F4C4A /* FakeHelvetica-SingleExtendedCharacter.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "FakeHelvetica-SingleExtendedCharacter.ttf"; path = "fonts/FakeHelvetica-SingleExtendedCharacter.ttf"; sourceTree = "<group>"; }; 303 305 4429FC5E1627089600F66D8B /* WorkQueueManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueueManager.cpp; sourceTree = "<group>"; }; 304 306 4429FC611627089600F66D8B /* WorkQueueManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkQueueManager.h; sourceTree = "<group>"; }; … … 750 752 1CBA02921FD86EA100179C7D /* FakeHelvetica-Helvetica2-400.ttf */, 751 753 1CBA02951FD86EA100179C7D /* FakeHelvetica-Helvetica2-500.ttf */, 754 41D5B62522DD9D36000F4C4A /* FakeHelvetica-SingleExtendedCharacter.ttf */, 752 755 1CA211C71BCA107300B2101F /* FontWithFeatures.otf */, 753 756 1CA211C81BCA107300B2101F /* FontWithFeatures.ttf */, … … 1029 1032 1CBA02971FD87DEE00179C7D /* FakeHelvetica-Helvetica2-400.ttf in Resources */, 1030 1033 1CBA02961FD87DEC00179C7D /* FakeHelvetica-Helvetica2-500.ttf in Resources */, 1034 41D5B62622DD9D36000F4C4A /* FakeHelvetica-SingleExtendedCharacter.ttf in Resources */, 1031 1035 1CA211C91BCA107300B2101F /* FontWithFeatures.otf in Resources */, 1032 1036 1CA211CA1BCA107300B2101F /* FontWithFeatures.ttf in Resources */,
Note: See TracChangeset
for help on using the changeset viewer.