Skip to content

Commit 2b735ea

Browse files
committed
Add more detail to element() about elements that aren't rendered. (And some edits from the *next* commit, since I accidentally let this commit hang.)
1 parent ef34cc2 commit 2b735ea

2 files changed

Lines changed: 41 additions & 10 deletions

File tree

css3-images/Overview.html

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
<h1>CSS Image Values and Replaced Content Module Level 3</h1>
1818

19-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 17 February
19+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 22 February
2020
2012</h2>
2121

2222
<dl>
2323
<dt>This Version:
2424

2525
<dd><a
2626
href="http://dev.w3.org/csswg/css3-images/">http://dev.w3.org/csswg/css3-images/</a>
27-
<!-- <dd><a href="http://www.w3.org/TR/2012/ED-css3-images-20120217/">http://www.w3.org/TR/2012/WD-css3-images-20120217/</a>-->
27+
<!-- <dd><a href="http://www.w3.org/TR/2012/ED-css3-images-20120222/">http://www.w3.org/TR/2012/WD-css3-images-20120222/</a>-->
2828

2929

3030
<dt>Latest Version:
@@ -691,15 +691,19 @@ <h3 id=element-reference><span class=secno>3.3. </span> Using Elements as
691691
<dd>The function represents a solid-color transparent-black image with no
692692
intrinsic dimensions.
693693

694-
<dt>The function references an element that is not rendered, but which <a
695-
href="#paint-source"><i title=paint-source>provides a paint
694+
<dt>The function references an <a href="#element-not-rendered"><i
695+
title=element-not-rendered>element that is not rendered</i></a>, but
696+
which <a href="#paint-source"><i title=paint-source>provides a paint
696697
source</i></a>
697698

698699
<dd>
699700
<p>The function represents an image with the dimensions and appearance of
700701
the <a href="#paint-source"><i title=paint-source>paint source</i></a>.
701702
The host language defines the dimensions and appearance of paint
702-
sources.
703+
sources.</p>
704+
705+
<p>If any properties on the element would inherit their value from the
706+
element's parent, they must instead be set to their initial value.</p>
703707

704708
<div class=example>
705709
<p>For example, the &lsquo;<code class=css>element()</code>&rsquo;
@@ -741,7 +745,8 @@ <h3 id=element-reference><span class=secno>3.3. </span> Using Elements as
741745
&lt;/ul></pre>
742746
</div>
743747

744-
<dt>The function references an element that is not rendered
748+
<dt>The function references an <a href="#element-not-rendered"><i
749+
title=element-not-rendered>element that is not rendered</i></a>
745750

746751
<dt>The function references an element that is a descendant of a replaced
747752
element
@@ -825,6 +830,15 @@ <h3 id=element-reference><span class=secno>3.3. </span> Using Elements as
825830
regeneration process. That is, the image must look identical to the
826831
referenced element, modulo rasterization quality.
827832

833+
<p>An element is <dfn id=element-not-rendered
834+
title=element-not-rendered>not rendered</dfn> if it does not have an
835+
associated box. This can happen, for example, if the element or an
836+
ancestor is &lsquo;<code class=css>display:none</code>&rsquo;, or if the
837+
element is not in a rendered document. In SVG, the descendants of a
838+
<code>&lt;defs></code> element are also considered to not be rendered.
839+
Other host languages may define additional ways in which an element can be
840+
considered not rendered.
841+
828842
<h4 class=no-num id=paint-sources> Paint Sources</h4>
829843

830844
<p>Host languages may define that some elements provide a <dfn
@@ -2745,6 +2759,9 @@ <h2 class=no-num id=index>Index</h2>
27452759
<li>&lsquo;<code class=css>dppx</code>&rsquo;, <a href="#dppx"
27462760
title="''dppx''"><strong>2.</strong></a>
27472761

2762+
<li>element-not-rendered, <a href="#element-not-rendered"
2763+
title=element-not-rendered><strong>3.3.</strong></a>
2764+
27482765
<li>&lt;element-reference>, <a href="#element-reference-type"
27492766
title="&lt;element-reference>"><strong>3.3.</strong></a>
27502767

