Changeset 220997 in webkit
- Timestamp:
- Aug 21, 2017 6:50:34 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r220996 r220997 1 2017-08-21 Myles C. Maxfield <mmaxfield@apple.com> 2 3 DataInteractionTests.ExternalSourceAttributedStringToContentEditable hits a debug assertion 4 https://bugs.webkit.org/show_bug.cgi?id=175787 5 <rdar://problem/33996612> 6 7 Reviewed by Wenson Hsieh. 8 9 The variation axis values of San Francisco changed from the GX-style scale to the CSS-style 10 scale. Previously, we were normalizing the values we got from Core Text to fit the CSS scale; 11 however, this is no longer necessary since the font now does this itself. 12 13 The assertion was getting hit because the normalized values were huge and were overflowing 14 a single FontSelectionValue (and going negative). This patch adds handling for this 15 situation. 16 17 Test: DataInteractionTests.ExternalSourceBoldSystemAttributedStringToContentEditable 18 19 * platform/graphics/FontSelectionAlgorithm.h: Typedef the backing type for a FontSelectionValue. 20 (WebCore::FontSelectionValue::rawValue const): 21 (WebCore::FontSelectionValue::maximumValue): 22 (WebCore::FontSelectionValue::minimumValue): 23 (WebCore::FontSelectionValue::FontSelectionValue): 24 * platform/graphics/cocoa/FontCacheCoreText.cpp: Opt-out of normalization for San Francisco. 25 (WebCore::variationCapabilitiesForFontDescriptor): 26 (WebCore::capabilitiesForFontDescriptor): 27 1 28 2017-08-21 Chris Dumez <cdumez@apple.com> 2 29 -
trunk/Source/WebCore/platform/graphics/FontSelectionAlgorithm.h
r218464 r220997 41 41 class FontSelectionValue { 42 42 public: 43 typedef int16_t BackingType; 44 43 45 FontSelectionValue() = default; 44 46 … … 73 75 bool operator>=(const FontSelectionValue other) const; 74 76 75 int16_trawValue() const77 BackingType rawValue() const 76 78 { 77 79 return m_backing; … … 80 82 static FontSelectionValue maximumValue() 81 83 { 82 static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(std::numeric_limits< int16_t>::max(), RawTag::RawTag);84 static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(std::numeric_limits<BackingType>::max(), RawTag::RawTag); 83 85 return result.get(); 84 86 } … … 86 88 static FontSelectionValue minimumValue() 87 89 { 88 static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(std::numeric_limits< int16_t>::min(), RawTag::RawTag);90 static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(std::numeric_limits<BackingType>::min(), RawTag::RawTag); 89 91 return result.get(); 90 92 } … … 102 104 enum class RawTag { RawTag }; 103 105 104 FontSelectionValue( int16_trawValue, RawTag)106 FontSelectionValue(BackingType rawValue, RawTag) 105 107 : m_backing(rawValue) 106 108 { … … 108 110 109 111 static constexpr int fractionalEntropy = 4; 110 int16_tm_backing { 0 };112 BackingType m_backing { 0 }; 111 113 }; 112 114 -
trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
r220506 r220997 999 999 } 1000 1000 1001 if (FontType(font.get()).variationType == FontType::VariationType::TrueTypeGX) { 1001 bool optOutFromGXNormalization = false; 1002 #if ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)) 1003 optOutFromGXNormalization = CTFontDescriptorIsSystemUIFont(fontDescriptor); 1004 #endif 1005 1006 if (FontType(font.get()).variationType == FontType::VariationType::TrueTypeGX && !optOutFromGXNormalization) { 1002 1007 if (result.weight) 1003 1008 result.weight = {{ normalizeWeight(result.weight.value().minimum), normalizeWeight(result.weight.value().maximum) }}; … … 1007 1012 result.slope = {{ normalizeSlope(result.slope.value().minimum), normalizeSlope(result.slope.value().maximum) }}; 1008 1013 } 1014 1015 auto minimum = static_cast<float>(FontSelectionValue::minimumValue()); 1016 auto maximum = static_cast<float>(FontSelectionValue::maximumValue()); 1017 if (result.weight && (result.weight.value().minimum < minimum || result.weight.value().maximum > maximum)) 1018 result.weight = { }; 1019 if (result.width && (result.width.value().minimum < minimum || result.width.value().maximum > maximum)) 1020 result.width = { }; 1021 if (result.slope && (result.slope.value().minimum < minimum || result.slope.value().maximum > maximum)) 1022 result.slope = { }; 1009 1023 #else 1010 1024 UNUSED_PARAM(fontDescriptor); … … 1092 1106 #endif 1093 1107 1094 return{{ FontSelectionValue(variationCapabilities.weight.value().minimum), FontSelectionValue(variationCapabilities.weight.value().maximum) },1108 FontSelectionCapabilities result = {{ FontSelectionValue(variationCapabilities.weight.value().minimum), FontSelectionValue(variationCapabilities.weight.value().maximum) }, 1095 1109 { FontSelectionValue(variationCapabilities.width.value().minimum), FontSelectionValue(variationCapabilities.width.value().maximum) }, 1096 1110 { FontSelectionValue(variationCapabilities.slope.value().minimum), FontSelectionValue(variationCapabilities.slope.value().maximum) }}; 1111 ASSERT(result.weight.isValid()); 1112 ASSERT(result.width.isValid()); 1113 ASSERT(result.slope.isValid()); 1114 return result; 1097 1115 } 1098 1116 -
trunk/Tools/ChangeLog
r220991 r220997 1 2017-08-21 Myles C. Maxfield <mmaxfield@apple.com> 2 3 DataInteractionTests.ExternalSourceAttributedStringToContentEditable hits a debug assertion 4 https://bugs.webkit.org/show_bug.cgi?id=175787 5 <rdar://problem/33996612> 6 7 Reviewed by Wenson Hsieh. 8 9 * TestWebKitAPI/Tests/ios/DataInteractionTests.mm: 10 (TestWebKitAPI::TEST): 11 1 12 2017-08-21 Myles C. Maxfield <mmaxfield@apple.com> 2 13 -
trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm
r220952 r220997 686 686 } 687 687 688 TEST(DataInteractionTests, DISABLED_ExternalSourceBoldSystemAttributedStringToContentEditable)688 TEST(DataInteractionTests, ExternalSourceBoldSystemAttributedStringToContentEditable) 689 689 { 690 690 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
Note: See TracChangeset
for help on using the changeset viewer.