Changeset 210612 in webkit


Ignore:
Timestamp:
Jan 11, 2017, 5:52:33 PM (9 years ago)
Author:
Ryan Haddad
Message:

Reverting r210598, r210597, and r210591 to fix the iOS simulator build.
https://bugs.webkit.org/show_bug.cgi?id=166672

Unreviewed build fix.

  • platform/graphics/cocoa/FontCacheCoreText.cpp:

(WebCore::preparePlatformFont):
(WebCore::fontIsSystemFont): Deleted.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r210609 r210612  
     12017-01-11  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Reverting r210598, r210597, and r210591 to fix the iOS simulator build.
     4        https://bugs.webkit.org/show_bug.cgi?id=166672
     5
     6        Unreviewed build fix.
     7
     8        * platform/graphics/cocoa/FontCacheCoreText.cpp:
     9        (WebCore::preparePlatformFont):
     10        (WebCore::fontIsSystemFont): Deleted.
     11
    1122017-01-11  Andreas Kling  <akling@apple.com>
    213
  • trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp

    r210598 r210612  
    420420#endif
    421421
    422 #define WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000)
    423 #if ENABLE(VARIATION_FONTS) && WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG
    424 static inline bool fontIsSystemFont(CTFontRef font)
    425 {
    426     if (CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(font)).get()))
    427         return true;
    428     auto name = adoptCF(CTFontCopyPostScriptName(font));
    429     return CFStringGetLength(name.get()) > 0 && CFStringGetCharacterAtIndex(name.get(), 0) == '.';
    430 }
    431 #endif
    432 
    433422RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, TextRenderingMode textRenderingMode, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, const FontFeatureSettings& features, const FontVariantSettings& variantSettings, const FontVariationSettings& variations)
    434423{
    435     bool alwaysAddVariations = false;
    436 
    437     // FIXME: Remove when <rdar://problem/29859207> is fixed
    438 #if ENABLE(VARIATION_FONTS)
    439     auto defaultValues = defaultVariationValues(originalFont);
    440 #if WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG
    441     alwaysAddVariations = !defaultValues.isEmpty();
    442 #endif
    443 #endif
    444 
    445     if (!originalFont || (!features.size() && (!alwaysAddVariations && variations.isEmpty()) && (textRenderingMode == AutoTextRendering) && variantSettings.isAllNormal()
     424    if (!originalFont || (!features.size() && variations.isEmpty() && (textRenderingMode == AutoTextRendering) && variantSettings.isAllNormal()
    446425        && (!fontFaceFeatures || !fontFaceFeatures->size()) && (!fontFaceVariantSettings || fontFaceVariantSettings->isAllNormal())))
    447426        return originalFont;
     
    480459
    481460#if ENABLE(VARIATION_FONTS)
     461    auto defaultValues = defaultVariationValues(originalFont);
     462
    482463    VariationsMap variationsToBeApplied;
    483 
    484     auto applyVariationValue = [&](const FontTag& tag, float value, bool isDefaultValue) {
    485         // FIXME: Remove when <rdar://problem/28707822> is fixed
     464    for (auto& newVariation : variations) {
     465        auto iterator = defaultValues.find(newVariation.tag());
     466        if (iterator != defaultValues.end()) {
     467            float valueToApply = std::max(std::min(newVariation.value(), iterator->value.maximumValue), iterator->value.minimumValue);
     468
     469            // FIXME: Remove when <rdar://problem/28707822> is fixed
    486470#define WORKAROUND_CORETEXT_VARIATIONS_DEFAULT_VALUE_BUG (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000)
    487471#if WORKAROUND_CORETEXT_VARIATIONS_DEFAULT_VALUE_BUG
    488         if (isDefaultValue)
    489             value += 0.0001;
    490 #else
    491         UNUSED_PARAM(isDefaultValue);
     472            if (valueToApply == iterator->value.defaultValue)
     473                valueToApply += 0.0001;
    492474#endif
    493475#undef WORKAROUND_CORETEXT_VARIATIONS_DEFAULT_VALUE_BUG
    494         variationsToBeApplied.set(tag, value);
    495     };
    496 
    497     for (auto& newVariation : variations) {
    498         auto iterator = defaultValues.find(newVariation.tag());
    499         if (iterator == defaultValues.end())
    500             continue;
    501         float valueToApply = clampTo(newVariation.value(), iterator->value.minimumValue, iterator->value.maximumValue);
    502         bool isDefaultValue = valueToApply == iterator->value.defaultValue;
    503         applyVariationValue(newVariation.tag(), valueToApply, isDefaultValue);
    504     }
    505 
    506 #if WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG
    507     if (!fontIsSystemFont(originalFont)) {
    508         for (auto& defaultValue : defaultValues) {
    509             if (!variationsToBeApplied.contains(defaultValue.key))
    510                 applyVariationValue(defaultValue.key, defaultValue.value.defaultValue, true);
     476
     477            variationsToBeApplied.set(newVariation.tag(), valueToApply);
    511478        }
    512479    }
    513480#endif
    514 #undef WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG
    515 
    516 #endif // ENABLE(VARIATION_FONTS)
    517481
    518482    RetainPtr<CFMutableDictionaryRef> attributes = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
Note: See TracChangeset for help on using the changeset viewer.