Diff
Modified: trunk/Source/WebCore/ChangeLog (187801 => 187802)
--- trunk/Source/WebCore/ChangeLog 2015-08-04 03:06:05 UTC (rev 187801)
+++ trunk/Source/WebCore/ChangeLog 2015-08-04 03:08:18 UTC (rev 187802)
@@ -1,3 +1,30 @@
+2015-08-03 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r187707, r187709, r187724, and
+ r187728.
+ https://bugs.webkit.org/show_bug.cgi?id=147617
+
+ fast/text/international/arabic-justify.html is flakey
+ (Requested by litherum on #webkit).
+
+ Reverted changesets:
+
+ "[OS X] Migrate to CTFontCreateForCharactersWithLanguage from
+ [NSFont findFontLike:forString:withRange:inLanguage]"
+ https://bugs.webkit.org/show_bug.cgi?id=147483
+ http://trac.webkit.org/changeset/187707
+
+ "Fix the build"
+ http://trac.webkit.org/changeset/187709
+
+ "Expand CharacterFallbackMapKey to a struct"
+ https://bugs.webkit.org/show_bug.cgi?id=147530
+ http://trac.webkit.org/changeset/187724
+
+ "CharacterFallbackMapKey should be locale-specific"
+ https://bugs.webkit.org/show_bug.cgi?id=147532
+ http://trac.webkit.org/changeset/187728
+
2015-08-03 Myles C. Maxfield <mmaxfi...@apple.com>
REGRESSION(r184899): Crash when focusing an input element styled with a web font
Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (187801 => 187802)
--- trunk/Source/WebCore/platform/graphics/Font.cpp 2015-08-04 03:06:05 UTC (rev 187801)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp 2015-08-04 03:08:18 UTC (rev 187802)
@@ -38,7 +38,6 @@
#include "OpenTypeMathData.h"
#include <wtf/MathExtras.h>
#include <wtf/NeverDestroyed.h>
-#include <wtf/text/AtomicStringHash.h>
#if ENABLE(OPENTYPE_VERTICAL)
#include "OpenTypeVerticalData.h"
@@ -397,58 +396,9 @@
#endif
}
-class CharacterFallbackMapKey {
-public:
- CharacterFallbackMapKey()
- {
- }
-
- CharacterFallbackMapKey(const AtomicString& locale, UChar32 character, bool isForPlatformFont)
- : locale(locale)
- , character(character)
- , isForPlatformFont(isForPlatformFont)
- {
- }
-
- CharacterFallbackMapKey(WTF::HashTableDeletedValueType)
- : character(-1)
- {
- }
-
- bool isHashTableDeletedValue() const { return character == -1; }
-
- bool operator==(const CharacterFallbackMapKey& other) const
- {
- return locale == other.locale && character == other.character && isForPlatformFont == other.isForPlatformFont;
- }
-
- static const bool emptyValueIsZero = true;
-
-private:
- friend struct CharacterFallbackMapKeyHash;
-
- AtomicString locale;
- UChar32 character { 0 };
- bool isForPlatformFont { false };
-};
-
-struct CharacterFallbackMapKeyHash {
- static unsigned hash(const CharacterFallbackMapKey& key)
- {
- return WTF::pairIntHash(key.locale.isNull() ? 0 : WTF::AtomicStringHash::hash(key.locale), WTF::pairIntHash(key.character, key.isForPlatformFont));
- }
-
- static bool equal(const CharacterFallbackMapKey& a, const CharacterFallbackMapKey& b)
- {
- return a == b;
- }
-
- static const bool safeToCompareToEmptyOrDeleted = true;
-};
-
// Fonts are not ref'd to avoid cycles.
-// FIXME: Shouldn't these be WeakPtrs?
-typedef HashMap<CharacterFallbackMapKey, Font*, CharacterFallbackMapKeyHash, WTF::SimpleClassHashTraits<CharacterFallbackMapKey>> CharacterFallbackMap;
+typedef std::pair<UChar32, bool /* isForPlatformFont */> CharacterFallbackMapKey;
+typedef HashMap<CharacterFallbackMapKey, Font*> CharacterFallbackMap;
typedef HashMap<const Font*, CharacterFallbackMap> SystemFallbackCache;
static SystemFallbackCache& systemFallbackCache()
@@ -466,8 +416,8 @@
return FontCache::singleton().systemFallbackForCharacters(description, this, isForPlatformFont, &codeUnit, 1);
}
- auto key = CharacterFallbackMapKey(description.locale(), character, isForPlatformFont);
- auto characterAddResult = fontAddResult.iterator->value.add(WTF::move(key), nullptr);
+ auto key = std::make_pair(character, isForPlatformFont);
+ auto characterAddResult = fontAddResult.iterator->value.add(key, nullptr);
Font*& fallbackFont = characterAddResult.iterator->value;
Modified: trunk/Source/WebCore/platform/graphics/FontCache.cpp (187801 => 187802)
--- trunk/Source/WebCore/platform/graphics/FontCache.cpp 2015-08-04 03:06:05 UTC (rev 187801)
+++ trunk/Source/WebCore/platform/graphics/FontCache.cpp 2015-08-04 03:08:18 UTC (rev 187802)
@@ -414,7 +414,6 @@
{
pruneUnreferencedEntriesFromFontCascadeCache();
pruneSystemFallbackFonts();
- platformPurgeInactiveFontData();
#if PLATFORM(IOS)
FontLocker fontLocker;
Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (187801 => 187802)
--- trunk/Source/WebCore/platform/graphics/FontCache.h 2015-08-04 03:06:05 UTC (rev 187801)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h 2015-08-04 03:08:18 UTC (rev 187802)
@@ -150,7 +150,6 @@
WEBCORE_EXPORT size_t fontCount();
WEBCORE_EXPORT size_t inactiveFontCount();
WEBCORE_EXPORT void purgeInactiveFontData(unsigned count = UINT_MAX);
- void platformPurgeInactiveFontData();
#if PLATFORM(WIN)
RefPtr<Font> fontFromDescriptionAndLogFont(const FontDescription&, const LOGFONT&, AtomicString& outFontFamilyName);
@@ -185,12 +184,6 @@
friend class Font;
};
-#if !PLATFORM(MAC)
-inline void FontCache::platformPurgeInactiveFontData()
-{
}
-#endif
-}
-
#endif
Modified: trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (187801 => 187802)
--- trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm 2015-08-04 03:06:05 UTC (rev 187801)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm 2015-08-04 03:08:18 UTC (rev 187802)
@@ -459,56 +459,22 @@
return knownFamilies.get().add(family).isNewEntry;
}
-typedef HashSet<RetainPtr<CTFontRef>, WTF::RetainPtrObjectHash<CTFontRef>, WTF::RetainPtrObjectHashTraits<CTFontRef>> FallbackDedupSet;
-static FallbackDedupSet& fallbackDedupSet()
-{
- static NeverDestroyed<FallbackDedupSet> dedupSet;
- return dedupSet.get();
-}
-
-void FontCache::platformPurgeInactiveFontData()
-{
- // This only has to be consistent throughout an individual layout or paint.
- fallbackDedupSet().clear();
-}
-
-static inline RetainPtr<CTFontRef> lookupCTFont(CTFontRef font, float fontSize, const UChar* characters, unsigned length)
-{
-#if __MAC_OS_X_VERSION_MIN_REQUIRED != 1090
- UNUSED_PARAM(fontSize);
-#else
- if (!font) {
- font = reinterpret_cast<CTFontRef>([NSFont userFontOfSize:fontSize]);
- bool acceptable = true;
-
- RetainPtr<CFCharacterSetRef> characterSet = adoptCF(CTFontCopyCharacterSet(font));
- for (auto character : StringView(characters, length).codePoints()) {
- if (!CFCharacterSetIsLongCharacterMember(characterSet.get(), character)) {
- acceptable = false;
- break;
- }
- }
- if (acceptable)
- return font;
- }
-#endif
- CFIndex coveredLength = 0;
- return adoptCF(CTFontCreateForCharactersWithLanguage(font, characters, length, nullptr, &coveredLength));
-}
-
RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font* originalFontData, bool isPlatformFont, const UChar* characters, unsigned length)
{
+ UChar32 character;
+ U16_GET(characters, 0, 0, length, character);
const FontPlatformData& platformData = originalFontData->platformData();
NSFont *nsFont = platformData.nsFont();
- RetainPtr<CTFontRef> result = lookupCTFont(platformData.font(), platformData.size(), characters, length);
- if (!result)
- return nullptr;
- // FontCascade::drawGlyphBuffer() requires that there are no duplicate Font objects which refer to the same thing. This is enforced in
- // FontCache::fontForPlatformData(), where our equality check is based on hashing the FontPlatformData, whose hash includes the raw CoreText
- // font pointer.
- NSFont *substituteFont = reinterpret_cast<NSFont *>(const_cast<__CTFont*>(fallbackDedupSet().add(result).iterator->get()));
+ NSString *string = [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(characters) length:length freeWhenDone:NO];
+ NSFont *substituteFont = [NSFont findFontLike:nsFont forString:string withRange:NSMakeRange(0, [string length]) inLanguage:nil];
+ [string release];
+ if (!substituteFont && length == 1)
+ substituteFont = [NSFont findFontLike:nsFont forCharacter:characters[0] inLanguage:nil];
+ if (!substituteFont)
+ return 0;
+
// Use the family name from the AppKit-supplied substitute font, requesting the
// traits, weight, and size we want. One way this does better than the original
// AppKit request is that it takes synthetic bold and oblique into account.
@@ -542,8 +508,6 @@
if (traits != substituteFontTraits || weight != substituteFontWeight || !nsFont) {
if (NSFont *bestVariation = [fontManager fontWithFamily:[substituteFont familyName] traits:traits weight:weight size:size]) {
- UChar32 character;
- U16_GET(characters, 0, 0, length, character);
if (!nsFont || (([fontManager traitsOfFont:bestVariation] != substituteFontTraits || [fontManager weightOfFont:bestVariation] != substituteFontWeight)
&& [[bestVariation coveredCharacterSet] longCharacterIsMember:character]))
substituteFont = bestVariation;
Modified: trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h (187801 => 187802)
--- trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h 2015-08-04 03:06:05 UTC (rev 187801)
+++ trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h 2015-08-04 03:08:18 UTC (rev 187802)
@@ -91,7 +91,6 @@
bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
CTFontRef CTFontCreateForCSS(CFStringRef name, uint16_t weight, CTFontSymbolicTraits, CGFloat size);
-CTFontRef CTFontCreateForCharactersWithLanguage(CTFontRef currentFont, const UTF16Char *characters, CFIndex length, CFStringRef language, CFIndex *coveredLength);
#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
extern const CFStringRef kCTUIFontTextStyleShortHeadline;
Modified: trunk/Source/WebCore/platform/spi/mac/NSFontSPI.h (187801 => 187802)
--- trunk/Source/WebCore/platform/spi/mac/NSFontSPI.h 2015-08-04 03:06:05 UTC (rev 187801)
+++ trunk/Source/WebCore/platform/spi/mac/NSFontSPI.h 2015-08-04 03:08:18 UTC (rev 187802)
@@ -35,6 +35,9 @@
#else
@interface NSFont (Private)
++ (NSFont *)findFontLike:(NSFont *)aFont forCharacter:(UInt32)c inLanguage:(id) language;
++ (NSFont *)findFontLike:(NSFont *)aFont forString:(NSString *)string withRange:(NSRange)range inLanguage:(id) language;
+
+ (NSFont *)systemFontOfSize:(CGFloat)size weight:(CGFloat)weight;
@end