Title: [210997] trunk/Source/WebCore
Revision
210997
Author
[email protected]
Date
2017-01-20 16:21:29 -0800 (Fri, 20 Jan 2017)

Log Message

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (210996 => 210997)


--- trunk/Source/WebCore/ChangeLog	2017-01-21 00:17:53 UTC (rev 210996)
+++ trunk/Source/WebCore/ChangeLog	2017-01-21 00:21:29 UTC (rev 210997)
@@ -1,3 +1,16 @@
+2017-01-20  Ryan Haddad  <[email protected]>
+
+        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  <[email protected]>
 
         Remove outdated ENABLE(CSP_NEXT) build flag

Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.h (210996 => 210997)


--- trunk/Source/WebCore/platform/graphics/FontPlatformData.h	2017-01-21 00:17:53 UTC (rev 210996)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.h	2017-01-21 00:21:29 UTC (rev 210997)
@@ -172,7 +172,25 @@
     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
     {

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm (210996 => 210997)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm	2017-01-21 00:17:53 UTC (rev 210996)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm	2017-01-21 00:21:29 UTC (rev 210997)
@@ -58,19 +58,18 @@
 #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 @@
 
     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;

Modified: trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp (210996 => 210997)


--- trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2017-01-21 00:17:53 UTC (rev 210996)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp	2017-01-21 00:21:29 UTC (rev 210997)
@@ -280,11 +280,6 @@
     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.

Modified: trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp (210996 => 210997)


--- trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp	2017-01-21 00:17:53 UTC (rev 210996)
+++ trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp	2017-01-21 00:21:29 UTC (rev 210997)
@@ -129,11 +129,6 @@
 {
 }
 
-unsigned FontPlatformData::hash() const
-{
-    return m_font ? m_font->hash() : 0;
-}
-
 bool FontPlatformData::platformIsEqual(const FontPlatformData& other) const
 {
     return m_font == other.m_font

Modified: trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp (210996 => 210997)


--- trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp	2017-01-21 00:17:53 UTC (rev 210996)
+++ trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp	2017-01-21 00:21:29 UTC (rev 210997)
@@ -85,11 +85,6 @@
     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

Modified: trunk/Source/WebCore/platform/graphics/win/FontPlatformDataDirect2D.cpp (210996 => 210997)


--- trunk/Source/WebCore/platform/graphics/win/FontPlatformDataDirect2D.cpp	2017-01-21 00:17:53 UTC (rev 210996)
+++ trunk/Source/WebCore/platform/graphics/win/FontPlatformDataDirect2D.cpp	2017-01-21 00:21:29 UTC (rev 210997)
@@ -104,11 +104,6 @@
     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
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to