Incorrect use of String::foldCase for font family names
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Feb 2019 14:39:10 +0000 (14:39 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Feb 2019 14:39:10 +0000 (14:39 +0000)
commite158bde6c10ed51637d462fa634ad6116713252d
tree67690f97300b44791eab818aacf6ce8e0ab6c9bd
parent77556eac59d1f2a4f5ea158310b524e9fa49ddbb
Incorrect use of String::foldCase for font family names
https://bugs.webkit.org/show_bug.cgi?id=194895

Reviewed by Myles C. Maxfield.

* platform/graphics/FontCascadeDescription.cpp:
(WebCore::FontCascadeDescription::familiesEqualForTextAutoSizing): Use
familyNamesAreEqual instead of calling convertToASCIILowercase directly.
(WebCore::FontCascadeDescription::familyNamesAreEqual): Use AtomicString's
operator== when we want case sensitive family name comparisons. This is a special
case to accomodate CoreText, which uses "."-prefix names for internal fonts that
are treated case sensitively. (Ideally webpages would not use these fonts at all.)
(WebCore::FontCascadeDescription::familyNameHash): Use AtomicString's existingHash
when we want case sensitive family name hashing.
(WebCore::FontCascadeDescription::foldedFamilyName): Take a String instead of an
AtomicString so we can use this at an additional call site. Converting from an
AtomicString to a String if free and automatic at the existing call sites. Use
convertToASCIILowercase instead of foldCase for three reasons: 1) Other functions
here are folding only ASCII case by using ASCIICaseInsensitiveHash, and this one
must be consistent. 2) this is considerably faster, and 3) font family names don't
need arbitrary Unicode case folding, it's only A-Z that should be folded.
* platform/graphics/FontCascadeDescription.h: Take a String instead of AtomicString
in the foldedFamilyName function.

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontDatabase::collectionForFamily): Instead of calling foldCase, use
FontCascadeDescription::foldedFamilyName to correctly fold font family names.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242038 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/FontCascadeDescription.cpp
Source/WebCore/platform/graphics/FontCascadeDescription.h
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp