@@ -9,6 +9,7 @@ Abstract:
9
9
Editor : Shane Stephens, shanestephens@google.com
10
10
Repository : w3c/css-houdini-drafts
11
11
Ignored Vars : type, unit
12
+ Ignored Terms : Drawable
12
13
</pre>
13
14
14
15
<pre class=anchors>
@@ -609,6 +610,44 @@ document.querySelector('.example').styleMap.get('background-position').y;
609
610
610
611
</div>
611
612
613
+ {{CSSImageValue}} objects {#image-objects}
614
+ -------------------------------------
615
+
616
+ <pre class='idl'>
617
+
618
+ enum CSSImageState {"ready", "pending", "invalid"};
619
+
620
+ interface CSSImageValue : CSSStyleValue {
621
+ readonly attribute CSSImageState state;
622
+ readonly attribute Drawable? drawable;
623
+ };
624
+
625
+ interface CSSURLImageValue : CSSImageValue {
626
+ readonly attribute DOMString url;
627
+ };
628
+
629
+ </pre>
630
+
631
+ {{CSSImageValue}} objects represent values for properties that take <<image>> productions,
632
+ for example 'background-image' , 'list-style-image' , and 'border-image-source' .
633
+
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.
637
+
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.
641
+
642
+ Issue: clean up the above wording once Drawables are a thing.
643
+
644
+ {{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.
646
+
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.
649
+
650
+
612
651
Mapping of properties to accepted types {#mapping-of-properties-to-accepted-types}
613
652
==================================================================================
614
653
This section provides a table of which types of {{CSSStyleValue}} a given property can accept.
@@ -693,7 +732,7 @@ Shorthand properties and values are not supported.
693
732
</tr>
694
733
<tr>
695
734
<td> 'background-image' </td>
696
- <td> URIValue | {{CSSKeywordValue }}</td>
735
+ <td> {{CSSImageValue }}</td>
697
736
</tr>
698
737
<tr>
699
738
<td> 'background-origin' </td>
@@ -745,7 +784,7 @@ Shorthand properties and values are not supported.
745
784
</tr>
746
785
<tr>
747
786
<td> 'border-image-source' </td>
748
- <td> URIValue | {{CSSKeywordValue }}</td>
787
+ <td> {{CSSImageValue }}</td>
749
788
</tr>
750
789
<tr>
751
790
<td> 'border-image-width' </td>
@@ -853,7 +892,7 @@ Shorthand properties and values are not supported.
853
892
</tr>
854
893
<tr>
855
894
<td> 'list-style-image' </td>
856
- <td> URIValue | {{CSSKeywordValue }}</td>
895
+ <td> {{CSSImageValue }}</td>
857
896
</tr>
858
897
<tr>
859
898
<td> 'list-style-position' </td>
@@ -1222,6 +1261,22 @@ The following process sets a value for either <var>x</var> or<var>y</var>, depen
1222
1261
1. amend <var> x</var> (if <var> bias</var> is horizontal) or <var> y</var> (if <var> bias</var> is vertical) by
1223
1262
adding <var> adjustment</var> to it.
1224
1263
1264
+ {{CSSImageValue}} normalization {#imagevalue-normalization}
1265
+ -----------------------------------------------------------
1266
+
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.
1274
+
1275
+ If <a attribute for=CSSImageValue>state</a> is set to "pending" then the image
1276
+ reference is reevaluated once the pending data becomes available, according to the
1277
+ same rules referenced above.
1278
+
1279
+ Normalization does not fail for {{CSSImageValue}} objects.
1225
1280
1226
1281
Security Considerations {#security-considerations}
1227
1282
==================================================
@@ -1312,3 +1367,7 @@ During computation, both the <a attribute for=CSSPositionValue>x</a> and
1312
1367
<a attribute for=CSSPositionValue>y</a> components of a {{CSSPositionValue}} are
1313
1368
computed according to <a section href='#computed-lengthvalue-objects'></a> .
1314
1369
1370
+ Computed {{CSSImageValue}} objects {#computed-imagevalue-objects}
1371
+ -----------------------------------------------------------------
1372
+
1373
+ {{CSSImageValue}} objects are not modified during computation.
0 commit comments