Skip to content

Commit dd4fa98

Browse files
committed
[css-overflow-4] Draft spec for continue: collapse (#7708)
1 parent fb926e0 commit dd4fa98

File tree

1 file changed

+93
-30
lines changed

1 file changed

+93
-30
lines changed

css-overflow-4/Overview.bs

Lines changed: 93 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,15 @@ Indicating Block-Axis Overflow: the 'block-ellipsis' property</h3>
707707
</pre>
708708

709709
This property allows inserting content into the last line box
710-
before a (forced <em>or</em> unforced) <a>region break</a>
711-
to indicate the continuity of truncated/interrupted content.
710+
before a (forced <em>or</em> unforced) <a>region break</a> or a [=clamp point=]
711+
to indicate the continuity of truncated / interrupted content.
712712
It only affects line boxes contained directly by the <a>block container</a> itself,
713713
but as it inherits, will have an effect on descendants’ line boxes unless overridden.
714-
If the box contains no line box immediately preceding a <a>region break</a>,
715-
then this property has no effect.
714+
715+
This property only affects a line box if there is eiher a [=region break=] or a [=clamp point=]
716+
after it in the [=block formatting context=], and there are no boxes or line boxes in between.
717+
If the [=clamp point=] is placed at the end of the [=line-clamp container=], then the line will
718+
not be affected.
716719

717720
Note: See [[css-overflow-4#fragmentation]] for a way to generate boxes with such a [=region break=].
718721

@@ -777,10 +780,12 @@ Indicating Block-Axis Overflow: the 'block-ellipsis' property</h3>
777780
The [=block overflow ellipsis=] must not be included
778781
in either the ''::first-letter'' nor the ''::first-line'' pseudo-elements.
779782

780-
If there is a subsequent <a>fragmentation container</a> in the [=fragmentation context=]
783+
If the [=block overflow ellipsis=] is placed before a [=region break=] and
784+
there is a subsequent <a>fragmentation container</a> in the [=fragmentation context=]
781785
that would receive subsequent content,
782786
then the content displaced by the <a>block overflow ellipsis</a>
783-
must be pushed to that <a>fragmentation container</a>.
787+
must be pushed to that <a>fragmentation container</a>. If it is placed before a [=clamp point=],
788+
then the displaced content must be pushed to the remainder of the [=inline formatting context=].
784789

785790
The UA must treat the <a>block overflow ellipsis</a> as an unbreakable string,
786791
If any part of the [=block overflow ellipsis=] overflows,
@@ -844,7 +849,7 @@ Limiting Visible Lines: the 'line-clamp' shorthand property</h3>
844849
<dt><dfn><<integer [1,∞]>></dfn>
845850
</dt><dfn><'block-ellipsis'></dfn>
846851
<dd>
847-
Sets 'continue' to ''discard''
852+
Sets 'continue' to ''collapse''
848853
if either or both values ares specified.
849854

850855
Sets 'max-lines' to the specified <<integer>>
@@ -901,7 +906,7 @@ Legacy compatibility</h4>
901906

902907
For compatibility with legacy content,
903908
UAs that support 'line-clamp' must also support the '-webkit-line-clamp' property
904-
and the additional ''-webkit-discard'' value for the 'continue' property.
909+
and the additional ''-webkit-collapse'' value for the 'continue' property.
905910

906911
<pre class="propdef shorthand">
907912
Name: -webkit-line-clamp
@@ -912,17 +917,17 @@ Legacy compatibility</h4>
912917

913918
<pre class="propdef partial">
914919
Name: continue
915-
New Values: -webkit-discard
920+
New Values: -webkit-collapse
916921
</pre>
917922

918923
Like 'line-clamp', '-webkit-line-clamp' is a shorthand of 'max-lines', 'continue', and 'block-ellipsis',
919924
except that:
920925

921926
* its syntax is ''line-clamp/none'' | <<integer [1,∞]>>
922-
* it sets 'continue' to ''-webkit-discard'' instead of ''discard''
927+
* it sets 'continue' to ''-webkit-collapse'' instead of ''collapse''
923928
* it unconditionally sets 'block-ellipsis' to ''block-ellipsis/auto''
924929

925-
The <dfn value for=continue>-webkit-discard</dfn> value behaves identically to ''discard'',
930+
The <dfn value for=continue>-webkit-collapse</dfn> value behaves identically to ''collapse'',
926931
except that it only takes effect
927932
if the [=specified value=] of the 'display' property
928933
is ''-webkit-box'' or ''-webkit-inline-box''
@@ -947,28 +952,33 @@ Forcing a Break After a Set Number of Lines: the 'max-lines' property</h3>
947952
Name: max-lines
948953
Value: ''none'' | <<integer [1,∞]>>
949954
Initial: ''none''
950-
Applies to: <a>block containers</a> which are also [=fragmentation containers=] that capture [=region breaks=]
955+
Applies to: <a>block containers</a> which are also either [=fragmentation containers=] that capture [=region breaks=] or [=line-clamp containers=]
951956
Inherited: no
952957
Percentages: N/A
953958
Computed value: the keyword ''max-lines/none'' or an integer
954959
Animation type: by computed value type
955960
</pre>
956961

957-
This property only has an effect on boxes that are [=fragmentation containers=] that capture [=region breaks=].
962+
If the value of 'max-lines' is not <dfn for=max-lines dfn-type=value>none</dfn>, then, where
963+
<var>N</var> is the computed value of 'max-lines':
964+
965+
- If the box is a [=fragmentation container=] that captures [=region breaks=],
966+
a <a>region break</a> or
967+
is forced after its <var>N</var>th
968+
descendant <a>in-flow</a> <a>line box</a>.
969+
If fewer than <var>N</var> line boxes exist,
970+
then 'max-lines' introduces no <a>region break</a>.
971+
- If the box is a [=line-clamp container=], its [=clamp point=] is set after its <var>N</var>th
972+
descendant <a>in-flow</a> <a>line box</a>.
973+
If fewer than <var>N</var> line boxes exist, then the clamp point is set to the end of the
974+
line-clamp container.
958975

959-
Also, if the value of 'max-lines' is not <dfn for=max-lines dfn-type=value>none</dfn>,
960-
a <a>region break</a>
961-
is forced after its <var>N</var>th
962-
descendant <a>in-flow</a> <a>line box</a>,
963-
where <var>N</var> is the specified value of 'max-lines'.
964-
Only lines boxes in the same <a>Block Formatting Context</a>
976+
977+
Only line boxes in the same <a>Block Formatting Context</a>
965978
are counted:
966979
the contents of descendants that establish <a>independent formatting contexts</a>
967980
are skipped over while counting line boxes.
968981

969-
If fewer than <var>N</var> line boxes exist,
970-
then 'max-lines' introduces no <a>region break</a>.
971-
972982
Note: This implies that 'max-lines' has no effect when applied to [=multi-column containers=],
973983
since any line box they contain are nested into [=independent formatting contexts=].
974984

@@ -1004,7 +1014,7 @@ Fragmentation of Overflow: the 'continue' property</h3>
10041014

10051015
<pre class=propdef>
10061016
Name: continue
1007-
Value: auto | discard
1017+
Value: auto | discard | collapse
10081018
Initial: ''continue/auto''
10091019
Applies to: [=block containers=] and [=multicol containers=]
10101020
Inherited: no
@@ -1014,10 +1024,11 @@ Fragmentation of Overflow: the 'continue' property</h3>
10141024
</pre>
10151025

10161026
The 'continue' property gives authors the ability
1017-
to turn a box into a [=fragmentation container=] (see [[!CSS-BREAK-3]])
1018-
and to specify that content after the [=fragmentation break=] must be discarded.
1027+
to truncate/interrupt the content inside a box, by either visually hiding
1028+
the remaining content, or by turning the box into a [=fragmentation container=] (see [[!CSS-BREAK-3]])
1029+
and discarding the content after the [=fragmentation break=].
10191030

1020-
Issue: This property is meant to generalize and replace the <code>region-fragment</code> property from [[CSS-REGIONS-1]].
1031+
Issue: ''continue: discard'' is meant to generalize and replace the <code>region-fragment</code> property from [[CSS-REGIONS-1]].
10211032
Once it is sufficiently stable in this specification,
10221033
<code>region-fragment</code> should be removed from the regions specification in favor of this.
10231034

@@ -1048,6 +1059,15 @@ Fragmentation of Overflow: the 'continue' property</h3>
10481059
Breaks applying to other [=fragmentation contexts=]
10491060
(such as pagination of this box itself)
10501061
do not cause any content to be discarded.
1062+
1063+
<dt><dfn>collapse</dfn>
1064+
<dd>
1065+
If the box is a [=block container=], then it must
1066+
[=establish an independent formatting context=] that also becomes a [=line-clamp container=].
1067+
This causes all content after the [=clamp point=] to be visually hidden, and to not be
1068+
taken into account for the box's [=automatic block size=].
1069+
1070+
This keyword has no effect on [=multicol containers=].
10511071
</dl>
10521072

10531073
<div class=example>
@@ -1115,6 +1135,9 @@ Fragmentation of Overflow: the 'continue' property</h3>
11151135
would cause intrinsic sizes to depend on layout, which would cause circularities.
11161136
-->
11171137

1138+
Note: This differs from the ''visibility: hidden''-like behavior of content after the [=clamp
1139+
point=] with ''continue: collapse''.
1140+
11181141
Note: In the case of <a href="https://www.w3.org/TR/css-break-3/#parallel-flows">parallel fragmentation flows</a>,
11191142
content occurring after the <a>fragmentation break</a> in the box tree
11201143
could still be rendered,
@@ -1123,13 +1146,13 @@ Fragmentation of Overflow: the 'continue' property</h3>
11231146

11241147
Additionaliy,
11251148
for compatibility (see [[#webkit-line-clamp]]),
1126-
when the [=computed value=] of the 'continue' property is ''discard''
1149+
when the [=computed value=] of the 'continue' property is ''collapse'' or ''-webkit-collapse''
11271150
and the [=computed value=] of the '-webkit-box-orient' property is ''vertical'':
11281151
* If the [=specified value=] of the 'display' property is ''-webkit-box'',
1129-
the [=computed value=] is becomes ''flow-root'' and
1152+
the [=computed value=] becomes ''flow-root'' and
11301153
the box establishes a [=BFC=].
1131-
* If the [=specified value=] of the 'display property is ''-webkit-inline-box'',
1132-
the [=computed value=] is becomes ''inline-block'' and
1154+
* If the [=specified value=] of the 'display' property is ''-webkit-inline-box'',
1155+
the [=computed value=] becomes ''inline-block'' and
11331156
the box establishes a [=BFC=].
11341157

11351158
Note: This means that 'line-clamp' will work
@@ -1140,6 +1163,46 @@ Fragmentation of Overflow: the 'continue' property</h3>
11401163
as the box would be a [=flex container=] rather than a [=block container=],
11411164
and thus the 'continue' property would not apply.
11421165

1166+
<h4 id=line-clamp-containers>Line-clamp containers</h4>
1167+
1168+
A <dfn>line-clamp container</dfn> is an [=independent formatting context|independent=] [=block formatting context=] that
1169+
additionally follows the rules in this section. All line-clamp containers contain a
1170+
<dfn>clamp point</dfn>, which is one of the following positions inside it:
1171+
1172+
- The start of the line-clamp container.
1173+
- A point between two [=in-flow=] sibling boxes in the line-clamp
1174+
container's [=block formatting context=].
1175+
- A point between two [=line boxes=] in an in-flow [=inline formatting
1176+
context=] inside the line-clamp container's [=block formatting context=].
1177+
- The end of the line-clamp container.
1178+
1179+
Note: The [=clamp point=] can never be before a parent box's first child, or
1180+
after a parent box's last child, unless that parent box is the line-clamp
1181+
container. Similarly, the clamp point can never be before the first line or
1182+
after the first line of an [=inline formatting context=]. It can also never
1183+
be in [=out-of-flow=] content, or inside an [=independent formatting
1184+
context=].
1185+
1186+
If the [=line-clamp container=]'s [=block formatting context root=] has a [=computed value=] of
1187+
'max-lines' other than ''max-lines/none'', then that property will determine the [=clamp point=].
1188+
Otherwise, the clamp point will be set to the last possible clamp point such that, for it and
1189+
all previous possible clamp points, the line-clamp container's [=automatic block size=] (as
1190+
determined below) is not greater than the [=block size=] the box would have if its automatic
1191+
block size were infinite.
1192+
1193+
Any boxes in a [=line-clamp container=] that follow its [=clamp point=] in the box tree, as well
1194+
as any [=line boxes=] that follow it inside an [=inline formatting context=], will be invisible
1195+
(behaving like ''visibility: hidden''). This includes [=independent formatting contexts=] as
1196+
well as [=out-of-flow=] boxes, and all of their descendants. Any overflow such boxes and line
1197+
boxes might have is always counted as [=ink overflow=] rather than [=scrollable overflow=].
1198+
1199+
NOTE: This differs from the ''display: none''-like behavior of not rendered content with
1200+
''continue: discard''.
1201+
1202+
If a [=block container=] contains a [=clamp point=], within itself or in any of its descendants,
1203+
its [=automatic block size=] will not take into account any of its children after the clamp point.
1204+
This also applies for the [=line-clamp container=] itself.
1205+
11431206
<h2 id=sbg-ext class=nonum>
11441207
Appendix A: Possible extensions for ''scrollbar-gutter''</h2>
11451208

0 commit comments

Comments
 (0)