Skip to content

Commit 60433e4

Browse files
committed
[css-font-loading] Tweak the 'when loading is done' bit to allow for the initial load to work correctly.
1 parent 9bbfc20 commit 60433e4

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

css-font-loading/Overview.bs

+6-4
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ The <code>FontFaceSet</code> Interface</h2>
475475
and <dfn attribute for=FontFaceSet>[<!---->[FailedFonts]]</dfn> slots,
476476
all of which are initialized to the empty list,
477477
a <dfn attribute for=FontFaceSet>[<!---->[ReadyPromise]]</dfn> slot,
478-
which is initialized to a fresh <a idl>Promise</a> fulfilled with the <a idl>FontFaceSet</a>,
478+
which is initialized to a fresh pending <a idl>Promise</a>,
479479
and a <dfn attribute for=FontFaceSet>[<!---->[ContainedFonts]]</dfn> slot,
480480
which is initialized by the <a constructor title="FontFaceSet()">FontFaceSet constructor</a> to a <a interface>Set</a> object
481481
(though see <a section href="#document-font-face-set"></a> for information on how the Set may be pre-filled
@@ -611,8 +611,8 @@ Events</h3>
611611
append them to <var>font face set's</var> <a attribute>[<!---->[FailedFonts]]</a> slot.
612612
</ol>
613613

614-
If there are ever <a>no pending font loads</a>
615-
and either of <var>font face set's</var> <a attribute>[<!---->[LoadedFonts]]</a> or <a attribute>[<!---->[FailedFonts]]</a> slots are not empty,
614+
Whenever a <a interface>FontFaceSet</a> goes from having <a>possibly pending font loads</a>
615+
to having <a>no pending font loads</a>,
616616
user agents must run these steps:
617617

618618
<ol>
@@ -621,12 +621,14 @@ Events</h3>
621621

622622
<li>
623623
<a>Fire a font load event</a> named <a event>loadingdone</a> at <var>font face set</var>
624-
with the contents of <var>font face set's</var> <a attribute>[<!---->[LoadedFonts]]</a> slots, if any.
624+
with the (possibly empty) contents of <var>font face set's</var> <a attribute>[<!---->[LoadedFonts]]</a> slot.
625+
Reset the <a attribute>[<!---->[LoadedFonts]]</a> slot to an empty list.
625626

626627
<li>
627628
If <var>font face set's</var> <a attribute>[<!---->[FailedFonts]]</a> slots is non-empty,
628629
<a>fire a font load event</a> named <a event>loadingerror</a> at <var>font face set</var>
629630
with the contents of <var>font face set's</var> <a attribute>[<!---->[FailedFonts]]</a> slot.
631+
Reset the <a attribute>[<!---->[FailedFonts]]</a> slot to an empty list.
630632

631633
<li>
632634
Fulfill <var>font face set's</var> <a attribute>[<!---->[ReadyPromise]]</a> attribute's value with <var>font face set</var>.

css-font-loading/Overview.html

+6-4
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ <h2 class="heading settled heading" data-level=3 id=FontFaceSet-interface><span
586586
and <dfn class=idl-code data-dfn-for=FontFaceSet data-dfn-type=attribute data-export="" id=dom-fontfaceset-failedfonts>[[FailedFonts]]<a class=self-link href=#dom-fontfaceset-failedfonts></a></dfn> slots,
587587
all of which are initialized to the empty list,
588588
a <dfn class=idl-code data-dfn-for=FontFaceSet data-dfn-type=attribute data-export="" id=dom-fontfaceset-readypromise>[[ReadyPromise]]<a class=self-link href=#dom-fontfaceset-readypromise></a></dfn> slot,
589-
which is initialized to a fresh <a data-link-type=idl href=#dom-promise title=promise>Promise</a> fulfilled with the <a data-link-type=idl href=#dom-fontfaceset title=fontfaceset>FontFaceSet</a>,
589+
which is initialized to a fresh pending <a data-link-type=idl href=#dom-promise title=promise>Promise</a>,
590590
and a <dfn class=idl-code data-dfn-for=FontFaceSet data-dfn-type=attribute data-export="" id=dom-fontfaceset-containedfonts>[[ContainedFonts]]<a class=self-link href=#dom-fontfaceset-containedfonts></a></dfn> slot,
591591
which is initialized by the <a class=idl-code data-link-type=constructor href=#dom-fontfaceset-fontfaceset title=fontfaceset()>FontFaceSet constructor</a> to a <a class=idl-code data-link-type=interface title=set>Set</a> object
592592
(though see <a data-section="" href=#document-font-face-set>§4.2
@@ -715,8 +715,8 @@ <h3 class="heading settled heading" data-level=3.1 id=FontFaceSet-events><span c
715715
append them to <var>font face set’s</var> <a class=idl-code data-link-type=attribute href=#dom-fontfaceset-failedfonts title=[[failedfonts]]>[[FailedFonts]]</a> slot.
716716
</ol>
717717

718-
<p>If there are ever <a data-link-type=dfn href=#no-pending-font-loads title="no pending font loads">no pending font loads</a>
719-
and either of <var>font face set’s</var> <a class=idl-code data-link-type=attribute href=#dom-fontfaceset-loadedfonts title=[[loadedfonts]]>[[LoadedFonts]]</a> or <a class=idl-code data-link-type=attribute href=#dom-fontfaceset-failedfonts title=[[failedfonts]]>[[FailedFonts]]</a> slots are not empty,
718+
<p>Whenever a <a class=idl-code data-link-type=interface href=#dom-fontfaceset title=fontfaceset>FontFaceSet</a> goes from having <a data-link-type=dfn href=#possibly-pending-font-loads title="possibly pending font loads">possibly pending font loads</a>
719+
to having <a data-link-type=dfn href=#no-pending-font-loads title="no pending font loads">no pending font loads</a>,
720720
user agents must run these steps:</p>
721721

722722
<ol>
@@ -725,12 +725,14 @@ <h3 class="heading settled heading" data-level=3.1 id=FontFaceSet-events><span c
725725

726726
<li>
727727
<a data-link-type=dfn href=#fire-a-font-load-event title="fire a font load event">Fire a font load event</a> named <a class=idl-code data-link-type=event href=#dom-fontfaceset-loadingdone title=loadingdone>loadingdone</a> at <var>font face set</var>
728-
with the contents of <var>font face set’s</var> <a class=idl-code data-link-type=attribute href=#dom-fontfaceset-loadedfonts title=[[loadedfonts]]>[[LoadedFonts]]</a> slots, if any.
728+
with the (possibly empty) contents of <var>font face set’s</var> <a class=idl-code data-link-type=attribute href=#dom-fontfaceset-loadedfonts title=[[loadedfonts]]>[[LoadedFonts]]</a> slot.
729+
Reset the <a class=idl-code data-link-type=attribute href=#dom-fontfaceset-loadedfonts title=[[loadedfonts]]>[[LoadedFonts]]</a> slot to an empty list.
729730

730731
<li>
731732
If <var>font face set’s</var> <a class=idl-code data-link-type=attribute href=#dom-fontfaceset-failedfonts title=[[failedfonts]]>[[FailedFonts]]</a> slots is non-empty,
732733
<a data-link-type=dfn href=#fire-a-font-load-event title="fire a font load event">fire a font load event</a> named <a class=idl-code data-link-type=event href=#dom-fontfaceset-loadingerror title=loadingerror>loadingerror</a> at <var>font face set</var>
733734
with the contents of <var>font face set’s</var> <a class=idl-code data-link-type=attribute href=#dom-fontfaceset-failedfonts title=[[failedfonts]]>[[FailedFonts]]</a> slot.
735+
Reset the <a class=idl-code data-link-type=attribute href=#dom-fontfaceset-failedfonts title=[[failedfonts]]>[[FailedFonts]]</a> slot to an empty list.
734736

735737
<li>
736738
Fulfill <var>font face set’s</var> <a class=idl-code data-link-type=attribute href=#dom-fontfaceset-readypromise title=[[readypromise]]>[[ReadyPromise]]</a> attribute’s value with <var>font face set</var>.

0 commit comments

Comments
 (0)