Changeset 242038 in webkit
- Timestamp:
- Feb 25, 2019 6:39:10 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r242035 r242038 1 2019-02-20 Darin Adler <darin@apple.com> 2 3 Incorrect use of String::foldCase for font family names 4 https://bugs.webkit.org/show_bug.cgi?id=194895 5 6 Reviewed by Myles C. Maxfield. 7 8 * platform/graphics/FontCascadeDescription.cpp: 9 (WebCore::FontCascadeDescription::familiesEqualForTextAutoSizing): Use 10 familyNamesAreEqual instead of calling convertToASCIILowercase directly. 11 (WebCore::FontCascadeDescription::familyNamesAreEqual): Use AtomicString's 12 operator== when we want case sensitive family name comparisons. This is a special 13 case to accomodate CoreText, which uses "."-prefix names for internal fonts that 14 are treated case sensitively. (Ideally webpages would not use these fonts at all.) 15 (WebCore::FontCascadeDescription::familyNameHash): Use AtomicString's existingHash 16 when we want case sensitive family name hashing. 17 (WebCore::FontCascadeDescription::foldedFamilyName): Take a String instead of an 18 AtomicString so we can use this at an additional call site. Converting from an 19 AtomicString to a String if free and automatic at the existing call sites. Use 20 convertToASCIILowercase instead of foldCase for three reasons: 1) Other functions 21 here are folding only ASCII case by using ASCIICaseInsensitiveHash, and this one 22 must be consistent. 2) this is considerably faster, and 3) font family names don't 23 need arbitrary Unicode case folding, it's only A-Z that should be folded. 24 * platform/graphics/FontCascadeDescription.h: Take a String instead of AtomicString 25 in the foldedFamilyName function. 26 27 * platform/graphics/cocoa/FontCacheCoreText.cpp: 28 (WebCore::FontDatabase::collectionForFamily): Instead of calling foldCase, use 29 FontCascadeDescription::foldedFamilyName to correctly fold font family names. 30 1 31 2019-02-25 Charlie Turner <cturner@igalia.com> 2 32 -
trunk/Source/WebCore/platform/graphics/FontCascadeDescription.cpp
r236914 r242038 64 64 65 65 #if !USE_PLATFORM_SYSTEM_FALLBACK_LIST 66 66 67 unsigned FontCascadeDescription::effectiveFamilyCount() const 67 68 { … … 73 74 return familyAt(i); 74 75 } 76 75 77 #endif 76 78 … … 108 110 109 111 for (unsigned i = 0; i < thisFamilyCount; ++i) { 110 if (! equalIgnoringASCIICase(familyAt(i), other.familyAt(i)))112 if (!familyNamesAreEqual(familyAt(i), other.familyAt(i))) 111 113 return false; 112 114 } … … 119 121 bool FontCascadeDescription::familyNamesAreEqual(const AtomicString& family1, const AtomicString& family2) 120 122 { 121 // FIXME: <rdar://problem/33594253> CoreText matches dot-prefixed font names case sensitively. We should 122 // always take the case insensitive patch once this radar is fixed. 123 #if PLATFORM(COCOA) 123 124 if (family1.startsWith('.')) 124 return StringHash::equal(family1.string(), family2.string()); 125 return family1 == family2; 126 #endif 125 127 return ASCIICaseInsensitiveHash::equal(family1, family2); 126 128 } … … 128 130 unsigned FontCascadeDescription::familyNameHash(const AtomicString& family) 129 131 { 130 // FIXME: <rdar://problem/33594253> CoreText matches dot-prefixed font names case sensitively. We should 131 // always take the case insensitive patch once this radar is fixed. 132 #if PLATFORM(COCOA) 132 133 if (family.startsWith('.')) 133 return StringHash::hash(family.string()); 134 return family.existingHash(); 135 #endif 134 136 return ASCIICaseInsensitiveHash::hash(family); 135 137 } 136 138 137 String FontCascadeDescription::foldedFamilyName(const AtomicString& family)139 String FontCascadeDescription::foldedFamilyName(const String& family) 138 140 { 139 // FIXME: <rdar://problem/33594253> CoreText matches dot-prefixed font names case sensitively. We should 140 // always take the case insensitive patch once this radar is fixed. 141 #if PLATFORM(COCOA) 141 142 if (family.startsWith('.')) 142 return family.string(); 143 return family.string().foldCase(); 143 return family; 144 #endif 145 return family.convertToASCIILowercase(); 144 146 } 145 147 -
trunk/Source/WebCore/platform/graphics/FontCascadeDescription.h
r239427 r242038 60 60 static bool familyNamesAreEqual(const AtomicString&, const AtomicString&); 61 61 static unsigned familyNameHash(const AtomicString&); 62 static String foldedFamilyName(const AtomicString&);62 static String foldedFamilyName(const String&); 63 63 64 64 unsigned effectiveFamilyCount() const; -
trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
r239822 r242038 888 888 const InstalledFontFamily& collectionForFamily(const String& familyName) 889 889 { 890 auto folded = familyName.foldCase();890 auto folded = FontCascadeDescription::foldedFamilyName(familyName); 891 891 { 892 892 std::lock_guard<Lock> locker(m_familyNameToFontDescriptorsLock);
Note: See TracChangeset
for help on using the changeset viewer.