|
19 | 19 |
|
20 | 20 | <h1>CSS Image Values and Replaced Content Module Level 3</h1> |
21 | 21 |
|
22 | | - <h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 14 December |
| 22 | + <h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 15 December |
23 | 23 | 2010</h2> |
24 | 24 |
|
25 | 25 | <dl> |
26 | 26 | <dt>This version:</dt> |
27 | | - <!-- <dd><a href="http://www.w3.org/TR/2010/CR-css3-images-20101214/">http://www.w3.org/TR/2010/CR-css3-images-20101214/</a></dd> --> |
| 27 | + <!-- <dd><a href="http://www.w3.org/TR/2010/CR-css3-images-20101215/">http://www.w3.org/TR/2010/CR-css3-images-20101215/</a></dd> --> |
28 | 28 |
|
29 | 29 | <dd><a |
30 | 30 | href="http://dev.w3.org/csswg/css3-images/">http://dev.w3.org/csswg/css3-images/</a> |
@@ -482,36 +482,65 @@ <h3 id=element-reference><span class=secno>4.3. </span>Using Elements as |
482 | 482 | function is an ID selector, the function references the element matched |
483 | 483 | by the selector. If it's an identifier, the function references the |
484 | 484 | element who's <dfn id=css-element-reference-identifier>CSS element |
485 | | - reference identifier</dfn> is the identifier. (CSS does not define how |
486 | | - an element acquires a ‘<a |
| 485 | + reference identifier</dfn> is the given identifier. (CSS does not define |
| 486 | + how an element acquires a ‘<a |
487 | 487 | href="#css-element-reference-identifier"><code class=css>CSS element |
488 | 488 | reference identifier</code></a>’; that is determined by the host |
489 | 489 | language.) If no element in the document matches the selector, or no |
490 | 490 | element has the identifier as its ‘<a |
491 | 491 | href="#css-element-reference-identifier"><code class=css>CSS element |
492 | 492 | reference identifier</code></a>’, the function represents a fully |
493 | 493 | transparent image with no intrinsic dimensions, equivalent to |
494 | | - <code>image(transparent)</code>. Otherwise, the function represents an |
495 | | - image with width and height equal to the width and height of the |
496 | | - referenced element, with an appearance exactly equivalent to that of the |
497 | | - referenced element. Whether or not the referenced element is currently |
498 | | - being rendered on-screen, for media types where this is relevant, must |
499 | | - not affect the appearance of the image represented by the function; the |
500 | | - image must always be equivalent to how the element would appear when |
501 | | - rendered on-screen. If the document changes so that which element is |
502 | | - matched, or whether an element is matched at all, changes, the image |
503 | | - represented by the function must change accordingly.</p> |
| 494 | + <code>image(transparent)</code>. If the document changes so that which |
| 495 | + element is matched, or whether an element is matched at all, changes, |
| 496 | + the image represented by the function must change accordingly.</p> |
| 497 | + |
| 498 | + <p>If the ‘<code class=css>element()</code>’ function refers |
| 499 | + to an element, then it represents an image with width and height equal |
| 500 | + to the width and height of the margin box of the referenced element. The |
| 501 | + image must be constructed by rendering the referenced element and its |
| 502 | + descendants at the same size that the element would be in its document, |
| 503 | + over an infinite transparent black background, positioned so that the |
| 504 | + edges of the margin box of the element is flush with the edges of the |
| 505 | + image. <span class=note>If the element has decorations or descendants |
| 506 | + that extend outside the margin box, these will be clipped to the margin |
| 507 | + box in the generated image by default. ‘<code |
| 508 | + class=css>background-repeat:extend</code>’ may allow the author to |
| 509 | + override this behavior so that decorations and descendants outside the |
| 510 | + margin box are still painted.</span> If the referenced element or an |
| 511 | + ancestor of the referenced element has a transform applied to it, the |
| 512 | + transform must be ignored for the purpose of constructing this image |
| 513 | + (transforms on descendants must be unaffected).</p> |
504 | 514 |
|
505 | 515 | <p>If the argument passed to ‘<code |
506 | 516 | class=css>element()</code>’ isn't an ID selector or an ident, it |
507 | 517 | is a syntax error.</p> |
508 | 518 |
|
509 | 519 | <div class=example> TODO: copy an example from the MozHacks article</div> |
510 | 520 |
|
511 | | - <div class=issue> This can pretty obviously result in dependency cycles. |
512 | | - An element can try to use itself as a background, for example. I need to |
513 | | - add a section about determining the dependency graph and what to do when |
514 | | - a cycle is detected.</div> |
| 521 | + <div> |
| 522 | + <h4 class="no-num no-toc" id=element-cycles>Detecting and Resolving |
| 523 | + Circular Relationships Introduced by ‘<code |
| 524 | + class=css>element()</code>’</h4> |
| 525 | + |
| 526 | + <p>The ‘<code class=css>element()</code>’ function can |
| 527 | + produce nonsensical circular relationships, such as an element using |
| 528 | + itself as its own background. These relationships can be easily and |
| 529 | + reliably detected and resolved, however, by keeping track of a |
| 530 | + dependency graph and using common cycle-detection algorithms.</p> |
| 531 | + |
| 532 | + <p>Populate the dependency graph initially by having every element |
| 533 | + depend on each of its children. Then, whenever a property on an element |
| 534 | + A uses the ‘<code class=css>element()</code>’ function to |
| 535 | + refer to an element B, add an edge to the graph by having A depend on |
| 536 | + B. If a dependency cycle is detected, any ‘<code |
| 537 | + class=css>element()</code>’ functions that produced a dependency |
| 538 | + in the cycle represent a fully transparent image with no intrinsic |
| 539 | + dimensions.</p> |
| 540 | + |
| 541 | + <p class=issue>Someone else needs to review this and make sure that I'm |
| 542 | + not missing any cycles.</p> |
| 543 | + </div> |
515 | 544 | </div> |
516 | 545 |
|
517 | 546 | <div> |
|
0 commit comments