Skip to content

Commit 94982e8

Browse files
committed
[css-display][various] Split out 'independent FC' from 'new FC' and rewrite definitions to be more explicit in general, and edit various specs to properly refer to it. Closes #2597. Fixes #1457 properly.
1 parent 5b6b22b commit 94982e8

File tree

9 files changed

+70
-21
lines changed

9 files changed

+70
-21
lines changed

‎css-align-3/Overview.bs

+1-1
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ The 'justify-content' And 'align-content' Properties</h3>
915915
<tr>
916916
<th>''justify-content/normal'' Behavior
917917
<td>
918-
All values other than ''justify-content/normal'' force the block container to establish a new formatting context.
918+
All values other than ''justify-content/normal'' force the block container to [=establish an independent formatting context=].
919919

920920
For table cells, the behavior of the ''justify-content/normal'' depends on the computed value of 'vertical-align':
921921
''vertical-align/top'' makes it behave as ''start'',

‎css-contain-1/Overview.bs

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Layout Containment</h3>
217217
layout containment has no effect.
218218
Otherwise, giving an element <dfn export>layout containment</dfn> has the following effects:
219219

220-
1. The element establishes a new <a>formatting context</a>.
220+
1. The element [=establishes an independent formatting context=].
221221

222222
2. If a <a>fragmentation context</a> participates in <a>layout containment</a>,
223223
the first element with <a>layout containment</a>
@@ -352,7 +352,7 @@ Paint Containment</h3>
352352
<span class=note>This is as if to ''overflow: visible'' was changed to ''overflow: clip'' at used value.</span>
353353
2. The element acts as a containing block for absolutely positioned and fixed positioned descendants.
354354
3. The element creates a <a>stacking context</a>.
355-
4. The element establishes a new <a>formatting context</a>.
355+
4. The element [=establishes an independent formatting context=].
356356

357357
Possible optimizations that can be enabled by <a>paint containment</a> include (but are not limited to):
358358

‎css-display-3/Overview.bs

+59-9
Original file line numberDiff line numberDiff line change
@@ -1030,20 +1030,37 @@ Appendix A: Glossary</h2>
10301030
lays out boxes according to the <a>flex layout</a> rules [[CSS3-FLEXBOX]],
10311031
whereas a <a>block formatting context</a>
10321032
lays out boxes according to the block-and-inline layout rules [[CSS2]].
1033+
Additionally, some types of [=formatting contexts=] interleave and co-exist:
1034+
for example, an [=inline formatting context=] exists within
1035+
and interacts with the [=block formatting context=]
1036+
of the element that establishes it,
1037+
and a [=ruby container=] overlays a [=ruby formatting context=]
1038+
over the [=inline formatting context=] in which its [=ruby base container=] participates.
10331039

1034-
When a box establishes a <em>new</em> [=formatting context=]
1040+
A box either establishes a new [=independent formatting context=]
1041+
or continues the [=formatting context=] of its containing block.
1042+
In some cases,
1043+
it might additionally establish a new (non-independent) co-existing formatting context.
1044+
Unless otherwise specified, however,
1045+
establishing a new <a>formatting context</a>
1046+
creates an <a>independent formatting context</a>.
1047+
The type of formatting context established by the box
1048+
is determined by its <a>inner display type</a>.
1049+
E.g. a <a>grid container</a> establishes a new <a>grid formatting context</a>,
1050+
a <a>ruby container</a> establishes a new <a>ruby formatting context</a>,
1051+
and a <a>block container</a> can establish a new <a>block formatting context</a>
1052+
and/or a new <a>inline formatting context</a>.
1053+
See the 'display' property.
1054+
1055+
<dt><dfn>independent formatting context</dfn>
1056+
<dd>
1057+
When a box establishes an independent formatting context
10351058
(whether that [=formatting context=] is of the same type as its parent or not),
10361059
it essentially creates a new, independent layout environment:
10371060
except through the sizing of the box itself,
10381061
the layout of its descendants is (generally)
10391062
not affected by the the rules and contents of
10401063
the [=formatting context=] outside the box, and vice versa.
1041-
However, certain types of [=formatting context=] interleave and co-exist:
1042-
for example, an [=inline formatting context=] exists within
1043-
and interacts with the [=block formatting context=]
1044-
of the element that establishes it,
1045-
and a [=ruby container=] overlays a [=ruby formatting context=]
1046-
over the [=inline formatting context=] in which its [=ruby base container=] participates.
10471064

10481065
<p class="example">
10491066
For example, in a <a>block formatting context</a>,
@@ -1058,10 +1075,38 @@ Appendix A: Glossary</h2>
10581075
As another example, margins do not collapse across [=formatting context=] boundaries.
10591076

10601077
<p class="note">
1061-
Exclusions are able to affect content across [=formatting context=] boundaries.
1078+
Exclusions are able to affect content across [=independent formatting context=] boundaries.
10621079
(At time of writing, they are the only layout feature that can.)
10631080
[[CSS3-EXCLUSIONS]]
10641081

