W3C home > Mailing lists > Public > www-style@w3.org > March 2015

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

From: Cameron McCormack <cam@mcc.id.au>
Date: Wed, 18 Mar 2015 18:00:59 +1100
To: www-style@w3.org
Message-ID: <20150318070059.GG27130@wok.mcc.id.au>
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”, …


  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

Cameron McCormack ≝ http://mcc.id.au/
Received on Wednesday, 18 March 2015 07:01:29 UTC

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