Modified: trunk/Source/WebCore/ChangeLog (210611 => 210612)
--- trunk/Source/WebCore/ChangeLog 2017-01-12 01:24:44 UTC (rev 210611)
+++ trunk/Source/WebCore/ChangeLog 2017-01-12 01:52:33 UTC (rev 210612)
@@ -1,3 +1,14 @@
+2017-01-11 Ryan Haddad <ryanhad...@apple.com>
+
+ 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.
+
2017-01-11 Andreas Kling <akl...@apple.com>
Crash when WebCore's GC heap grows way too large.
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (210611 => 210612)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2017-01-12 01:24:44 UTC (rev 210611)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2017-01-12 01:52:33 UTC (rev 210612)
@@ -419,30 +419,9 @@
}
#endif
-#define WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000)
-#if ENABLE(VARIATION_FONTS) && WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG
-static inline bool fontIsSystemFont(CTFontRef font)
-{
- if (CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(font)).get()))
- return true;
- auto name = adoptCF(CTFontCopyPostScriptName(font));
- return CFStringGetLength(name.get()) > 0 && CFStringGetCharacterAtIndex(name.get(), 0) == '.';
-}
-#endif
-
RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, TextRenderingMode textRenderingMode, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, const FontFeatureSettings& features, const FontVariantSettings& variantSettings, const FontVariationSettings& variations)
{
- bool alwaysAddVariations = false;
-
- // FIXME: Remove when <rdar://problem/29859207> is fixed
-#if ENABLE(VARIATION_FONTS)
- auto defaultValues = defaultVariationValues(originalFont);
-#if WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG
- alwaysAddVariations = !defaultValues.isEmpty();
-#endif
-#endif
-
- if (!originalFont || (!features.size() && (!alwaysAddVariations && variations.isEmpty()) && (textRenderingMode == AutoTextRendering) && variantSettings.isAllNormal()
+ if (!originalFont || (!features.size() && variations.isEmpty() && (textRenderingMode == AutoTextRendering) && variantSettings.isAllNormal()
&& (!fontFaceFeatures || !fontFaceFeatures->size()) && (!fontFaceVariantSettings || fontFaceVariantSettings->isAllNormal())))
return originalFont;
@@ -479,42 +458,27 @@
featuresToBeApplied.set(newFeature.tag(), newFeature.value());
#if ENABLE(VARIATION_FONTS)
+ auto defaultValues = defaultVariationValues(originalFont);
+
VariationsMap variationsToBeApplied;
+ for (auto& newVariation : variations) {
+ auto iterator = defaultValues.find(newVariation.tag());
+ if (iterator != defaultValues.end()) {
+ float valueToApply = std::max(std::min(newVariation.value(), iterator->value.maximumValue), iterator->value.minimumValue);
- auto applyVariationValue = [&](const FontTag& tag, float value, bool isDefaultValue) {
- // FIXME: Remove when <rdar://problem/28707822> is fixed
+ // FIXME: Remove when <rdar://problem/28707822> is fixed
#define WORKAROUND_CORETEXT_VARIATIONS_DEFAULT_VALUE_BUG (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000)
#if WORKAROUND_CORETEXT_VARIATIONS_DEFAULT_VALUE_BUG
- if (isDefaultValue)
- value += 0.0001;
-#else
- UNUSED_PARAM(isDefaultValue);
+ if (valueToApply == iterator->value.defaultValue)
+ valueToApply += 0.0001;
#endif
#undef WORKAROUND_CORETEXT_VARIATIONS_DEFAULT_VALUE_BUG
- variationsToBeApplied.set(tag, value);
- };
- for (auto& newVariation : variations) {
- auto iterator = defaultValues.find(newVariation.tag());
- if (iterator == defaultValues.end())
- continue;
- float valueToApply = clampTo(newVariation.value(), iterator->value.minimumValue, iterator->value.maximumValue);
- bool isDefaultValue = valueToApply == iterator->value.defaultValue;
- applyVariationValue(newVariation.tag(), valueToApply, isDefaultValue);
- }
-
-#if WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG
- if (!fontIsSystemFont(originalFont)) {
- for (auto& defaultValue : defaultValues) {
- if (!variationsToBeApplied.contains(defaultValue.key))
- applyVariationValue(defaultValue.key, defaultValue.value.defaultValue, true);
+ variationsToBeApplied.set(newVariation.tag(), valueToApply);
}
}
#endif
-#undef WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG
-#endif // ENABLE(VARIATION_FONTS)
-
RetainPtr<CFMutableDictionaryRef> attributes = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
if (!featuresToBeApplied.isEmpty()) {
RetainPtr<CFMutableArrayRef> featureArray = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, features.size(), &kCFTypeArrayCallBacks));