Re: [css-font-loading] resolving the [[ReadyPromise]] etc. when there are no pending font loads

On Sun, Sep 28, 2014 at 2:40 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> The spec currently says that when we go from there being "possibly pending
> font loads" to "no pending font loads", we set the FontFaceSet's status to
> loaded, dispatch some events, and resolve or the [[ReadyPromise]].
>
> When the FontFaceSet has no FontFace objects in it, this will result in
> loadingdone events being dispatched after every restyle or relayout done in
> the document.  I don't think that's what we want.
>
> Instead, I think we need to track whether we previously went from "no
> pending font loads" to "possibly pending font loads" only due to a scheduled
> restyle or relayout, and if so, and we don't subsequently have any FontFace
> objects start loading, the transition back to "no pending font loads"
> shouldn't run those steps.  (There's probably a simpler way to formulate
> that in the spec.)

I finally fixed the issue about when a FontFaceSet has no pending font
loads by separating out the generic condition (nothing in it that's
pending) from the specific font source conditions (all the rest).

I then added an early abort to the "some -> none" algo if nothing was
loaded during the last "pending" period, which should address this.
No state is changed when you go from "none -> some" until a font
actually starts loading, so I don't think I need to do any additional
cleanup.

~TJ

Received on Monday, 29 September 2014 18:27:45 UTC