Skip to content

Commit 6bbec16

Browse files
committed
[css-font-loading] Turns out firing events calls the event handlers syncly. Queue more tasks instead.
1 parent 54c41bc commit 6bbec16

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

css-font-loading/Overview.bs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -634,12 +634,12 @@ Events</h3>
634634
<li>
635635
Set the {{FontFaceSet/status}} attribute of <var>font face set</var> to "loading".
636636

637-
<li>
638-
<a>Fire a font load event</a> named {{loading}} at <var>font face set</var>.
639-
640637
<li>
641638
If <var>font face set's</var> {{[[ReadyPromise]]}} slot currently holds a fulfilled promise,
642639
replace it with a fresh pending promise.
640+
641+
<li>
642+
Queue a task to <a>fire a font load event</a> named {{loading}} at <var>font face set</var>.
643643
</ol>
644644

645645
When asked to <dfn>switch the FontFaceSet to loaded</dfn> for a given {{FontFaceSet}},
@@ -653,16 +653,20 @@ Events</h3>
653653

654654
3. Set <var>font face set’s</var> {{FontFaceSet/status}} attribute to "loaded".
655655

656-
4. <a>Fire a font load event</a> named {{loadingdone}} at <var>font face set</var>
657-
with the (possibly empty) contents of <var>font face set's</var> {{[[LoadedFonts]]}} slot.
658-
Reset the {{[[LoadedFonts]]}} slot to an empty list.
656+
4. Fulfill <var>font face set's</var> {{[[ReadyPromise]]}} attribute's value with <var>font face set</var>.
657+
658+
5. Queue a task to perform the following steps synchronously:
659+
660+
1. <a>Fire a font load event</a> named {{loadingdone}} at <var>font face set</var>
661+
with the (possibly empty) contents of <var>font face set's</var> {{[[LoadedFonts]]}} slot.
662+
2. Reset the {{[[LoadedFonts]]}} slot to an empty list.
659663

660-
5. If <var>font face set's</var> {{[[FailedFonts]]}} slots is non-empty,
661-
<a>fire a font load event</a> named {{loadingerror}} at <var>font face set</var>
662-
with the contents of <var>font face set's</var> {{[[FailedFonts]]}} slot.
663-
Reset the {{[[FailedFonts]]}} slot to an empty list.
664+
6. Queue a task to perform the following steps synchronously:
664665

665-
6. Fulfill <var>font face set's</var> {{[[ReadyPromise]]}} attribute's value with <var>font face set</var>.
666+
1. If <var>font face set's</var> {{[[FailedFonts]]}} slots is non-empty,
667+
<a>fire a font load event</a> named {{loadingerror}} at <var>font face set</var>
668+
with the contents of <var>font face set's</var> {{[[FailedFonts]]}} slot.
669+
2. Reset the {{[[FailedFonts]]}} slot to an empty list.
666670

667671
Whenever a {{FontFaceSet}} goes from <a>pending on the environment</a> to not <a>pending on the environment</a>,
668672
the user agent must run the following steps:

0 commit comments

Comments
 (0)