Skip to content

Commit a4fdf3e

Browse files
committed
[css-font-loading] Switch to using the new idl setlike declaration.
--HG-- extra : rebase_source : 00f52c615020565d3e1537665e6fc08fa4e07d20
1 parent 98ffa44 commit a4fdf3e

2 files changed

Lines changed: 95 additions & 172 deletions

File tree

css-font-loading/Overview.bs

Lines changed: 23 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -407,19 +407,10 @@ The <code>FontFaceSet</code> Interface</h2>
407407
[Exposed=Window,Worker,
408408
Constructor(sequence<FontFace> initialFaces)]
409409
interface FontFaceSet : EventTarget {
410-
// Emulate the Set interface, until we can extend Set correctly.
411-
readonly attribute unsigned long size;
412-
void add(FontFace font);
413-
boolean has(FontFace font);
414-
boolean delete(FontFace font);
415-
void clear();
416-
Iterator entries();
417-
Iterator keys();
418-
Iterator values();
419-
void forEach(ForEachCallback cb, optional any thisArg);
420-
FontFace iterator;
421-
422-
// -- events for when loading state changes
410+
// FontFaceSet is Set-like!
411+
setlike&lt;FontFace>;
412+
413+
// events for when loading state changes
423414
attribute EventHandler onloading;
424415
attribute EventHandler onloadingdone;
425416
attribute EventHandler onloadingerror;
@@ -440,70 +431,48 @@ The <code>FontFaceSet</code> Interface</h2>
440431
};
441432
</pre>
442433

443-
<dl dfn-type=attribute dfn-for="FontFaceSet">
444-
<dt><dfn>ready</dfn> <span attribute-info for=FontFaceSet/ready></span>
434+
<dl dfn-for="FontFaceSet">
435+
<dt><dfn attribute>ready</dfn> <span attribute-info for=FontFaceSet/ready></span>
445436
<dd>
446437
This attribute reflects the {{FontFaceSet}}'s {{[[ReadyPromise]]}} slot.
447438

448439
See [[#font-face-set-ready]] for more details on this {{Promise}} and its use.
449440

450-
<dt><dfn>size</dfn> <span attribute-info for=FontFaceSet/size></span>
451-
<dd>
452-
This attribute reflects the <code>size</code> attribute of the {{FontFaceSet}}'s {{[[ContainedFonts]]}} slot.
453-
454441
<dt><dfn attribute for="FontFaceSet">status</dfn> <span attribute-info for="FontFaceSet/status"></span>
455442
<dd>
456443
If there are <a>possibly pending font loads</a>,
457444
the {{FontFaceSet/status}} attribute must have the value <code>"loading"</code>.
458445
Otherwise, it must have the value <code>"loaded"</code>.
459-
</dl>
460446

461-
<dl dfn-type=method dfn-for="FontFaceSet">
462-
<dt><dfn title="FontFaceSet()" constructor>FontFaceSet</dfn>(sequence&lt;{{FontFace}}> <dfn argument for="FontFaceSet/FontFaceSet()">initialFaces</dfn>)
447+
<dt><dfn constructor title="FontFaceSet()">FontFaceSet</dfn>(sequence&lt;{{FontFace}}> <dfn argument for="FontFaceSet/FontFaceSet()">initialFaces</dfn>)
463448
<dd>
464449
The {{FontFaceSet}} constructor, when called,
465-
must construct a new {{Set}} object
466-
by passing its {{initialFaces}} argument
467-
to the {{Set}} constructor,
468-
then assigning that {{Set}} object to the {{FontFaceSet}}'s {{[[ContainedFonts]]}} slot.
469-
470-
<dt><dfn title=add()>add</dfn>({{FontFace}} font)
471-
<dt><dfn title=has()>has</dfn>({{FontFace}} font)
472-
<dt><dfn title=delete()>delete</dfn>({{FontFace}} font)
473-
<dt><dfn title=entries()>entries</dfn>()
474-
<dt><dfn title=keys()>keys</dfn>()
475-
<dt><dfn title=values()>values</dfn>()
476-
<dt><dfn title=forEach()>forEach</dfn>({{ForEachCallback}} cb, optional any thisArg)
477-
<dd>
478-
If {{add()}} or {{delete()}} are called
479-
with an argument that is a <a>CSS-connected</a> {{FontFace}} object,
480-
they must throw an InvalidModificationError exception.
481-
482-
All of these methods call the corresponding method of the {{FontFaceSet}}'s {{[[ContainedFonts]]}} slot
483-
with the same arguments as were passed to them,
484-
and return the value returned by the called method.
450+
must iterate its {{initialFaces}} argument
451+
and add each value to its <a>set entries</a>.
485452

486-
<dt><dfn title=clear()>clear</dfn>()
453+
<dt><dfn>iteration order</dfn>
487454
<dd>
488-
This must remove all non-<a>CSS-connected</a> {{FontFace}} objects
489-
from the {{FontFaceSet}}'s {{[[ContainedFonts]]}} slot.
455+
When iterated over,
456+
all <a>CSS-connected</a> {{FontFace}} objects must come first,
457+
in document order of their connected ''@font-face'' rules,
458+
followed by the non-<a>CSS-connected</a> {{FontFace}} objects,
459+
in insertion order.
490460

491-
<dt><dfn iterator title="iterator">iterator behavior</dfn>
461+
<dt><dfn>set entries</dfn>
492462
<dd>
493-
The <a spec=webidl>iterator behavior</a> is the iterator behavior of the {{FontFaceSet}}'s {{[[ContainedFonts]]}} slot.
463+
If a {{FontFaceSet}} is a <a>font source</a>,
464+
its <a spec=webidl for>set entries</a> are initialized as specified in [[#document-font-face-set]].
465+
466+
Otherwise, its <a spec=webidl for>set entries</a> are initially empty.
494467
</dl>
495468

496469
{{FontFaceSet}} objects also have internal
497470
<dfn attribute for=FontFaceSet>\[[LoadingFonts]]</dfn>,
498471
<dfn attribute for=FontFaceSet>\[[LoadedFonts]]</dfn>,
499472
and <dfn attribute for=FontFaceSet>\[[FailedFonts]]</dfn> slots,
500-
all of which are initialized to the empty list,
501-
a <dfn attribute for=FontFaceSet>\[[ReadyPromise]]</dfn> slot,
502-
which is initialized to a fresh pending {{Promise}},
503-
and a <dfn attribute for=FontFaceSet>\[[ContainedFonts]]</dfn> slot,
504-
which is initialized by the <a constructor title="FontFaceSet()">FontFaceSet constructor</a> to a {{Set}} object
505-
(though see [[#document-font-face-set]] for information on how the Set may be pre-filled
506-
for {{FontFaceSet}} objects created by the user agent).
473+
all of which are initialized to empty lists,
474+
and a <dfn attribute for=FontFaceSet>\[[ReadyPromise]]</dfn> slot,
475+
which is initialized to a fresh pending {{Promise}}.
507476

508477
Because font families are loaded only when they are used,
509478
content sometimes needs to understand when the loading of fonts occurs.
@@ -976,9 +945,6 @@ Interaction with CSS’s ''@font-face'' Rule</h3>
976945
As specified in [[#font-face-css-connection]], though,
977946
the {{FontFace}} is no longer <a>CSS-connected</a> at that point.
978947

979-
All non-<a>CSS-connected</a> {{FontFace}} objects must be sorted after the <a>CSS-connected</a> ones,
980-
in insertion order.
981-
982948
Note: It is expected that a future version of this specification
983949
will define ways of interacting with and querying local fonts as well.
984950

0 commit comments

Comments
 (0)