Skip to content

Commit fca9351

Browse files
committed
(merge)
2 parents c2839c1 + 8bb64af commit fca9351

9 files changed

Lines changed: 211 additions & 180 deletions

File tree

css-font-loading/Overview.bs

Lines changed: 120 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,15 @@ The Constructor</h3>
250250
set <var>font face's</var> internal {{[[Data]]}} slot to the passed argument.
251251

252252
3. If <var>font face's</var> {{[[Data]]}} slot is not <code>null</code>,
253-
queue a task to set <var>font face's</var> {{FontFace/status}} attribute to "loading".
254-
Attempt to parse the data in it as a font.
253+
queue a task to run the following steps synchronously:
254+
255+
1. Set <var>font face's</var> {{FontFace/status}} attribute to "loading".
256+
2. For each {{FontFaceSet}} <var>font face</var> is in:
257+
1. If the {{FontFaceSet}}’s {{[[LoadingFonts]]}} list is empty,
258+
<a>switch the FontFaceSet to loading</a>.
259+
2. Append <var>font face</var> to the {{FontFaceSet}}’s {{[[LoadingFonts]]}} list.
260+
261+
Asynchronously, attempt to parse the data in it as a font.
255262
When this is completed,
256263
successfully or not,
257264
queue a task to run the following steps synchronously:
@@ -261,10 +268,24 @@ The Constructor</h3>
261268
fulfill <var>font face's</var> {{[[FontStatusPromise]]}} with <var>font face</var>,
262269
and set its {{FontFace/status}} attribute to "loaded".
263270

271+
For each {{FontFaceSet}} <var>font face</var> is in:
272+
1. Add <var>font face</var> to the {{FontFaceSet}}’s {{[[LoadedFonts]]}} list.
273+
2. Remove <var>font face</var> from the {{FontFaceSet}}’s {{[[LoadingFonts]]}} list.
274+
If <var>font</var> was the last item in that list
275+
(and so the list is now empty),
276+
<a>switch the FontFaceSet to loaded</a>.
277+
264278
2. Otherwise,
265279
reject <var>font face's</var> {{[[FontStatusPromise]]}} with a DOMException named "SyntaxError"
266280
and set <var>font face's</var> {{FontFace/status}} attribute to "error".
267281

282+
For each {{FontFaceSet}} <var>font face</var> is in:
283+
1. Add <var>font face</var> to the {{FontFaceSet}}’s {{[[FailedFonts]]}} list.
284+
2. Remove <var>font face</var> from the {{FontFaceSet}}’s {{[[LoadingFonts]]}} list.
285+
If <var>font</var> was the last item in that list
286+
(and so the list is now empty),
287+
<a>switch the FontFaceSet to loaded</a>.
288+
268289
Note: Newly constructed FontFace objects are not automatically added
269290
to the FontFaceSet associated with a document
270291
or a context for a worker thread.
@@ -294,7 +315,7 @@ The <code>load()</code> method</h3>
294315
When the <dfn method for=FontFace>load()</dfn> method is called,
295316
execute these steps:
296317

297-
<ol link-type=idl>
318+
<ol>
298319
<li>
299320
Let <var>font face</var> be the {{FontFace}} object on which this method was called.
300321

@@ -327,11 +348,25 @@ The <code>load()</code> method</h3>
327348
a DOMException whose name is "NetworkError"
328349
and set <var>font face's</var> {{FontFace/status}} attribute to "error".
329350

351+
For each {{FontFaceSet}} <var>font face</var> is in:
352+
1. Add <var>font face</var> to the {{FontFaceSet}}’s {{[[FailedFonts]]}} list.
353+
2. Remove <var>font face</var> from the {{FontFaceSet}}’s {{[[LoadingFonts]]}} list.
354+
If <var>font</var> was the last item in that list
355+
(and so the list is now empty),
356+
<a>switch the FontFaceSet to loaded</a>.
357+
330358
<li>
331359
Otherwise,
332360
<var>font face</var> now represents the loaded font;
333361
fulfill <var>font face's</var> {{[[FontStatusPromise]]}} with <var>font face</var>
334362
and set <var>font face's</var> {{FontFace/status}} attribute to "loaded".
363+
364+
For each {{FontFaceSet}} <var>font face</var> is in:
365+
1. Add <var>font face</var> to the {{FontFaceSet}}’s {{[[LoadedFonts]]}} list.
366+
2. Remove <var>font face</var> from the {{FontFaceSet}}’s {{[[LoadingFonts]]}} list.
367+
If <var>font</var> was the last item in that list
368+
(and so the list is now empty),
369+
<a>switch the FontFaceSet to loaded</a>.
335370
</ol>
336371
</ol>
337372