1082+
Certain properties can force a box to
1083+
<dfn lt="establish an independent formatting context|
1084+
establishes an independent formatting context|
1085+
establishing an independent formatting context|
1086+
established an independent formatting context">
1087+
establish an independent formatting context</dfn>
1088+
in cases where it wouldn't ordinarily.
1089+
For example,
1090+
making a box <a>out-of-flow</a>
1091+
causes it to <a>blockify</a> as well as to [=establish an independent formatting context=].
1092+
As another example,
1093+
certain values of the 'contain' property
1094+
can cause a box to <a>establish an independent formatting context</a>.
1095+
Turning a block into a <a>scroll container</a>
1096+
will cause it to <a>establish an independent formatting context</a>;
1097+
however turning a <a>subgrid</a> into a <a>scroll container</a> will not--
1098+
it continues to act as a subgrid,
1099+
with its contents participating in the layout of its parent <a>grid container</a>.
1100+
1101+
A [=block box=] that [=establishes an independent formatting context=]
1102+
establishes a new [=block formatting context=] for its contents.
1103+
In most other cases,
1104+
forcing a box to [=establish an independent formatting context=] is a no-op--
1105+
either the box already establishes an <a>independent formatting context</a>
1106+
(e.g. <a>flex containers</a>),
1107+
or it's not possible to establish a totally independent new formatting context on that type of box
1108+
(e.g. non-replaced <a>inline boxes</a>).
1109+
10651110
<dt><dfn>block formatting context</dfn>
10661111
<dt><dfn>inline formatting context</dfn>
10671112
<dd>
@@ -1259,6 +1304,11 @@ Appendix C: Box Construction Guidelines for Spec Authors</h2>
12591304
can't directly contain <a>block-level</a> boxes;
12601305
any boxes generated within such an element
12611306
must be <a>inline-level</a>.
1307+
* Boxes that fundamentally cannot establish an [=independent formatting context=]
1308+
(such as non-replaced inlines)
1309+
must not be asked to [=establish an independent formatting context=].
1310+
Blockify them first,
1311+
or otherwise change their box type to one that can establish an [=independent formatting context=].
12621312

12631313
<h2 class=no-num id="acknowledgments">
12641314
Acknowledgments</h2>
@@ -1340,7 +1390,7 @@ Changes</h2>
13401390
* Clarified interaction of various box tree fixups.
13411391
(<a href="https://drafts.csswg.org/css-display-3/issues-wd-2017#issue-38">Issue 38</a>,
13421392
<a href="https://drafts.csswg.org/css-display-3/issues-wd-2017#issue-48">Issue 48</a>)
1343-
* Added the definition of <a>becoming a formatting context</a>.
1393+
* Added the definition of becoming a formatting context.
13441394
* Miscellaneous minor fixes and minor clarifications.
13451395

13461396
A <a href="https://drafts.csswg.org/css-display-3/issues-wd-2017">Disposition of Comments</a> is also available.

‎css-flexbox-1/Overview.bs

+1-2
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,7 @@ Flex Items</h2>
638638
Its contents will however inherit styles (such as font settings) from the flex container.
639639
</div>
640640

641-
A <a>flex item</a> establishes a new formatting context for its contents.
642-
The type of this formatting context is determined by its 'display' value, as usual.
641+
A <a>flex item</a> [=establishes an independent formatting context=] for its contents.
643642
However, flex items themselves are <dfn>flex-level</dfn> boxes, not block-level boxes:
644643
they participate in their container's flex formatting context,
645644
not in a block formatting context.

‎css-grid-1/Overview.bs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1034,8 +1034,8 @@ Grid Items</h2>
10341034

10351035
<h3 id="grid-item-display">
10361036
Grid Item Display</h3>
1037-
A <a>grid item</a> establishes a new formatting context for its contents.
1038-
The type of this formatting context is determined by its 'display' value, as usual.
1037+
1038+
A <a>grid item</a> [=establishes an independent formatting context=] for its contents.
10391039
However, grid items are <dfn>grid-level</dfn> boxes, not block-level boxes:
10401040
they participate in their container's <a>grid formatting context</a>,
10411041
not in a block formatting context.

‎css-inline-3/Overview.bs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ Short paragraphs with initial letters</h4>
11071107
</figure>
11081108

11091109
If the subsequent block starts with an initial letter,
1110-
establishes a new formatting context,
1110+
establishes an [=independent formatting context=],
11111111
or specifies 'clear' in the initial letter’s containing block’s start direction,
11121112
then it must clear the previous block’s initial letter.
11131113

‎css-multicol-1/Overview.bs

+2-2
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,8 @@ Spanning columns</h2>
778778
ancestor in the same block formatting context.
779779
Content in the normal flow that appears before the
780780
element is automatically balanced across all columns in the immediately preceding column row before the
781-
element appears.
782-
The element establishes a new <a>formatting context</a>.
781+
element appears.
782+
The element [=establishes an independent formatting context=].
783783

784784
Note: Whether the element establishes a new <a>formatting context</a>
785785
does not depend on whether the element is a descendent of a multicol or not.

‎css-overflow-3/Overview.bs

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ Scrolling and Clipping Overflow: the 'overflow-x', 'overflow-y', and 'overflow'
385385

386386
If the computed value of 'overflow' on a <a>block box</a>
387387
is neither ''overflow/visible'' nor ''overflow/clip'' nor a combination thereof,
388-
it creates a new <a>block formatting context</a> for its content.
388+
it [=establishes an independent formatting context=] for its contents.
389389

390390

391391
<h3 id="static-media">

‎css-rhythm-1/Overview.bs

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Specifying the Step Size: the 'block-step-size' property {#block-step-size}
181181
Negative <<length>> values are invalid.
182182

183183
Values other than ''block-step-size/none''
184-
cause the box to establish a new formatting context.
184+
cause the box to [=establish an independent formatting context=].
185185

186186
In situations where margins <a href="https://www.w3.org/TR/CSS2/box.html#collapsing-margins">collapse</a>,
187187
only the box’s own margin is considered

0 commit comments

Comments
 (0)