10BC0 [css-font-loading] Use proper async language, per discussion with Anne. · w3c/csswg-drafts@1b6d0e3 · GitHub
Skip to content
< 10BC0 div id="responsive-meta-container" data-turbo-replace>

Commit 1b6d0e3

Browse files
committed
[css-font-loading] Use proper async language, per discussion with Anne.
--HG-- extra : rebase_source : 98492376e19918167a9a5abaced39673c43e812f
1 parent 447c601 commit 1b6d0e3

2 files changed

Lines changed: 90 additions & 42 deletions

File tree

css-font-loading/Overview.bs

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,23 @@ The Constructor</h3>
181181
If <var>font face's</var> <a>[<!---->[Data]]</a> slot is not <code>null</code>,
182182
set <var>font face's</var> <a for=FontFace>status</a> attribute to "loading",
183183
and attempt to parse the data in it as a font.
184-
If this is successful,
185-
<var>font face</var> now represents the parsed font;
186-
fulfill <var>font face's</var> <a>[<!---->[FontStatusPromise]]</a> with <var>font face</var>,
187-
and set its <a for=FontFace>status</a> attribute to "loaded".
188-
If it is unsuccessful,
189-
reject <var>font face's</var> <a>[<!---->[FontStatusPromise]]</a> with a SyntaxError
190-
and set <var>font face's</var> <a for=FontFace>status</a> attribute to "error".
184+
When this is completed,
185+
successfully or not,
186+
await a stable state,
187+
then run the following steps synchronously:
188+
189+
<ol>
190+
<li>
191+
If the load was successful,
192+
<var>font face</var> now represents the parsed font;
193+
fulfill <var>font face's</var> <a>[<!---->[FontStatusPromise]]</a> with <var>font face</var>,
194+
and set its <a for=FontFace>status</a> attribute to "loaded".
195+
196+
<li>
197+
Otherwise,
198+
reject <var>font face's</var> <a>[<!---->[FontStatusPromise]]</a> with a SyntaxError
199+
and set <var>font face's</var> <a for=FontFace>status</a> attribute to "error".
200+
</ol>
191201
</ol>
192202

193203
Note: Newly constructed FontFace objects are not automatically added
@@ -231,15 +241,23 @@ The <code>load()</code> method</h3>
231241
as if it was the value of a ''@font-face'' rule's 'src' descriptor.
232242

233243
<li>
234-
If the attempt to load fails,
235-
reject <var>font face's</var> <a>[<!---->[FontStatusPromise]]</a> with a NetworkError
236-
and set <var>font face's</var> <a for=FontFace>status</a> attribute to "error".
244+
When the load operation completes,
245+
successfully or not,
246+
await a stable state,
247+
then run the following steps synchronously:
237248

238-
<li>
239-
Otherwise,
240-
<var>font face</var> now represents the loaded font;
241-
fulfill <var>font face's</var> <a>[<!---->[FontStatusPromise]]</a> with <var>font face</var>
242-
and set <var>font face's</var> <a for=FontFace>status</a> attribute to "loaded".
249+
<ol>
250+
<li>
251+
If the attempt to load fails,
252+
reject <var>font face's</var> <a>[<!---->[FontStatusPromise]]</a> with a NetworkError
253+
and set <var>font face's</var> <a for=FontFace>status</a> attribute to "error".
254+
255+
<li>
256+
Otherwise,
257+
<var>font face</var> now represents the loaded font;
258+
fulfill <var>font face's</var> <a>[<!---->[FontStatusPromise]]</a> with <var>font face</var>
259+
and set <var>font face's</var> <a for=FontFace>status</a> attribute to "loaded".
260+
</ol>
243261
</ol>
244262

245263
User agents can initiate font loads on their own,
@@ -567,12 +585,18 @@ The <code>load()</code> method</h3>
567585
and terminate these steps.
568586

569587
<li>
570-
For all of the font faces in the <var>font face list</var>,
571-
call their <a method for=FontFace>load()</a> method.
588+
Await a stable state,
589+
then run the following steps synchronously:
572590

573-
<li>
574-
Resolve <var>promise</var> with the result of
575-
waiting for all of the <a attribute>[<!---->[FontStatusPromise]]</a>s of each font face in the <var>font face list</var>, in order.
591+
<ol>
592+
<li>
593+
For all of the font faces in the <var>font face list</var>,
594+
call their <a method for=FontFace>load()</a> method.
595+
596+
<li>
597+
Resolve <var>promise</var> with the result of
598+
waiting for all of the <a attribute>[<!---->[FontStatusPromise]]</a>s of each font face in the <var>font face list</var>, in order.
599+
</ol>
576600
</ol>
577601

578602
<h3 id='font-face-set-check'>