@@ -413,6 +448,9 @@ The <code>FontFaceSet</code> Interface</h2>
413448
interface FontFaceSet : EventTarget {
414449
// FontFaceSet is Set-like!
415450
setlike&lt;FontFace>;
451+
FontFaceSet add(FontFace font);
452+
boolean delete(FontFace font);
453+
void clear();
416454

417455
// events for when loading state changes
418456
attribute EventHandler onloading;
@@ -443,11 +481,6 @@ The <code>FontFaceSet</code> Interface</h2>
443481

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

446-
: <dfn attribute for="FontFaceSet">status</dfn>
447-
:: If there are <a>possibly pending font loads</a>,
448-
the {{FontFaceSet/status}} attribute must have the value <code>"loading"</code>.
449-
Otherwise, it must have the value <code>"loaded"</code>.
450-
451484
: <dfn constructor lt="FontFaceSet()">FontFaceSet</dfn>(sequence&lt;{{FontFace}}> <dfn argument for="FontFaceSet/FontFaceSet()">initialFaces</dfn>)
452485
:: The {{FontFaceSet}} constructor, when called,
453486
must iterate its {{initialFaces}} argument
@@ -464,7 +497,54 @@ The <code>FontFaceSet</code> Interface</h2>
464497
:: If a {{FontFaceSet}} is a <a>font source</a>,
465498
its <a spec=webidl for>set entries</a> are initialized as specified in [[#document-font-face-set]].
466499

467-
Otherwise, its <a spec=webidl for>set entries</a> are initially empty.
500+
Otherwise, its <a spec=webidl>set entries</a> are initially empty.
501+
502+
: <dfn method>add(font)</dfn>
503+
::
504+
When the {{add()}} method is called,
505+
execute the following steps:
506+
507+
1. If <var>font</var> is already in the {{FontFaceSet}}’s <a>set entries</a>,
508+
skip to the last step of this algorithm immediately.
509+
2. If <var>font</var> is <a>CSS-connected</a>,
510+
throw an {{InvalidModificationError}} exception
511+
and exit this algorithm immediately.
512+
3. Add the <var>font</var> argument to the {{FontFaceSet}}’s <a>set entries</a>.
513+
2. If <var>font</var>’s {{FontFace/status}} attribute is "loading":
514+
1. If the {{FontFaceSet}}’s {{[[LoadingFonts]]}} list is empty,
515+
<a>switch the FontFaceSet to loading</a>.
516+
2. Append <var>font</var> to the {{FontFaceSet}}’s {{[[LoadingFonts]]}} list.
517+
3. Return the {{FontFaceSet}}.
518+
519+
: <dfn method>delete(font)</dfn>
520+
::
521+
When the {{delete()}} method is called,
522+
execute the following steps:
523+
524+
1. If <var>font</var> is <a>CSS-connected</a>,
525+
return <code class='lang-javascript'>false</code>
526+
and exit this algorithm immediately.
527+
2. Let <var>deleted</var> be the result of removing <var>font</var> from the {{FontFaceSet}}’s <a>set entries</a>.
528+
3. If <var>font</var> is present in the {{FontFaceSet}}’s {{[[LoadedFonts]]}}, or {{[[FailedFonts]]}} lists,
529+
remove it.
530+
4. If <var>font</var> is present in the {{FontFaceSet}}’s {{[[LoadingFonts]]}} list,
531+
remove it.
532+
If <var>font</var> was the last item in that list
533+
(and so the list is now empty),
534+
<a>switch the FontFaceSet to loaded</a>.
535+
5. Return <var>deleted</var>.
536+
537+
: <dfn method>clear()</dfn>
538+
::
539+
When the {{clear()}} method is called,
540+
execute the following steps:
541+
542+
1. Remove all items from the {{FontFaceSet}}’s <a>set entries</a>,
543+
its {{[[LoadedFonts]]}} list,
544+
and its {{[[FailedFonts]]}} list.
545+
2. If the {{FontFaceSet}}’s {{[[LoadingFonts]]}} list is non-empty,
546+
remove all items from it,
547+
then <a>switch the FontFaceSet to loaded</a>.
468548
</div>
469549

470550
{{FontFaceSet}} objects also have internal
@@ -480,27 +560,11 @@ The <code>FontFaceSet</code> Interface</h2>
480560
Authors can use the events and methods defined here to allow greater control over actions
481561
that are dependent upon the availability of specific fonts.
482562

483-
There are <dfn>no pending font loads</dfn> for a given {{FontFaceSet}} whenever
484-
none of its contained {{FontFace}} objects have a {{FontFace/status}} of <code>"loading"</code>.
563+
A {{FontFaceSet}} is <dfn export for="FontFaceSet">pending on the environment</dfn> if any of the following are true:
485564

486-
For {{FontFaceSet}}s that are <a>font sources</a>,
487-
in addition to the above constriant,
488-
the following must all be true
489-
for them to be considered as having <a>no pending font loads</a>:
490-
491-
<ul>
492-
<li>
493-
The document has finished loading.
494-
495-
<li>
496-
There are no pending stylesheet requests.
497-
498-
<li>
499-
There are no pending layout operations which might cause the user agent to request a font.
500-
</ul>
501-
502-
If a {{FontFaceSet}} can't be considered to have <a>no pending font loads</a>,
503-
it instead has <dfn>possibly pending font loads</dfn>.
565+
* the document is still loading
566+
* the document has pending stylesheet requests
567+
* the document has pending layout operations which might cause the user agent to request a font.
504568

505569
<!--
506570
████████ ██ ██ ████████ ██ ██ ████████ ██████
@@ -559,82 +623,54 @@ Events</h3>
559623
the result of filtering <var>font faces</var> to only contain {{FontFace}} objects contained in <var>target</var>.
560624
</ol>
561625

562-
Whenever one or more {{FontFace}} objects within a given {{FontFaceSet}}
563-
change their {{FontFace/status}} attribute to "<code>loading</code>",
564-
or one or more {{FontFace}} objects whose {{FontFace/status}} attribute is <em>already</em> "<code>loading</code>"
565-
is added to a {{FontFaceSet}},
626+
When asked to <dfn>switch the FontFaceSet to loading</dfn> for a given {{FontFaceSet}},
566627
the user agent must run the following steps:
567628

568629
<ol>
569630
<li>
570-
Let <var>font face set</var> be the given {{FontFaceSet}},
571-
and <var>loading fonts</var> be the {{FontFace}} objects
572-
that have newly switched to "loading" status
573-
or that were added to <var>font face set</var> while already in "loading" status,
574-
in the same order as they appear in <var>font face set</var>.
631+
Let <var>font face set</var> be the given {{FontFaceSet}}.
575632

576633
<li>
577634
Set the {{FontFaceSet/status}} attribute of <var>font face set</var> to "loading".
578635

579636
<li>
580-
If <var>font face set's</var> {{[[LoadingFonts]]}} slot is currently empty,
581-
<a>fire a font load event</a> named {{loading}} at <var>font face set</var>.
582-
583-
<li>
584-
Append the <var>loading fonts</var> to <var>font face set's</var> {{[[LoadingFonts]]}} slot.
637+
<a>Fire a font load event</a> named {{loading}} at <var>font face set</var>.
585638

586639
<li>
587640
If <var>font face set's</var> {{[[ReadyPromise]]}} slot currently holds a fulfilled promise,
588641
replace it with a fresh pending promise.
589642
</ol>
590643

591-
Whenever one or more <a>available font faces</a> for a given {{FontFaceSet}}
592-
change their {{FontFace/status}} attribute to "loaded" or "error",
644+
When asked to <dfn>switch the FontFaceSet to loaded</dfn> for a given {{FontFaceSet}},
593645
the user agent must run the following steps:
594646

595-
<ol>
596-
<li>
597-
Let <var>font face set</var> be the given {{FontFaceSet}},
598-
and <var>loaded fonts</var> be the {{FontFace}} objects
599-
that have newly switched to "loaded" or "error" status,
600-
in the same order as they appear in <var>font face set</var>.
647+
1. Let <var>font face set</var> be the given {{FontFaceSet}}.
601648

602-
<li>
603-
For each font in the <var>loaded fonts</var>,
604-
if their {{FontFace/status}} attribute is "loaded",
605-
append them to <var>font face set's</var> {{[[LoadedFonts]]}} slot;
606-
if it's "error",
607-
append them to <var>font face set's</var> {{[[FailedFonts]]}} slot.
608-
</ol>
649+
2. If <var>font face set</var> is <a>pending on the environment</a>,
650+
mark it as <dfn export for=FontFaceSet>stuck on the environment</dfn>,
651+
and exit this algorithm.
609652

610-
Whenever a {{FontFaceSet}} goes from having <a>possibly pending font loads</a>
611-
to having <a>no pending font loads</a>,
612-
user agents must run these steps:
653+
3. Set <var>font face set’s</var> {{FontFaceSet/status}} attribute to "loaded".
613654

614-
<ol>
615-
<li>
616-
If this is not the first time the {{FontFaceSet}} has had <a>no pending font loads</a>,
617-
and none of its contained {{FontFace}} objects began loading
618-
since the last time it had <a>no pending font loads</a>,
619-
abort this algorithm.
655+
4. <a>Fire a font load event</a> named {{loadingdone}} at <var>font face set</var>
656+
with the (possibly empty) contents of <var>font face set's</var> {{[[LoadedFonts]]}} slot.
657+
Reset the {{[[LoadedFonts]]}} slot to an empty list.
620658

621-
<li>
622-
Set <var>font face set's</var> {{FontFaceSet/status}} attribute to "loaded".
659+
5. If <var>font face set's</var> {{[[FailedFonts]]}} slots is non-empty,
660+
<a>fire a font load event</a> named {{loadingerror}} at <var>font face set</var>
661+
with the contents of <var>font face set's</var> {{[[FailedFonts]]}} slot.
662+
Reset the {{[[FailedFonts]]}} slot to an empty list.
623663

624-
<li>
625-
<a>Fire a font load event</a> named {{loadingdone}} at <var>font face set</var>
626-
with the (possibly empty) contents of <var>font face set's</var> {{[[LoadedFonts]]}} slot.
627-
Reset the {{[[LoadedFonts]]}} slot to an empty list.
664+
6. Fulfill <var>font face set's</var> {{[[ReadyPromise]]}} attribute's value with <var>font face set</var>.
628665

629-
<li>
630-
If <var>font face set's</var> {{[[FailedFonts]]}} slots is non-empty,
631-
<a>fire a font load event</a> named {{loadingerror}} at <var>font face set</var>
632-
with the contents of <var>font face set's</var> {{[[FailedFonts]]}} slot.
633-
Reset the {{[[FailedFonts]]}} slot to an empty list.
666+
Whenever a {{FontFaceSet}} goes from <a>pending on the environment</a> to not <a>pending on the environment</a>,
667+
the user agent must run the following steps:
634668

635-
<li>
636-
Fulfill <var>font face set's</var> {{[[ReadyPromise]]}} attribute's value with <var>font face set</var>.
637-
</ol>
669+
1. If the {{FontFaceSet}} is <a>stuck on the environment</a> and its {{[[LoadingFonts]]}} list is empty,
670+
<a>switch the FontFaceSet to loaded</a>.
671+
672+
2. If the {{FontFaceSet}} is <a>stuck on the environment</a>,
673+
unmark it as such.
638674

639675

640676
If asked to <dfn export>find the matching font faces</dfn>
@@ -655,7 +691,7 @@ Events</h3>
655691
return a syntax error.
656692

657693
Absolutize all relative lengths against the initial values of the corresponding properties.
658-
(For example, a relative font weight like ''bolder'' is evaluated against the initial value ''normal''.)
694+
(For example, a relative font weight like ''bolder'' is evaluated against the initial value ''font-weight/normal''.)
659695

660696
<li>
661697
If <var>text</var> was not explicitly provided,
@@ -968,7 +1004,8 @@ Interaction with CSS’s ''@font-face'' Rule</h3>
9681004
and throw an {{InvalidModificationError}}.
9691005

9701006
When a {{FontFaceSet}} object's {{FontFaceSet/delete()}} method is called with a <a>CSS-connected</a> {{FontFace}} object,
971-
the operation must be a no-op.
1007+
the operation must be a no-op,
1008+
and return <code class="lang-javascript">false</code>.
9721009

9731010
Note: Authors can still maintain references to a removed {{FontFace}},
9741011
even if it's been automatically removed from a <a>font source</a>.

css-images-4/Overview.bs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,23 @@ Link Defaults: css21 (property) display, css21 (dfn) stacking context
2020
Images Values: the <<image>> type {#image-values}
2121
=================================================
2222

23+
Image File Formats {#image-file-formats}
24+
----------------------------------------
25+
26+
At minimum, the UA must support the following image file formats
27+
when referenced from an <<image>> value,
28+
for all the properties in which using <<image>> is valid:
29+
<ul>
30+
<li>PNG, as specified in [[!PNG]]
31+
<li>SVG, as specified in [[!SVG]],
32+
using the <a href="http://www.w3.org/TR/svg-integration/#secure-static-mode">secure static mode</a> (See [[!SVG-INTEGRATION]])
33+
<li>If the UA supports animated <<image>>s,
34+
SVG, as specified in [[!SVG]],
35+
using the <a href="http://www.w3.org/TR/svg-integration/#secure-animated-mode">secure animated mode</a> (See [[!SVG-INTEGRATION]])
36+
</ul>
37+
38+
The UA may support other file formats as well.
39+
2340
Image Fallbacks and Annotations: the ''image()'' notation {#image-notation}
2441
---------------------------------------------------------------------------
2542

0 commit comments

Comments
 (0)