@@ -610,18 +610,51 @@ document.querySelector('.example').styleMap.get('background-position').y;
610
610
611
611
</div>
612
612
613
- {{CSSImageValue }} objects {#image -objects}
614
- -------------------------------------
613
+ {{CSSResourceValue }} objects {#resourcevalue -objects}
614
+ -----------------------------------------------------
615
615
616
616
<pre class='idl'>
617
617
618
- enum CSSImageState {"ready ", "pending ", "invalid "};
618
+ enum CSSResourceState {"unloaded ", "loading ", "loaded", "error "};
619
619
620
- interface CSSImageValue : CSSStyleValue {
621
- readonly attribute CSSImageState state;
622
- readonly attribute Drawable? drawable;
620
+ interface CSSResourceValue {
621
+ readonly attribute CSSResourceState state;
623
622
};
624
623
624
+ </pre>
625
+
626
+ {{CSSResourceValue}} objects represent CSS values that may require an asynchronous network fetch
627
+ before being usable.
628
+
629
+ A {{CSSResourceValue}} is in one of the following states, as reflected in the value of the
630
+ <a attribute for=CSSResourceValue>state</a> attribute:
631
+
632
+ : ''unloaded''
633
+ :: The resource is not ready and is not actively being fetched
634
+ : ''loading''
635
+ :: The resource is not ready, but is in the process of being fetched
636
+ : ''loaded''
637
+ :: The resource is ready for rendering
638
+ : ''error''
639
+ :: The resource can't be fetched, or the fetched resource is invalid
640
+
641
+ <div class='example'>
642
+ For example, images that match the <<url>> production can be used immediately, but will not result
643
+ in a visual change until the image data is fetched. {{CSSResourceValue}} objects represent this by
644
+ providing values that track loaded state via the {{CSSResourceState}} enum.
645
+ </div>
646
+
647
+ {{CSSImageValue}} objects {#imagevalue-objects}
648
+ -----------------------------------------------
649
+
650
+ <pre class='idl'>
651
+
652
+ interface CSSImageValue : CSSResourceValue {
653
+ readonly attribute double intrinsicWidth;
654
+ readonly attribute double intrinsicHeight;
655
+ };
656
+
657
+ [Constructor(DOMString url)]
625
658
interface CSSURLImageValue : CSSImageValue {
626
659
readonly attribute DOMString url;
627
660
};
@@ -631,22 +664,33 @@ interface CSSURLImageValue : CSSImageValue {
631
664
{{CSSImageValue}} objects represent values for properties that take <<image>> productions,
632
665
for example 'background-image' , 'list-style-image' , and 'border-image-source' .
633
666
634
- The <a attribute for=CSSImageValue>state</a> attribute is set to "pending" if the image requires
635
- network data that has not yet been fetched, to "invalid" if an error means that the image can't be
636
- rendered, and to "ready" otherwise.
667
+ {{CSSImageValue}} objects that do not require network data (for example linear and radial gradients)
668
+ are initialized with <a attribute for=CSSResourceValue>state</a> ''loaded'' .
637
669
638
- The <a attribute for=CSSImageValue>drawable </a> attribute is null if <a attribute for=CSSImageValue>state</a>
639
- is "pending" or "invalid". Otherwise, the {{Drawable}} can be used to render image data via the canvas
640
- API .
670
+ If <a attribute for=CSSResourceValue>state </a> is ''unloaded'' , ''loading'' , or ''error'' , then
671
+ <a attribute for=CSSImageValue>intrinsicWidth</a> and <a attribute for=CSSImageValue>intrinsicHeight</a>
672
+ are 0. Otherwise, the attributes are set to the intrinsic width and height of the referenced image .
641
673
642
- Issue: clean up the above wording once Drawables are a thing.
674
+ Issue: Does the loading lifecycle need to be described here?
643
675
644
676
{{CSSURLImageValue}} objects represent {{CSSImageValue}} s that match the <<url>> production. For these
645
- objects, the <a attribute for=CSSURLImageValue>url</a> attribute contains the URL that contains the image.
677
+ objects, the <a attribute for=CSSURLImageValue>url</a> attribute contains the URL that references the image.
678
+
679
+ {{CSSFontFaceValue}} objects {#fontfacevalue-objects}
680
+ -----------------------------------------------------
681
+
682
+ <pre class='idl'>
646
683
647
- Issue: We should add a promise that waits for the {{CSSImageState}} to become ready, but
648
- this should probably be deferred until we have cancellable promises.
684
+ [Constructor(DOMString fontFaceName)]
685
+ interface CSSFontFaceValue : CSSResourceValue {
686
+ readonly attribute DOMString fontFaceName;
687
+ };
649
688
689
+ </pre>
690
+
691
+ {{CSSFontFaceValue}} objects represent font faces that can be used to render text. As
692
+ font data may need to be fetched from a remote source, {{CSSFontFaceValue}} is a subclass
693
+ of {{CSSResourceValue}} .
650
694
651
695
Mapping of properties to accepted types {#mapping-of-properties-to-accepted-types}
652
696
==================================================================================
@@ -1261,22 +1305,20 @@ The following process sets a value for either <var>x</var> or<var>y</var>, depen
1261
1305
1. amend <var> x</var> (if <var> bias</var> is horizontal) or <var> y</var> (if <var> bias</var> is vertical) by
1262
1306
adding <var> adjustment</var> to it.
1263
1307
1264
- {{CSSImageValue }} normalization {#imagevalue -normalization}
1265
- -----------------------------------------------------------
1308
+ {{CSSResourceValue }} normalization {#resourcevalue -normalization}
1309
+ --------------------------------------------------------------
1266
1310
1267
- Image references are normalized by determining whether the reference is invalid
1268
- (in which case <a attribute for=CSSImageValue>state</a> is set to "invalid") or
1269
- requires network data (in which case <a attribute for=CSSImageValue>state</a>
1270
- is set to "pending"). If data is not required and the reference is valid then
1271
- <a attribute for=CSSImageValue>state</a> is set to "ready" and the
1272
- <a attribute for=CSSImageValue>drawable</a> attribute is provided with a
1273
- {{Drawable}} representing the image.
1311
+ Resource references are normalized by determining whether the reference is invalid
1312
+ (in which case <a attribute for=CSSResourceValue>state</a> is set to ''error'' ) or
1313
+ requires network data (in which case <a attribute for=CSSResourceValue>state</a>
1314
+ is set to ''loading'' ). If data is not required and the reference is valid then
1315
+ <a attribute for=CSSResourceValue>state</a> is set to ''loaded'' .
1274
1316
1275
- If <a attribute for=CSSImageValue >state</a> is set to "pending" then the image
1317
+ If <a attribute for=CSSResourceValue >state</a> is set to ''loading'' then the image
1276
1318
reference is reevaluated once the pending data becomes available, according to the
1277
1319
same rules referenced above.
1278
1320
1279
- Normalization does not fail for {{CSSImageValue }} objects.
1321
+ Normalization does not fail for {{CSSResourceValue }} objects.
1280
1322
1281
1323
Security Considerations {#security-considerations}
1282
1324
==================================================
0 commit comments