Changeset 188025 in webkit
- Timestamp:
- Aug 5, 2015 10:16:09 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r188024 r188025 1 2015-08-05 Myles C. Maxfield <mmaxfield@apple.com> 2 3 CharacterFallbackMapKey should be locale-specific 4 https://bugs.webkit.org/show_bug.cgi?id=147532 5 6 Reviewed by Dean Jackson. 7 8 This is in preparation for locale-specific font fallback. 9 10 No new tests because there is no behavior change. 11 12 * platform/graphics/Font.cpp: 13 (WebCore::CharacterFallbackMapKey::CharacterFallbackMapKey): 14 (WebCore::CharacterFallbackMapKey::operator==): 15 (WebCore::CharacterFallbackMapKeyHash::hash): 16 (WebCore::Font::systemFallbackFontForCharacter): 17 1 18 2015-08-05 Myles C. Maxfield <mmaxfield@apple.com> 2 19 -
trunk/Source/WebCore/platform/graphics/Font.cpp
r188024 r188025 39 39 #include <wtf/MathExtras.h> 40 40 #include <wtf/NeverDestroyed.h> 41 #include <wtf/text/AtomicStringHash.h> 41 42 42 43 #if ENABLE(OPENTYPE_VERTICAL) … … 397 398 } 398 399 399 struct CharacterFallbackMapKey { 400 class CharacterFallbackMapKey { 401 public: 400 402 CharacterFallbackMapKey() 401 403 { 402 404 } 403 405 404 CharacterFallbackMapKey(UChar32 character, bool isForPlatformFont) 405 : character(character) 406 CharacterFallbackMapKey(const AtomicString& locale, UChar32 character, bool isForPlatformFont) 407 : locale(locale) 408 , character(character) 406 409 , isForPlatformFont(isForPlatformFont) 407 410 { … … 417 420 bool operator==(const CharacterFallbackMapKey& other) const 418 421 { 419 return character == other.character && isForPlatformFont == other.isForPlatformFont;422 return locale == other.locale && character == other.character && isForPlatformFont == other.isForPlatformFont; 420 423 } 421 424 422 425 static const bool emptyValueIsZero = true; 423 426 427 private: 428 friend struct CharacterFallbackMapKeyHash; 429 430 AtomicString locale; 424 431 UChar32 character { 0 }; 425 432 bool isForPlatformFont { false }; … … 429 436 static unsigned hash(const CharacterFallbackMapKey& key) 430 437 { 431 return WTF::pairIntHash(key. character, key.isForPlatformFont);438 return WTF::pairIntHash(key.locale.isNull() ? 0 : WTF::AtomicStringHash::hash(key.locale), WTF::pairIntHash(key.character, key.isForPlatformFont)); 432 439 } 433 440 … … 441 448 442 449 // Fonts are not ref'd to avoid cycles. 450 // FIXME: Shouldn't these be WeakPtrs? 443 451 typedef HashMap<CharacterFallbackMapKey, Font*, CharacterFallbackMapKeyHash, WTF::SimpleClassHashTraits<CharacterFallbackMapKey>> CharacterFallbackMap; 444 452 typedef HashMap<const Font*, CharacterFallbackMap> SystemFallbackCache; … … 459 467 } 460 468 461 auto key = CharacterFallbackMapKey( character, isForPlatformFont);469 auto key = CharacterFallbackMapKey(description.locale(), character, isForPlatformFont); 462 470 auto characterAddResult = fontAddResult.iterator->value.add(WTF::move(key), nullptr); 463 471
Note: See TracChangeset
for help on using the changeset viewer.