css-font-loading/Overview.html

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,23 @@ <h3 class="heading settled heading" data-level=2.1 id=font-face-constructor><spa
279279
If <var>font face’s</var> <a data-link-type=idl href=#dom-fontface-data title=[[data]]>[[Data]]</a> slot is not <code>null</code>,
280280
set <var>font face’s</var> <a data-link-for=FontFace data-link-type=idl href=#dom-fontface-status title=status>status</a> attribute to "loading",
281281
and attempt to parse the data in it as a font.
282-
If this is successful,
283-
<var>font face</var> now represents the parsed font;
284-
fulfill <var>font face’s</var> <a data-link-type=idl href=#dom-fontface-fontstatuspromise title=[[fontstatuspromise]]>[[FontStatusPromise]]</a> with <var>font face</var>,
285-
and set its <a data-link-for=FontFace data-link-type=idl href=#dom-fontface-status title=status>status</a> attribute to "loaded".
286-
If it is unsuccessful,
287-
reject <var>font face’s</var> <a data-link-type=idl href=#dom-fontface-fontstatuspromise title=[[fontstatuspromise]]>[[FontStatusPromise]]</a> with a SyntaxError
288-
and set <var>font face’s</var> <a data-link-for=FontFace data-link-type=idl href=#dom-fontface-status title=status>status</a> attribute to "error".
282+
When this is completed,
283+
successfully or not,
284+
await a stable state,
285+
then run the following steps synchronously:
286+
287+
<ol>
288+
<li>
289+
If the load was successful,
290+
<var>font face</var> now represents the parsed font;
291+
fulfill <var>font face’s</var> <a data-link-type=idl href=#dom-fontface-fontstatuspromise title=[[fontstatuspromise]]>[[FontStatusPromise]]</a> with <var>font face</var>,
292+
and set its <a data-link-for=FontFace data-link-type=idl href=#dom-fontface-status title=status>status</a> attribute to "loaded".
293+
294+
<li>
295+
Otherwise,
296+
reject <var>font face’s</var> <a data-link-type=idl href=#dom-fontface-fontstatuspromise title=[[fontstatuspromise]]>[[FontStatusPromise]]</a> with a SyntaxError
297+
and set <var>font face’s</var> <a data-link-for=FontFace data-link-type=idl href=#dom-fontface-status title=status>status</a> attribute to "error".
298+
</ol>
289299
</ol>
290300

291301
<p class=note>Note: Newly constructed FontFace objects are not automatically added
@@ -329,15 +339,23 @@ <h3 class="heading settled heading" data-level=2.2 id=font-face-load><span class
329339
as if it was the value of a <a class=css data-link-type=maybe href=http://www.w3.org/TR/css-fonts-3/#at-font-face-rule title=@font-face>@font-face</a> rule’s <a class=property data-link-type=propdesc href=http://www.w3.org/TR/css-fonts-3/#descdef-src title=src>src</a> descriptor.
330340

331341
</var><li>
332-
If the attempt to load fails,
333-
reject <var>font face’s</var> <a data-link-type=idl href=#dom-fontface-fontstatuspromise title=[[fontstatuspromise]]>[[FontStatusPromise]]</a> with a NetworkError
334-
and set <var>font face’s</var> <a data-link-for=FontFace data-link-type=idl href=#dom-fontface-status title=status>status</a> attribute to "error".
335-
336-
<li>
337-
Otherwise,
338-
<var>font face</var> now represents the loaded font;
339-
fulfill <var>font face’s</var> <a data-link-type=idl href=#dom-fontface-fontstatuspromise title=[[fontstatuspromise]]>[[FontStatusPromise]]</a> with <var>font face</var>
340-
and set <var>font face’s</var> <a data-link-for=FontFace data-link-type=idl href=#dom-fontface-status title=status>status</a> attribute to "loaded".
342+
When the load operation completes,
343+
successfully or not,
344+
await a stable state,
345+
then run the following steps synchronously:
346+
347+
<ol>
348+
<li>
349+
If the attempt to load fails,
350+
reject <var>font face’s</var> <a data-link-type=idl href=#dom-fontface-fontstatuspromise title=[[fontstatuspromise]]>[[FontStatusPromise]]</a> with a NetworkError
351+
and set <var>font face’s</var> <a data-link-for=FontFace data-link-type=idl href=#dom-fontface-status title=status>status</a> attribute to "error".
352+
353+
<li>
354+
Otherwise,
355+
<var>font face</var> now represents the loaded font;
356+
fulfill <var>font face’s</var> <a data-link-type=idl href=#dom-fontface-fontstatuspromise title=[[fontstatuspromise]]>[[FontStatusPromise]]</a> with <var>font face</var>
357+
and set <var>font face’s</var> <a data-link-for=FontFace data-link-type=idl href=#dom-fontface-status title=status>status</a> attribute to "loaded".
358+
</ol>
341359
</ol>
342360

343361
<p>User agents can initiate font loads on their own,
@@ -664,12 +682,18 @@ <h3 class="heading settled heading" data-level=3.3 id=font-face-set-load><span c
664682
and terminate these steps.
665683

666684
<li>
667-
For all of the font faces in the <var>font face list</var>,
668-
call their <a class=idl-code data-link-for=FontFace data-link-type=method href=#dom-fontface-load title=load()>load()</a> method.
669-
670-
<li>
671-
Resolve <var>promise</var> with the result of
672-
waiting for all of the <a class=idl-code data-link-type=attribute href=#dom-fontface-fontstatuspromise title=[[fontstatuspromise]]>[[FontStatusPromise]]</a>s of each font face in the <var>font face list</var>, in order.
685+
Await a stable state,
686+
then run the following steps synchronously:
687+
688+
<ol>
689+
<li>
690+
For all of the font faces in the <var>font face list</var>,
691+
call their <a class=idl-code data-link-for=FontFace data-link-type=method href=#dom-fontface-load title=load()>load()</a> method.
692+
693+
<li>
694+
Resolve <var>promise</var> with the result of
695+
waiting for all of the <a class=idl-code data-link-type=attribute href=#dom-fontface-fontstatuspromise title=[[fontstatuspromise]]>[[FontStatusPromise]]</a>s of each font face in the <var>font face list</var>, in order.
696+
</ol>
673697
</ol>
674698

675699
<h3 class="heading settled heading" data-level=3.4 id=font-face-set-check><span class=secno>3.4 </span><span class=content>

0 commit comments

Comments
 (0)