Bug 145149

Summary: [Mac] All font lookups are flakey
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: Layout and RenderingAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=145180
Attachments:
Description Flags
Patch none

Description Myles C. Maxfield 2015-05-18 16:00:50 PDT
On all OSes.
Comment 1 Myles C. Maxfield 2015-05-18 16:03:16 PDT
Created attachment 253350 [details]
Patch
Comment 2 WebKit Commit Bot 2015-05-18 18:00:40 PDT
Comment on attachment 253350 [details]
Patch

Clearing flags on attachment: 253350

Committed r184532: <http://trac.webkit.org/changeset/184532>
Comment 3 WebKit Commit Bot 2015-05-18 18:00:46 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Myles C. Maxfield 2015-05-18 18:02:04 PDT
Reopened for the root cause.
Comment 5 Myles C. Maxfield 2015-05-18 18:04:44 PDT
Fails when run after jquery/offset.html
Comment 6 Myles C. Maxfield 2015-05-18 18:21:25 PDT
Reduction of the font-weights test: <div style="font-family: HelveticaNeue-Light; font-weight: 100;">Font: HelveticaNeue-Light Weight: 100</div>
Comment 7 Myles C. Maxfield 2015-05-18 19:47:58 PDT
reduction of the offset test:
<script>
testRunner.waitUntilDone()
window.setTimeout(function() {
    testRunner.notifyDone();
}, 13);
</script>
<h2 style="font-family: HelveticaNeue-Light;">asdf
Comment 8 Myles C. Maxfield 2015-05-18 20:03:02 PDT
Running the test alone uses HelveticaNeue-Light, while running the two together uses HelveticaNeue-UltraLight
Comment 9 Myles C. Maxfield 2015-05-18 20:33:08 PDT
This is because the desiredFamilyToAvailableFamilyDictionary() cache inside fontWithFamily() in FontCacheMac is incorrect.

In particular, there are two exit points of this function. If our search item exists in the cache, we skip the first exit point, which may be the correct one to take.

A previous font may have skipped over the first exit point because of external information (weight, traits, etc). Because of this, we will insert this name into the cache. However, when the second font comes around, its external information may mean that it should take the first exit point. However, we notice that the family name is in the cache and skip the first exit point.
Comment 10 Myles C. Maxfield 2015-05-18 20:37:37 PDT
See https://bugs.webkit.org/show_bug.cgi?id=137539
Comment 11 Myles C. Maxfield 2015-05-18 20:51:56 PDT
platform/mac/fast/text/font-weights.html is the test in question.
Comment 12 Myles C. Maxfield 2015-05-18 20:52:20 PDT
<rdar://problem/21012406>
Comment 13 Myles C. Maxfield 2015-05-21 10:34:44 PDT
Fixed in https://bugs.webkit.org/show_bug.cgi?id=145180