Changeset 247632 in webkit


Ignore:
Timestamp:
Jul 18, 2019 6:40:00 PM (5 years ago)
Author:
Alan Coon
Message:

Cherry-pick r247566. rdar://problem/53279081

Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts
https://bugs.webkit.org/show_bug.cgi?id=199769
<rdar://problem/49390297>

Reviewed by Myles C. Maxfield.

Source/WebCore:

When getting a system font, set the appropriate attribute so that it
does not fallback to a user initiated font.
Add an ASSERT that checks that the font in use is not a user font if
policy is to not use user installed fonts.

Tests: fast/text/user-installed-fonts/extended-character-with-user-font.html

fast/text/user-installed-fonts/extended-character.html

  • platform/graphics/Font.h:
  • platform/graphics/FontCascadeFonts.cpp: (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
  • platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::preparePlatformFont): (WebCore::FontDatabase::singletonAllowingUserInstalledFonts): (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts): (WebCore::addAttributesForInstalledFonts): (WebCore::addAttributesForWebFonts): (WebCore::installedFontMandatoryAttributes):
  • platform/graphics/mac/SimpleFontDataCoreText.cpp: (WebCore::Font::isUserInstalledFont const):

Source/WTF:

  • wtf/Platform.h:

Tools:

Add a font containing one extended character not found in system fonts.

  • WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
  • WebKitTestRunner/fonts/FakeHelvetica-SingleExtendedCharacter.ttf: Added.

LayoutTests:

Tests require WTR and recent MacOS, hence why they are disabled elsewhere.

  • TestExpectations:
  • platform/mac-wk2/TestExpectations:
  • fast/text/user-installed-fonts/extended-character-expected.html: Added.
  • fast/text/user-installed-fonts/extended-character-with-user-font-expected-mismatch.html: Added.
  • fast/text/user-installed-fonts/extended-character-with-user-font.html: Added.
  • fast/text/user-installed-fonts/extended-character.html: Added.

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

