W3C home > Mailing lists > Public > www-style@w3.org > July 2014

[css-font-loading] handling when the FontFaceSet becomes empty

From: Cameron McCormack <cam@mcc.id.au>
Date: Sat, 05 Jul 2014 18:21:06 +1000
Message-ID: <53B7B572.4040701@mcc.id.au>
To: "www-style@w3.org" <www-style@w3.org>
The spec currently says to set a FontFaceSet's status attribute to 
"loaded", dispatch loadingdone & loadingerror events, and resolve its 
[[ReadyPromise]] if "there are ever no pending font loads and either of 
font face setís [[LoadedFonts]] or [[FailedFonts]] slots are not empty".

First, I think this should be reworded to talk about running these steps 
when you transition from "not(there are no pending font loads)" to 
"there are no pending font loads", otherwise it reads like a FontFaceSet 
containing only loaded/error FontFaces should constantly be running 
these steps.

Second, what's the reasoning behind not running these steps when there 
are no FontFace objects in the FontFaceSet at all?  I think it's 
consistent with the FontFaceSet's status initially being "loaded" to 
change it to "loaded", dispatch a loadingdone event and resolve the 
promise in this example:

   assert(document.fonts.status == "loaded");
   var face = new FontFace("test", "url(x)");
   assert(document.fonts.status == "loading");

   // Here I would expect document.fonts.status to be "loaded",
   // a loadeddone event to be dispatched with an empty list of
   // FontFaces, and for document.fonts.ready to have been replaced.
Received on Saturday, 5 July 2014 08:19:15 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:44 UTC