Re: [css-font-loading] “whenever” algorithms

One additional reason for moving away from “whenever” algorithms is that
it is possible for two different “whenever” algorithms to be triggered
at the same time, and it is not defined which order their steps are run.

For example, consider:

  assert(document.fonts.status == "unloaded");
  document.fonts.add(new FontFace("test", "url(some-font)");

When the font finishes downloading, we are in step 5 of
http://dev.w3.org/csswg/css-font-loading/#font-face-load.  Step 5.2
updates the FontFace’s status attribute to “loaded”.  At that moment,
both the

  Whenever one or more available font faces for a given FontFaceSet
  change their status attribute to “loaded” or “error”, …

and

  Whenever a FontFaceSet goes from having possibly pending font loads to
  having no pending font loads, …

conditions are triggered.  Clearly, to get the expected behaviour of the
FontFace being exposed on the loadingdone event, you need to run the
former algorithm’s steps before the latter’s.  But it’s not well
defined.

-- 
Cameron McCormack ≝ http://mcc.id.au/

Received on Wednesday, 18 March 2015 07:01:29 UTC