css3-images/Overview.src.html

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ <h3 id="image-notation">
220220
<p>So that authors can take advantage of CSS's forwards-compatible parsing
221221
rules to provide a fallback for image slices, implementations that support
222222
the ''image()'' notation <em>must</em> support the <code>xywh=#,#,#,#</code>
223-
form of media fragment identifiers for images. [[!MEDIA-FRAGS]]
223+
form of media fragment identifiers for images. [[!MEDIA-FRAGS]]</p>
224+
225+
<p>If a URL in the list uses a fragment identifier syntax that the implementation does not understand, or which the implementation does not consider valid for that type of image, the image must be treated as invalid.</p>
224226

225227
<p>The ''image()'' notation is defined as:
226228

@@ -261,6 +263,14 @@ <h3 id="image-notation">
261263
<p>In the above, the background is the image "bg-image.png", overlaid with partially-transparent blue.
262264
</div>
263265

266+
<div class='example'>
267+
<p>Implementations are required to ignore images that use fragment identifers they don't recognize, which allows authors to use new fragment formats and still get safe fallback, which doesn't exist in normal CSS (as an unknown fragment identifier in ''url()'' doesn't make the property invalid).</p>
268+
269+
<p>For example, if a future specification defined a way to refer to a specific frame of an animated GIF, an author could write the following to get newer browsers to use the GIF's frame, and older browsers to instead download the fallback image:</p>
270+
271+
<pre>background-image: image('cat_meme.gif#frame=5', 'lolcat.png');</pre>
272+
</div>
273+
264274
<p>Along with each URL, the author may specify a directionality, similar to adding a <code>dir</code> attribute to an element in HTML. The image represented by the function takes on the directionality of the used URL. If a directional image is used on or in an element with opposite <a href="http://www.w3.org/TR/CSS21/visuren.html#propdef-direction">direction</a>, the image must be flipped in the inline direction (as if it was transformed by, e.g., <code>scaleX(-1)</code>, if the inline direction is the X axis).</p>
265275

266276
<div class='example'>
@@ -335,9 +345,11 @@ <h3 id='element-reference'>
335345
<dt>The function doesn't reference an element</dt>
336346
<dd>The function represents a solid-color transparent-black image with no intrinsic dimensions.</dd>
337347

338-
<dt>The function references an element that is not rendered, but which <i title=paint-source>provides a paint source</i></dt>
348+
<dt>The function references an <i title='element-not-rendered'>element that is not rendered</i>, but which <i title='paint-source'>provides a paint source</i></dt>
339349
<dd>
340-
<p>The function represents an image with the dimensions and appearance of the <i title=paint-source>paint source</i>. The host language defines the dimensions and appearance of paint sources.
350+
<p>The function represents an image with the dimensions and appearance of the <i title=paint-source>paint source</i>. The host language defines the dimensions and appearance of paint sources.</p>
351+
352+
<p>If any properties on the element would inherit their value from the element's parent, they must instead be set to their initial value.</p>
341353

342354
<div class='example'>
343355
<p>For example, the ''element()'' function can reference an SVG &lt;pattern> element in an HTML document:</p>
@@ -376,7 +388,7 @@ <h3 id='element-reference'>
376388
</div>
377389
</dd>
378390

379-
<dt>The function references an element that is not rendered</dt>
391+
<dt>The function references an <i title='element-not-rendered'>element that is not rendered</i></dt>
380392
<dt>The function references an element that is a descendant of a replaced element</dt>
381393
<dd>
382394
<p>The function represents a solid-color transparent-black image with no intrinsic dimensions.</p>
@@ -442,6 +454,8 @@ <h3 id='element-reference'>
442454
the image must look identical to the referenced element, modulo rasterization
443455
quality.</p>
444456

457+
<p>An element is <dfn id='element-not-rendered' title='element-not-rendered'>not rendered</dfn> if it does not have an associated box. This can happen, for example, if the element or an ancestor is ''display:none'', or if the element is not in a rendered document. In SVG, the descendants of a <code>&lt;defs></code> element are also considered to not be rendered. Other host languages may define additional ways in which an element can be considered not rendered.</p>
458+
445459
<h4 id='paint-sources' class='no-num'>
446460
Paint Sources</h4>
447461

0 commit comments

Comments
 (0)