Title: [220061] branches/safari-604-branch

Diff

Modified: branches/safari-604-branch/LayoutTests/ChangeLog (220060 => 220061)


--- branches/safari-604-branch/LayoutTests/ChangeLog	2017-07-31 11:23:41 UTC (rev 220060)
+++ branches/safari-604-branch/LayoutTests/ChangeLog	2017-07-31 14:37:23 UTC (rev 220061)
@@ -1,3 +1,20 @@
+2017-07-31  Jason Marcell  <[email protected]>
+
+        Cherry-pick r220009. rdar://problem/33619585
+
+    2017-07-28  Myles C. Maxfield  <[email protected]>
+
+            [macOS] Reeder's defaults font is Times instead of San Francisco
+            https://bugs.webkit.org/show_bug.cgi?id=174885
+            <rdar://problem/33462483>
+
+            Reviewed by Simon Fraser.
+
+            * fast/text/font-lookup-dot-prefix-case-sensitive-2-expected.html: Added.
+            * fast/text/font-lookup-dot-prefix-case-sensitive-2.html: Added.
+            * fast/text/font-lookup-dot-prefix-case-sensitive-expected-mismatch.html: Added.
+            * fast/text/font-lookup-dot-prefix-case-sensitive.html: Added.
+
 2017-07-28  Jason Marcell  <[email protected]>
 
         Cherry-pick r220003. rdar://problem/33595572

Added: branches/safari-604-branch/LayoutTests/fast/text/font-lookup-dot-prefix-case-sensitive-2-expected.html (0 => 220061)


