Diff
Modified: trunk/LayoutTests/ChangeLog (201977 => 201978)
--- trunk/LayoutTests/ChangeLog 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/LayoutTests/ChangeLog 2016-06-11 21:48:15 UTC (rev 201978)
@@ -1,3 +1,26 @@
+2016-06-11 Myles C. Maxfield <[email protected]>
+
+ [Cocoa] Map commonly used Chinese Windows font names to names present on Cocoa operating systems
+ https://bugs.webkit.org/show_bug.cgi?id=158649
+ <rdar://problem/13258122>
+
+ Reviewed by Darin Adler.
+
+ Because this tests platform-specific font names, the test must
+ be platform-specific. Because it's a ref test, make two tests which
+ are mutually-exclusive on Cocoa platforms, and expected to fail
+ everywhere else.
+
+ * fast/text/chinese-font-name-aliases-2-expected.html: Added.
+ * fast/text/chinese-font-name-aliases-2.html: Added.
+ * fast/text/chinese-font-name-aliases-expected.html: Added.
+ * fast/text/chinese-font-name-aliases.html: Added.
+ * platform/efl/TestExpectations:
+ * platform/gtk/TestExpectations:
+ * platform/ios-simulator/TestExpectations:
+ * platform/mac/TestExpectations:
+ * platform/win/TestExpectations:
+
2016-06-11 Commit Queue <[email protected]>
Unreviewed, rolling out r201967, r201968, and r201972.
Added: trunk/LayoutTests/fast/text/chinese-font-name-aliases-2-expected.html (0 => 201978)
--- trunk/LayoutTests/fast/text/chinese-font-name-aliases-2-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/chinese-font-name-aliases-2-expected.html 2016-06-11 21:48:15 UTC (rev 201978)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.item {
+ font-size: 48px;
+}
+</style>
+</head>
+<body>
+This test makes sure that Windows font names are aliased to specific fonts which exist on Cocoa platforms. Note the expected results of this test will vary depending on which operating system is used.
+<span class="item" style="font-family: 'Songti SC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Songti SC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Songti SC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Heiti SC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Heiti SC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Heiti SC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Heiti TC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Heiti TC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Songti TC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Songti TC';">纸牌屋雪</span>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/fast/text/chinese-font-name-aliases-2.html (0 => 201978)
--- trunk/LayoutTests/fast/text/chinese-font-name-aliases-2.html (rev 0)
+++ trunk/LayoutTests/fast/text/chinese-font-name-aliases-2.html 2016-06-11 21:48:15 UTC (rev 201978)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.item {
+ font-size: 48px;
+}
+</style>
+</head>
+<body>
+This test makes sure that Windows font names are aliased to specific fonts which exist on Cocoa platforms. Note the expected results of this test will vary depending on which operating system is used.
+<span class="item" style="font-family: '宋体';">纸牌屋雪</span>
+<span class="item" style="font-family: '\5b8b\4f53';">纸牌屋雪</span>
+<span class="item" style="font-family: 'SimSun';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Microsoft YaHei';">纸牌屋雪</span>
+<span class="item" style="font-family: '微软雅黑';">纸牌屋雪</span>
+<span class="item" style="font-family: '黑体';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Microsoft JhengHei';">纸牌屋雪</span>
+<span class="item" style="font-family: '微軟正黑體';">纸牌屋雪</span>
+<span class="item" style="font-family: 'MS MingLiU';">纸牌屋雪</span>
+<span class="item" style="font-family: '微軟新細明體';">纸牌屋雪</span>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/fast/text/chinese-font-name-aliases-expected.html (0 => 201978)
--- trunk/LayoutTests/fast/text/chinese-font-name-aliases-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/chinese-font-name-aliases-expected.html 2016-06-11 21:48:15 UTC (rev 201978)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.item {
+ font-size: 48px;
+}
+</style>
+</head>
+<body>
+This test makes sure that Windows font names are aliased to specific fonts which exist on Cocoa platforms. Note the expected results of this test will vary depending on which operating system is used.
+<span class="item" style="font-family: 'Songti SC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Songti SC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Songti SC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'PingFang SC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'PingFang SC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'PingFang TC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'PingFang TC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Songti TC';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Songti TC';">纸牌屋雪</span>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/fast/text/chinese-font-name-aliases.html (0 => 201978)
--- trunk/LayoutTests/fast/text/chinese-font-name-aliases.html (rev 0)
+++ trunk/LayoutTests/fast/text/chinese-font-name-aliases.html 2016-06-11 21:48:15 UTC (rev 201978)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+.item {
+ font-size: 48px;
+}
+</style>
+</head>
+<body>
+This test makes sure that Windows font names are aliased to specific fonts which exist on Cocoa platforms. Note the expected results of this test will vary depending on which operating system is used.
+<span class="item" style="font-family: '宋体';">纸牌屋雪</span>
+<span class="item" style="font-family: '\5b8b\4f53';">纸牌屋雪</span>
+<span class="item" style="font-family: 'SimSun';">纸牌屋雪</span>
+<span class="item" style="font-family: '微软雅黑';">纸牌屋雪</span>
+<span class="item" style="font-family: '黑体';">纸牌屋雪</span>
+<span class="item" style="font-family: 'Microsoft JhengHei';">纸牌屋雪</span>
+<span class="item" style="font-family: '微軟正黑體';">纸牌屋雪</span>
+<span class="item" style="font-family: 'MS MingLiU';">纸牌屋雪</span>
+<span class="item" style="font-family: '微軟新細明體';">纸牌屋雪</span>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/LayoutTests/platform/efl/TestExpectations (201977 => 201978)
--- trunk/LayoutTests/platform/efl/TestExpectations 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/LayoutTests/platform/efl/TestExpectations 2016-06-11 21:48:15 UTC (rev 201978)
@@ -2627,3 +2627,7 @@
webkit.org/b/158412 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/readyState_during_canplaythrough.html [ Failure ]
webkit.org/b/158412 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/track/track-element/track-api-texttracks.html [ Failure ]
webkit.org/b/158412 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html [ Crash ]
+
+# These tests hardcode platform-specific font aliases.
+webkit.org/b/158649 fast/text/chinese-font-name-aliases.html [ ImageOnlyFailure ]
+webkit.org/b/158649 fast/text/chinese-font-name-aliases-2.html [ ImageOnlyFailure ]
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (201977 => 201978)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2016-06-11 21:48:15 UTC (rev 201978)
@@ -2648,3 +2648,7 @@
# Timing out on OS X.
imported/w3c/web-platform-tests/IndexedDB/idbcursor_iterating.htm [ Pass ]
+
+# These tests hardcode platform-specific font aliases.
+webkit.org/b/158649 fast/text/chinese-font-name-aliases.html [ ImageOnlyFailure ]
+webkit.org/b/158649 fast/text/chinese-font-name-aliases-2.html [ ImageOnlyFailure ]
Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (201977 => 201978)
--- trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-06-11 21:48:15 UTC (rev 201978)
@@ -3001,3 +3001,6 @@
webkit.org/b/157916 http/tests/misc/slow-loading-animated-image.html [ Pass ImageOnlyFailure ]
webkit.org/b/158618 fast/hidpi/hidpi-3x-device-pixel-ratio.html [ Failure ]
+
+# These tests hardcode platform-specific font aliases.
+webkit.org/b/158649 fast/text/chinese-font-name-aliases-2.html [ ImageOnlyFailure ]
Modified: trunk/LayoutTests/platform/mac/TestExpectations (201977 => 201978)
--- trunk/LayoutTests/platform/mac/TestExpectations 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2016-06-11 21:48:15 UTC (rev 201978)
@@ -1355,3 +1355,7 @@
webkit.org/b/143653 [ Yosemite ] http/tests/websocket/tests/hybi/upgrade-simple-ws.html [ Skip ] # Timeout
webkit.org/b/158534 css3/filters/backdrop/dynamic-backdrop-filter-change.html [ Pass ImageOnlyFailure ]
+
+# These tests hardcode platform-specific font aliases.
+webkit.org/b/158649 [ Yosemite ] fast/text/chinese-font-name-aliases.html [ ImageOnlyFailure ]
+webkit.org/b/158649 [ ElCapitan ] fast/text/chinese-font-name-aliases-2.html [ ImageOnlyFailure ]
Modified: trunk/LayoutTests/platform/win/TestExpectations (201977 => 201978)
--- trunk/LayoutTests/platform/win/TestExpectations 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/LayoutTests/platform/win/TestExpectations 2016-06-11 21:48:15 UTC (rev 201978)
@@ -3387,3 +3387,7 @@
# dumpPolicyDelegateCallbacks is not supported in DumpRenderTree
fast/loader/iframe-src-invalid-url.html [ Skip ]
+
+# These tests hardcode platform-specific font aliases.
+webkit.org/b/158649 fast/text/chinese-font-name-aliases.html [ ImageOnlyFailure ]
+webkit.org/b/158649 fast/text/chinese-font-name-aliases-2.html [ ImageOnlyFailure ]
Modified: trunk/Source/WTF/ChangeLog (201977 => 201978)
--- trunk/Source/WTF/ChangeLog 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/Source/WTF/ChangeLog 2016-06-11 21:48:15 UTC (rev 201978)
@@ -1,3 +1,14 @@
+2016-06-11 Myles C. Maxfield <[email protected]>
+
+ [Cocoa] Map commonly used Chinese Windows font names to names present on Cocoa operating systems
+ https://bugs.webkit.org/show_bug.cgi?id=158649
+ <rdar://problem/13258122>
+
+ Reviewed by Darin Adler.
+
+ * wtf/text/StringCommon.h:
+ (WTF::naiveEqualWithoutPerformingUnicodeNormalization): Added.
+
2016-06-11 Chris Dumez <[email protected]>
WorkerNavigator is missing some attributes
Modified: trunk/Source/WTF/wtf/text/StringCommon.h (201977 => 201978)
--- trunk/Source/WTF/wtf/text/StringCommon.h 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/Source/WTF/wtf/text/StringCommon.h 2016-06-11 21:48:15 UTC (rev 201978)
@@ -323,6 +323,17 @@
return equal(*a, *b);
}
+template<typename StringClass, unsigned length> bool naiveEqualWithoutPerformingUnicodeNormalization(const StringClass& a, const UChar (&codepoints)[length])
+{
+ if (a.length() != length)
+ return false;
+
+ if (a.is8Bit())
+ return equal(a.characters8(), codepoints, length);
+
+ return equal(a.characters16(), codepoints, length);
+}
+
template<typename CharacterTypeA, typename CharacterTypeB>
inline bool equalIgnoringASCIICase(const CharacterTypeA* a, const CharacterTypeB* b, unsigned length)
{
Modified: trunk/Source/WebCore/ChangeLog (201977 => 201978)
--- trunk/Source/WebCore/ChangeLog 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/Source/WebCore/ChangeLog 2016-06-11 21:48:15 UTC (rev 201978)
@@ -1,3 +1,30 @@
+2016-06-11 Myles C. Maxfield <[email protected]>
+
+ [Cocoa] Map commonly used Chinese Windows font names to names present on Cocoa operating systems
+ https://bugs.webkit.org/show_bug.cgi?id=158649
+ <rdar://problem/13258122>
+
+ Reviewed by Darin Adler.
+
+ There are many Chinese websites which hardcode Windows font names.
+ We should map these to fonts which best match them on Cocoa operating
+ systems. We can do this by using our existing fallback font name
+ infrastructure.
+
+ Tests: fast/text/chinese-font-name-aliases-2.html
+ fast/text/chinese-font-name-aliases.html
+
+ * platform/graphics/FontCache.cpp:
+ (WebCore::FontCache::alternateFamilyName):
+ (WebCore::alternateFamilyName): Deleted.
+ * platform/graphics/FontCache.h:
+ * platform/graphics/cocoa/FontCacheCoreText.cpp:
+ (WebCore::FontCache::platformAlternateFamilyName):
+ * platform/graphics/freetype/FontCacheFreeType.cpp:
+ (WebCore::FontCache::platformAlternateFamilyName):
+ * platform/graphics/win/FontCacheWin.cpp:
+ (WebCore::FontCache::platformAlternateFamilyName):
+
2016-06-11 Commit Queue <[email protected]>
Unreviewed, rolling out r201967, r201968, and r201972.
Modified: trunk/Source/WebCore/platform/graphics/FontCache.cpp (201977 => 201978)
--- trunk/Source/WebCore/platform/graphics/FontCache.cpp 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/Source/WebCore/platform/graphics/FontCache.cpp 2016-06-11 21:48:15 UTC (rev 201978)
@@ -159,33 +159,33 @@
return cache;
}
-static AtomicString alternateFamilyName(const AtomicString& familyName)
+const AtomicString& FontCache::alternateFamilyName(const AtomicString& familyName)
{
+ static NeverDestroyed<AtomicString> helvetica("Helvetica", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> timesNewRoman("Times New Roman", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> courierNew("Courier New", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> arial("Arial", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> courier("Courier", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> times("Times", AtomicString::ConstructFromLiteral);
+
+ const AtomicString& platformSpecificAlternate = platformAlternateFamilyName(familyName);
+ if (!platformSpecificAlternate.isNull())
+ return platformSpecificAlternate;
+
switch (familyName.length()) {
case 5:
if (equalLettersIgnoringASCIICase(familyName, "arial"))
- return AtomicString("Helvetica", AtomicString::ConstructFromLiteral);
+ return helvetica;
if (equalLettersIgnoringASCIICase(familyName, "times"))
- return AtomicString("Times New Roman", AtomicString::ConstructFromLiteral);
+ return timesNewRoman;
break;
case 7:
if (equalLettersIgnoringASCIICase(familyName, "courier"))
- return AtomicString("Courier New", AtomicString::ConstructFromLiteral);
+ return courierNew;
break;
-#if OS(WINDOWS)
- // On Windows, we don't support bitmap fonts, but legacy content expects support.
- // Thus we allow Times New Roman as an alternative for the bitmap font MS Serif,
- // even if the webpage does not specify fallback.
- // FIXME: Seems unlikely this is still needed. If it was really needed, I think we
- // would need it on other platforms too.
- case 8:
- if (equalLettersIgnoringASCIICase(familyName, "ms serif"))
- return AtomicString("Times New Roman", AtomicString::ConstructFromLiteral);
- break;
-#endif
case 9:
if (equalLettersIgnoringASCIICase(familyName, "helvetica"))
- return AtomicString("Arial", AtomicString::ConstructFromLiteral);
+ return arial;
break;
#if !OS(WINDOWS)
// On Windows, Courier New is a TrueType font that is always present and
@@ -195,23 +195,12 @@
// only be tried if Courier New is not found.
case 11:
if (equalLettersIgnoringASCIICase(familyName, "courier new"))
- return AtomicString("Courier", AtomicString::ConstructFromLiteral);
+ return courier;
break;
#endif
-#if OS(WINDOWS)
- // On Windows, we don't support bitmap fonts, but legacy content expects support.
- // Thus we allow Microsoft Sans Serif as an alternative for the bitmap font MS Sans Serif,
- // even if the webpage does not specify fallback.
- // FIXME: Seems unlikely this is still needed. If it was really needed, I think we
- // would need it on other platforms too.
- case 13:
- if (equalLettersIgnoringASCIICase(familyName, "ms sans serif"))
- return AtomicString("Microsoft Sans Serif", AtomicString::ConstructFromLiteral);
- break;
-#endif
case 15:
if (equalLettersIgnoringASCIICase(familyName, "times new roman"))
- return AtomicString("Times", AtomicString::ConstructFromLiteral);
+ return times;
break;
}
@@ -251,7 +240,7 @@
if (!it->value && !checkingAlternateName) {
// We were unable to find a font. We have a small set of fonts that we alias to other names,
// e.g., Arial/Helvetica, Courier/Courier New, etc. Try looking up the font under the aliased name.
- const AtomicString alternateName = alternateFamilyName(familyName);
+ const AtomicString& alternateName = alternateFamilyName(familyName);
if (!alternateName.isNull()) {
FontPlatformData* fontPlatformDataForAlternateName = getCachedFontPlatformData(fontDescription, alternateName, fontFaceFeatures, fontFaceVariantSettings, true);
// Lookup the key in the hash table again as the previous iterator may have
Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (201977 => 201978)
--- trunk/Source/WebCore/platform/graphics/FontCache.h 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h 2016-06-11 21:48:15 UTC (rev 201978)
@@ -226,6 +226,9 @@
FontPlatformData* getCustomFallbackFont(const UInt32, const FontDescription&);
#endif
std::unique_ptr<FontPlatformData> createFontPlatformData(const FontDescription&, const AtomicString& family, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings);
+
+ static const AtomicString& alternateFamilyName(const AtomicString&);
+ static const AtomicString& platformAlternateFamilyName(const AtomicString&);
Timer m_purgeTimer;
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (201977 => 201978)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2016-06-11 21:48:15 UTC (rev 201978)
@@ -796,4 +796,64 @@
return fontForPlatformData(alternateFont);
}
+const AtomicString& FontCache::platformAlternateFamilyName(const AtomicString& familyName)
+{
+ static const UChar songtiString[] = { 0x5b8b, 0x4f53 };
+ static const UChar weiruanYaHeiString[] = { 0x5fae, 0x8f6f, 0x96c5, 0x9ed1 };
+ static const UChar heitiString[] = { 0x9ed1, 0x4f53 };
+ static const UChar weiruanZhengHeitiString[] = { 0x5fae, 0x8edf, 0x6b63, 0x9ed1, 0x9ad4 };
+ static const UChar weiruanXinXiMingTi[] = { 0x5fae, 0x8edf, 0x65b0, 0x7d30, 0x660e, 0x9ad4 };
+
+ static NeverDestroyed<AtomicString> songtiSC("Songti SC", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> songtiTC("Songti TC", AtomicString::ConstructFromLiteral);
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) || PLATFORM(IOS)
+ static NeverDestroyed<AtomicString> heitiSCReplacement("PingFang SC", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> heitiTCReplacement("PingFang TC", AtomicString::ConstructFromLiteral);
+#else
+ static NeverDestroyed<AtomicString> heitiSCReplacement("Heiti SC", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> heitiTCReplacement("Heiti TC", AtomicString::ConstructFromLiteral);
+#endif
+
+ switch (familyName.length()) {
+ case 2:
+ if (naiveEqualWithoutPerformingUnicodeNormalization(familyName, songtiString))
+ return songtiSC;
+ if (naiveEqualWithoutPerformingUnicodeNormalization(familyName, heitiString))
+ return heitiSCReplacement;
+ break;
+ case 4:
+ if (naiveEqualWithoutPerformingUnicodeNormalization(familyName, weiruanYaHeiString))
+ return heitiSCReplacement;
+ break;
+ case 5:
+ if (naiveEqualWithoutPerformingUnicodeNormalization(familyName, weiruanZhengHeitiString))
+ return heitiTCReplacement;
+ break;
+ case 6:
+ if (equalLettersIgnoringASCIICase(familyName, "simsun"))
+ return songtiSC;
+ if (naiveEqualWithoutPerformingUnicodeNormalization(familyName, weiruanXinXiMingTi))
+ return songtiTC;
+ break;
+ case 10:
+ if (equalLettersIgnoringASCIICase(familyName, "ms mingliu"))
+ return songtiTC;
+ if (equalIgnoringASCIICase(familyName, "\\5b8b\\4f53"))
+ return songtiSC;
+ break;
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101100
+ case 15:
+ if (equalLettersIgnoringASCIICase(familyName, "microsoft yahei"))
+ return heitiSCReplacement;
+ break;
+#endif
+ case 18:
+ if (equalLettersIgnoringASCIICase(familyName, "microsoft jhenghei"))
+ return heitiTCReplacement;
+ break;
+ }
+
+ return nullAtom;
}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp (201977 => 201978)
--- trunk/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp 2016-06-11 21:48:15 UTC (rev 201978)
@@ -383,4 +383,9 @@
return platformData;
}
+const AtomicString& FontCache::platformAlternateFamilyName(const AtomicString& familyName)
+{
+ return nullAtom;
}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp (201977 => 201978)
--- trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp 2016-06-11 21:48:15 UTC (rev 201978)
@@ -604,4 +604,32 @@
return result;
}
+const AtomicString& FontCache::platformAlternateFamilyName(const AtomicString& familyName)
+{
+ static NeverDestroyed<AtomicString> timesNewRoman("Times New Roman", AtomicString::ConstructFromLiteral);
+ static NeverDestroyed<AtomicString> microsoftSansSerif("Microsoft Sans Serif", AtomicString::ConstructFromLiteral);
+
+ switch (familyName.length()) {
+ // On Windows, we don't support bitmap fonts, but legacy content expects support.
+ // Thus we allow Times New Roman as an alternative for the bitmap font MS Serif,
+ // even if the webpage does not specify fallback.
+ // FIXME: Seems unlikely this is still needed. If it was really needed, I think we
+ // would need it on other platforms too.
+ case 8:
+ if (equalLettersIgnoringASCIICase(familyName, "ms serif"))
+ return timesNewRoman;
+ break;
+ // On Windows, we don't support bitmap fonts, but legacy content expects support.
+ // Thus we allow Microsoft Sans Serif as an alternative for the bitmap font MS Sans Serif,
+ // even if the webpage does not specify fallback.
+ // FIXME: Seems unlikely this is still needed. If it was really needed, I think we
+ // would need it on other platforms too.
+ case 13:
+ if (equalLettersIgnoringASCIICase(familyName, "ms sans serif"))
+ return microsoftSansSerif;
+ break;
+ }
+ return nullAtom;
}
+
+}
Modified: trunk/Tools/ChangeLog (201977 => 201978)
--- trunk/Tools/ChangeLog 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/Tools/ChangeLog 2016-06-11 21:48:15 UTC (rev 201978)
@@ -1,3 +1,14 @@
+2016-06-11 Myles C. Maxfield <[email protected]>
+
+ [Cocoa] Map commonly used Chinese Windows font names to names present on Cocoa operating systems
+ https://bugs.webkit.org/show_bug.cgi?id=158649
+ <rdar://problem/13258122>
+
+ Reviewed by Darin Adler.
+
+ * TestWebKitAPI/Tests/WTF/WTFString.h:
+ (TestWebKitAPI::TEST):
+
2016-06-10 Alex Christensen <[email protected]>
Fix CMake build.
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp (201977 => 201978)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp 2016-06-11 20:05:55 UTC (rev 201977)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp 2016-06-11 21:48:15 UTC (rev 201978)
@@ -292,4 +292,25 @@
ASSERT_EQ(string2.existingHash(), 0u);
}
+TEST(WTF, StringNaiveUnicodeEqual)
+{
+ String string1("abc");
+ ASSERT_FALSE(string1.isNull());
+ ASSERT_TRUE(string1.is8Bit());
+ UChar ab[] = { 'a', 'b' };
+ UChar abc[] = { 'a', 'b', 'c' };
+ UChar abcd[] = { 'a', 'b', 'c', 'd' };
+ UChar aBc[] = { 'a', 'B', 'c' };
+ ASSERT_FALSE(naiveEqualWithoutPerformingUnicodeNormalization(string1, ab));
+ ASSERT_TRUE(naiveEqualWithoutPerformingUnicodeNormalization(string1, abc));
+ ASSERT_FALSE(naiveEqualWithoutPerformingUnicodeNormalization(string1, abcd));
+ ASSERT_FALSE(naiveEqualWithoutPerformingUnicodeNormalization(string1, aBc));
+
+ String string2(abc, 3);
+ ASSERT_FALSE(naiveEqualWithoutPerformingUnicodeNormalization(string2, ab));
+ ASSERT_TRUE(naiveEqualWithoutPerformingUnicodeNormalization(string2, abc));
+ ASSERT_FALSE(naiveEqualWithoutPerformingUnicodeNormalization(string2, abcd));
+ ASSERT_FALSE(naiveEqualWithoutPerformingUnicodeNormalization(string2, aBc));
+}
+
} // namespace TestWebKitAPI