Location:
branches/safari-608-branch
Files:
5 added
12 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-608-branch/LayoutTests/ChangeLog

    r247612 r247632  
     12019-07-18  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r247566. rdar://problem/53279081
     4
     5    Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts
     6    https://bugs.webkit.org/show_bug.cgi?id=199769
     7    <rdar://problem/49390297>
     8   
     9    Reviewed by Myles C. Maxfield.
     10   
     11    Source/WebCore:
     12   
     13    When getting a system font, set the appropriate attribute so that it
     14    does not fallback to a user initiated font.
     15    Add an ASSERT that checks that the font in use is not a user font if
     16    policy is to not use user installed fonts.
     17   
     18    Tests: fast/text/user-installed-fonts/extended-character-with-user-font.html
     19           fast/text/user-installed-fonts/extended-character.html
     20   
     21    * platform/graphics/Font.h:
     22    * platform/graphics/FontCascadeFonts.cpp:
     23    (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
     24    * platform/graphics/cocoa/FontCacheCoreText.cpp:
     25    (WebCore::preparePlatformFont):
     26    (WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
     27    (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
     28    (WebCore::addAttributesForInstalledFonts):
     29    (WebCore::addAttributesForWebFonts):
     30    (WebCore::installedFontMandatoryAttributes):
     31    * platform/graphics/mac/SimpleFontDataCoreText.cpp:
     32    (WebCore::Font::isUserInstalledFont const):
     33   
     34    Source/WTF:
     35   
     36    * wtf/Platform.h:
     37   
     38    Tools:
     39   
     40    Add a font containing one extended character not found in system fonts.
     41   
     42    * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
     43    * WebKitTestRunner/fonts/FakeHelvetica-SingleExtendedCharacter.ttf: Added.
     44   
     45    LayoutTests:
     46   
     47    Tests require WTR and recent MacOS, hence why they are disabled elsewhere.
     48   
     49    * TestExpectations:
     50    * platform/mac-wk2/TestExpectations:
     51    * fast/text/user-installed-fonts/extended-character-expected.html: Added.
     52    * fast/text/user-installed-fonts/extended-character-with-user-font-expected-mismatch.html: Added.
     53    * fast/text/user-installed-fonts/extended-character-with-user-font.html: Added.
     54    * fast/text/user-installed-fonts/extended-character.html: Added.
     55   
     56   
     57    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247566 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     58
     59    2019-07-18  Youenn Fablet  <youenn@apple.com>
     60
     61            Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts
     62            https://bugs.webkit.org/show_bug.cgi?id=199769
     63            <rdar://problem/49390297>
     64
     65            Reviewed by Myles C. Maxfield.
     66
     67            Tests require WTR and recent MacOS, hence why they are disabled elsewhere.
     68
     69            * TestExpectations:
     70            * platform/mac-wk2/TestExpectations:
     71            * fast/text/user-installed-fonts/extended-character-expected.html: Added.
     72            * fast/text/user-installed-fonts/extended-character-with-user-font-expected-mismatch.html: Added.
     73            * fast/text/user-installed-fonts/extended-character-with-user-font.html: Added.
     74            * fast/text/user-installed-fonts/extended-character.html: Added.
     75
    1762019-07-17  Kocsen Chung  <kocsen_chung@apple.com>
    277
  • branches/safari-608-branch/LayoutTests/TestExpectations

    r247574 r247632  
    16691669webkit.org/b/190626 imported/w3c/web-platform-tests/html/semantics/forms/the-datalist-element/datalistoptions.html [ Failure ]
    16701670webkit.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
     1673fast/text/user-installed-fonts/extended-character.html [ Skip ]
     1674fast/text/user-installed-fonts/extended-character-with-user-font.html [ Skip ]
    16711675
    16721676# Does timeout
  • branches/safari-608-branch/LayoutTests/platform/mac-wk2/TestExpectations

    r247333 r247632  
    774774webkit.org/b/185994 fast/text/user-installed-fonts/shadow-postscript-family.html [ Pass ImageOnlyFailure ]
    775775
     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
    776780# <rdar://problem/25010307>
    777781[ HighSierra+ ] http/tests/ssl/applepay/ApplePayError.html [ Pass ]
  • branches/safari-608-branch/Source/WTF/ChangeLog

    r247591 r247632  
     12019-07-18  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r247566. rdar://problem/53279081
     4
     5    Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts
     6    https://bugs.webkit.org/show_bug.cgi?id=199769
     7    <rdar://problem/49390297>
     8   
     9    Reviewed by Myles C. Maxfield.
     10   
     11    Source/WebCore:
     12   
     13    When getting a system font, set the appropriate attribute so that it
     14    does not fallback to a user initiated font.
     15    Add an ASSERT that checks that the font in use is not a user font if
     16    policy is to not use user installed fonts.
     17   
     18    Tests: fast/text/user-installed-fonts/extended-character-with-user-font.html
     19           fast/text/user-installed-fonts/extended-character.html
     20   
     21    * platform/graphics/Font.h:
     22    * platform/graphics/FontCascadeFonts.cpp:
     23    (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
     24    * platform/graphics/cocoa/FontCacheCoreText.cpp:
     25    (WebCore::preparePlatformFont):
     26    (WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
     27    (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
     28    (WebCore::addAttributesForInstalledFonts):
     29    (WebCore::addAttributesForWebFonts):
     30    (WebCore::installedFontMandatoryAttributes):
     31    * platform/graphics/mac/SimpleFontDataCoreText.cpp:
     32    (WebCore::Font::isUserInstalledFont const):
     33   
     34    Source/WTF:
     35   
     36    * wtf/Platform.h:
     37   
     38    Tools:
     39   
     40    Add a font containing one extended character not found in system fonts.
     41   
     42    * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
     43    * WebKitTestRunner/fonts/FakeHelvetica-SingleExtendedCharacter.ttf: Added.
     44   
     45    LayoutTests:
     46   
     47    Tests require WTR and recent MacOS, hence why they are disabled elsewhere.
     48   
     49    * TestExpectations:
     50    * platform/mac-wk2/TestExpectations:
     51    * fast/text/user-installed-fonts/extended-character-expected.html: Added.
     52    * fast/text/user-installed-fonts/extended-character-with-user-font-expected-mismatch.html: Added.
     53    * fast/text/user-installed-fonts/extended-character-with-user-font.html: Added.
     54    * fast/text/user-installed-fonts/extended-character.html: Added.
     55   
     56   
     57    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247566 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     58
     59    2019-07-18  Youenn Fablet  <youenn@apple.com>
     60
     61            Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts
     62            https://bugs.webkit.org/show_bug.cgi?id=199769
     63            <rdar://problem/49390297>
     64
     65            Reviewed by Myles C. Maxfield.
     66
     67            * wtf/Platform.h:
     68
    1692019-07-17  Kocsen Chung  <kocsen_chung@apple.com>
    270
  • branches/safari-608-branch/Source/WTF/wtf/Platform.h

    r247591 r247632  
    15371537#endif
    15381538
     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
    15391543#if PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000
    15401544#define HAVE_ARKIT_QUICK_LOOK_PREVIEW_ITEM 1
  • branches/safari-608-branch/Source/WebCore/ChangeLog

    r247630 r247632  
     12019-07-18  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r247566. rdar://problem/53279081
     4
     5    Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts
     6    https://bugs.webkit.org/show_bug.cgi?id=199769
     7    <rdar://problem/49390297>
     8   
     9    Reviewed by Myles C. Maxfield.
     10   
     11    Source/WebCore:
     12   
     13    When getting a system font, set the appropriate attribute so that it
     14    does not fallback to a user initiated font.
     15    Add an ASSERT that checks that the font in use is not a user font if
     16    policy is to not use user installed fonts.
     17   
     18    Tests: fast/text/user-installed-fonts/extended-character-with-user-font.html
     19           fast/text/user-installed-fonts/extended-character.html
     20   
     21    * platform/graphics/Font.h:
     22    * platform/graphics/FontCascadeFonts.cpp:
     23    (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
     24    * platform/graphics/cocoa/FontCacheCoreText.cpp:
     25    (WebCore::preparePlatformFont):
     26    (WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
     27    (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
     28    (WebCore::addAttributesForInstalledFonts):
     29    (WebCore::addAttributesForWebFonts):
     30    (WebCore::installedFontMandatoryAttributes):
     31    * platform/graphics/mac/SimpleFontDataCoreText.cpp:
     32    (WebCore::Font::isUserInstalledFont const):
     33   
     34    Source/WTF:
     35   
     36    * wtf/Platform.h:
     37   
     38    Tools:
     39   
     40    Add a font containing one extended character not found in system fonts.
     41   
     42    * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
     43    * WebKitTestRunner/fonts/FakeHelvetica-SingleExtendedCharacter.ttf: Added.
     44   
     45    LayoutTests:
     46   
     47    Tests require WTR and recent MacOS, hence why they are disabled elsewhere.
     48   
     49    * TestExpectations:
     50    * platform/mac-wk2/TestExpectations:
     51    * fast/text/user-installed-fonts/extended-character-expected.html: Added.
     52    * fast/text/user-installed-fonts/extended-character-with-user-font-expected-mismatch.html: Added.
     53    * fast/text/user-installed-fonts/extended-character-with-user-font.html: Added.
     54    * fast/text/user-installed-fonts/extended-character.html: Added.
     55   
     56   
     57    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247566 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     58
     59    2019-07-18  Youenn Fablet  <youenn@apple.com>
     60
     61            Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts
     62            https://bugs.webkit.org/show_bug.cgi?id=199769
     63            <rdar://problem/49390297>
     64
     65            Reviewed by Myles C. Maxfield.
     66
     67            When getting a system font, set the appropriate attribute so that it
     68            does not fallback to a user initiated font.
     69            Add an ASSERT that checks that the font in use is not a user font if
     70            policy is to not use user installed fonts.
     71
     72            Tests: fast/text/user-installed-fonts/extended-character-with-user-font.html
     73                   fast/text/user-installed-fonts/extended-character.html
     74
     75            * platform/graphics/Font.h:
     76            * platform/graphics/FontCascadeFonts.cpp:
     77            (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
     78            * platform/graphics/cocoa/FontCacheCoreText.cpp:
     79            (WebCore::preparePlatformFont):
     80            (WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
     81            (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
     82            (WebCore::addAttributesForInstalledFonts):
     83            (WebCore::addAttributesForWebFonts):
     84            (WebCore::installedFontMandatoryAttributes):
     85            * platform/graphics/mac/SimpleFontDataCoreText.cpp:
     86            (WebCore::Font::isUserInstalledFont const):
     87
    1882019-07-18  Alan Coon  <alancoon@apple.com>
    289
  • branches/safari-608-branch/Source/WebCore/platform/graphics/Font.h

    r245393 r247632  
    205205#endif
    206206
     207#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
     208    bool isUserInstalledFont() const;
     209#endif
     210
    207211    bool canRenderCombiningCharacterSequence(const UChar*, size_t) const;
    208212    bool applyTransforms(GlyphBufferGlyph*, GlyphBufferAdvance*, size_t glyphCount, bool enableKerning, bool requiresShaping) const;
  • branches/safari-608-branch/Source/WebCore/platform/graphics/FontCascadeFonts.cpp

    r246490 r247632  
    350350        return GlyphData();
    351351
     352#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
     353    ASSERT(!systemFallbackFont->isUserInstalledFont() || description.shouldAllowUserInstalledFonts() == AllowUserInstalledFonts::Yes);
     354#endif
     355
    352356    if (systemFallbackShouldBeInvisible)
    353357        systemFallbackFont = const_cast<Font*>(&systemFallbackFont->invisibleFont());
  • branches/safari-608-branch/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp

    r247585 r247632  
    3939
    4040#define HAS_CORE_TEXT_WIDTH_ATTRIBUTE ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000))
    41 #define CAN_DISALLOW_USER_INSTALLED_FONTS ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000))
    4241
    4342namespace WebCore {
     
    571570    bool fontFaceDoesntSpecifyVariations = !fontFaceVariantSettings || fontFaceVariantSettings->isAllNormal();
    572571    if (noFontFeatureSettings && noFontVariationSettings && textRenderingModeIsAuto && variantSettingsIsNormal && dontNeedToApplyOpticalSizing && fontFaceDoesntSpecifyFeatures && fontFaceDoesntSpecifyVariations)
    573         return originalFont;
     572        return createFontForInstalledFonts(originalFont, fontDescription.shouldAllowUserInstalledFonts());
    574573
    575574    // This algorithm is described at http://www.w3.org/TR/css3-fonts/#feature-precedence
     
    686685    }
    687686
     687    addAttributesForInstalledFonts(attributes.get(), fontDescription.shouldAllowUserInstalledFonts());
     688
    688689    auto descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
    689     auto result = adoptCF(CTFontCreateCopyWithAttributes(originalFont, CTFontGetSize(originalFont), nullptr, descriptor.get()));
    690     return result;
     690    return adoptCF(CTFontCreateCopyWithAttributes(originalFont, CTFontGetSize(originalFont), nullptr, descriptor.get()));
    691691}
    692692
     
    839839class FontDatabase {
    840840public:
    841 #if !CAN_DISALLOW_USER_INSTALLED_FONTS
     841#if !HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
    842842    static FontDatabase& singleton()
    843843    {
     
    849849    static FontDatabase& singletonAllowingUserInstalledFonts()
    850850    {
    851 #if CAN_DISALLOW_USER_INSTALLED_FONTS
     851#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
    852852        static NeverDestroyed<FontDatabase> database(AllowUserInstalledFonts::Yes);
    853853        return database;
     
    859859    static FontDatabase& singletonDisallowingUserInstalledFonts()
    860860    {
    861 #if CAN_DISALLOW_USER_INSTALLED_FONTS
     861#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
    862862        static NeverDestroyed<FontDatabase> database(AllowUserInstalledFonts::No);
    863863        return database;
     
    873873        InstalledFont() = default;
    874874
    875         InstalledFont(CTFontDescriptorRef fontDescriptor)
     875        InstalledFont(CTFontDescriptorRef fontDescriptor, AllowUserInstalledFonts allowUserInstalledFonts)
    876876            : fontDescriptor(fontDescriptor)
    877877            , capabilities(capabilitiesForFontDescriptor(fontDescriptor))
    878878        {
     879            if (allowUserInstalledFonts != AllowUserInstalledFonts::No)
     880                return;
     881            auto attributes = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
     882            addAttributesForInstalledFonts(attributes.get(), allowUserInstalledFonts);
     883            this->fontDescriptor = CTFontDescriptorCreateCopyWithAttributes(fontDescriptor, attributes.get());
    879884        }
    880885
     
    934939                result.reserveInitialCapacity(count);
    935940                for (CFIndex i = 0; i < count; ++i) {
    936                     InstalledFont installedFont(static_cast<CTFontDescriptorRef>(CFArrayGetValueAtIndex(matches.get(), i)));
     941                    InstalledFont installedFont(static_cast<CTFontDescriptorRef>(CFArrayGetValueAtIndex(matches.get(), i)), m_allowUserInstalledFonts);
    937942                    result.uncheckedAppend(WTFMove(installedFont));
    938943                }
     
    963968            auto mandatoryAttributes = installedFontMandatoryAttributes(m_allowUserInstalledFonts);
    964969            auto match = adoptCF(CTFontDescriptorCreateMatchingFontDescriptor(fontDescriptorToMatch.get(), mandatoryAttributes.get()));
    965             return InstalledFont(match.get());
     970            return InstalledFont(match.get(), m_allowUserInstalledFonts);
    966971        }).iterator->value;
    967972    }
     
    15071512void addAttributesForInstalledFonts(CFMutableDictionaryRef attributes, AllowUserInstalledFonts allowUserInstalledFonts)
    15081513{
    1509 #if CAN_DISALLOW_USER_INSTALLED_FONTS
     1514#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
    15101515    if (allowUserInstalledFonts == AllowUserInstalledFonts::No) {
    15111516        CFDictionaryAddValue(attributes, kCTFontUserInstalledAttribute, kCFBooleanFalse);
     
    15311536}
    15321537
     1538static inline bool isFontMatchingUserInstalledFontFallback(CTFontRef font, AllowUserInstalledFonts allowUserInstalledFonts)
     1539{
     1540#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
     1541    bool willFallbackToSystemOnly = false;
     1542    if (auto fontFallbackOptionAttributeRef = adoptCF(static_cast<CFNumberRef>(CTFontCopyAttribute(font, kCTFontFallbackOptionAttribute)))) {
     1543        int64_t fontFallbackOptionAttribute;
     1544        CFNumberGetValue(fontFallbackOptionAttributeRef.get(), kCFNumberSInt64Type, &fontFallbackOptionAttribute);
     1545        willFallbackToSystemOnly = fontFallbackOptionAttribute == kCTFontFallbackOptionSystem;
     1546    }
     1547
     1548    bool shouldFallbackToSystemOnly = allowUserInstalledFonts == AllowUserInstalledFonts::No;
     1549    return willFallbackToSystemOnly == shouldFallbackToSystemOnly;
     1550#else
     1551    UNUSED_PARAM(font);
     1552    UNUSED_PARAM(allowUserInstalledFonts);
     1553    return true;
     1554#endif
     1555}
     1556
    15331557RetainPtr<CTFontRef> createFontForInstalledFonts(CTFontRef font, AllowUserInstalledFonts allowUserInstalledFonts)
    15341558{
     1559    if (isFontMatchingUserInstalledFontFallback(font, allowUserInstalledFonts))
     1560        return font;
     1561
    15351562    auto attributes = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
    15361563    addAttributesForInstalledFonts(attributes.get(), allowUserInstalledFonts);
     
    15441571void addAttributesForWebFonts(CFMutableDictionaryRef attributes, AllowUserInstalledFonts allowUserInstalledFonts)
    15451572{
    1546 #if CAN_DISALLOW_USER_INSTALLED_FONTS
     1573#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
    15471574    if (allowUserInstalledFonts == AllowUserInstalledFonts::No) {
    15481575        CTFontFallbackOption fallbackOption = kCTFontFallbackOptionSystem;
     
    15581585RetainPtr<CFSetRef> installedFontMandatoryAttributes(AllowUserInstalledFonts allowUserInstalledFonts)
    15591586{
    1560 #if CAN_DISALLOW_USER_INSTALLED_FONTS
     1587#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
    15611588    if (allowUserInstalledFonts == AllowUserInstalledFonts::No) {
    15621589        CFTypeRef mandatoryAttributesValues[] = { kCTFontFamilyNameAttribute, kCTFontPostScriptNameAttribute, kCTFontEnabledAttribute, kCTFontUserInstalledAttribute, kCTFontFallbackOptionAttribute };
  • branches/safari-608-branch/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp

    r233851 r247632  
    2929
    3030#include <CoreText/CoreText.h>
     31#include <pal/spi/cocoa/CoreTextSPI.h>
    3132
    3233namespace WebCore {
     
    5455}
    5556
     57#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
     58bool Font::isUserInstalledFont() const
     59{
     60    auto isUserInstalledFont = adoptCF(static_cast<CFBooleanRef>(CTFontCopyAttribute(getCTFont(), kCTFontUserInstalledAttribute)));
     61    return isUserInstalledFont && CFBooleanGetValue(isUserInstalledFont.get());
     62}
     63#endif
     64
    5665} // namespace WebCore
  • branches/safari-608-branch/Tools/ChangeLog

    r247609 r247632  
     12019-07-18  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r247566. rdar://problem/53279081
     4
     5    Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts
     6    https://bugs.webkit.org/show_bug.cgi?id=199769
     7    <rdar://problem/49390297>
     8   
     9    Reviewed by Myles C. Maxfield.
     10   
     11    Source/WebCore:
     12   
     13    When getting a system font, set the appropriate attribute so that it
     14    does not fallback to a user initiated font.
     15    Add an ASSERT that checks that the font in use is not a user font if
     16    policy is to not use user installed fonts.
     17   
     18    Tests: fast/text/user-installed-fonts/extended-character-with-user-font.html
     19           fast/text/user-installed-fonts/extended-character.html
     20   
     21    * platform/graphics/Font.h:
     22    * platform/graphics/FontCascadeFonts.cpp:
     23    (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
     24    * platform/graphics/cocoa/FontCacheCoreText.cpp:
     25    (WebCore::preparePlatformFont):
     26    (WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
     27    (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
     28    (WebCore::addAttributesForInstalledFonts):
     29    (WebCore::addAttributesForWebFonts):
     30    (WebCore::installedFontMandatoryAttributes):
     31    * platform/graphics/mac/SimpleFontDataCoreText.cpp:
     32    (WebCore::Font::isUserInstalledFont const):
     33   
     34    Source/WTF:
     35   
     36    * wtf/Platform.h:
     37   
     38    Tools:
     39   
     40    Add a font containing one extended character not found in system fonts.
     41   
     42    * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
     43    * WebKitTestRunner/fonts/FakeHelvetica-SingleExtendedCharacter.ttf: Added.
     44   
     45    LayoutTests:
     46   
     47    Tests require WTR and recent MacOS, hence why they are disabled elsewhere.
     48   
     49    * TestExpectations:
     50    * platform/mac-wk2/TestExpectations:
     51    * fast/text/user-installed-fonts/extended-character-expected.html: Added.
     52    * fast/text/user-installed-fonts/extended-character-with-user-font-expected-mismatch.html: Added.
     53    * fast/text/user-installed-fonts/extended-character-with-user-font.html: Added.
     54    * fast/text/user-installed-fonts/extended-character.html: Added.
     55   
     56   
     57    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247566 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     58
     59    2019-07-18  Youenn Fablet  <youenn@apple.com>
     60
     61            Make sure to set kCTFontFallbackOptionAttribute to kCTFontFallbackOptionSystem for system fonts
     62            https://bugs.webkit.org/show_bug.cgi?id=199769
     63            <rdar://problem/49390297>
     64
     65            Reviewed by Myles C. Maxfield.
     66
     67            Add a font containing one extended character not found in system fonts.
     68
     69            * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
     70            * WebKitTestRunner/fonts/FakeHelvetica-SingleExtendedCharacter.ttf: Added.
     71
    1722019-07-17  Kocsen Chung  <kocsen_chung@apple.com>
    273
  • branches/safari-608-branch/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj

    r241841 r247632  
    9797                31DA8A3D1E7205CC00E1DF2F /* IOSLayoutTestCommunication.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3148A0531E6F85B600D3B316 /* IOSLayoutTestCommunication.cpp */; };
    9898                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 */; };
    99100                4430AE191F82C4FD0099915A /* GeneratedTouchesDebugWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4430AE171F82C4EE0099915A /* GeneratedTouchesDebugWindow.mm */; };
    100101                51058AD51D678820009A538C /* libWebCoreTestSupport.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 41230E16138C78BF00BCCFCA /* libWebCoreTestSupport.dylib */; };
     
    301302                41C5378C21F1333C008B1FAD /* TestWebsiteDataStoreDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestWebsiteDataStoreDelegate.h; path = cocoa/TestWebsiteDataStoreDelegate.h; sourceTree = "<group>"; };
    302303                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>"; };
    303305                4429FC5E1627089600F66D8B /* WorkQueueManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkQueueManager.cpp; sourceTree = "<group>"; };
    304306                4429FC611627089600F66D8B /* WorkQueueManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkQueueManager.h; sourceTree = "<group>"; };
     
    750752                                1CBA02921FD86EA100179C7D /* FakeHelvetica-Helvetica2-400.ttf */,
    751753                                1CBA02951FD86EA100179C7D /* FakeHelvetica-Helvetica2-500.ttf */,
     754                                41D5B62522DD9D36000F4C4A /* FakeHelvetica-SingleExtendedCharacter.ttf */,
    752755                                1CA211C71BCA107300B2101F /* FontWithFeatures.otf */,
    753756                                1CA211C81BCA107300B2101F /* FontWithFeatures.ttf */,
     
    10291032                                1CBA02971FD87DEE00179C7D /* FakeHelvetica-Helvetica2-400.ttf in Resources */,
    10301033                                1CBA02961FD87DEC00179C7D /* FakeHelvetica-Helvetica2-500.ttf in Resources */,
     1034                                41D5B62622DD9D36000F4C4A /* FakeHelvetica-SingleExtendedCharacter.ttf in Resources */,
    10311035                                1CA211C91BCA107300B2101F /* FontWithFeatures.otf in Resources */,
    10321036                                1CA211CA1BCA107300B2101F /* FontWithFeatures.ttf in Resources */,
Note: See TracChangeset for help on using the changeset viewer.