Testable Assertions List

CSS 2.1 Section 13 Paged Media

28 Apr 2009

==== Page Boxes: the @page Rule ====

  1. The content of the document is flowed into the page area of one or more page sheets.
    The page area includes the boxes laid out on that page.
  2. For a single-page document, the containing box for the root element is the page area.
    The edges of the first page area establish the rectangle that is the initial containing block of the document.
    The containing block in which the root element lives is a rectangle called the initial containing block. For continuous media, it has the dimensions of the viewport and is anchored at the canvas origin; it is the page area for paged media.
  3. For a single-page document, the containing box for positioned content with no positioned ancestor is the page area.
    The edges of the first page area establish the rectangle that is the initial containing block of the document.
  4. A percentage height on the root element is relative to the page area height.
    The edges of the first page area establish the rectangle that is the initial containing block of the document.
    A percentage height on the root element is relative to the initial containing block.
  5. A percentage width on the root element is relative to the page area width.
    The edges of the first page area establish the rectangle that is the initial containing block of the document.
    The percentage is calculated with respect to the width of the generated box's containing block.
  6. Elements with 'position: absolute' are positioned relative to their containing blocks, ignoring any page breaks, as if the document were continuous (so long as the positioned content is specified early enough within the source document that the targeted position hasn't already been printed or laid out for printing).
    The edges of the first page area establish the rectangle that is the initial containing block of the document.
    The containing block for a positioned box is established by the nearest positioned ancestor (or, if none exists, the initial containing block
    For absolutely positioned content that resolves to a position on a page other than the page being laid out (the current page), or resolves to a position on the current page which has already been rendered for printing, printers may place the content
    • on another location on the current page,
    • on a subsequent page, or
    • may omit it.
    Tests:
  7. For HTML documents in paged media, when the HTML and BODY elements have heights of 100%, a percentage height on a child of BODY is relative to the page area height.
    The edges of the first page area establish the rectangle that is the initial containing block of the document.
    The containing block for a positioned box is established by the nearest positioned ancestor (or, if none exists, the initial containing block)
    The percentage is calculated with respect to the height of the generated box's containing block.
  8. When a relatively positioned element whose 'height' and 'width' match that of the page area has a corner positioned at a corner of the page area, any positioned children are positioned relative to the page area.
    The containing block for a positioned box is established by the nearest positioned ancestor (or, if none exists, the initial containing block
  9. Elements with 'position: fixed' are positioned relative to the page area and are rendered on every page of the printed document.
    The edges of the first page area establish the rectangle that is the initial containing block of the document.
    For paged media, boxes with fixed positions are repeated on every page.
    fixed: The box's position is calculated according to the 'absolute' model, but in addition, the box is fixed with respect to some reference.
  10. Any portion of an element with 'position: fixed' which is positioned outside the page area is not printed.
    Parts of the fixed position box that are not visible in the initial containing block will not print.
    Tests: page-container-007.xht, do another with oversized element with border just off the page on all sides...
  11. For documents in the html namespace, a background on 'html' will cover the page area but not the margin area.
    The canvas background is painted within and covers the page area.
    The background of the root element becomes the background of the canvas and covers the entire canvas...
  12. For documents in the html namespace, a background on 'body' will cover the page area.
    The canvas background is painted within and covers the page area.
    The background of the root element becomes the background of the canvas and covers the entire canvas...
    For documents whose root element is an HTML 'HTML' element or an XHTML 'html' element that has computed values of 'transparent' for 'background-color' and 'none' for 'background-image', user agents must instead use the computed value of those properties from that element's first HTML 'BODY' element or XHTML 'body' element child when painting backgrounds for the canvas, and must not paint a background for that child element.
  13. An @page rule consists of the keyword "@page", followed by an optional page selector, followed by a block of declarations.
    An @page rule consists of the keyword "@page", followed by an optional page selector, followed by a block of declarations.
  14. In CSS 2.1, page selectors may designate the first page, all left pages, or all right pages.
    In CSS 2.1, page selectors may designate the first page, all left pages, or all right pages

    ===== Page Margins =====

  15. Authors can specify the margins of a page box inside an @page rule.
    Authors can specify the margins of a page box inside an @page rule.
    In CSS 2.1, only the margin properties ('margin-top', 'margin-right', 'margin-bottom', 'margin-left', and 'margin') apply within the page context.
  16. Percentage values on right and left margins are relative to the page box width.
    Percentage values on the margin properties are relative to the dimensions of the page box; for left and right margins, they refer to the width of the page box while for top and bottom margins, they refer to the height of the page box.
  17. Percentage values on top and bottom margins are relative to the page box height.
    Percentage values on the margin properties are relative to the dimensions of the page box; for left and right margins, they refer to the width of the page box while for top and bottom margins, they refer to the height of the page box.
  18. Page margins may be specified in the following units: in, mm, cm, pt, pc, px, and percentages.
    The page context has no notion of fonts, so 'em' and 'ex' units are not allowed. Percentage values on the margin properties are relative to the dimensions of the page box; for left and right margins, they refer to the width of the page box while for top and bottom margins, they refer to the height of the page box. All other units associated with the respective CSS 2.1 properties are allowed.
    Tests: Retrieve Revenution tests?
  19. "A margin declaration within a page context which is not qualified by a pseudo-class (or, for css3, a named page identifier) sets the margins for every page of the document which doesn't match a page context with a :first, :right, or :left pseudoclass (or, for css3, a named page identifier)."
    Authors can specify the margins of a page box inside an @page rule.
    Properties specified in a :left or :right @page rule override those specified in an @page rule that has no pseudo-class specified. Properties specified in a :first @page rule override those specified in :left or :right @page rules.

    ===== Page Selectors: selecting left, right, and first pages =====

  20. The right and left pages of a document may use differing margin styles that yield equivalent page area widths.
    When printing double-sided documents, the page boxes on left and right pages MAY be different.
    If different declarations have been given for left and right pages, the user agent must honor these declarations even if the user agent does not transfer the page boxes to left and right sheets (e.g., a printer that only prints single-sided).
  21. The right and left pages of a document may use differing margin styles that yield different page area widths, but the UA may adjust the margins such that the page area widths are the same.
    When printing double-sided documents, the page boxes on left and right pages MAY be different.
    If different declarations have been given for left and right pages, the user agent must honor these declarations even if the user agent does not transfer the page boxes to left and right sheets (e.g., a printer that only prints single-sided).
    To simplify implementations, user agents may use a single page area width on left, right, and first pages. In this case, the page area width of the first page should be used.
  22. The right and left pages of a document may use differing margin styles that yield different page area heights.
    When printing double-sided documents, the page boxes on left and right pages MAY be different.
    If different declarations have been given for left and right pages, the user agent must honor these declarations even if the user agent does not transfer the page boxes to left and right sheets (e.g., a printer that only prints single-sided).
  23. User agents automatically classify all pages into either the ':left' or ':right' pseudo-class.
    All pages are automatically classified by user agents into either the :left or :right pseudo-class.
  24. Declarations inside a page context defined with the ':first' pseudo-class apply only to the first page of a document.
    Authors MAY also specify style for the first page of a document with the ':first' pseudo-class:
  25. Properties specified in a :left or :right @page rule override those specified in an @page rule that has no pseudo-class specified.
    Properties specified in a :left or :right @page rule override those specified in an @page rule that has no pseudo-class specified
  26. Properties specified in a :first @page context overrides those specified in :left or :right @page contexts.
    Properties specified in a :first @page rule override those specified in :left or :right @page rules.
  27. Properties specified in a :first @page rule override those specified in an @page rule with no pseudo-class specified.
    Properties specified in a :left or :right @page rule override those specified in an @page rule that has no pseudo-class specified.
    Properties specified in a :first @page rule override those specified in :left or :right @page rules.

    ===== Content Outside the Page Box =====

  28. Content should be allowed slightly beyond the page box to allow pages to "bleed".
    Content should be allowed slightly beyond the page box to allow pages to "bleed".
  29. User agents should avoid generating a large number of empty page boxes to honor the positioning of elements.
    User agents should avoid generating a large number of empty page boxes to honor the positioning of elements
    Tests:
  30. The UA appropriately deals with boxes positioned outside the page box (they may be printed or not, but the UA doesn't crash or muck up neighboring content).
    User agents may handle boxes positioned outside the page box in several ways, including discarding them or creating page boxes for them at the end of the document.
    Tests:

    ===== Page Breaks =====

  31. The syntax of the 'page-break-before' property is auto | always | avoid | left | right.
    Value: auto | always | avoid | left | right
  32. The initial value of the 'page-break-before' property is 'auto'.
    Initial: auto
  33. The 'page-break-before' property applies to block-level elements.
    Applies to: block-level elements
  34. The 'page-break-before' property applies to floated block-level elements in normal flow.
    Applies to: block-level elements
  35. The 'page-break-before' property is not inherited.
    Inherited: no
  36. The 'page-break-before' property applies to paged media only.
    Media: paged
  37. The 'auto' value of the 'page-break-before' property neither forces nor forbids a page break before the box.
    auto: Neither force nor forbid a page break before (after, inside) the generated box.
  38. The 'always' value of the 'page-break-before' property forces a page break before the box.
    always: Always force a page break before (after) the generated box.
  39. The 'left' value of the 'page-break-before' property forces one or two page breaks before the box so that the page after the break is formatted as a left page.
    left: Force one or two page breaks before (after) the generated box so that the next page is formatted as a left page.
  40. The 'right' value of the 'page-break-before' property forces one or two page breaks before the box so that the page after the break is formatted as a right page.
    right: Force one or two page breaks before (after) the generated box so that the next page is formatted as a right page.
  41. The 'avoid' value of the 'page-break-before' property prevents a page break before the element when possible.
    Avoid a page break before (after, inside) the generated box.
  42. The syntax of the 'page-break-after' property is auto | always | avoid | left | right.
    Value: auto | always | avoid | left | right
  43. The initial value of the 'page-break-after' property is 'auto'.
    Initial: auto
  44. The 'page-break-after' property applies to block-level elements.
    Applies to: block-level elements
  45. The 'page-break-after' property is not inherited.
    Inherited: no
  46. The 'page-break-after' property applies to paged media only.
    Media: paged
  47. The 'auto' value of the 'page-break-after' property neither forces nor forbids a page break after the box.
    auto: Neither force nor forbid a page break before (after, inside) the generated box.
  48. The 'always' value of the 'page-break-after' property forces a page break after the box.
    always: Always force a page break before (after) the generated box.
  49. The 'left' value of the 'page-break-after' property forces one or two page breaks after the box. The page after the break should be formatted as a left page.
    left: Force one or two page breaks before (after) the generated box so that the next page is formatted as a left page.
  50. The 'right' value of the 'page-break-after' property forces one or two page breaks after the box. The page after the break should be formatted as a right page.
    right: Force one or two page breaks before (after) the generated box so that the next page is formatted as a right page.
  51. The 'avoid' value of the 'page-break-after' property inhibits a page break after the element when possible.
    Avoid a page break before (after, inside) the generated box.
  52. The syntax of the 'page-break-inside' property is auto | avoid.
    Value: auto | avoid
  53. The initial value of the 'page-break-inside' property is 'auto'.
    Initial: auto
  54. The 'page-break-inside' property applies to block-level elements.
    Applies to: block-level elements
  55. The 'page-break-inside' property is not inherited.
    Inherited: no
    Tests: page-break-inside-005.xht
    Not testable unless we relax Rule B first.
  56. The 'page-break-inside' property applies to paged media only.
    Media: paged
  57. The 'auto' value of the 'page-break-inside' property neither forces nor forbids a page break inside the box.
    auto: Neither force nor forbid a page break before (after, inside) the generated box.
  58. The 'avoid' value of the 'page-break-inside' property causes the UA to avoid breaking inside the element.
    avoid: Avoid a page break before (after, inside) the generated box.
  59. The UA may apply the page-breaking properties to table rows.
    User agents may also apply these properties to other elements, e.g., 'table-row' elements.
    Tests:
  60. The 'inherit' value on the 'page-break-before' property of an element will cause the element to use the computed value of the page-break-before property for the element's parent.
    Each property may also have a specified value of 'inherit', which means that, for a given element, the property takes the same computed value as the property for the element's parent.
    Tests:
  61. The 'inherit' value on the 'page-break-after' property of an element will cause the element to use the computed value of the page-break-before property for the element's parent.
    Each property may also have a specified value of 'inherit', which means that, for a given element, the property takes the same computed value as the property for the element's parent.
    Tests:
  62. The 'inherit' value on the 'page-break-inside' property of an element will cause the element to use the computed value of the page-break-before property for the element's parent.
    Each property may also have a specified value of 'inherit', which means that, for a given element, the property takes the same computed value as the property for the element's parent.
    Tests:
  63. When there's a conflict, the values 'always', 'left', and 'right' take precedence over 'avoid'.
    ...the values 'always', 'left', and 'right' take precedence over 'avoid'.
    Tests:
  64. When a forced page break splits a box, the box's margins, borders, and padding have no visual effect where the split occurs.
    When a page break splits a box, the box's margins, borders, and padding have no visual effect where the split occurs.
  65. When an unforced page break splits a box, the box's margins, borders, and padding have no visual effect where the split occurs.
    When a page break splits a box, the box's margins, borders, and padding have no visual effect where the split occurs.
    Tests:

    ===== Breaks inside elements: 'orphans', 'widows' =====

  66. The syntax of the 'orphans' property is <integer>.
    Value: <integer>
  67. The initial value of the 'orphans' property is 2.
    Initial: 2
  68. The 'orphans' property applies to block-level elements.
    Applies to: block-level elements
  69. The 'orphans' property is inherited.
    Inherited: yes
  70. The 'orphans' property applies to paged media.
    Media: visual, paged
  71. The 'orphans' property specifies the minimum number of line boxes in a block element that must be left at the bottom of a page when a page break occurs inside the block.
    The 'orphans' property specifies the minimum number of line boxes in a block element that must be left at the bottom of a page.
  72. The syntax of the 'widows' property is <integer>.
    Value: <integer>
  73. The initial value of the 'widows' property is 2.
    Initial: 2
  74. The 'widows' property applies to block-level elements.
    Applies to: block-level elements
  75. The 'widows' property is inherited.
    Inherited: yes
  76. The 'widows' property applies to paged media.
    Media: visual, paged
  77. The 'widows' property specifies the minimum number of line boxes of a block element that must be left at the top of a page when a page break occurs inside the block.
    The 'windows' property specifies the minimum number of line boxes of a block that must be left at the top of a page.

    ===== Allowed page breaks =====

  78. Page breaks occur in the vertical margin between sibling block boxes when
    1. 'page-break-after' for the first block and 'page-break-before' for the second block are 'auto', 'always', 'left', or 'right'; and
    2. the siblings' 'page-break-inside' property values are 'avoid'; and
    3. the parent's 'page-break-inside' property value is not 'avoid'.
    In the normal flow, page breaks may occur at the following places: 1. In the vertical margin between block boxes (or rows in a table). ... These breaks are subject to the following rules: ...
  79. When a page break occurs in the vertical margin between block boxes (or rows in a table), the used values of any adjoining margins are set to '0'.
    In the vertical margin between block boxes (or rows in a table). When a page break occurs here, the computed values of the relevant 'margin-top' and 'margin-bottom' properties are set to '0'.
    Replace http://www.revenutiontesting.com/w3c/allowed-page-breaks-000.xht
  80. When an element would span a page break solely to render a bottom margin, that margin is instead truncated and the element does not span pages.
    In the normal flow, page breaks may occur at the following places: ... 3. Between the bottom content edge of a block box and the end of its child content (bottom margin edge of the last block-level child or bottom edge of the last line box) if the distance between them is positive.. These breaks are subject to the following rules:...
    No wording in the spec yet justifies this test case. Elika to propose...
  81. When an element would span a page break solely to render a bottom margin, that margin is instead truncated and the element does not span pages, even if the element has a background or border.
    In the normal flow, page breaks may occur at the following places: ... 3. Between the bottom content edge of a block box and the end of its child content (bottom margin edge of the last block-level child or bottom edge of the last line box) if the distance between them is positive.. These breaks are subject to the following rules:...
    No wording in the spec yet justifies this test case. Elika to propose...
  82. Page breaks occur between line boxes inside a block box when the box won't fit inside the page area of a single page.
    In the normal flow, page breaks may occur at the following places: ... 2. Between line boxes inside a block box. These breaks are subject to the following rules:...
    Tests:
  83. Page breaks occur between line boxes inside a block box when the box won't fit into the available space on the page, and its 'page-break-before' property value is 'avoid'.
    In the normal flow, page breaks may occur at the following places: ... 2. Between line boxes inside a block box. These breaks are subject to the following rules:...
  84. Breaking between line boxes is allowed 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 and the value of the 'page-break-inside' property is 'auto'.
    Rule C: Breaking at (2) 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.
    Rule D: breaking at (2) is allowed only if the 'page-break-inside' property is 'auto'.
  85. If the page breaking rules don't provide enough break points to keep content from overflowing the page boxes, then the restrictions imposed by 'avoid' on the 'page-break-*' properties are dropped.:
    Do we want to drop B before A and D?
    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.
  86. If even after dropping the restrictions due to 'avoid' values on 'page-break-*' there aren't enough break points to keep content from overflowing the page boxes, then the restrictions due to 'widows' and 'orphans' are dropped as well. :
    If that still does not lead to sufficient break points, rule C is dropped as well, to find still more break points.

    ===== Forced Page Breaks =====

  87. A page break MUST occur in the vertical margin between block boxes (or rows in a table) 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'.
    A page break MUST occur at (1) 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'.

    ===== Best Page Breaks =====

  88. UA's should avoid breaking inside a box that has a border.
    Avoid breaking inside a block that has a border.
    Tests:
  89. UA's should avoid breaking inside a table.
    QUOTE
    Tests:
  90. UA's should avoid breaking inside a floated element.
    Avoid breaking inside a floated element
    Tests:
  91. UA's should avoid breaking inside a replaced element.
    Avoid breaking inside a replaced element
    Tests:

    ===== Cascading in the Page Context =====

  92. A right page of a document (that is, not a left or first page) applies all @page style rules, then applies all @page:right style rules.
    Declarations in the page context obey the cascade just like normal CSS declarations.
    Properties specified in a :left or :right @page rule override those specified in an @page rule that has no pseudo-class specified. Properties specified in a :first @page rule override those specified in :left or :right @page rules.
    Tests:
  93. A left page of a document (that is, not a right or first page) applies all @page style rules, then applies all @page:left style rules.
    Declarations in the page context obey the cascade just like normal CSS declarations.
    Properties specified in a :left or :right @page rule override those specified in an @page rule that has no pseudo-class specified. Properties specified in a :first @page rule override those specified in :left or :right @page rules.
    Tests:
  94. The first page of a document applies all @page style rules, then either @page:right or @page:left rules, then @page:first rules.
    Declarations in the page context obey the cascade just like normal CSS declarations.
    Properties specified in a :left or :right @page rule override those specified in an @page rule that has no pseudo-class specified. Properties specified in a :first @page rule override those specified in :left or :right @page rules.
    Tests:
  95. Page contexts cascade.
    Declarations in the page context obey the cascade just like normal CSS declarations.

    ===== Page Grammar =====

  96. There must be no white space between the '@' and the {P}{A}{G}{E} in a page_sym for a page context.
    @{P}{A}{G}{E} {return PAGE_SYM;}
    Tests:
  97. There may or may not be white space preceding a pseudo_page production within a page context.
    page
      : PAGE_SYM S* pseudo_page? S*
        LBRACE S* declaration [ ';' S* declaration ]* '}' S*
      ;
  98. There may or may not be white space following a pseudo_page production within a page context.
    page
      : PAGE_SYM S* pseudo_page? S*
        LBRACE S* declaration [ ';' S* declaration ]* '}' S*
      ;
  99. ASSERTION
    SpecQuote
    Tests:
  100. ASSERTION
    SpecQuote
    Tests: