Unreviewed, rolling out r210778.
authorryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Jan 2017 00:21:29 +0000 (00:21 +0000)
committerryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Jan 2017 00:21:29 +0000 (00:21 +0000)
This change caused multiple LayoutTests to crash.

Reverted changeset:

"[Cocoa] Unify FontPlatformData's hashing and equality
operators"
https://bugs.webkit.org/show_bug.cgi?id=167061
http://trac.webkit.org/changeset/210778

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210997 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/FontPlatformData.h
Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
Source/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp
Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp
Source/WebCore/platform/graphics/win/FontPlatformDataDirect2D.cpp

index 876fb20..adf2e55 100644 (file)
@@ -1,3 +1,16 @@
+2017-01-20  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r210778.
+
+        This change caused multiple LayoutTests to crash.
+
+        Reverted changeset:
+
+        "[Cocoa] Unify FontPlatformData's hashing and equality
+        operators"
+        https://bugs.webkit.org/show_bug.cgi?id=167061
+        http://trac.webkit.org/changeset/210778
+
 2017-01-20  Joseph Pecoraro  <pecoraro@apple.com>
 
         Remove outdated ENABLE(CSP_NEXT) build flag
index b154b65..ad382f4 100644 (file)
@@ -172,7 +172,25 @@ public:
     FcFontSet* fallbacks() const;
 #endif
 
-    unsigned hash() const;
+    unsigned hash() const
+    {
+#if USE(CAIRO)
+        return PtrHash<cairo_scaled_font_t*>::hash(m_scaledFont.get());
+#elif PLATFORM(WIN)
+        return m_font ? m_font->hash() : 0;
+#elif PLATFORM(COCOA)
+        uintptr_t flags = static_cast<uintptr_t>(m_isHashTableDeletedValue << 5 | m_textRenderingMode << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique);
+#if USE(APPKIT)
+        uintptr_t fontHash = (uintptr_t)m_font.get();
+#else
+        uintptr_t fontHash = reinterpret_cast<uintptr_t>(CFHash(m_font.get()));
+#endif
+        uintptr_t hashCodes[3] = { fontHash, m_widthVariant, flags };
+        return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
+#else
+#error "Unsupported configuration"
+#endif
+    }
 
     bool operator==(const FontPlatformData& other) const
     {
index 0da13fa..e22e326 100644 (file)
@@ -58,19 +58,18 @@ FontPlatformData::FontPlatformData(CTFontRef font, float size, bool syntheticBol
 #endif
 }
 
-unsigned FontPlatformData::hash() const
-{
-    uintptr_t flags = static_cast<uintptr_t>(m_isHashTableDeletedValue << 5 | m_textRenderingMode << 3 | m_orientation << 2 | m_syntheticBold << 1 | m_syntheticOblique);
-    uintptr_t fontHash = reinterpret_cast<uintptr_t>(CFHash(m_font.get()));
-    uintptr_t hashCodes[3] = { fontHash, m_widthVariant, flags };
-    return StringHasher::hashMemory<sizeof(hashCodes)>(hashCodes);
-}
-
 bool FontPlatformData::platformIsEqual(const FontPlatformData& other) const
 {
-    if (!m_font || !other.m_font)
-        return m_font == other.m_font;
-    return CFEqual(m_font.get(), other.m_font.get());
+    bool result = false;
+    if (m_font || other.m_font) {
+#if PLATFORM(IOS)
+        result = m_font && other.m_font && CFEqual(m_font.get(), other.m_font.get());
+#else
+        result = m_font == other.m_font;
+#endif
+        return result;
+    }
+    return true;
 }
 
 CTFontRef FontPlatformData::registeredFont() const
@@ -110,11 +109,11 @@ static CFDictionaryRef cascadeToLastResortAttributesDictionary()
 
     RetainPtr<CTFontDescriptorRef> lastResort = adoptCF(CTFontDescriptorCreateWithNameAndSize(CFSTR("LastResort"), 0));
 
-    CFTypeRef descriptors[] = { lastResort.get() };
+    const void* descriptors[] = { lastResort.get() };
     RetainPtr<CFArrayRef> array = adoptCF(CFArrayCreate(kCFAllocatorDefault, descriptors, WTF_ARRAY_LENGTH(descriptors), &kCFTypeArrayCallBacks));
 
-    CFTypeRef keys[] = { kCTFontCascadeListAttribute };
-    CFTypeRef values[] = { array.get() };
+    const void* keys[] = { kCTFontCascadeListAttribute };
+    const void* values[] = { array.get() };
     attributes = CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
 
     return attributes;
index b8ec73c..84e1ba1 100644 (file)
@@ -280,11 +280,6 @@ bool FontPlatformData::isFixedPitch() const
     return m_fixedWidth;
 }
 
-unsigned FontPlatformData::hash() const
-{
-    return PtrHash<cairo_scaled_font_t*>::hash(m_scaledFont.get());
-}
-
 bool FontPlatformData::platformIsEqual(const FontPlatformData& other) const
 {
     // FcPatternEqual does not support null pointers as arguments.
index a845341..8920071 100644 (file)
@@ -129,11 +129,6 @@ FontPlatformData::FontPlatformData(GDIObject<HFONT> hfont, CGFontRef font, float
 {
 }
 
-unsigned FontPlatformData::hash() const
-{
-    return m_font ? m_font->hash() : 0;
-}
-
 bool FontPlatformData::platformIsEqual(const FontPlatformData& other) const
 {
     return m_font == other.m_font
index e63a122..f888994 100644 (file)
@@ -85,11 +85,6 @@ FontPlatformData::FontPlatformData(GDIObject<HFONT> font, cairo_font_face_t* fon
     cairo_font_options_destroy(options);
 }
 
-unsigned FontPlatformData::hash() const
-{
-    return PtrHash<cairo_scaled_font_t*>::hash(m_scaledFont.get());
-}
-
 bool FontPlatformData::platformIsEqual(const FontPlatformData& other) const
 {
     return m_font == other.m_font
index e0f424d..d464dca 100644 (file)
@@ -104,11 +104,6 @@ static bool fontsAreEqual(IDWriteFont* a, IDWriteFont* b)
     return true;
 }
 
-unsigned FontPlatformData::hash() const
-{
-    return m_font ? m_font->hash() : 0;
-}
-
 bool FontPlatformData::platformIsEqual(const FontPlatformData& other) const
 {
     return m_font == other.m_font