Skip to content

Commit 98417a7

Browse files
committed
[css-overflow-3] Initial proposal for handling block ellipsis.
1 parent 631e449 commit 98417a7

File tree

1 file changed

+149
-0
lines changed

1 file changed

+149
-0
lines changed

css-overflow-3/Overview.bs

+149
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,155 @@ Limiting Visible Lines: the 'max-lines' property</h2>
534534
introduced by the 'max-lines' property.
535535

536536

537+
<h2 id="block-ellipsis">
538+
Indicating Block-Axis Overflow: the 'block-overflow' property</h2>
539+
540+
ISSUE: This section is an unofficial draft, posted here for discussion.
541+
See <a href="https://github.com/w3c/csswg-drafts/issues/390">issue</a>.
542+
543+
<pre class=propdef>
544+
Name: block-overflow
545+
Value: clip | ellipsis | <<string>>
546+
Initial: clip
547+
Applies to: <a>block containers</a>
548+
Inherited: yes
549+
Animatable: no
550+
Percentages: N/A
551+
Media: visual
552+
Computed value: specified value
553+
</pre>
554+
555+
This property allows inserting content into the last line box
556+
before a (forced <em>or</em> unforced) <a>region break</a>
557+
to indicate the continuity of truncated/interrupted content.
558+
It only affects line boxes contained directly by the <a>block container</a> itself,
559+
but as it inherits, will have an effect on descendants’ line boxes unless overridden.
560+
If the box contains no line box immediately preceding a <a>region break</a>,
561+
then this property has no effect.
562+
563+
ISSUE: Should this apply to other types of fragmentation breaks (e.g. pages, columns)?
564+
565+
The inserted content is called the <dfn>block overflow ellipsis</dfn>.
566+
Values have the following meanings:
567+
568+
<dl dfn-for="block-overflow" dfn-type=value>
569+
<dt><dfn>clip</dfn>
570+
<dd>
571+
The content is not altered.
572+
573+
<dt><dfn>ellipsis</dfn>
574+
<dd>
575+
Render an ellipsis character (U+2026)--
576+
or a more typographically-appropriate equivalent--
577+
as the <a>block overflow ellipsis</a>
578+
at the end of the affected line box.
579+
UAs should use the conventions of the
580+
<a>content language</a>,
581+
writing system, and
582+
<a>writing mode</a>
583+
to determine the most appropriate ellipsis string.
584+
585+
<dt><dfn><<string>></dfn>
586+
<dd>
587+
Render the specified string
588+
as the <a>block overflow ellipsis</a>
589+
at the end of the affected line box.
590+
The UA may truncate this string if it is absurdly long.
591+
</dl>
592+
593+
<div class="example">
594+
In this example, the lead paragraph of each article
595+
is listed in a shortened menu,
596+
truncated to fit within 10 lines
597+
that end with “… (continued on next page)”:
598+
599+
<xmp highlight=css>
600+
li {
601+
max-lines: 5;
602+
block-overflow: ellipsis;
603+
block-ellipsis: "… (continued on next page)";
604+
}
605+
strong {
606+
display: block;
607+
text-transform: uppercase;
608+
}
609+
</xmp>
610+
611+
<xmp highlight=markup>
612+
<li><a href="cheese-is-milk">
613+
<strong>Cheese is Actually Made of Milk!</strong>
614+
Investigative reporters at the World Wide Web Press Corps
615+
have discovered the secret of cheese.
616+
Tracing through byzantine layers of bureacracy and shadow corporations,
617+
our crack team of journalists have traced the source of camembert.
618+
</a></li>
619+
</xmp>
620+
621+
Sample rendering:
622+
623+
<pre class="figure">
624+
+---------------------------------------+
625+
| CHEESE IS ACTUALLY MADE OF MILK! |
626+
| Investigative reporters at the World |
627+
| Wide Web Press Corps have discovered |
628+
| the secret of cheese. Tracing through |
629+
| byzantine… (continued on next page) |
630+
+---------------------------------------+
631+
</pre>
632+
</div>
633+
634+
When 'block-overflow' is not ''block-overflow/clip'',
635+
the <a>block overflow ellipsis</a>
636+
is wrapped in an anonymous inline
637+
and placed at the end of the line box
638+
as a direct child of its containing block,
639+
effectively shortening the line box
640+
from the perspective of the remaining contents of the line.
641+
This inline is assigned ''unicode-bidi: plaintext''
642+
and is placed in the line box after the last
643+
<a>soft wrap opportunity</a> [[!CSS-TEXT-3]]
644+
that would still allow the entire <a>block overflow ellipsis</a> to fit on the line.
645+
(This can result in the entire contents of the line box being replaced.)
646+
For this purpose, <a>soft wrap opportunities</a> added by 'overflow-wrap' are ignored.
647+
Text <a href="https://www.w3.org/TR/css-text-3/#justification">alignment and justification</a>
648+
occurs after placement,
649+
and measures the inserted <a>block overflow ellipsis</a>
650+
together with the rest of the line’s content.
651+
652+
If there is no next <a>fragmentation container</a>
653+
and thus the remainder of the content after the break would be discarded,
654+
then the UA may visually replace the contents of the line,
655+
as it does for 'text-overflow'.
656+
If, however, there is a next <a>fragmentation container</a>
657+
that would receive subsequent content,
658+
then the content replaced by the <a>block overflow ellipsis</a>
659+
must be pushed to the next <a>fragmentation container</a>
660+
and the <a>block overflow ellipsis</a> inserted and laid out
661+
exactly as if it were part of the <a>in-flow</a> contents of the line.
662+
This can result in changes to layout within or impacted by the line.
663+
The means of breaking any resulting cycles is up to the UA.
664+
665+
If the <a>block overflow ellipsis</a>
666+
is too long to fit in the line,
667+
the result is undefined.
668+
(The UA may, for example, treat the <a>block overflow ellipsis</a> as an unbreakable string,
669+
or it may lay out the string across more than one line,
670+
replacing content in earlier lines as well.)
671+
672+
The <a>block overflow ellipsis</a> does not capture events:
673+
pointer events are dispatched to whatever is underneath
674+
or otherwise visually replaced by it.
675+
676+
It also has no effect on the intrinsic size of the box:
677+
its <a lt="min-content size">min-content</a> and <a lt="max-content size">max-content</a> sizes
678+
are calculated exactly as if 'block-overflow' were ''block-overflow/clip''.
679+
680+
Note: Future specifications may extend this feature,
681+
for example by providing an ''::ellipsis'' pseudo-element
682+
to style the text,
683+
or by allowing the selection of a child element of the block
684+
to use as either an inline-level or block-level indicator
685+
(in which case, it can capture events).
537686

538687
Privacy and Security Considerations {#priv-sec}
539688
===============================================

0 commit comments

Comments
 (0)