- From: Elika Etemad via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 25 Jan 2012 03:54:25 +0000
- To: public-css-commits@w3.org
Update of /sources/public/csswg/css3-break In directory hutz:/tmp/cvs-serv17461 Modified Files: Overview.html Overview.src.html Log Message: Rewrite breaking rules, incorporate resolutions from <http://lists.w3.org/Archives/Public/www-style/2011Nov/0711.html> Index: Overview.html =================================================================== RCS file: /sources/public/csswg/css3-break/Overview.html,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Overview.html 25 Jan 2012 02:00:19 -0000 1.13 +++ Overview.html 25 Jan 2012 03:54:23 -0000 1.14 @@ -12,7 +12,7 @@ <body> <div class=head> <!--begin-logo--> - <p id=x><a href="http://www.w3.org/"><img alt=W3C height=48 + <p><a href="http://www.w3.org/"><img alt=W3C height=48 src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo--> <h1 id=css-fragmentation-module>CSS Fragmentation Controls Module Level 3</h1> @@ -64,7 +64,7 @@ with subject line "<code>[css3-break] …message topic…</code>" </dl> [...1081 lines suppressed...] <li>orphans, <a href="#orphans" title=orphans><strong>3.2.</strong></a> + <li>page break, <a href="#page-break" + title="page break"><strong>4.2.</strong></a> + <li>pagination, <a href="#pagination" title=pagination><strong>1.</strong></a> + <li>region break, <a href="#region-break" + title="region break"><strong>4.2.</strong></a> + <li>renderer, <a href="#renderer" title=renderer><strong>5.2.</strong></a> + <li>spread break, <a href="#spread-break" + title="spread break"><strong>4.2.</strong></a> + <li>style sheet <ul> <li>as conformance class, <a href="#style-sheet" Index: Overview.src.html =================================================================== RCS file: /sources/public/csswg/css3-break/Overview.src.html,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Overview.src.html 25 Jan 2012 02:00:19 -0000 1.14 +++ Overview.src.html 25 Jan 2012 03:54:23 -0000 1.15 @@ -152,14 +152,16 @@ <p> Each <dfn>fragmentation break</dfn> (hereafter, <dfn>break</dfn>) ends layout in the current <i>fragmenter</i> and causes the remaining content - of the fragmented flow to be laid out in the next - <i>fragmentation container</i>. + of the fragmented flow to be laid out in the next <i>fragmenter</i>, in + some cases causing a new fragmenter to be generated to hold the deferred + content. </p> <p class="note"> Breaking inline content into lines is another form of fragmentation, and similarly creates box fragments when it breaks - <a href="http://www.w3.org/TR/CSS21/visuren.html#inline-boxes">inline boxes</a>. + <a href="http://www.w3.org/TR/CSS21/visuren.html#inline-boxes">inline boxes</a> + across <a href="http://www.w3.org/TR/CSS21/visuren.html#line-box">line boxes</a>. However, inline breaking is not covered here; see [[CSS3TEXT]] and the 'box-decoration-break' property in [[CSS3BACKGROUND]]. </p> @@ -431,7 +433,7 @@ of the box. The 'widows' property specifies the minimum number of line boxes of a block container that must be left at the start of a <i>fragment</i>, unless this is the last <i>fragment</i> of the box. Examples of how they are used to control - <i>fragmenter</i> breaks are given below. + fragmentation breaks are given below. </p> <p> Only positive integers are allowed as values of 'orphans' and 'widows'. Negative @@ -447,140 +449,208 @@ Rules for Breaking</h2> <p> - When a break splits a box, the box's bottom margins, borders, and padding have - no visual effect where the split occurs; the box's background and left and right - margins, border, and padding extend to the bottom of the page, through an ensuing - blank page if one exists, and onto the top of the subsequent page. + A fragmented flow may be broken across fragmenters at a number of + <a href="#possible-breaks">possible break points</a>. In the case of + <a href="#forced-breaks">forced breaks</a>, the UA is required to + break the flow at that point. In the case of + <a href="#unforced-breaks">unforced breaks</a> the UA has to choose + among the possible breaks that are allowed. </p> -<h3 id="allowed-pg-brk"> -Allowed page breaks</h3> - - <p>In the normal flow, page breaks may occur at the following places:</p> +<h3 id="possible-breaks"> +Possible Break Points</h3> + <p> + Fragmentation breaks boxes in the block flow dimension. + Breaks may occur at the following places: + </p> <ol> - <li id="brk-btw-blocks"> - In the vertical margin between sibling block boxes (or rows - in a table). When an unforced page break occurs here, both the adjoining 'margin-top' - and 'margin-bottom' are set to zero. - </li> - <li id="brk-btw-lines">Between line boxes inside a block box.</li> - <li id="brk-end-block"> - Between the content edge of a block box and the outer edges of - its child content (margin edges of block-level children or line box edges for inline-level - children) <em>if</em> there is a (non-zero) gap between them. - </li> - </ol> - - <p>These breaks are subject to the following rules:</p> - - <ul> - <li> - <strong>Rule A:</strong> Breaking at <a href="#brk-btw-blocks">(1)</a> is allowed - only if the 'page-break-after' and 'page-break-before' properties of all the elements - generating boxes that meet at this margin allow it, which is when at least one of - them has the value ''always'', ''left'', - or ''right'', or when all of them are ''auto''. - </li> - <li> - <strong>Rule B:</strong> However, if all of them are ''auto'' - and a common ancestor of all the elements has a 'page-break-inside' - value of ''avoid'', then breaking here is not allowed. + <li id="btw-blocks"> + Between sibling block-level boxes (or rows in a table). </li> - <li> - <strong>Rule C:</strong> Breaking at <a href="#brk-btw-lines">(2)</a> is allowed - only if the number of line boxes between the break and the start of the enclosing - block box is the value of 'orphans' or more, and the number of line boxes between - the break and the end of the box is the value of 'widows' or more. + <li id="btw-lines"> + Between line boxes inside a block container box (if the lines are + perpendicular to the fragmenter's block flow direction); or between + column boxes in a multi-column element or table (if the columns are + perpendicular to the fragmenter's block flow direciton). </li> - <li> - <strong>Rule D:</strong> In addition, breaking at <a href="#brk-btw-blocks">(2)</a> - or <a href="#brk-end-block">(3)</a> is allowed only if the 'page-break-inside' property - of all ancestors is ''auto''. + <li id="end-block"> + Between the content edge of a block box and the outer edges of its + child content (margin edges of block-level children or line box + edges for inline-level children) <em>if</em> there is a (non-zero) + gap between them. </li> - </ul> + </ol> <p> - If the above doesn't provide enough break points to keep content from overflowing - the page boxes, then rules A, B and D are dropped in order to find additional breakpoints. - In this case the UA may use the 'avoid's that are in effect at those points to weigh - the appropriateness of the new breakpoints; however, this specification does not - suggest a precise algorithm. + Since breaks are usually only possible between siblings (1), not between + a child and its parent, a 'break-before' value on a first-child box is + propagated to its parent. Likewise a 'break-after' value on a last-child + box is propagated to its parent. </p> <p> - If that still does not lead to sufficient break points, rule C is dropped as well, - to find still more break points. + When paginating, if there are no possible break points below the top + of the page, and not all the content fits, the UA may break anywhere + in order to avoid losing content off the edge of the page. </p> -<h3 id="forced-pg-brk"> -Forced page breaks</h3> +<h3 id="break-types"> +Types of Breaks</h3> <p> - A page break must occur at <a href="#brk-btw-blocks">(1)</a> - if, among the'page-break-after' and 'page-break-before' properties of all the elements - generating boxes that meet at this margin, there is at least one with the value - ''always'', ''left'', or - ''right''. + There are different types of breaks in CSS, defined based on the type of + fragmenters they span: </p> + <dl> + <dt><dfn>page break</dfn></dt> + <dd> + A break between two <a href="http://www.w3.org/TR/css3-page/#page-box">page boxes</a>. + [[!CSS3PAGE]] + </dd> + <dt><dfn>spread break</dfn></dt> + <dd> + A break between two page boxes that are not associated with + <a href="http://www.w3.org/TR/css3-page/#facing-pages">facing pages</a>. + A spread break is always also a page break. + [[!CSS3PAGE]] + </dd> + <dt><dfn>column break</dfn></dt> + <dd> + A break between two <a href="http://www.w3.org/TR/css3-multicol/#column-box">column boxes</a>. + Note that if the column boxes are on different pages, then the break is + also a <i>page break</i>. + [[!CSS3COL]] + </dd> + <dt><dfn>region break</dfn></dt> + <dd> + A break between two <a href="http://www.w3.org/TR/css3-regions/#regions">regions</a>. + Note that if the region boxes are on different pages, then the break is + also a <i>page break</i>. + [[!CSS3-REGIONS]] + </dd> + </dl> + <p class="note"> + A fifth type of break is the <dfn>line break</dfn>, which is a break between + two <a href="http://www.w3.org/TR/CSS21/visuren.html#line-box">line boxes</a>. + These are not covered in this specification; see [[!CSS21]]. + </p> + +<h3 id="forced-breaks"> +Forced breaks</h3> + <p> - When multiple 'page-break-before' and/or 'page-break-after' properties with values - of "always", "left" or "right" apply at a margin, only one of them should generate - page breaks. That is, no content-empty pages are generated by page-break properties, - except for at most one content-empty page as may be required by 'right' and 'left' - values to position ensuing content on a right- or left-facing page. + A forced break then occurs at <a href="#btw-blocks">(1)</a> if, among the + 'break-after' properties specified on or propagated to the earlier + sibling box and the 'break-before' properties specified on or propagated + to the later sibling box there is at least one with a <i>forced break + value</i>. </p> <p> + When multiple <i>forced break values</i> apply, they combine such all types + of break are honored and no content-empty page boxes are generated, except + for at most one content-empty page as may be required by the ''right'' or + ''left'' values to position ensuing content on a right- or left-facing page. + When ''left'' and ''right'' are both combined, the value specified on the + latest element in document order wins. + </p> + <p class="note"> A page break must also occur at <a href="#brk-btw-blocks">(1)</a> if the last line box above this margin and the first one below it do not have the - same value for 'page'. + same value for 'page'. See [[!CSS3PAGE]] </p> + +<h3 id="unforced-breaks"> +Unforced Breaks</h3> + <p> - When a forced page break occurs at <a href="#brk-btw-blocks">(1)</a>, the used values - of any adjoining 'margin-bottom' are set to zero. + While <a href="#breaking-controls">breaking controls</a> can force breaks, + they can also discourage them. The following rules control whether breaking + at a <a href="#posible-breaks">possible break point</a> is allowed: + </p> + <dl> + <dt>Rule A</dt> + <dd> + A fragmented flow may break at <a href="#btw-blocks">(1)</a> only if + all the 'break-after' and 'break-before' values applicable to this + break point allow it, which is when at least one of them forces a + break or when all of them are ''auto''. + </dd> + <dt>Rule B</dt> + <dd> + However, if all of them are ''auto'' and a common ancestor of all + the elements has a 'break-inside' value of ''avoid'', then breaking + here is not allowed. + </dd> + <dt>Rule C</dt> + <dd> + Breaking at <a href="#btw-lines">(2)</a> is allowed only if the number + of line boxes between the break and the start of the enclosing block + box is the value of 'orphans' or more, and the number of line boxes + between the break and the end of the box is the value of 'widows' or more. + </dd> + <dt>Rule D</dt> + <dd> + Additionally, breaking at <a href="#btw-blocks">(2)</a> or + <a href="#end-block">(3)</a> is allowed only if the 'break-inside' + property of all ancestors is ''auto''. + </dd> + </dl> + <p> + If the above doesn't provide enough break points to keep content from + overflowing the page boxes, then rules A, B and D are dropped in order + to find additional breakpoints. + In this case the UA may use the ''avoid''s that are in effect at those + points to weigh the appropriateness of the new breakpoints; however, + this specification does not suggest a precise algorithm. + </p> + <p> + If that still does not lead to sufficient break points, rule C is + dropped as well, to find still more break points. </p> <h3 id="best-pg-brk"> -"Best" page breaks</h3> +Optimizing Unforced Breaks</h3> - <p> - CSS3 does <em>not</em> define which of a set of allowed page breaks must - be used; except as defined earlier in the section, CSS3 does not forbid - a user agent to break at every possible break point, or to not break at all. But - CSS3 does recommend that user agents observe the following guidelines (while recognizing - that they are sometimes contradictory):</p> + <p>While CSS3 requires that a fragmented flow must break at allowed + break points in order to avoid overflowing the fragmenters in its + fragmentation context, it does not define <em>which</em> of a set of + possible <a href="#unforced-breaks">allowed breaks</a> must be taken. + However, it is recommended that user agents observe the following + guidelines (while recognizing that they are sometimes contradictory): + </p> <ul> <li>Break as few times as possible.</li> - <li>Make all pages that don't end with a forced break appear to have about the same height.</li> + <li>Make all fragmenters that don't end with a forced break appear + to be equally filled with content.</li> <li>Avoid breaking inside a replaced element.</li> </ul> <div class="example"> <p> Suppose, for example, that the style sheet contains ''orphans : 4'', ''widows : 2'', and there are 20 lines (line boxes) available - at the bottom of the current page, and the next block in normal flow is considered - for placement: + at the bottom of the current page, and the next block in normal flow + is considered for placement: </p> <ul> <li> - If the block contains 20 line boxes or fewer, it should - be placed on the current page. + If the block contains 20 line boxes or fewer, it should be placed + on the current page. </li> <li> - If the block contains 21 or 22 line boxes, the second part of the paragrap - must not violate the 'widows' - constraint, and so the second part must contain at least - two line boxes; likewise the first part must contain at - least four line boxes. + If the block contains 21 or 22 line boxes, the second fragment of + the paragraph must not violate the 'widows' constraint, and so + the second fragment must contain at least two line boxes; + likewise the first fragment must contain at least four line boxes. </li> <li> - If the block contains 23 line boxes or more, the first part should contain - 20 lines and the second part the remaining lines. (But if any - part of the block is placed on the current page, that part must - contain at least four line boxes and the second part at least two line boxes.) + If the block contains 23 line boxes or more, the first fragment should + contain 20 lines and the second fragment the remaining lines. But if + any fragment of the block is placed on the current page, that fragment + must contain at least four line boxes and the second fragment at least + two line boxes. </li> </ul> <p> - Now suppose that 'orphans' is ''10'', - 'widows' is ''20'', and there + Now suppose that 'orphans' is ''10'', 'widows' is ''20'', and there are 8 lines available at the bottom of the current page: </p> <ul> @@ -589,14 +659,28 @@ on the current page. </li> <li> - If the block contains 9 lines or more, it may NOT be split - (that would violate the orphan constraint), so it must + If the block contains 9 lines or more, it must NOT be split + (that would violate the 'orphans' constraint), so it must move as a block to the next page. </li> </ul> </div> - <!-- End section "Page Breaks" --> +<h3 id="breaking-boxes"> +Box Model for Breaking</h3> + + <p> + When an unforced break occurs between block-level boxes, any adjoining + margins are set to zero. When a forced break occurs there, any margins + before the break are truncated, but margins after the break are preserved. + </p> + + <p> + When a break splits a box, the box's bottom margins, borders, and padding have + no visual effect where the split occurs; the box's background and left and right + margins, border, and padding extend to the bottom of the page, through an ensuing + blank page if one exists, and onto the top of the subsequent page. + </p> <h2 id="conformance"> Conformance</h2>
Received on Wednesday, 25 January 2012 03:54:34 UTC