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

On Sat, Jul 5, 2014 at 1:21 AM, Cameron McCormack <cam@mcc.id.au> wrote:
> 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.

Done.

> 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)");
>   face.load();
>   document.fonts.add(face);
>   assert(document.fonts.status == "loading");
>   document.fonts.clear();
>
>   // 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.

I don't recall any specific reasoning, so it's probably accidental.
I've changed it accordingly; this also means that the initial value of
[[ReadyPromise]] is back to being a pending promise; it'll get
fulfilled on load by this algo if you're not loading any fonts.

~TJ

Received on Monday, 7 July 2014 21:01:33 UTC