@@ -12,7 +12,7 @@ Editor: Tab Atkins Jr., Google, http://xanthir.com/contact/
1212Former Editor : John Daggett, Mozilla, jdaggett@mozilla.com
1313Abstract : This CSS module describes events and interfaces used for dynamically loading font resources.
1414Link Defaults : css-fonts-3 (descriptor) src, dom-core-ls (interface) event
15- Ignored Terms : domstring, eventinit, cssfontfacerule, eventtarget, workerglobalscope, document, canvasproxy
15+ Ignored Terms : domstring, eventinit, cssfontfacerule, eventtarget, workerglobalscope, document, canvasproxy, iterator, unsigned long, set
1616</pre>
1717
1818<h2 id="introduction">
@@ -359,9 +359,20 @@ The <code>FontFaceSet</code> Interface</h2>
359359
360360 enum FontFaceSetLoadStatus { "loading", "loaded" };
361361
362- [SetClass(FontFace),
363- Exposed=Window,Worker]
362+ callback ForEachCallback = void (FontFace font, long index, FontFaceSet self);
363+
364+ [Exposed=Window,Worker]
364365 interface FontFaceSet {
366+ // Emulate the Set interface, until we can extend Set correctly.
367+ readonly attribute unsigned long size;
368+ void add(FontFace font);
369+ boolean has(FontFace font);
370+ boolean delete(FontFace font);
371+ void clear();
372+ Iterator entries();
373+ Iterator keys();
374+ Iterator values();
375+ void forEach(ForEachCallback cb, optional any thisArg);
365376
366377 // -- events for when loading state changes
367378 attribute EventHandler onloading;
@@ -392,16 +403,43 @@ The <code>FontFaceSet</code> Interface</h2>
392403 This attribute reflects the <a idl>FontFaceSet</a> 's <a idl>[<!---->[ReadyPromise]]</a> slot.
393404
394405 See <a section href="#font-face-set-ready"></a> for more details on this <a idl>Promise</a> and its use.
406+
407+ <dt> <dfn>size</dfn> <span attribute-info for=FontFaceSet/size></span>
408+ <dd>
409+ This attribute reflects the <code> size</code> attribute of the <a idl>FontFaceSet</a> 's <a idl>[<!---->[ContainedFonts]]</a> slot.
410+
411+ <dt> <dfn attribute for="FontFaceSet">status</dfn> <span attribute-info for="FontFaceSet/status"></span>
412+ <dd>
413+ If there are <a>possibly pending font loads</a> ,
414+ the <a attribute for=FontFaceSet>status</a> attribute must have the value <code> "loading"</code> .
415+ Otherwise, it must have the value <code> "loaded"</code> .
395416 </dl>
396417
397- Note: The use of [SetClass] is controversial,
398- so this will be rewritten to instead be just a Set look-alike,
399- without use of [SetClass] ,
400- at least until we figure out how to do this kind of thing correctly.
418+ <dl dfn-type=method dfn-for="FontFaceSet">
419+ <dt> <dfn title=add()>add</dfn> (<a idl>FontFace</a> font)
420+ <dt> <dfn title=has()>has</dfn> (<a idl>FontFace</a> font)
421+ <dt> <dfn title=delete()>delete</dfn> (<a idl>FontFace</a> font)
422+ <dt> <dfn title=clear()>clear</dfn> ()
423+ <dt> <dfn title=entries()>entries</dfn> ()
424+ <dt> <dfn title=keys()>keys</dfn> ()
425+ <dt> <dfn title=values()>values</dfn> ()
426+ <dt> <dfn title=forEach()>forEach</dfn> (<a idl>ForEachCallback</a> cb, optional any thisArg)
427+ <dd>
428+ All of these methods call the corresponding method of the <a idl>FontFaceSet</a> 's <a idl>[<!---->[ContainedFonts]]</a> slot
429+ with the same arguments as were passed to them,
430+ and return the value returned by the called method.
431+ </dl>
401432
402- The set entries for a <a interface>FontFaceSet</a> is initially an empty list.
403- A <a interface>FontFaceSet</a> attached to a document may have some initial <a interface>FontFace</a> objects prefilled in it;
404- see the section on <a href="#document-font-face-set">Interactions with CSS's @font-face Rule</a> for details.
433+ <a interface>FontFaceSet</a> objects also have internal
434+ <dfn attribute for=FontFaceSet>[<!---->[LoadingFonts]]</dfn> ,
435+ <dfn attribute for=FontFaceSet>[<!---->[LoadedFonts]]</dfn> ,
436+ <dfn attribute for=FontFaceSet>[<!---->[FailedFonts]]</dfn> slots,
437+ all of which are initialized to the empty list,
438+ a <dfn attribute for=FontFaceSet>[<!---->[ReadyPromise]]</dfn> slot,
439+ which is initialized to a fresh pending <a idl>Promise</a> ,
440+ and a <dfn attribute for=FontFaceSet>[<!---->[ContainedFonts]]</dfn> slot,
441+ which is initialized to an empty <a interface>Set</a> object
442+ (though see <a section href="#document-font-face-set"></a> for information on how the Set may be pre-filled).
405443
406444 Because font families are loaded only when they are used,
407445 content sometimes needs to understand when the loading of fonts occurs.
@@ -428,22 +466,6 @@ The <code>FontFaceSet</code> Interface</h2>
428466 If any of the above conditions are false,
429467 there are <dfn>possibly pending font loads</dfn> .
430468
431- <dl>
432- <dt> <dfn attribute for="FontFaceSet">status</dfn> , of type <a interface>DOMString</a>
433- <dd>
434- If there are <a>possibly pending font loads</a> ,
435- the <a attribute for=FontFaceSet>status</a> attribute must have the value <code class="idl-code"> "loading"</code> .
436- Otherwise, it must have the value <code class="idl-code"> "loaded"</code> .
437- </dl>
438-
439- <a interface>FontFaceSet</a> objects also have internal
440- <dfn attribute for=FontFaceSet>[<!---->[LoadingFonts]]</dfn> ,
441- <dfn attribute for=FontFaceSet>[<!---->[LoadedFonts]]</dfn> ,
442- <dfn attribute for=FontFaceSet>[<!---->[FailedFonts]]</dfn> slots,
443- all of which are initialized to the empty list,
444- and a <dfn attribute for=FontFaceSet>[<!---->[ReadyPromise]]</dfn> slot,
445- which is initialized to a fresh pending <a idl>Promise</a> .
446-
447469<h3 id='set-modifications'>
448470Modifications of normal Set methods</h3>
449471
@@ -717,7 +739,7 @@ The <code>check()</code> method</h3>
717739
718740 <li>
719741 If the <var> font face list</var> contains no font faces,
720- return <code class="idl-code" > false</code> .
742+ return <code> false</code> .
721743
722744 <li>
723745 If all fonts in the <var> font face list</var> have a <a attribute for=FontFace>status</a> attribute of "loaded",
0 commit comments