css-overflow/Overview.bs

Wed, 11 Feb 2015 16:55:25 +1100

author
L. David Baron <[email protected]>
date
Wed, 11 Feb 2015 16:55:25 +1100
changeset 15207
ea07ee919097
parent 15181
9174c05261f3
child 15277
ec3666d1e63d
permissions
-rw-r--r--

[css-overflow] Add Florian Rivoal as coeditor.

Resolved in http://www.w3.org/2015/02/08-css-irc#T06-47-28 .

     1 <h1>CSS Overflow Module Level 3</h1>
     2 <pre class="metadata">
     3 Status: ED
     4 ED: http://dev.w3.org/csswg/css-overflow/
     5 Shortname: css-overflow
     6 Group: csswg
     7 Level: 1
     8 TR: http://www.w3.org/TR/css-overflow-3/
     9 Previous version: http://www.w3.org/TR/2013/WD-css-overflow-3-20130418/
    10 Editor: L. David Baron, Mozilla, http://dbaron.org/
    11 Editor: Florian Rivoal, Invited Expert, [email protected]
    12 Abstract: This module contains the features of CSS relating to new mechanisms of overflow handling in visual media (e.g., screen or paper).  In interactive media, it describes features that allow the overflow from a fixed size container to be handled by pagination (displaying one page at a time).  It also describes features, applying to all visual media, that allow the contents of an element to be spread across multiple fragments, allowing the contents to flow across multiple regions or to have different styles for different fragments.
    13 Status Text: The following features are at risk: &hellip;
    14 !Change Log: <a href="https://hg.csswg.org/drafts/log/tip/css-overflow/Overview.bs">from 27 January 2015 to the present</a>
    15 !Change Log: <a href="https://hg.csswg.org/drafts/log/tip/css-overflow/Overview.src.html">from 28 March 2013 to 27 January 2015</a>
    16 !Change Log: <a href="https://hg.csswg.org/drafts/log/tip/css3-overflow/Overview.src.html">from 31 July 2012 to 27 March 2013</a>
    17 </pre>
    18 <!-- FIXME: Regressions from bikeshed conversion: -->
    19 <!-- - Value lines in propdef tables no longer link to #values. -->
    20 <!-- - no longer says "Test suite: none yet" -->
    21 <!-- - Abstract has the most introductory sentence last -->
    22 <!-- FIXME: other bikeshed issues -->
    23 <!-- <integer> in max-lines value line should link to the dfn below, not to css-values -->
    24 <pre class="link-defaults">
    25 spec:css-transforms-1; type:property; text:transform-style
    26 </pre>
    27 <!-- FIXME: the break-* link doesn't actually work! -->
    28 <pre class="anchors">
    29 url: http://www.w3.org/TR/2008/CR-css3-marquee-20081205/#the-overflow-style; type: property; text: overflow-style;
    30 url: http://dev.w3.org/csswg/css-break/#breaking-controls; type: property; text: break-*;
    31 url: http://dev.w3.org/csswg/css-multicol/#overflow-columns; type: dfn; text: overflow columns;
    32 url: http://dev.w3.org/csswg/selectors-3/#subject; type: dfn; text: subject;
    33 </pre>
    34 	<style>
    35 		table.source-demo-pair {
    36 			width: 100%;
    37 		}
    39 		.in-cards-demo {
    40 			width: 13em;
    41 			height: 8em;
    43 			padding: 4px;
    44 			border: medium solid blue;
    45 			margin: 6px;
    47 			font: medium/1.3 Times New Roman, Times, serif;
    48 			white-space: nowrap;
    49 		}
    51 		.bouncy-columns-demo {
    52 			width: 6em;
    53 			height: 10em;
    54 			float: left;
    55 			margin: 1em;
    56 			font: medium/1.25 Times New Roman, Times, serif;
    57 			white-space: nowrap;
    58 		}
    59 		.bouncy-columns-demo.one {
    60 			background: aqua; color: black;
    61 			transform: rotate(-3deg);
    62 		}
    63 		.bouncy-columns-demo.two {
    64 			background: yellow; color: black;
    65 			transform: rotate(3deg);
    66 		}
    68 		.article-font-inherit-demo {
    69 			font: 1em/1.25 Times New Roman, Times, serif;
    70 			white-space: nowrap;
    71 		}
    72 		.article-font-inherit-demo.one {
    73 			width: 12em;
    74 			font-size: 1.5em;
    75 			margin-bottom: 1em;
    76 			height: 4em;
    77 		}
    78 		.article-font-inherit-demo.two {
    79 			width: 11em;
    80 			margin-left: 5em;
    81 			margin-right: 2em;
    82 		}
    84 		.dark-columns-demo {
    85 			width: 6em;
    86 			height: 10em;
    87 			float: left;
    88 			margin-right: 1em;
    89 			font: medium/1.25 Times New Roman, Times, serif;
    90 			white-space: nowrap;
    91 		}
    92 		.dark-columns-demo.one {
    93 			background: aqua; color: black;
    94 		}
    95 		.dark-columns-demo.one :link {
    96 			color: blue;
    97 		}
    98 		.dark-columns-demo.one :visited {
    99 			color: purple;
   100 		}
   101 		.dark-columns-demo.two {
   102 			background: navy; color: white;
   103 		}
   104 		.dark-columns-demo.two :link {
   105 			color: aqua;
   106 		}
   107 		.dark-columns-demo.two :visited {
   108 			color: fuchsia;
   109 		}
   111 		.article-max-lines-demo {
   112 			font: 1em/1.25 Times New Roman, Times, serif;
   113 			white-space: nowrap;
   114 		}
   115 		.article-max-lines-demo.one::first-letter {
   116 			font-size: 2em;
   117 			line-height: 0.9;
   118 		}
   119 		.article-max-lines-demo.one {
   120 			font-size: 1.5em;
   121 			width: 16em;
   122 		}
   123 		.article-max-lines-demo.two {
   124 			width: 11.5em;
   125 			float: left; margin-right: 1em;
   126 		}
   127 		.article-max-lines-demo.three {
   128 			width: 11.5em;
   129 			float: left;
   130 		}
   131 	</style>
   133 	<p>
   134 	</p>
   136 <h2 id="intro">
   137 Introduction</h2>
   139 	<p>
   140 		In CSS Level 1 [[CSS1]], placing more content than would fit
   141 		inside an element with a specified size
   142 		was generally an authoring error.
   143 		Doing so caused the content to extend
   144 		outside the bounds of the element,
   145 		which would likely cause
   146 		that content to overlap with other elements.
   147 	</p>
   149 	<p>
   150 		CSS Level 2 [[CSS21]] introduced the 'overflow' property,
   151 		which allows authors to have overflow be handled by scrolling,
   152 		which means it is no longer an authoring error.
   153 		It also allows authors to specify
   154 		that overflow is handled by clipping,
   155 		which makes sense when the author's intent
   156 		is that the content not be shown.
   157 	</p>
   159 	<p>
   160 		However, scrolling is not the only way
   161 		to present large amounts of content,
   162 		and may even not be the optimal way.
   163 		After all, the codex replaced the scroll
   164 		as the common format for large written works
   165 		because of its advantages.
   166 	</p>
   168 	<p>
   169 		This specification introduces
   170 		a mechanism for Web pages to specify
   171 		that an element of a page should handle overflow
   172 		through pagination rather than through scrolling.
   173 	</p>
   175 	<p>
   176 		This specification also extends the concept of overflow
   177 		in another direction.
   178 		Instead of requiring that authors specify a single area
   179 		into which the content of an element must flow,
   180 		this specification allows authors to specify multiple fragments,
   181 		each with their own dimensions and styles,
   182 		so that the content of the element can flow from one to the next,
   183 		using as many as needed to place the content without overflowing.
   184 	</p>
   186 	<p>
   187 		In both of these cases, implementations must
   188 		break the content in the block-progression dimension.
   189 		Implementations must do this is described
   190 		in the CSS Fragmentation Module [[!CSS3-BREAK]].
   191 	</p>
   193 <h2 id="overflow-concepts">Types of overflow</h2>
   195 	<p>
   196 		CSS uses the term <dfn>overflow</dfn> to describe
   197 		the contents of a box
   198 		that extend outside that one of that box's edges
   199 		(i.e., its <i>content edge</i>, <i>padding edge</i>,
   200 		<i>border edge</i>, or <i>margin edge</i>).
   201 		The overflow might be described as the elements or features
   202 		that cause this overflow,
   203 		the non-rectangular region occupied by these features,
   204 		or, more commonly,
   205 		as the minimal rectangle that bounds that region.
   206 		A box's overflow is computed based on the boxes and styles
   207 		of the box and of all its descendants whose containing block chain
   208 		<span class="issue">undefined term?</span>
   209 		includes the box.
   210 	</p>
   212 	<p>
   213 		In most cases, any of these types of overflow
   214 		can be computed for any box
   215 		from the bounds and properties of that box,
   216 		and from the overflow (of that type)
   217 		of each of its children.
   218 		However, this is not always the case; for example,
   219 		when ''transform-style: preserve-3d'' [[CSS3-TRANSFORMS]] is used on
   220 		some of the children, their descendants with
   221 		''transform-style: preserve-3d'' must also be examined.
   222 	</p>
   224 <h3 id="ink-overflow">Ink overflow</h3>
   226 	<p>
   227 		The <dfn id="ink-overflow0">ink overflow</dfn> of a box
   228 		is the part of that box and its contents that
   229 		creates a visual effect outside of
   230 		the box's border box.
   231 	</p>
   233 	<p>
   234 		Since some effects in CSS (for example, the blurs in
   235 		'text-shadow' [[CSS3TEXT]] and 'box-shadow' [[CSS3BG]])
   236 		do not define what visual extent they cover, the extent
   237 		of the <a>ink overflow</a> is undefined.
   238 	</p>
   240 	<p class="issue">
   241 		Should we try to define it at all and just leave pieces undefined?
   242 	</p>
   244 	<p>
   245 		The <dfn>ink overflow region</dfn> is the non-rectangular region
   246 		occupied by the <a>ink overflow</a>, and the
   247 		<dfn>ink overflow rectangle</dfn> is
   248 		the minimal rectangle whose axis is aligned to the box's axes
   249 		and contains the <a>ink overflow region</a>.
   250 		Note that the <a>ink overflow rectangle</a> is a rectangle
   251 		in the box's coordinate system, but might be non-rectangular
   252 		in other coordinate systems due to transforms [[CSS3-TRANSFORMS]].
   253 	</p>
   255 <h3 id="scrollable-overflow">Scrollable overflow</h3>
   257 	<p>
   258 		The <dfn id="scrollable-overflow0">scrollable overflow</dfn> of a box is the
   259 		set of things extending outside of that box's padding edge
   260 		for which a scrolling mechanism needs to be provided.
   261 	</p>
   263 	<p class="issue">
   264 		The following definition should be rewritten to use
   265 		the concept of <a href="http://dev.w3.org/csswg/css-transforms/#3d-rendering-context">3D rendering context</a> [[!CSS3-TRANSFORMS]]
   266 		and related terms,
   267 		particularly once those concepts stabilize following changes
   268 		proposed in the CSS WG meeting on the morning of 2014-01-28.
   269 	</p>
   271 	<p>
   272 		Given the following definitions
   273 		<span class="issue">which belong in [[CSS3-TRANSFORMS]]</span>:
   274 	</p>
   276 	<dl>
   277 		<dt><dfn>3d-preserving child</dfn></dt>
   278 		<dd>
   279 			A child box B of a containing block C is a 3d-preserving
   280 			child if it has ''transform-style: preserve-3d''
   281 			and the user-agent is not required to flatten it
   282 			based on the <a href="http://www.w3.org/TR/css3-transforms/#transform-style-property">requirements</a> in [[!CSS3-TRANSFORMS]].
   283 		</dt>
   284 		<dt><dfn>non-3d-preserving child</dfn></dt>
   285 		<dd>
   286 			A child C of a box P is a non-3d-preserving-child if
   287 			it is not a <a>3d-preserving child</a>.
   288 		</dd>
   289 		<dt><dfn>3d-preserving descendant</dfn></dt>
   290 		<dd>
   291 			Box D is a 3d-preserving descendant of box A if A is
   292 			an ancestor of D, and D and all of the boxes (if any)
   293 			in the containing block chain from D to A
   294 			are <a>3d-preserving child</a> boxes.
   295 		</dd>
   296 	</dl>
   298 	<p>The scrollable overflow of a box is the union of the following things,
   299 	all adjusted for transforms <span class="issue">undefined concept!</span> into the box's coordinate space:</p>
   301 	<ul>
   302 		<li>
   303 			for the box and all of its <a>3d-preserving descendant</a> boxes:
   304 			<ul>
   305 				<li>the box's own padding edge (for the box itself) or border edge (for <a>3d-preserving descendant</a> boxes)</li>
   306 				<li>the bounds <span class="issue">undefined term!</span> of any text directly in the box</li>
   307 				<li><span class="issue">MORE HERE!</span>
   308 			</ul>
   309 		<li>
   310 			for all the <a>non-3d-preserving child</a> boxes of the
   311 			box and its <a>3d-preserving descendant</a> boxes,
   312 			the scrollable overflow of the box
   313 		</li>
   314 	</ul>
   316 	<p class="issue">
   317 		I wrote this definition off the top of my head,
   318 		so it can't possibly be right.
   319 		It's missing tons of pieces!
   320 	</p>
   322 	<p class="issue">
   323 		The handling of preserve-3d subtrees here is probably wrong;
   324 		the elements should probably count
   325 		only towards the overflow of the element that flattens them.
   326 	</p>
   328 	<p>
   329 		The <dfn>scrollable overflow region</dfn> is the non-rectangular region
   330 		occupied by the <a>scrollable overflow</a>, and the
   331 		<dfn>scrollable overflow rectangle</dfn> is
   332 		the minimal rectangle whose axis is aligned to the box's axes
   333 		and contains the <a>scrollable overflow region</a>.
   334 		Note that the <a>scrollable overflow rectangle</a> is a rectangle
   335 		in the box's coordinate system, but might be non-rectangular
   336 		in other coordinate systems due to transforms [[CSS3-TRANSFORMS]].
   337 	</p>
   339 <h3 id="border-box-overflow">Border box overflow</h3>
   341 	<p class="issue">
   342 		This concept has been proposed for some uses, such as for
   343 		determining what the 'outline' property goes around, and
   344 		as the basis of a coordinate system for specifying clips and masks,
   345 		but it's not clear if it's needed.
   346 	</p>
   348 	<p>
   349 		The <dfn>border-box overflow</dfn> of a box is the
   350 		union of the box's border edge and the border edges of
   351 		the box's descendants.</p>
   352 	</p>
   354 	<p class="issue">
   355 		If needed, define more formally, as for scrollable overflow above.
   356 		(Maybe even share the definitions in an appropriate way!)
   357 	</p>
   359 	<p>
   360 		The <dfn>border-box overflow region</dfn> is the non-rectangular region
   361 		occupied by the <a>border-box overflow</a>, and the
   362 		<dfn>border-box overflow rectangle</dfn> is
   363 		the minimal rectangle whose axis is aligned to the box's axes
   364 		and contains the <a>border-box overflow region</a>.
   365 		Note that the <a>border-box overflow rectangle</a> is a rectangle
   366 		in the box's coordinate system, but might be non-rectangular
   367 		in other coordinate systems due to transforms [[CSS3-TRANSFORMS]].
   368 	</p>
   370 <h2 id="overflow-properties">Overflow properties</h2>
   372 	<p>
   373 		The 'overflow-x' property specifies
   374 		the handling of overflow in the horizontal direction
   375 		(i.e., overflow from the left and right sides of the box),
   376 		and the 'overflow-y' property specifies the handling
   377 		of overflow in the vertical direction
   378 		(i.e., overflow from the top and bottom sides of the box) 
   379 	</p>
   381 	<pre class=propdef>
   382 		Name: overflow-x, overflow-y
   383 		Value: ''visible'' | ''hidden'' | ''scroll'' | ''auto'' | ''paged-x'' | ''paged-y'' | ''paged-x-controls'' | ''paged-y-controls'' | ''fragments''
   384 		Initial: ''visible''
   385 		Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
   386 		Inherited: no
   387 		Percentages: N/A
   388 		Media: visual
   389 		Computed value: see below
   390 		Animatable: no
   391 		Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
   392 	</pre>
   394 	<p>
   395 		The 'overflow' property is a shorthand property
   396 		that sets the specified values of both 'overflow-x' and 'overflow-y'
   397 		to the value specified for 'overflow'.
   398 	</p>
   400 	<pre class=propdef>
   401 		Name: overflow
   402 		Value: ''visible'' | ''hidden'' | ''scroll'' | ''auto'' | ''paged-x'' | ''paged-y'' | ''paged-x-controls'' | ''paged-y-controls'' | ''fragments''
   403 		Initial: see individual properties
   404 		Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
   405 		Inherited: no
   406 		Percentages: N/A
   407 		Media: visual
   408 		Computed value: see individual properties
   409 		Animatable: no
   410 		Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
   411 	</pre>
   413 	<p>The values of these properties are:</p>
   415 	<dl dfn-for="overflow" dfn-type="value">
   416 		<dt><dfn>visible</dfn>
   417 		<dd>
   418 			There is no special handling of overflow, that is, it
   419 			may be rendered outside the block container.
   420 		</dd>
   421 		<dt><dfn>hidden</dfn>
   422 		<dt><dfn>scroll</dfn>
   423 		<dt><dfn>auto</dfn>
   424 		<dd>
   425 			These values are collectively the <dfn dfn>scrolling values</dfn>;
   426 			they are defined in the section on
   427 			<a href="#scrolling-overflow">scrolling and hidden overflow</a>.
   428 		</dd>
   429 		<dt><dfn>paged-x</dfn>
   430 		<dt><dfn>paged-y</dfn>
   431 		<dt><dfn>paged-x-controls</dfn>
   432 		<dt><dfn>paged-y-controls</dfn>
   433 		<dt><dfn>fragments</dfn>
   434 		<dd>
   435 			These values are collectively the <dfn dfn>fragmenting values</dfn>;
   436 			they are defined in the sections on
   437 			<a href="#paginated-overflow">paginated overflow</a> and
   438 			<a href="#fragment-overflow">fragment overflow</a>.
   439 		</dd>
   440 	</dl>
   442 	<div id="overflow-computed-values">
   443 		<p>The computed values of 'overflow-x' and 'overflow-y'
   444 		are determined from the cascaded values [[!CSS3CASCADE]]
   445 		based on the following rules:</p>
   447 		<ol>
   448 			<li>
   449 				If one or both of the cascaded values are
   450 				<a>fragmenting values</a>, then:
   451 				<ol>
   452 					<li>
   453 						If one of the cascaded values is one of the
   454 						<a>fragmenting values</a>
   455 						and the other is not,
   456 						then the computed values are
   457 						the same as the cascaded values.
   458 					</li>
   459 					<li>
   460 						If both of the cascaded values are <a>fragmenting values</a>, then:
   461 						<ol>
   462 							<li>
   463 								for horizontal writing mode [[!CSS3-WRITING-MODES]],
   464 								the computed value for 'overflow-y' is the cascaded value
   465 								and the computed value for 'overflow-x' is ''overflow/hidden'', or
   466 							</li>
   467 							<li>
   468 								for vertical writing mode [[!CSS3-WRITING-MODES]],
   469 								the computed value for 'overflow-x' is the cascaded value
   470 								and the computed value for 'overflow-y' is ''overflow/hidden''.
   471 							</li>
   472 						</ol>
   473 					</li>
   474 				</ol>
   475 			</li>
   476 			<li>
   477 				Otherwise, if one cascaded values is
   478 				one of the <a>scrolling values</a>
   479 				and the other is ''overflow/visible'',
   480 				then computed values are the cascaded values
   481 				with ''overflow/visible'' changed to ''overflow/auto''.
   482 			</li>
   483 			<li>
   484 				Otherwise, the computed values are as specified.
   485 			</li>
   486 		</ol>
   487 	</div>
   489 	<p class="issue">
   490 		Are all 4 of the ''paged-*'' values really needed?
   491 	</p>
   493 	<p>
   494 		When the <a>fragmenting values</a> are used,
   495 		the overflow from the fragments themselves
   496 		treats the fragmenting value as ''overflow/hidden''.
   497 		<span class="issue">Is this the right behavior?</span>
   498 		<span class="issue">Give example.</span>
   499 	</p>
   501 	<p class="issue">
   502 		[[CSS3-MARQUEE]] describes an 'overflow-style' property,
   503 		but it has not picked up implementation experience
   504 		that the working group is aware of.
   505 		Should this document treat 'overflow-style' as a defunct proposal,
   506 		or should this document describe the 'overflow-style' property
   507 		and attempt to revive it,
   508 		despite that implementations have implemented
   509 		'overflow-x' and 'overflow-y' instead?
   510 	</p>
   512 	<p class="issue">
   513 		There are <a href="http://lists.w3.org/Archives/Public/www-style/2012May/1197.html">discussions</a>
   514 		about how overflow, overflow-style, overflow-x and overflow-y
   515 		should work and interact with each other.
   516 		Until consensus on this topic is reached,
   517 		it is not completely clear which of these
   518 		should be used for
   519 		paged-x | paged-y | paged-x-controls | paged-y-controls | fragments
   520 	</p>
   522 <h2 id="scrolling-overflow">Scrolling and hidden overflow</h2>
   524 	<p class="issue">
   525 		Move material from [[CSS21]] and [[CSS3BOX]] here.
   526 	</p>
   528 	<p class="issue">
   529 		Explain which directions allow scrolling and which don't,
   530 		as a function of 'direction'
   531 		(including propagation of 'direction' to the ICB).
   532 	</p>
   534 <h2 id="paginated-overflow">Paginated overflow</h2>
   536 <p class="issue">overflow:paginate or overflow:pages (or paged-x, paged-y, paged-x-controls, paged-y-controls as [[CSS3GCPM]] has?)</p>
   538 <p class="issue">Ability to display N pages at once
   539 rather than just one page at once?</p>
   541 	<p class="issue">
   542 		The current implementation of paginated overflow uses
   543 		the 'overflow'/'overflow-x'/'overflow-y' properties
   544 		rather than the 'overflow-style' property as proposed
   545 		in the [[CSS3GCPM]] draft
   546 		(which also matches the [[CSS3-MARQUEE]] proposal).
   547 		We should probably switch away from 'overflow-style',
   548 		but that's not 100% clear.
   549 	</p>
   551 <h2 id="fragment-overflow">Fragment overflow</h2>
   553 	<p>
   554 		This section introduces and defines the meaning of
   555 		the new ''fragments'' value of the 'overflow' property.
   556 	</p>
   558 	<p>
   559 		When the computed value of 'overflow' for an element is ''fragments'',
   560 		and implementations would otherwise have created a box for the element,
   561 		then implementations must create a sequence of <dfn>fragment box</dfn>es
   562 		for that element.
   563 		(It is possible for an element with ''overflow: fragments''
   564 		to generate only one <a>fragment box</a>.
   565 		However, if an element's computed 'overflow' is not ''fragments'',
   566 		then its box is not a <a>fragment box</a>.)
   567 		Every <a>fragment box</a> is a fragmentation container,
   568 		and any overflow
   569 		that would cause that fragmentation container to fragment
   570 		causes another <a>fragment box</a> created as a next sibling
   571 		of the previous one.
   572 		<span class="issue">Or is it as though it's a next sibling of
   573 		the element?  Need to figure out exactly how this interacts with
   574 		other box-level fixup.</span>
   575 		Additionally, if the <a>fragment box</a> is also
   576 		a multi-column box (as defined in [[!CSS3COL]]
   577 		<span class="issue">though it defines <i>multi-column element</i></span>)
   578 		any content that would lead to the creation of <a>overflow columns</a> [[!CSS3COL]]
   579 		instead is flown into an additional fragment box.
   580 		However, fragment boxes may themselves be broken
   581 		(due to fragmentation in a fragmentation context outside of them,
   582 		such as pages, columns, or other fragment boxes);
   583 		such breaking leads to fragments of the same fragment box
   584 		rather than multiple fragment boxes.
   585 		(This matters because fragment boxes may be styled by their index;
   586 		such breaking leads to multiple fragments of a fragment box
   587 		with a single index.
   588 		This design choice is so that
   589 		breaking a fragment box across pages does not break
   590 		the association of indices to particular pieces of content.)
   591 		<span class="issue">Should a forced break that breaks to
   592 		an outer fragmentation context cause a new fragment of a single
   593 		fragment box or a new fragment box?</span>
   594 		<span class="issue">Should we find a term other than
   595 		<a>fragment box</a> here to make this a little less confusing?</span>
   596 	</p>
   598 	<p class="issue">
   599 		What if we want to be able to style the pieces of an element
   600 		split within another type of fragmentation context?
   601 		These rules prevent ever using ''::nth-fragment()'' for that,
   602 		despite that the name seems the most logical name for such a feature.
   603 	</p>
   605 	<div class="example">
   606 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
   607 &lt;title&gt;Breaking content into
   608   equal-sized cards&lt;/title&gt;
   609 &lt;style&gt;
   610   .in-cards {
   611     overflow: fragments;
   613     width: 13em;
   614     height: 8em;
   616     padding: 4px;
   617     border: medium solid blue;
   618     margin: 6px;
   620     font: medium/1.3 Times New
   621       Roman, Times, serif;
   622   }
   623 &lt;/style&gt;
   624 &lt;div class="in-cards"&gt;
   625   In this example, the text in the div
   626   is broken into a series of cards.
   627   These cards all have the same style.
   628   The presence of enough content to
   629   overflow one of the cards causes
   630   another one to be created.  The second
   631   card is created just like it's the
   632   next sibling of the first.
   633 &lt;/div&gt;</pre></td><td>
   634 			<div class="in-cards-demo">In this example, the text in the<br>div is broken into a series of<br>cards.  These cards all have the<br>same style. The presence of<br>enough content to overflow<br>one of the cards causes another</div>
   635 			<div class="in-cards-demo">one to be created.  The second<br>card is created just like it's the<br>next sibling of the first.</div>
   636 		</td></tr></table>
   637 	</div>
   639 	<p class="issue">
   640 		We should specify that ''overflow: fragments'' does not apply
   641 		to at least some table parts,
   642 		and perhaps other elements as well.
   643 		We need to determine exactly which ones.
   644 	</p>
   646 	<p class="issue">
   647 		This specification needs to say which type of
   648 		fragmentation context is created
   649 		so that it's clear which values of the 'break-*' properties
   650 		cause breaks within this context.
   651 		We probably want ''break-*: region'' to apply.
   652 	</p>
   654 	<p class="issue">
   655 		This specification needs a processing model
   656 		that will apply in cases where the layout containing the
   657 		fragments has characteristics that use the intrinsic size of the fragments
   658 		to change the amount of space available for them,
   659 		such as [[CSS3-GRID-LAYOUT]].
   660 		There has already been some work on such a processing model
   661 		in [[CSS3-REGIONS]],
   662 		and the work done on a model there,
   663 		and the editors of that specification,
   664 		should inform what happens in this specification.
   665 	</p>
   667 <h3 id="fragment-styling">Fragment styling</h3>
   669 <h4 id="fragment-pseudo-element">The ::nth-fragment() pseudo-element</h4>
   671 	<p>
   672 		The <dfn selector>::nth-fragment()</dfn> pseudo-element
   673 		is a pseudo-element
   674 		that describes some of the <a>fragment box</a>es generated by an element.
   675 		The argument to the pseudo-element takes the same syntax
   676 		as the argument to the :nth-child() pseudo-class
   677 		defined in [[!SELECT]], and has the same meaning
   678 		except that the number is relative to
   679 		<a>fragment box</a>es generated by the element
   680 		instead of siblings of the element.
   681 	</p>
   683 	<p class="note">
   684 		Selectors that allow addressing fragments
   685 		by counting from the end rather than the start
   686 		are intentionally not provided.
   687 		Such selectors would interfere with determining
   688 		the number of fragments.
   689 	</p>
   691 	<p class="issue">
   692 		Depending on future discussions,
   693 		this ''::nth-fragment(<var>an+b</var>)'' syntax
   694 		may be replaced with
   695 		the new ''::fragment:nth(<var>an+b</var>)'' syntax.
   696 	</p>
   698 <h4 id="style-of-fragments">Styling of fragments</h4>
   700 	<p class="issue">
   701 		Should this apply to fragment overflow only,
   702 		or also to paginated overflow?
   703 		(If it applies,
   704 		then stricter property restrictions would be needed
   705 		for paginated overflow.)
   706 	</p>
   708 	<p>
   709 		In the absence of rules with ''::nth-fragment()'' pseudo-elements,
   710 		the computed style for each <a>fragment box</a>
   711 		is the computed style for the element
   712 		for which the <a>fragment box</a> was created.
   713 		However, the style for a <a>fragment box</a> is also influenced
   714 		by rules whose selector's <a>subject</a> [[!SELECT]]
   715 		has an ''::nth-fragment()'' pseudo-element,
   716 		if the 1-based number of the <a>fragment box</a> matches
   717 		that ''::nth-fragment()'' pseudo-element
   718 		and the selector (excluding the ''::nth-fragment()'' pseudo-element)
   719 		matches the element generating the fragments.
   720 	</p>
   722 	<p>
   723 		When determining the style of the <a>fragment box</a>,
   724 		these rules that match the fragment pseudo-element
   725 		cascade together with the rules that match the element,
   726 		with the fragment pseudo-element adding the specificity
   727 		of a pseudo-class to the specificity calculation.
   728 		<span class="issue">Does this need to be specified in
   729 		the cascading module as well?</span>
   730 	</p>
   732 	<div class="example">
   733 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
   734 &lt;style&gt;
   735   .bouncy-columns {
   736     overflow: fragments;
   737     width: 6em;
   738     height: 10em;
   739     float: left;
   740     margin: 1em;
   741     font: medium/1.25 Times New
   742       Roman, Times, serif;
   743   }
   744   .bouncy-columns::nth-fragment(1) {
   745     background: aqua; color: black;
   746     transform: rotate(-3deg);
   747   }
   748   .bouncy-columns::nth-fragment(2) {
   749     background: yellow; color: black;
   750     transform: rotate(3deg);
   751   }
   752 &lt;/style&gt;
   753 &lt;div class="bouncy-columns"&gt;
   754   <i>...</i>
   755 &lt;/div&gt;</pre></td><td>
   756 			<div class="bouncy-columns-demo one">In this<br>example, the<br>text in the div<br>is broken into<br>a series of<br>columns.  The<br>author<br>probably</div>
   757 			<div class="bouncy-columns-demo two">intended the<br>text to fill two<br>columns.  But<br>if it happens to<br>fill three<br>columns, the<br>third column is<br>still created.  It</div>
   758 			<div class="bouncy-columns-demo">just doesn't<br>have any<br>fragment-specific<br>styling because<br>the author<br>didn't give it<br>any.</div>
   759 		</td></tr></table>
   760 	</div>
   762 	<p>
   763 		Styling an ''::nth-fragment()'' pseudo-element with the 'overflow'
   764 		property does take effect;
   765 		if a <a>fragment box</a> has a
   766 		computed value of 'overflow' other than ''fragments''
   767 		then that fragment box is the last fragment.
   768 		However, overriding 'overflow' on the first fragment
   769 		does not cause the <a>fragment box</a> not to exist;
   770 		whether there are fragment boxes at all is determined by
   771 		the computed value of overflow for the element.
   772 		<span class="issue">Need to reword this to refer to the
   773 		appropriate choice of 'overflow-x' or 'overflow-y',
   774 		and then point to rule about the handling of the other one
   775 		of 'overflow-x' or 'overflow-y'.</span>
   776 	</p>
   778 	<p>
   779 		Styling an ''::nth-fragment()'' pseudo-element with the 'content'
   780 		property has no effect;
   781 		the computed value of 'content' for the fragment box
   782 		remains the same as the computed value of content for the element.
   783 	</p>
   785 	<p>
   786 		Specifying ''display: none'' for a <a>fragment box</a> causes
   787 		the fragment box with that index not to be generated.
   788 		However, in terms of the indices
   789 		used for matching ''::nth-fragment()'' pseudo-elements
   790 		of later fragment boxes,
   791 		it still counts as though it was generated.
   792 		However, since it is not generated, it does not contain any content.
   793 	</p>
   795 	<p>
   796 		Specifying other values of 'display', 'position',
   797 		or 'float' is permitted, but is not allowed to change
   798 		the computed value of 'display-inside'.
   799 		(Since 'overflow', 'overflow-x', and 'overflow-y' only
   800 		apply to block containers, flex containers, and grid containers
   801 		the computed value of 'display-inside' is always
   802 		''display-inside/block'', ''display-inside/flex'', or
   803 		''display-inside/grid''.
   804 		<span class="issue">Need to specify exactly how this works,
   805 		but it depends on
   806 		having 'display-inside' and 'display-outside' specified.</span>
   807 	</p>
   809 	<p>
   810 		To match the model for other pseudo-elements
   811 		where the pseudo-elements live inside their corresponding element,
   812 		declarations in ''::nth-fragment()'' pseudo-elements override
   813 		declarations in rules without the pseudo-element.
   814 		The relative priority within such declarations is determined
   815 		by normal cascading order (see [[!CSS21]]).
   816 	</p>
   818 	<p>
   819 		Styles specified on ''::nth-fragment()'' pseudo-elements
   820 		do affect inheritance to content within the <a>fragment box</a>.
   821 		In other words, the content within the <a>fragment box</a> must
   822 		inherit from the fragment box's style (i.e., the pseudo-element style)
   823 		rather than directly from the element.
   824 		This means that elements split between fragment boxes may
   825 		have different styles for different parts of the element.
   826 	</p>
   828 	<p class="issue">
   829 		This inheritance rule allows specifying styles indirectly
   830 		(by using explicit ''inherit'' or using default inheritance
   831 		on properties that don't apply to ''::first-letter'')
   832 		that can't be specified directly
   833 		(based on the rules in the next section).
   834 		This is a problem.
   835 		The restrictions that apply to styling inside fragments
   836 		should also apply to inheritance from fragments.
   837 	</p>
   839 	<div class="example">
   840 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
   841 &lt;style&gt;
   842   .article {
   843     overflow: fragments;
   844   }
   845   .article::nth-fragment(1) {
   846     font-size: 1.5em;
   847     margin-bottom: 1em;
   848     height: 4em;
   849   }
   850   .article::nth-fragment(2) {
   851     margin-left: 5em;
   852     margin-right: 2em;
   853   }
   854 &lt;/style&gt;
   855 &lt;div class="article"&gt;
   856   The &lt;code&gt;font-size&lt;/code&gt; property<i>...</i>
   857 &lt;/div&gt;</pre></td><td>
   858 			<div class="article-font-inherit-demo one">The <code>font-size</code> property<br>specified on the fragment<br>is inherited into the</div>
   859 			<div class="article-font-inherit-demo two">descendants of the fragment.<br>This means that inherited<br>properties can be used<br>reliably on a fragment, as in<br>this example.</div>
   860 		</td></tr></table>
   861 	</div>
   863 <h4 id="style-in-fragments">Styling inside fragments</h4>
   865 	<p class="issue">
   866 		Should this apply to fragment overflow only,
   867 		or also to paginated overflow,
   868 		or even to pagination across pages?
   869 	</p>
   871 	<p>
   872 		The ''::nth-fragment()'' pseudo-element
   873 		can also be used to style
   874 		content inside of a <a>fragment box</a>.
   875 		Unlike the ''::first-line'' and ''::first-letter'' pseudo-elements,
   876 		the ''::nth-fragment()'' pseudo-element can be applied
   877 		to parts of the selector other than the subject:
   878 		in particular, it can match ancestors of the subject.
   879 		However, the only CSS properties applied
   880 		by rules with such selectors
   881 		are those that apply
   882 		to the ''::first-letter'' pseudo-element.
   883 	</p>
   885 	<p>
   886 		To be more precise,
   887 		when a rule's selector has ''::nth-fragment()'' pseudo-elements
   888 		attached to parts of the selector other than the subject,
   889 		the declarations in that rule apply to
   890 		a fragment (or pseudo-element thereof) when:
   891 	</p>
   892 	<ol>
   893 		<li>
   894 			the declarations are for properties that apply to the
   895 			''::first-letter'' pseudo-element,
   896 		</li>
   897 		<li>
   898 			the declarations would apply to
   899 			that fragment (or pseudo-element thereof)
   900 			had those ''::nth-fragment()'' pseudo-elements been removed,
   901 			with a particular association between
   902 			each sequence of simple selectors and the element it matched,
   903 			and
   904 		</li>
   905 		<li>
   906 			for each removed ''::nth-fragment()'' pseudo-element,
   907 			the fragment lives within a <a>fragment box</a>
   908 			of the element associated in that association
   909 			with the selector that the pseudo-element was attached to,
   910 			and whose index matches the pseudo-element.
   911 		</li>
   912 	</ol>
   914 	<div class="example">
   915 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
   916 &lt;style&gt;
   917   .dark-columns {
   918     overflow: fragments;
   919     width: 6em;
   920     height: 10em;
   921     float: left;
   922     margin-right: 1em;
   923     font: medium/1.25 Times New
   924       Roman, Times, serif;
   925   }
   926   .dark-columns::nth-fragment(1) {
   927     background: aqua; color: black;
   928   }
   929   .dark-columns::nth-fragment(1) :link {
   930     color: blue;
   931   }
   932   .dark-columns::nth-fragment(1) :visited {
   933     color: purple;
   934   }
   935   .dark-columns::nth-fragment(2) {
   936     background: navy; color: white;
   937   }
   938   .dark-columns::nth-fragment(2) :link {
   939     color: aqua;
   940   }
   941   .dark-columns::nth-fragment(2) :visited {
   942     color: fuchsia;
   943   }
   944 &lt;/style&gt;
   945 &lt;div class="dark-columns"&gt;
   946   <i>...</i>
   947 &lt;/div&gt;</pre></td><td>
   948 			<div class="dark-columns-demo one">In this<br><a href="http://en.wiktionary.org/wiki/example">example</a>, the<br>text flows<br>from one<br>light-colored<br>fragment into<br>another<br>dark-colored</div>
   949 			<div class="dark-columns-demo two">fragment.  We<br>therefore want<br>different styles<br>for <a href="http://www.w3.org/Provider/Style/IntoContext.html">hyperlinks</a><br>in the different<br>fragments.</div>
   950 		</td></tr></table>
   951 	</div>
   954 <h3 id="max-lines">The 'max-lines' property</h3>
   956 	<p>
   957 		Authors may wish to style the opening lines of an element
   958 		with different styles
   959 		by putting those opening lines in a separate fragment.
   960 		However, since it may be difficult to predict the exact height
   961 		occupied by those lines
   962 		in order to restrict the first fragment to that height,
   963 		this specification introduces a 'max-lines' property
   964 		that forces a fragment to break
   965 		after a specified number of lines.
   966 		This forces a break after the given number of lines
   967 		contained within the element or its descendants,
   968 		as long as those lines are in the same block formatting context.
   969 	</p>
   971 	<pre class=propdef>
   972 		Name: max-lines
   973 		Value: ''none'' | <<integer>>
   974 		Initial: ''none''
   975 		Applies to: fragment boxes
   976 		Inherited: no
   977 		Animatable: as <a href="http://www.w3.org/TR/css3-transitions/#animatable-types">integer</a>
   978 		Percentages: N/A
   979 		Media: visual
   980 		Computed value: specified value
   981 		Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
   982 	</pre>
   984 	<dl dfn-for="max-lines" dfn-type="value">
   985 		<dt><dfn>none</dfn>
   986 		<dd>
   987 			<p>
   988 				Breaks occur only as specified elsewhere.
   989 			</p>
   990 		</dd>
   992 		<dt><dfn><<integer>></dfn>
   993 		<dd>
   994 			<p>
   995 				In addition to any breaks specified elsewhere,
   996 				a break is forced before any line that would exceed
   997 				the given number of lines
   998 				being placed inside the element
   999 				(excluding lines that are in
  1000 				a different block formatting context from
  1001 				the block formatting context to which
  1002 				an unstyled child of the element would belong).
  1003 			</p>
  1005 			<p class="issue">
  1006 				If there are multiple boundaries between this line
  1007 				and the previous, where exactly (in terms of element
  1008 				boundaries) is the break forced?
  1009 			</p>
  1011 			<p>
  1012 				Only positive integers are accepted.
  1013 				Zero or negative integers are a parse error.
  1014 			</p>
  1015 		</dd>
  1016 	</dl>
  1018 <p class="issue">Should this apply to fragment overflow only, or also
  1019 to pagination?</p>
  1021 	<div class="example">
  1022 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
  1023 &lt;style&gt;
  1024   .article {
  1025     overflow: fragments;
  1027   .article::first-letter {
  1028     font-size: 2em;
  1029     line-height: 0.9;
  1031   .article::nth-fragment(1) {
  1032     font-size: 1.5em;
  1033     max-lines: 3;
  1035   .article::nth-fragment(2) {
  1036     column-count: 2;
  1038 &lt;/style&gt;
  1039 &lt;div class="article"&gt;
  1040   <i>...</i>
  1041 &lt;/div&gt;</pre></td><td>
  1042 			<div class="article-max-lines-demo one">The max-lines property allows<br>authors to use a larger font for the first<br>few lines of an article.  Without the</div>
  1043 			<div class="article-max-lines-demo two">max-lines property, authors<br>might have to use the<br>'height' property instead, but<br>that would leave a slight gap<br>if the author miscalculated<br>how much height a given<br>number of lines would<br>occupy (which might be</div>
  1044 			<div class="article-max-lines-demo three">particularly hard if the author<br>didn't know what text would<br>be filling the space, exactly<br>what font would be used, or<br>exactly which platform's font<br>rendering would be used to<br>display the font).</div>
  1045 		</td></tr></table>
  1046 	</div>
  1048 <h2 id="static-media">Overflow in static media</h2>
  1050 	<p class="issue">
  1051 		This specification should define useful behavior
  1052 		for all values of 'overflow'
  1053 		in static media (such as print).
  1054 		Current implementation behavior is quite poor and
  1055 		produces unexpected results when authors have not considered
  1056 		what will happen when
  1057 		the content they produce for interactive media
  1058 		is printed.
  1059 	</p>
  1061 <h2 class=no-num id="acknowledgments">
  1062 Acknowledgments</h2>
  1064 	<p>
  1065 		Thanks especially to the feedback from
  1066 		Rossen Atanassov,
  1067 		Bert Bos,
  1068 		Tantek Çelik,
  1069 		John Daggett,
  1070 		fantasai,
  1071 		Daniel Glazman,
  1072 		Vincent Hardy,
  1073 		H&aring;kon Wium Lie,
  1074 		Peter Linss,
  1075 		Robert O'Callahan,
  1076 		Florian Rivoal,
  1077 		Alan Stearns,
  1078 		Steve Zilles,
  1079 		and all the rest of the
  1080 		<a href="http://lists.w3.org/Archives/Public/www-style/">www-style</a> community.
  1081 	</p>

mercurial