--- branches/safari-604-branch/LayoutTests/fast/text/font-lookup-dot-prefix-case-sensitive-2-expected.html	                        (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/text/font-lookup-dot-prefix-case-sensitive-2-expected.html	2017-07-31 14:37:23 UTC (rev 220061)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.internals) {
+    internals.invalidateFontCache();
+</script>
+</head>
+<body>
+<div style="font: 100px 'Times';">Hello</div>
+<div style="font: 100px '.AppleSystemUIFontMedium';">Hello</div>
+</body>
+</html>
+

Added: branches/safari-604-branch/LayoutTests/fast/text/font-lookup-dot-prefix-case-sensitive-2.html (0 => 220061)


--- branches/safari-604-branch/LayoutTests/fast/text/font-lookup-dot-prefix-case-sensitive-2.html	                        (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/text/font-lookup-dot-prefix-case-sensitive-2.html	2017-07-31 14:37:23 UTC (rev 220061)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.internals) {
+    internals.invalidateFontCache();
+</script>
+</head>
+<body>
+<div style="font: 100px '.apPLesysTemUiFontMEDium';">Hello</div>
+<div style="font: 100px '.AppleSystemUIFontMedium';">Hello</div>
+</body>
+</html>
+

Added: branches/safari-604-branch/LayoutTests/fast/text/font-lookup-dot-prefix-case-sensitive-expected-mismatch.html (0 => 220061)


--- branches/safari-604-branch/LayoutTests/fast/text/font-lookup-dot-prefix-case-sensitive-expected-mismatch.html	                        (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/text/font-lookup-dot-prefix-case-sensitive-expected-mismatch.html	2017-07-31 14:37:23 UTC (rev 220061)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.internals) {
+    internals.invalidateFontCache();
+</script>
+</head>
+<body>
+<div style="font: 100px 'Times';">Hello</div>
+</body>
+</html>
+

Added: branches/safari-604-branch/LayoutTests/fast/text/font-lookup-dot-prefix-case-sensitive.html (0 => 220061)


--- branches/safari-604-branch/LayoutTests/fast/text/font-lookup-dot-prefix-case-sensitive.html	                        (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/text/font-lookup-dot-prefix-case-sensitive.html	2017-07-31 14:37:23 UTC (rev 220061)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.internals) {
+    internals.invalidateFontCache();
+</script>
+</head>
+<body>
+<div style="font: 100px '.AppleSystemUIFontMedium';">Hello</div>
+</body>
+</html>
+

Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (220060 => 220061)


--- branches/safari-604-branch/Source/WebCore/ChangeLog	2017-07-31 11:23:41 UTC (rev 220060)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog	2017-07-31 14:37:23 UTC (rev 220061)
@@ -1,3 +1,37 @@
+2017-07-31  Jason Marcell  <[email protected]>
+
+        Cherry-pick r220009. rdar://problem/33619585
+
+    2017-07-28  Myles C. Maxfield  <[email protected]>
+
+            [macOS] Reeder's defaults font is Times instead of San Francisco
+            https://bugs.webkit.org/show_bug.cgi?id=174885
+            <rdar://problem/33462483>
+
+            Reviewed by Simon Fraser.
+
+            Reeder uses explicit dot-prefixed names in its source code. Within Core Text,
+            dot-prefixed names cannot be matched case insensitively. The solution is to
+            not case-fold these family names, and to make our caches case sensitive for
+            these special names.
+
+            Tests: fast/text/font-lookup-dot-prefix-case-sensitive-2.html
+                   fast/text/font-lookup-dot-prefix-case-sensitive.html
+
+            * platform/graphics/FontCache.cpp:
+            (WebCore::FontPlatformDataCacheKey::operator==):
+            (WebCore::FontPlatformDataCacheKeyHash::hash):
+            * platform/graphics/FontCascade.cpp:
+            (WebCore::keysMatch):
+            (WebCore::computeFontCascadeCacheHash):
+            * platform/graphics/FontDescription.cpp:
+            (WebCore::FontCascadeDescription::familyNamesAreEqual):
+            (WebCore::FontCascadeDescription::familyNameHash):
+            (WebCore::FontCascadeDescription::foldedFamilyName):
+            * platform/graphics/FontDescription.h:
+            * platform/graphics/cocoa/FontCacheCoreText.cpp:
+            (WebCore::FontDatabase::fontForPostScriptName):
+
 2017-07-28  Jason Marcell  <[email protected]>
 
         Cherry-pick r220003. rdar://problem/33595572

Modified: branches/safari-604-branch/Source/WebCore/platform/graphics/FontCache.cpp (220060 => 220061)


--- branches/safari-604-branch/Source/WebCore/platform/graphics/FontCache.cpp	2017-07-31 11:23:41 UTC (rev 220060)
+++ branches/safari-604-branch/Source/WebCore/platform/graphics/FontCache.cpp	2017-07-31 14:37:23 UTC (rev 220061)
@@ -127,7 +127,7 @@
             return true;
         if (m_family.isNull() || other.m_family.isNull())
             return false;
-        return ASCIICaseInsensitiveHash::equal(m_family, other.m_family);
+        return FontCascadeDescription::familyNamesAreEqual(m_family, other.m_family);
     }
 
     FontDescriptionKey m_fontDescriptionKey;
@@ -141,7 +141,7 @@
     static unsigned hash(const FontPlatformDataCacheKey& fontKey)
     {
         IntegerHasher hasher;
-        hasher.add(ASCIICaseInsensitiveHash::hash(fontKey.m_family));
+        hasher.add(FontCascadeDescription::familyNameHash(fontKey.m_family));
         hasher.add(fontKey.m_fontDescriptionKey.computeHash());
         hasher.add(fontKey.m_fontFaceFeatures.hash());
         hasher.add(fontKey.m_fontFaceVariantSettings.uniqueValue());

Modified: branches/safari-604-branch/Source/WebCore/platform/graphics/FontCascade.cpp (220060 => 220061)


--- branches/safari-604-branch/Source/WebCore/platform/graphics/FontCascade.cpp	2017-07-31 11:23:41 UTC (rev 220060)
+++ branches/safari-604-branch/Source/WebCore/platform/graphics/FontCascade.cpp	2017-07-31 14:37:23 UTC (rev 220061)
@@ -202,7 +202,7 @@
     if (size != b.families.size())
         return false;
     for (unsigned i = 0; i < size; ++i) {
-        if (!equalIgnoringASCIICase(a.families[i], b.families[i]))
+        if (!FontCascadeDescription::familyNamesAreEqual(a.families[i], b.families[i]))
             return false;
     }
     return true;
@@ -246,8 +246,8 @@
     hasher.add(key.fontSelectorId);
     hasher.add(key.fontSelectorVersion);
     for (unsigned i = 0; i < key.families.size(); ++i) {
-        StringImpl* family = key.families[i].impl();
-        hasher.add(family ? ASCIICaseInsensitiveHash::hash(family) : 0);
+        auto& family = key.families[i];
+        hasher.add(family.isNull() ? 0 : FontCascadeDescription::familyNameHash(family));
     }
     return hasher.hash();
 }

Modified: branches/safari-604-branch/Source/WebCore/platform/graphics/FontDescription.cpp (220060 => 220061)


--- branches/safari-604-branch/Source/WebCore/platform/graphics/FontDescription.cpp	2017-07-31 11:23:41 UTC (rev 220060)
+++ branches/safari-604-branch/Source/WebCore/platform/graphics/FontDescription.cpp	2017-07-31 14:37:23 UTC (rev 220061)
@@ -31,6 +31,7 @@
 #include "FontDescription.h"
 
 #include "LocaleToScriptMapping.h"
+#include <wtf/text/StringHash.h>
 
 namespace WebCore {
 
@@ -155,4 +156,31 @@
 
 #endif // ENABLE(TEXT_AUTOSIZING)
 
+bool FontCascadeDescription::familyNamesAreEqual(const AtomicString& family1, const AtomicString& family2)
+{
+    // FIXME: <rdar://problem/33594253> CoreText matches dot-prefixed font names case sensitively. We should
+    // always take the case insensitive patch once this radar is fixed.
+    if (family1.startsWith('.'))
+        return StringHash::equal(family1.string(), family2.string());
+    return ASCIICaseInsensitiveHash::equal(family1, family2);
+}
+
+unsigned FontCascadeDescription::familyNameHash(const AtomicString& family)
+{
+    // FIXME: <rdar://problem/33594253> CoreText matches dot-prefixed font names case sensitively. We should
+    // always take the case insensitive patch once this radar is fixed.
+    if (family.startsWith('.'))
+        return StringHash::hash(family.string());
+    return ASCIICaseInsensitiveHash::hash(family);
+}
+
+String FontCascadeDescription::foldedFamilyName(const AtomicString& family)
+{
+    // FIXME: <rdar://problem/33594253> CoreText matches dot-prefixed font names case sensitively. We should
+    // always take the case insensitive patch once this radar is fixed.
+    if (family.startsWith('.'))
+        return family.string();
+    return family.string().foldCase();
+}
+
 } // namespace WebCore

Modified: branches/safari-604-branch/Source/WebCore/platform/graphics/FontDescription.h (220060 => 220061)


--- branches/safari-604-branch/Source/WebCore/platform/graphics/FontDescription.h	2017-07-31 11:23:41 UTC (rev 220060)
+++ branches/safari-604-branch/Source/WebCore/platform/graphics/FontDescription.h	2017-07-31 14:37:23 UTC (rev 220061)
@@ -232,6 +232,10 @@
     const AtomicString& familyAt(unsigned i) const { return m_families[i]; }
     const RefCountedArray<AtomicString>& families() const { return m_families; }
 
+    static bool familyNamesAreEqual(const AtomicString&, const AtomicString&);
+    static unsigned familyNameHash(const AtomicString&);
+    static String foldedFamilyName(const AtomicString&);
+
     unsigned effectiveFamilyCount() const;
     FontFamilySpecification effectiveFamilyAt(unsigned) const;
 

Modified: branches/safari-604-branch/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (220060 => 220061)


--- branches/safari-604-branch/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2017-07-31 11:23:41 UTC (rev 220060)
+++ branches/safari-604-branch/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2017-07-31 14:37:23 UTC (rev 220061)
@@ -907,7 +907,7 @@
 
     const InstalledFont& fontForPostScriptName(const AtomicString& postScriptName)
     {
-        auto folded = postScriptName.string().foldCase();
+        const auto& folded = FontCascadeDescription::foldedFamilyName(postScriptName);
         return m_postScriptNameToFontDescriptors.ensure(folded, [&] {
             auto postScriptNameString = folded.createCFString();
 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to