Modified: trunk/Source/WebCore/ChangeLog (210374 => 210375)
--- trunk/Source/WebCore/ChangeLog 2017-01-05 21:27:50 UTC (rev 210374)
+++ trunk/Source/WebCore/ChangeLog 2017-01-05 21:35:05 UTC (rev 210375)
@@ -1,3 +1,16 @@
+2017-01-05 Ryan Haddad <[email protected]>
+
+ Unreviewed, rolling out r210370.
+
+ This change caused hundreds of LayoutTest failures on Sierra.
+
+ Reverted changeset:
+
+ "[Cocoa] Variation fonts without variations specified are not
+ rendered as if the default variations were specified"
+ https://bugs.webkit.org/show_bug.cgi?id=166672
+ http://trac.webkit.org/changeset/210370
+
2017-01-05 Carlos Garcia Campos <[email protected]>
[SOUP] Network process crash in WebKit::CustomProtocolManagerImpl::didFailWithError
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (210374 => 210375)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2017-01-05 21:27:50 UTC (rev 210374)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2017-01-05 21:35:05 UTC (rev 210375)
@@ -411,6 +411,10 @@
auto b2 = (rawAxisIdentifier & 0xFF0000) >> 16;
auto b3 = (rawAxisIdentifier & 0xFF00) >> 8;
auto b4 = rawAxisIdentifier & 0xFF;
+ ASSERT(b1 >= 0 && b1 <= std::numeric_limits<char>::max());
+ ASSERT(b2 >= 0 && b2 <= std::numeric_limits<char>::max());
+ ASSERT(b3 >= 0 && b3 <= std::numeric_limits<char>::max());
+ ASSERT(b4 >= 0 && b4 <= std::numeric_limits<char>::max());
FontTag resultKey = {{ static_cast<char>(b1), static_cast<char>(b2), static_cast<char>(b3), static_cast<char>(b4) }};
VariationDefaults resultValues = { rawDefaultValue, rawMinimumValue, rawMaximumValue };
result.set(resultKey, resultValues);
@@ -421,18 +425,7 @@
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
-#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)
- 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;
@@ -469,38 +462,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;
+ 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);
+ variationsToBeApplied.set(newVariation.tag(), valueToApply);
+ }
}
-
-#if WORKAROUND_CORETEXT_VARIATIONS_UNSPECIFIED_VALUE_BUG
- for (auto& defaultValue : defaultValues) {
- if (!variationsToBeApplied.contains(defaultValue.key))
- applyVariationValue(defaultValue.key, defaultValue.value.defaultValue, true);
- }
#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));