Title: [188024] trunk/Source/WebCore
- Revision
- 188024
- Author
- mmaxfi...@apple.com
- Date
- 2015-08-05 22:13:40 -0700 (Wed, 05 Aug 2015)
Log Message
Expand CharacterFallbackMapKey to a struct
https://bugs.webkit.org/show_bug.cgi?id=147530
Reviewed by Dean Jackson.
This is in prepraration for making this struct locale-specific.
No new tests because there is no behavior change.
* platform/graphics/Font.cpp:
(WebCore::CharacterFallbackMapKey::CharacterFallbackMapKey):
(WebCore::CharacterFallbackMapKey::isHashTableDeletedValue):
(WebCore::CharacterFallbackMapKey::operator==):
(WebCore::CharacterFallbackMapKeyHash::hash):
(WebCore::CharacterFallbackMapKeyHash::equal):
(WebCore::Font::systemFallbackFontForCharacter):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (188023 => 188024)
--- trunk/Source/WebCore/ChangeLog 2015-08-06 04:50:01 UTC (rev 188023)
+++ trunk/Source/WebCore/ChangeLog 2015-08-06 05:13:40 UTC (rev 188024)
@@ -1,3 +1,22 @@
+2015-08-05 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ Expand CharacterFallbackMapKey to a struct
+ https://bugs.webkit.org/show_bug.cgi?id=147530
+
+ Reviewed by Dean Jackson.
+
+ This is in prepraration for making this struct locale-specific.
+
+ No new tests because there is no behavior change.
+
+ * platform/graphics/Font.cpp:
+ (WebCore::CharacterFallbackMapKey::CharacterFallbackMapKey):
+ (WebCore::CharacterFallbackMapKey::isHashTableDeletedValue):
+ (WebCore::CharacterFallbackMapKey::operator==):
+ (WebCore::CharacterFallbackMapKeyHash::hash):
+ (WebCore::CharacterFallbackMapKeyHash::equal):
+ (WebCore::Font::systemFallbackFontForCharacter):
+
2015-08-05 Chris Dumez <cdu...@apple.com>
Crash when removing children of a MathMLSelectElement
Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (188023 => 188024)
--- trunk/Source/WebCore/platform/graphics/Font.cpp 2015-08-06 04:50:01 UTC (rev 188023)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp 2015-08-06 05:13:40 UTC (rev 188024)
@@ -396,9 +396,51 @@
#endif
}
+struct CharacterFallbackMapKey {
+ CharacterFallbackMapKey()
+ {
+ }
+
+ CharacterFallbackMapKey(UChar32 character, bool isForPlatformFont)
+ : character(character)
+ , isForPlatformFont(isForPlatformFont)
+ {
+ }
+
+ CharacterFallbackMapKey(WTF::HashTableDeletedValueType)
+ : character(-1)
+ {
+ }
+
+ bool isHashTableDeletedValue() const { return character == -1; }
+
+ bool operator==(const CharacterFallbackMapKey& other) const
+ {
+ return character == other.character && isForPlatformFont == other.isForPlatformFont;
+ }
+
+ static const bool emptyValueIsZero = true;
+
+ UChar32 character { 0 };
+ bool isForPlatformFont { false };
+};
+
+struct CharacterFallbackMapKeyHash {
+ static unsigned hash(const CharacterFallbackMapKey& key)
+ {
+ return 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.
-typedef std::pair<UChar32, bool /* isForPlatformFont */> CharacterFallbackMapKey;
-typedef HashMap<CharacterFallbackMapKey, Font*> CharacterFallbackMap;
+typedef HashMap<CharacterFallbackMapKey, Font*, CharacterFallbackMapKeyHash, WTF::SimpleClassHashTraits<CharacterFallbackMapKey>> CharacterFallbackMap;
typedef HashMap<const Font*, CharacterFallbackMap> SystemFallbackCache;
static SystemFallbackCache& systemFallbackCache()
@@ -416,8 +458,8 @@
return FontCache::singleton().systemFallbackForCharacters(description, this, isForPlatformFont, &codeUnit, 1);
}
- auto key = std::make_pair(character, isForPlatformFont);
- auto characterAddResult = fontAddResult.iterator->value.add(key, nullptr);
+ auto key = CharacterFallbackMapKey(character, isForPlatformFont);
+ auto characterAddResult = fontAddResult.iterator->value.add(WTF::move(key), nullptr);
Font*& fallbackFont = characterAddResult.iterator->value;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes