[Webkit-unassigned] [Bug 158884] New: [Font Loading] The callback passed to document.fonts.ready should always be called

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jun 17 13:38:33 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=158884

            Bug ID: 158884
           Summary: [Font Loading] The callback passed to
                    document.fonts.ready should always be called
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Text
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: fred.wang at free.fr
                CC: alex at igalia.com, mmaxfield at apple.com
            Blocks: 133567, 133845, 155638, 155639, 155714, 153742, 153918

Created attachment 281583
  --> https://bugs.webkit.org/attachment.cgi?id=281583&action=review
testcase

Per the CSS Font Loading working draft (https://drafts.csswg.org/css-font-loading/#font-face-set-ready):

"This is similar to listening for a loadingdone event to fire, but the callbacks passed to the ready promise will always get called, even when no font loads occur because the fonts in question are already loaded."

It seems that contrary to Chrome or Firefox, WebKit does not always call that callback, as shown by the simple attached testcase.

----

More context: we are extending the support for OpenType MATH table during the MathML refactoring and we are importing tests from http://tests.mathml-association.org/ that use custom web fonts to check all these OpenType features. These tests wait for the page load (so that the font loading requests will have started or even be done) and possibly wait again for the web font loading to complete as follows:

window.addEventListener("load", function() {
   document.fonts.ready.then(runTests);
});

This works in Gecko but not in WebKit. I tried calling document.fonts.ready before (e.g. at "DOMContentLoaded" or immediately) which may give better result in WebKit although it still does not always work and sometimes it's causing random failures on Gecko too. I suspect that the problem is the following: If the fonts loading request has not started then Gecko will call runTests immediately (per the spec) and so too early while if the fonts loading request is complete then WebKit will never call runTests (per the present bug) ; so one has to call document.fonts.ready.then exactly while the web fonts are loading (which is not easy since these web fonts are loaded via standard CSS rules rather than with Javascript).

I'm making this bug blocking some other MathML bugs, although for now it is still possible to tweak the tests with some setTimeOut or similar hacks.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160617/4984a777/attachment.html>


More information about the webkit-unassigned mailing list