-
Notifications
You must be signed in to change notification settings - Fork 790
Expand file tree
/
Copy pathExclusions.src.html
More file actions
1253 lines (1165 loc) · 50.4 KB
/
Exclusions.src.html
File metadata and controls
1253 lines (1165 loc) · 50.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html public '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>
<html lang="en">
<head profile="http://www.w3.org/2006/03/hcard">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS Exclusions and Shapes Module Level 1</title>
<link rel="stylesheet" type="text/css" href="default.css" />
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS].css" />
<link id="st" href="alternate-spec-style.css" rel="stylesheet"
type="text/css" disabled="true" title="additional spec styles">
<script type="text/javascript" src="style-toggle.js"></script>
<style type="text/css">
.singleImgExample {
display: block;
margin: auto;
}
.example-table {
table-layout: fixed;
width: 100%;
}
.example-table tr td img {
width: 90%;
}
a.toggle {
position: absolute;
top: 0.5em;
right: 0.5em;
font-size: smaller;
color: gray;
opacity: 0.2;
}
a.toggle:hover {
opacity: 1;
color: #46A4E9;
}
</style>
</head>
<body>
<div id="div-head" class="head">
<!--logo-->
<h1 id="css-exclusions-module">CSS exclusions and shapes module level 1</h1>
<h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
<dl>
<dt>This version:</dt>
<dd><a href="[VERSION]">http://www.w3.org/csswg/css3-exclusions/</a></dd>
<dt>Latest version:</dt>
<dd><a href="http://www.w3.org/TR/[SHORTNAME]/">http://www.w3.org/csswg/[SHORTNAME]/</a></dd>
<dt>Previous version:</dt>
<dd>None</dd>
<dt>Editors:</dt>
<dd class="vcard"><span class="fn">Vincent Hardy</span>, <span class="org">Adobe Systems, Inc.</span>, <span class="email">vhardy@adobe.com</span></dd>
<dd class="vcard"><span class="fn">Rossen Atanassov</span>, <span class="org">Microsoft Corporation</span>, <span class="email">ratan@microsoft.com</span></dd>
</dl>
<!--copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
<p><em>IN PROGRESS - NOT READY FOR REVIEW</em></p>
<p>
CSS exclusions define arbitrary areas around which inline content can flow.
Unlike CSS floats, which they extend, CSS exclusions can be positioned with any
CSS positioning schemes.
</p>
<p>
CSS Shapes control the geometric shapes used for wrapping inline
flow content outside or inside an element.
</p>
<p>
Combining CSS Exclusions and CSS Shapes allows sophisticated layouts,
for example having content flow into and/or around
circles or other, arbitrarily complex shapes.
</p>
<h2 class="no-num no-toc"
9927
id="status">Status of this document</h2>
<!--status-->
<!--<p>The following features are at risk: …</p>-->
<h2 class="no-num no-toc" id="contents">Table of contents</h2>
<!--toc-->
<h2 id="intro">Introduction</h2>
<p><em>This section is not normative.</em></p>
<p>
The exclusions section of this specification defines features that allow inline flow
content to wrap around outside the <span>exclusion area</span> of elements.
</p>
<p>
The shapes section of the specification defines properties to control the geometry of
an element's <span>exclusion area</span> as well as the geometry used for wrapping
an element's inline flow content.
</p>
<h2 id="definitions">Definitions</h2>
<dfn>Exclusion element</dfn>
<p>
An element that defines an <span>exclusion area</span>s for other elements. The 'wrap-flow' property
is used to make an element an exclusion element. An exclusion element contributes its
<span>exclusion area</span> to its <a href="http://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block</a>'s
<span>wrapping context</span>
</p>
<dfn>Exclusion area</dfn>
<p>
The area used for excluding inline flow content around an exclusion element. By default the
area is equivalent to the <a href="http://www.w3.org/TR/CSS2/box.html#box-dimensions">border box</a>.
This specification's 'shape-outside' property can define arbitrary, non-rectangular exclusion areas.
</p>
<dfn>Wrapping context</dfn>
<p>
An element's wrapping context holds the collection of areas that an element should 'wrap around'
when laying out its inline flow content. An element will wrap its content in the area that
correspond to the substraction of its wrapping context shapes from its own <span>content area</span>.
</p>
<p>
An element inherit its
<a href="http://www.w3.org/TR/CSS2/visudet.html#containing-block-details">containing block</a>'s
wrapping context unless it specifically
resets it using the 'wrap-through' property.
</p>
<dfn>Content area</dfn>
<p>
The area used for layout of the inline flow content of an element. By default the
area is equivalent to the <a href="http://www.w3.org/TR/CSS2/box.html#box-dimensions">content box</a>.
This specification's 'shape-inside' property can define arbitrary, non-rectangular content areas.
</p>
<dfn title="outside-inside">Outside and inside</dfn>
<p>
In this specification, ‘outside’ refers to DOM content that is not a descendant of an element
while 'inside’ refers to the element's descendants.
</p>
<h2 id="exclusions">Exclusions</h2>
<p>
Exclusion elements define exclusion areas that contribute to their containing block's
wrapping context. As a consequence, exclusions impact the layout of their containing block's
descendants.
<p>
<p>
Elements layout their inline content in their <span>content area</span> and avoid the
areas in their associated wrapping context. If the element is itself an exclusion, it
does not wrap around its own exclusion shape and the impact of other exclusions on other
exclusions is controlled by the 'z-index' property as explained in the
<a href="#exclusions-order">exclusions order</a> section.
</p>
The shape properties can is used to change the shape of exclusions.
</p>
<h3 id="declaring-exclusions">Declaring exclusions</h3>
<p>
An element becomes an exclusion when its 'wrap-flow' property has a computed value other than
'auto'.
</p>
<h4 id="wrap-flow-property">The 'wrap-flow' property</h4>
<table class="propdef">
<tr>
<th>Name:</th>
<td><dfn title="'wrap-flow'">wrap-flow</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><var>auto</var> | <var>both</var> | <var>left</var> | <var>right</var> | <var>maximum</var> | <var>clear</var></td>
</tr>
<tr>
<th>Initial:</th>
<td>auto</td>
</tr>
<tr>
<th>Applies to:</th>
<td>block-level elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>as specified, except for floats all values compute to 'auto'</td>
</tr>
</table>
<p>The values of this property have the following meanings:</p>
<dl>
<dt><dfn title="'wrap-flow'!!'auto'">auto</dfn></dt>
<dd>
For floats an exclusion is created, for all other elements an exclusion is not created.
</dd>
<dt><dfn title="'wrap-flow'!!'both'">both</dfn></dt>
<dd>
Inline flow content can flow on all sides of the exclusion.
</dd>
<dt><dfn title="'wrap-flow'!!'left'">left</dfn></dt>
<dd>
Inline flow content can wrap on the left side of the exclusion but must leave
the area to the right of the exclusion empty.
</dd>
<dt><dfn title="'wrap-flow'!!'right'">right</dfn></dt>
<dd>
Inline flow content can wrap on the right side of the exclusion but must leave
the area to the left of the exclusion empty.
</dd>
<dt><dfn titl
7299
e="'wrap-flow'!!'maximum'">maximum</dfn></dt>
<dd>
Inline flow content can wrap on the side of the exclusion with the largest
available space for the given line, and must leave the other side of the exclusion
empty..
</dd>
<dt><dfn title="'wrap-flow'!!'clear'">clear</dfn></dt>
<dd>
Inline flow content can only wrap on top and bottom of the exclusion and must leave
the areas to the left and right of the exclusion empty.
</dd>
</dl>
<p>
Setting the 'wrap-flow' property to 'both', 'left', 'right', 'maximum' or 'clear' on an
element makes that element an <span>exclusion element</a>. It's <span>exclusion shape</span>
is contributed to its containing block's wrapping context, causing the containing block's descendants
to wrap around its exclusion area.
</p>
<p>
The initial value for this property is 'auto'.
</p>
<p>
When the property's computed value is 'auto', the element does not become an
<span>exclusion element</span> unless its 'float'
property computed value is not 'none'. In that case, the element contributes its
'border box' to its containing block's <span>wrapping context</span> and content
flows around it according to the 'clear' property.
</p>
<p>
The element will be considered as an exclusion for all inline flow content descendants
of the exclusions' containing block.
</p>
<div class="issue">
What is the expected behavior if we have two positioned exclusions at the same height position,
but with conflicting 'wrap-flow' values. For example, two circles, one with wrap-flow: right and
one with wrap-flow: left?
</div>
<div class="example">
<p>
The 'wrap-flow' property values applied to an absolutely positioned element.
</p>
<code class="html"><pre>
<style type="text/css">
#exclusion {
position: absolute;
background: lightblue;
border: 3px solid blue;
}
</style>
<div style=”position: relative; border: 1px solid black;”>
<div id=”exclusion”>Donec metus messa, mollis...</div>
Lorem ipsum dolor sit amet...
</div>
</pre></code>
<table class="example-table">
<tr>
<td><code class="html">#exclusion{ wrap-flow: auto; }</code></td>
<td><code class="html">#exclusion{ wrap-flow: both; }</code></td>
</tr>
<tr>
<td><img src="images/exclusion_wrap_side_auto.png" alt="Example rendering for wrap-side: auto" /></td>
<td><img src="images/exclusion_wrap_side_both.png" alt="Example rendering for wrap-side: both" /></td>
</tr>
<tr>
<td><code class="html">#exclusion{ wrap-flow: left; }</code></td>
<td><code class="html">#exclusion{ wrap-flow: right; }</code></td>
</tr>
<tr>
<td><img src="images/exclusion_wrap_side_left.png" alt="Example rendering for wrap-side: left" /></td>
<td><img src="images/exclusion_wrap_side_right.png" alt="Example rendering for wrap-side: right" /></td>
</tr>
<tr>
<td><code class="html">#exclusion{ wrap-flow: maximum; }</code></td>
<td><code class="html">#exclusion{ wrap-flow: maximum; }</code></td>
</tr>
<tr>
<td><img src="images/exclusion_wrap_side_maximum_L.png" alt="Example rendering for wrap-side: maximum" /></td>
<td><img src="images/exclusion_wrap_side_maximum_R.png" alt="Example rendering for wrap-side: maximum" /></td>
</tr>
<tr>
<td><code class="html">#exclusion{ wrap-flow: clear; }</code></td>
<td><code class="html"> </code></td>
</tr>
<tr>
<td><img src="images/exclusion_wrap_side_clear.png" alt="Example rendering for wrap-side: clear" /></td>
<td> </td>
</tr>
</table>
</div>
<!-- End section "wrap-flow Property" -->
<!-- End section "Declaring Exclusions" -->
<h3 id="scope-and-effect-of-exclusions">Scope and Effect of Exclusions</h3>
<p>
An exclusion affects the inline flow content descended from the exclusion's containing
blocks (defined in <a href="http://www.w3.org/TR/CSS2/visudet.html#containing-block-details">
CSS 2.1 10.1</a>) and that of all descendant elements of the same containing
block. All inline flow content inside the containing block of the exclusions is
affected. To stop the effect of exclusions defined outside any element, the 'wrap-through'
property can be used (see definition of Propagation of Exclusions below).
</p>
<h4 id="wrap-margin-property">The 'wrap-margin' Property</h4>
<p>
The 'wrap-margin' property can be used to offset the inline flow content wrapping
on the outside of exclusions. Offsets created by the 'wrap-margin' property are
offset from the outside of the exclusion. This property takes on positive values
only.
</p>
<table class="propdef">
<tr>
<th>Name:</th>
<td><dfn title="'wrap-margin'">wrap-margin</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><var><length></var></td>
</tr>
<tr>
<th>Initial:</th>
<td>0</td>
</tr>
<tr>
<th>Applies to:</th>
<td>block-level elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>the absolute length</td>
</tr>
</table>
<!-- End secion "wrap-margin property" -->
<h4 id="wrap-padding-property">The 'wrap-padding' Property</h4>
<p>
The 'wrap-padding' property can be used to offset to the inline flow content wrapping
on the inside of elements. Offsets created by the 'wrap-padding' property are offset
from the <span>content area</span> of the element. This property takes on positive values only.
</p>
<table class="propdef">
<tr>
<th>Name:</th>
<td><dfn title="'wrap-padding'">wrap-padding</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><var><length></var></td>
</tr>
<tr>
<th>Initial:</th>
<td>0</td>
</tr>
<tr>
<th>Applies to:</th>
<td>block-level elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>the absolute length</td>
</tr>
</table>
<!-- End section "wrap-padding property" -->
<!-- End section "Scope and Efect of Exclusions" -->
<h3 id="propagation-of-exclusions">Propagation of Exclusions</h3>
<p>
By default, an element inherits its parent <span>wrapping context</span>. In other words
it is subject to the exclusions defined <span title="outside-inside">outside</sapn> the element.
</p>
<p>Setting the 'wrap-through' property to 'none' prevents an element from inheriting its parent
wrapping context. In other words, exclusions defined 'outside' the element, have not effect
on the element's children layout.
</p>
<div class="note">
Exclusions defined by an element's descendants still contribute to their containing block's
<span>wrapping context</span>. If that containing block is a child of an element with 'wrap-through'
set to none, or the element itself, then exclusion still have an effect on the children of that
containing block element.
</div>
<h4 id="wrap-through-property">The 'wrap-through' Property</h4>
<table class="propdef">
<tr>
<th>Name:</th>
<td><dfn title="'wrap-through'">wrap-through</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><var>wrap</var> | <var>none</var></td>
</tr>
<tr>
<th>Initial:</th>
<td>wrap</td>
</tr>
<tr>
<th>Applies to:</th>
<td>block-level elements</td>
</tr>
<tr>
<th>Inhe
1891
rited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>as specified</td>
</tr>
</table>
<p>The values of this property have the following meanings:</p>
<dl>
<dt><dfn title="'wrap-through'!!'wrap'">wrap</dfn></dt>
<dd>
The element inherits its parent node's <span>wrapping context</span>. Its descendant
inline content wraps around exclusions defined <span title="outside-inside">outside</span>
the element.
</dd>
</dl>
<dl>
<dt><dfn title="'wrap-through'!!'none'">none</dfn></dt>
<dd>
The element does not inherit its parent node's <span>wrapping context</span>. Its
descendants are only subject to exclusion shapes defined <span title="outside-inside">inside</span>
the element.
</dd>
</dl>
<div class="example">
<p>
Using the 'wrap-through' property to control the effect of exclusions.
</p>
<pre><code class="html">
<style type="text/css">
.exclusion {
wrap-flow: both;
position: absolute;
background-color: rgba(220, 230, 242, 0.5);
}
</style>
<div style=”position: relative;”>
<div class=”exclusion”></div>
<div style=”wrap-through: wrap;”> Lorem ipsum dolor sit amet...</div>
<div style=”wrap-through: none;”> Lorem ipsum dolor sit amet...</div>
</div>
</code></pre>
<img class="singleImgExample" src="images/exclusion_wrap_through.png" alt="Example rendering of wrap-through: wrap | none" />
</div>
<!-- End section "wrap-through property" -->
<!--
<h4 id="wrap-shorthand-property">The 'wrap' Shorthand Property</h4>
<table class="propdef">
<tr>
<th>Name:</th>
<td><dfn title="'wrap'">wrap</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><var><wrap-flow></var> || <var><wrap-margin></var> [ / <var><wrap-padding></var>]</td>
</tr>
<tr>
<th>Initial:</th>
<td>see individual properties</td>
</tr>
<tr>
<th>Applies to:</th>
<td>block-level elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>see individual properties</td>
</tr>
</table>
<p>
The 'wrap' property is a shorthand property for setting the exclusions properties
at the same place in the style sheet.
</p>
-->
<!-- End section "wrap shorthand property" -->
<!-- End section "Propagation of Exclusions" -->
<h3 id="exclusions-order">Exclusions order</h3>
<p>
Exclusions follow the painting order (See [[!CSS21]] Appendix E). Exclusions are applied in reverse
to the document order in which they are defined. The last exclusion appears on top
of all other exclusion, thus it affects the inline flow content of all other preceding
exclusions or elements descendant of the same containing block. To change the ordering
of positioned exclusions, z-index can be used.
</p>
<div class="issue">z-index only applies to positioned elements. Since any element can
be an exclusion and since they can overlap, should we say that the order of a statically positioned
exclusion cannot be controlled?</div>
<div class="example">
<p>Ordering of exclusions.</p>
<pre><code class="html">
<style type="text/css">
.exclusion {
wrap-flow: both;
position: absolute;
width: 50%;
height: 50%;
}
</style>
<div class=”exclusion” style=”top: 0px; left: 0px;”>
Lorem ipsum dolor sit amet...
</div>
<div id="orderedExclusion" class=”exclusion” style=”top: 25%; left: 25%;”>
Lorem ipsum dolor sit amet...
</div>
<div class=”exclusion” style=”top: 50%; left: 50%;”>
Lorem ipsum dolor sit amet...
</div>
</code></pre>
<table class="example-table">
<tr>
<td style="width:50%"><code class="html">#orderedExclusion{ z-index: auto; }</code></td>
<td style="width:50%"><code class="html">#orderedExclusion{ z-index: 1; }</code></td>
</tr>
<tr>
<td><img class="singleImgExample" src="images/exclusion_ordering.png" alt="Example rendering of default exclusion ordering." /></td>
<td><img class="singleImgExample" src="images/exclusion_ordering_z_order.png" alt="Example rendering of default exclusion ordering." /></td>
</tr>
</table>
</div>
<!-- End section "Order of Exclusions" -->
<h3 id="processing-model-of-exclusions">Processing Model of Exclusions</h3>
<p><em>This section is not normative.</em></p>
<p>
Exclusions can be specified on positioned elements and elements can be positioned
from their <a href="http://www.w3.org/TR/CSS21/visudet.html#static-position">static
position</a>. Since, the static position of such elements depends on the inline
flow content affected by the exclusion itself; there is a circular dependency between
the two layout tasks. To break this circular dependency a two-pass layout approach
is recommended. The first layout pass computes the static positions of all auto-positioned
exclusions by laying out all content besides exclusions. The second pass is layout
of all elements including all exclusions. Exclusions that depend on their static
position will use the position calculated during the first layout pass.
</p>
<p class="note">
Note, this may cause exclusions to overlap or be distant from their static position
(compared to non-exclusions auto-positioned elements).
</p>
<p>
Similar dependency exists for exclusions whose size or position is specified in
percentage and the containing block size is specified as 'auto'. In such cases the
size or position of the exclusion is calculated based on the size of the containing
block calculated in the first layout pass.
</p>
<p>
Exclusions can be positioned on all levels of nested elements. If layout is
restarted on every level of nesting, the time to complete layout will be exponential.
To avoid multiple layout passes, the restart of the second layout pass
should be scoped to the top-most containing block of exclusions. Similarly, restarting
layout for the entire document is not necessary unless there are exclusions whose
containing block is the initial containing block.
</p>
<div class="issue">Should we move this at the end in an 'implementation note' section?</div>
<!-- End section "Processing Model of Exclusions" -->
<!-- End section "Exclusions" -->
<h2 id="shapes">Shapes</h2>
<p>
Shapes define arbitrary geometric contours around which or into which inline flow
content flows. There are two different types of shapes – 'outside' and 'inside'.
The outside shape defines the <span>exclusion area</span> for an <span>exclusion element</span>.
The inside shape defines an element's <span>content shape</span> and the element's inline
content will flow within that shape.
</p>
<dfn>Flow Container</dfn>
<p>
A flow container is an element with a 'display' value that is computed as 'block',
'table-cell' or 'inline-block'.
</p>
<p class="note">
Note, while the boundaries used for wrapping inline flow content outside and inside
an element can be defined using shapes, the actual box model does not change. If
the element has specified margins, borders or paddings they will be computed and
rendered according to the [[CSS3-Box]] module.
</p>
<div class="example">
<p>CSS 'shape' and CSS box model relation.</p>
<pre><code class="html">
<style type="text/css">
.exclusion {
wrap-flow: both;
position: absolute;
shape-outside: circle(50% 50% 50%);
border: 1px solid red;
}
</style>
<div style=”position: relative; border: 1px solid black;”>
<div class=”exclusion”></div>
Lorem ipsum dolor sit amet...
</div>
</code></pre>
<img class="singleImgExample" src="images/shapes_CSS2.1_MBP.png" alt="Example rendering of circle shape and box model." />
</div>
<h3 id="shapes-from-svg-syntax">Shapes from SVG Syntax</h3>
<p>
Shapes can be specified using <a href="http://www.w3.org/TR/SVG/shapes.html">SVG basic shapes</a>.
</p>
<h4 id="supported-svg-shapes">Supported SVG Shapes</h4>
The following SVG shapes are supported by the CSS shapes module.
<dl>
<dt>rectangle(x, y, width, height, [[rx], ry])</dt>
<dd>
<ul>
<li><strong>x, y, width and height</strong> - define the bounding box of the rectangle</li>
<li><strong>rx</strong> - For rounded rectangles, the x-axis radius of the ellipse used
to round off the corners of the rectangle</li>
<li><strong>ry</strong> - For rounded rectangles, the y-axis radius of the ellipse used
to round off the corners of the rectangle</li>
</ul>
</dd>
<dt>circle(cx, cy, r)</dt>
<dd>
<ul>
<li><strong>cx</strong> - The x-axis coordinate of the center of the circle</li>
<li><str
1891
ong>cy</strong> - The y-axis coordinate of the center of the circle</li>
<li><strong>r</strong> - The radius of the circle. Note, cannot be expressed as a percentage.</li>
</ul>
</dd>
<dt>ellipse(cx, cy, rx, ry)</dt>
<dd>
<ul>
<li><strong>cx</strong> - The x-axis coordinate of the center of the ellipse</li>
<li><strong>cy</strong> - The y-axis coordinate of the center of the ellipse</li>
<li><strong>rx</strong> - The x-axis radius of the ellipse</li>
<li><strong>ry</strong> - The y-axis radius of the ellipse</li>
</ul>
</dd>
<dt>polygon([fillRule], x1, y1, x2, y2, x3, y3, … xn, yn)</dt>
<dd>
<ul>
<li><strong>fillRule</strong> - The filling rule used to determine the interior of the
polygon. See fill-rule property in SVG for details. Possible values are nonzero
or evenodd. Default value when omitted is nonzero.</li>
<li><strong>xi</strong> - The x-axis coordinate of the i-th vertex of the polygon</li>
<li><strong>yi</strong> - The y-axis coordinate of the i-th vertex of the polygon</li>
</ul>
<p>
If the polygon is not closed the user-agent will automatically add a new vertex
at the end.</p>
<br>
</dd>
</dl>
<h4 id='referencing-svg-shapes'>Referencing SVG shapes</h4>
<p>An SVG shape can be referenced using the <code>url()</code> syntax. The shape can be
any of the <a href="http://www.w3.org/TR/SVG/shapes.html">SVG basic shapes</a> or a
<a href="http://www.w3.org/TR/SVG/paths.html">path element</a>.</p>
<p>In all cases, percentages are resolved from the border box of the element.</p>
<div class="example">
<code class="html"><pre>
<style>
.in-a-circle {
shape-inside: url(#circle_shape);
}
.in-a-path {
shape-inside: url(#path-shape);
}
</style>
<svg ...>
<circle id="circle_shape" cx="50%x" cy="50%" r="50%" />
<path id="path-shape" d="..." />
</svg>
<div class="in-a-circle">...</div>
<div class="in-a-path">...</div>
</pre></code>
</div>
<p>When using the SVG syntax or referencing SVG elements to define shapes, all the lengths expressed
in percentages are resolved from the border box of the element. The coordinate system for the
shape has its origin on the top-left corder of the border box with the x-axis running to the right
and the y-axis running downwards. If the SVG element uses unitless coordinate values, they are equivalent
to using 'px' units. When defining shapes using percentages,
the border box of the element must always be fully known in advance.</p>
<div class="issue">We need to clarify what this last sentence means.</div>
<!-- End section "Shapes from SVG Syntax -->
<h3 id="shapes-from-image">Shapes from Image</h3>
<p>
Another way of defining shapes is by specifying a source image whose alpha channel
is used to compute the inside or outside shape. When shapes are computed from an image, all
values of the 'background-image' property can be applied.
</p>
<div class="issue">Need to clarify what we mean by this last sentence.</div>
<p>
The shape is computed to be the path that encloses the area where the opacity of
the specified image is greater than the 'shape-image-threshold' value. If the 'shape-image-threshold'
is not specified, the initial value to be considered is 0.5.
</p>
<p class="note">
Note, images can define cavities and inline flow content should wrap inside
them. In order to avoid that, another exclusion element can be overlaid.
</p>
<div class="issue">Need to say how content clears shapes with cavities</div>
<!-- End section "Shapes from image" -->
<h3 id="declaring-shapes">Declaring Shapes</h3>
<p>
Shapes are declared with the 'shape-outside' or 'shape-inside' properties.
The 'shape-outside' property changes the geometry of an <span>exclusion element</span>'s
<span>exclusion are</span>. If the element is not an <span>exclusion element</span>
(see the 'wrap-flow' property), then the 'shape-outside' property has no effect.
</p>
<p>
The 'shape-inside' property defines an element's <span>content area</span> and
the element's inline flow content wraps into that shape.
</p>
<h4 id="shape-outside-property">The 'shape-outside' Property</h4>
<table class="propdef">
<tr>
<th>Name:</th>
<td><dfn title="'shape-outside'">shape-outside</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><var>auto</var> | <var><shape></var> | <var><uri></var></td>
</tr>
<tr>
<th>Initial:</th>
<td>auto</td>
</tr>
<tr>
<th>Applies to:</th>
<td>block-level elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>computed lengths for <shape>, the absolute URI for <uri>, otherwise as specified</td>
</tr>
</table>
<p>The values of this property have the following meanings:</p>
<dl>
<dt><dfn title="'shape-outside'!!'auto'">auto</dfn></dt>
<dd>The shape is computed based on the border box of the element.</dd>
</dl>
<dl>
<dt><dfn title="'shape-outside'!!'<shape>'"><shape></dfn></dt>
<dd>
The shape is computed based on the values of one of 'rectangle',' circle', 'ellipse'
or 'polygon'.
</dd>
</dl>
<dl>
<dt><dfn title="'shape-outside'!!'<uri>'"><uri></dfn></dt>
<dd>
If the <uri> references an SVG shape element, that element defines the shape.
Otherwise, if the <uri> references an image, the shape is extracted and computed
based on the alpha channel of the specified image.
If the <uri> does not reference an SVG shape element or an image, the
effect is as if the value 'auto' had been specified.
</dd>
</dl>
<!-- End section "The shape-outside Property" -->
<h4 id="shape-inside-property">The 'shape-inside' Property</h4>
<p>
The 'shape-inside' modifies the shape of the inner inline flow content from rectangular
content box to an arbitrary geometry.
</p>
<table class="propdef">
<tr>
<th>Name:</th>
<td><dfn title="'shape-inside'">shape-inside</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><var>outside-shape</var> | <var>auto</var> | <var><shape></var> | <var><uri></var></td>
</tr>
<tr>
<th>Initial:</th>
<td>outside-shape</td>
</tr>
<tr>
<th>Applies to:</th>
<td>block-level elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>N/A</td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>computed lengths for <shape>, the absolute URI for <uri>, otherwise as specified</td>
</tr>
</table>
<p>The values of this property have the following meanings:</p>
<dl>
<dt><dfn title="'shape-inside'!!'outside-shape'">outside-shape</dfn></dt>
<dd>
The shape is computed based on the computed value of the 'shape-outside' property.
</dd>
</dl>
<dl>
<dt><dfn title="'shape-inside'!!'auto'">auto</dfn></dt>
<dd>
The shape is computed based on the content box of the element.
</dd>
</dl>
<dl>
<dt><dfn title="'shape-inside'!!'<shape>'"><shape></dfn></dt>
<dd>
The shape is computed based on the values of one of 'rectangle',' circle', 'ellipse'
or 'polygon'.
</dd>
</dl>
<dl>
<dt><dfn title="'shape-inside'!!'<uri>'"><image></dfn></dt>
<dd>
If the <uri> references an SVG shape element, that element defines the shape.
Otherwise, if the <uri> references an image, the shape is extracted and computed
based on the alpha channel of the specified image.
If the <uri> does not reference an SVG shape element or an image, the
effect is as if the value 'auto' had been specified.
</dd>
</dl>
<!-- End section "The shape-inside property" -->
<h4 id="shape-image-threshold-property">The 'shape-image-threshold' Property</h4>
<p>
The 'shape-image-threshold' defines the alpha channel threshold used to extract
the shape using an image. A value of 0.5 means that all the pixels that are more
than 50% transparent define the path of the exclusion shape. The 'shape-image-threshold'
applies to both 'shape-outside' and 'shape-inside'.
</p>
<p class="note">
The specified value of 'shape-image-threshold' is applied to both images used for
'shape-outside' and 'shape-inside'.
</p>
<table class="propdef">
<tr>
<th>Name:</th>
<td><dfn title="'shape-image-threshold'">shape-image-threshold</dfn></td>
</tr>
<tr>
<th>Value:</th>
<td><var><alphavalue></var></td>
</tr>
<tr>
<th>Initial:</th>
<td>0.5</td>
</tr>
<tr>
<th>Applies to:</th>
<td>block-level elements</td>
</tr>
<tr>
<th>Inherited:</th>
<td>no</td>
</tr>
<tr>
<th>Percentages:</th>
<td>alpha channel of the image specified by <image></td>
</tr>
<tr>
<th>Media:</th>
<td>visual</td>
</tr>
<tr>
<th>Computed value:</th>
<td>The same as the specified value after clipping the <alphavalue> to the range [0.0,1.0].</td>
</tr>
</table>
<p>The values of this property have the following meanings:</p>
<dl>
<dt><dfn title="'shape-image-threshold'!!'<alphavalue>'"><alphavalue></dfn></dt>
<dd>
A <number> value used to set the threshold used for extracting a shape from