[Mac] Font lookups are flakey due to caching
https://bugs.webkit.org/show_bug.cgi?id=145180
<rdar://problem/
21012406>
Reviewed by Darin Adler.
Source/WebCore:
Font lookups were flakey on Mac due to the cache in fontWithFamily().
The reason is that the "desired family" to "available family" mapping
is sometimes dependent on the desired traits. However, our cache was
only using the "desired family" as key.
This patch now uses a std::pair as key containing both the "desired
family" and the "desired traits" for correctness. I also updated the
cache to use WTF types instead of NS types.
Test: platform/mac/fast/text/font-weights.html
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::desiredFamilyToAvailableFamilyMap):
(WebCore::hasDesiredFamilyToAvailableFamilyMapping):
(WebCore::rememberDesiredFamilyToAvailableFamilyMapping):
(WebCore::fontWithFamily):
(WebCore::invalidateFontCache):
(WebCore::desiredFamilyToAvailableFamilyDictionary): Deleted.
LayoutTests:
* platform/mac/TestExpectations:
Unskip platform/mac/fast/text/font-weights.html as it is no longer
flakey after this change.
* platform/mac/fast/text/font-weights-expected.txt:
Rebaseline the test as the expected results were those based on the
bad caching behavior.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184599
268f45cc-cd09-0410-ab3c-
d52691b4dbfc