Skip to content

Commit 30e1273

Browse files
committed
[css-page] Rebase @page and margin at-rule grammars over the Syntax spec. Also fix linking errors.
1 parent af1704d commit 30e1273

1 file changed

Lines changed: 57 additions & 95 deletions

File tree

css-page/Overview.bs

Lines changed: 57 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ box:
356356
<li>Authors <em class="RFC2119">SHOULD NOT</em> position elements in
357357
inconvenient locations just to avoid rendering them. Instead:
358358
<ul>
359-
<li>To suppress box generation entirely, set the 'display' property to ''none''.
359+
<li>To suppress box generation entirely, set the 'display' property to ''display/none''.
360360
<li>To make a box invisible, set the <span class="property">'visibility'</span>
361361
property.
362362
</ul>
@@ -435,14 +435,14 @@ The @page Rule</h3>
435435
''@page'' rules are allowed
436436
wherever <a href="https://www.w3.org/TR/CSS21/syndata.html#rule-sets">rule-sets</a> are allowed.
437437
An ''@page'' rule consists of the keyword ''@page'',
438-
an <em class="RFC2119">OPTIONAL</em> comma-separated list of
439-
<a href="#page-selectors">page selectors</a>
438+
an optional comma-separated list of
439+
<a>page selectors</a>
440440
and a block of declarations
441441
(said to be in the <dfn export id="page-context">page context</dfn>).
442442
An ''@page'' rule can also contain other at-rules,
443443
interleaved between declarations.
444444
The current level of this specification
445-
only allows <a href="#margin-at-rules">margin at-rules</a> inside ''@page''.
445+
only allows <a>margin at-rules</a> inside ''@page''.
446446

447447
''@page'' rules without a selector list apply to every page.
448448
Other ''@page'' rules apply to pages that <a>match</a>
@@ -460,7 +460,7 @@ apply; that is, valid declarations within the block are applied.
460460
or a <a>page pseudo-class</a>,
461461
followed by zero or more additional <a>page pseudo-classes</a>.
462462
No whitespace is allowed between components of a selector.
463-
The <a lt="page_selector">page selector grammar</a>
463+
The <<page-selector>> grammar
464464
and examples can be found below.
465465

466466
A <a>page selector</a> is said to <dfn>match</dfn> a given page if and only if
@@ -543,7 +543,7 @@ margin-top: 10cm /* Top margin on first page 10cm */
543543
</div>
544544

545545
<h4 id="blank-pseudo">
546-
Blank-page pseudo-class: '':blank''</h4>
546+
Blank-page pseudo-class: ''@page/:blank''</h4>
547547

548548
The <dfn dfn-type="value" dfn-for="@page">:blank</dfn> pseudo-class <a lt="match">matches</a>
549549
<a lt="content-empty page">content-empty pages</a>
@@ -553,7 +553,7 @@ Blank-page pseudo-class: '':blank''</h4>
553553
<div class="note">
554554
Only the ''break-before/left'', ''break-before/right'', ''break-before/recto'' and ''break-before/verso'' values
555555
of the 'break-before' and 'break-after' properties
556-
can generate pages that match '':blank''.
556+
can generate pages that match ''@page/:blank''.
557557
</div>
558558

559559
<div class="example">
@@ -567,7 +567,7 @@ h1 { break-before: left }
567567
</pre>
568568
</div>
569569

570-
A page matched by '':blank'' can also be matched
570+
A page matched by ''@page/:blank'' can also be matched
571571
by other page pseudo-classes.
572572

573573
<div class="example">
@@ -606,83 +606,43 @@ pseudo-classes.</em>
606606

607607
<h3 id="syntax-page-selector">@page rule grammar</h3>
608608

609-
The syntax for the @page rule is a specialization of the generic at-rule
610-
defined by CSS 2.1. This grammar extends the at-rule syntax to allow @page rules
611-
nested inside @media rules. User agents must adhere
612-
to the following grammar:
613-
614-
See [[!CSS21]], Section 4.1.1 and Appendix G for the expansion of missing
615-
productions:
616-
<p id="specializatons-of-ATKEYWORD">
617-
All new lexical tokens are specializations of the ATKEYWORD lexical token:
618-
<pre class="lexical">
619-
PAGE_SYM ::= "@page"
620-
TOPLEFTCORNER_SYM ::= "@top-left-corner"
621-
TOPLEFT_SYM ::= "@top-left"
622-
TOPCENTER_SYM ::= "@top-center"
623-
TOPRIGHT_SYM ::= "@top-right"
624-
TOPRIGHTCORNER_SYM ::= "@top-right-corner"
625-
BOTTOMLEFTCORNER_SYM ::= "@bottom-left-corner"
626-
BOTTOMLEFT_SYM ::= "@bottom-left"
627-
BOTTOMCENTER_SYM ::= "@bottom-center"
628-
BOTTOMRIGHT_SYM ::= "@bottom-right"
629-
BOTTOMRIGHTCORNER_SYM ::= "@bottom-right-corner"
630-
LEFTTOP_SYM ::= "@left-top"
631-
LEFTMIDDLE_SYM ::= "@left-middle"
632-
LEFTBOTTOM_SYM ::= "@left-bottom"
633-
RIGHTTOP_SYM ::= "@right-top"
634-
RIGHTMIDDLE_SYM ::= "@right-middle"
635-
RIGHTBOTTOM_SYM ::= "@right-bottom"
636-
637-
<dfn>media</dfn> :
638-
MEDIA_SYM S* medium [ COMMA S* medium ]* LBRACE S* [ <a>page_rule</a> | ruleset ]* '}' S*
639-
;
640-
641-
<dfn id="syntax-prod-page">page_rule</dfn> :
642-
PAGE_SYM S* <a>page_selector_list</a> '{' S* <a>page_body</a> '}' S*
643-
;
644-
645-
<dfn>page_selector_list</dfn> :
646-
[ <a>page_selector</a> S* [ ',' <a>page_selector</a> S* ]* ]?
647-
;
648-
649-
<dfn>page_selector</dfn> :
650-
<a>pseudo_page</a>+ | IDENT <a>pseudo_page</a>*
651-
;
652-
653-
<dfn id="syntax-prod-pseudo-page">pseudo_page</dfn> :
654-
':' [ "left" | "right" | "first" | "blank" ]
655-
;
656-
657-
<dfn>page_body</dfn> : /* Can be empty */
658-
declaration? [ ';' S* <a>page_body</a> ]? |
659-
<a>page_margin_box</a> <a>page_body</a>
660-
;
661-
662-
<dfn id="syntax-prod-margin">page_margin_box</dfn> :
663-
<a>margin_sym</a> S* '{' S* declaration? [ ';' S* declaration? ]* '}' S*
664-
;
665-
666-
<dfn id="syntax-prod-margin-sym">margin_sym</dfn> :
667-
TOPLEFTCORNER_SYM |
668-
TOPLEFT_SYM |
669-
TOPCENTER_SYM |
670-
TOPRIGHT_SYM |
671-
TOPRIGHTCORNER_SYM |
672-
BOTTOMLEFTCORNER_SYM |
673-
BOTTOMLEFT_SYM |
674-
BOTTOMCENTER_SYM |
675-
BOTTOMRIGHT_SYM |
676-
BOTTOMRIGHTCORNER_SYM |
677-
LEFTTOP_SYM |
678-
LEFTMIDDLE_SYM |
679-
LEFTBOTTOM_SYM |
680-
RIGHTTOP_SYM |
681-
RIGHTMIDDLE_SYM |
682-
RIGHTBOTTOM_SYM
683-
;
609+
''@page'' rules are [=CSS/parsed=] according to the following grammar,
610+
plus the additional rules noted below:
611+
612+
<pre class=prod>
613+
@page = @page <<page-selector-list>>? { <<declaration-list>> }
614+
<dfn><<page-selector-list>></dfn> = <<page-selector>>#
615+
<dfn><<page-selector>></dfn> = [ <<ident-token>>? <<pseudo-page>>* ]!
616+
<dfn><<pseudo-page>></dfn> = ':' [ left | right | first | blank ]
617+
618+
/* Margin rules */
619+
<dfn>@top-left-corner</dfn> = @top-left-corner { <<declaration-list>> };
620+
<dfn>@top-left</dfn> = @top-left { <<declaration-list>> };
621+
<dfn>@top-center</dfn> = @top-center { <<declaration-list>> };
622+
<dfn>@top-right</dfn> = @top-right { <<declaration-list>> };
623+
<dfn>@top-right-corner</dfn> = @top-right-corner { <<declaration-list>> };
624+
<dfn>@bottom-left-corner</dfn> = @bottom-left-corner { <<declaration-list>> };
625+
<dfn>@bottom-left</dfn> = @bottom-left { <<declaration-list>> };
626+
<dfn>@bottom-center</dfn> = @bottom-center { <<declaration-list>> };
627+
<dfn>@bottom-right</dfn> = @bottom-right { <<declaration-list>> };
628+
<dfn>@bottom-right-corner</dfn> = @bottom-right-corner { <<declaration-list>> };
629+
<dfn>@left-top</dfn> = @left-top { <<declaration-list>> };
630+
<dfn>@left-middle</dfn> = @left-middle { <<declaration-list>> };
631+
<dfn>@left-bottom</dfn> = @left-bottom { <<declaration-list>> };
632+
<dfn>@right-top</dfn> = @right-top { <<declaration-list>> };
633+
<dfn>@right-middle</dfn> = @right-middle { <<declaration-list>> };
634+
<dfn>@right-bottom</dfn> = @right-bottom { <<declaration-list>> };
684635
</pre>
685636

637+
In addition, the following rules apply:
638+
639+
* No whitespace is allowed between the productions in <<page-selector>> or <<pseudo-page>>
640+
(similar to the rule for <<compound-selector>>).
641+
* The ''@page'' rule can only contain <a>page properties</a> and <a>margin at-rules</a>.
642+
* The <a>margin at-rules</a> can only contain <a>page-margin properties</a>.
643+
644+
645+
686646
<div class="example">
687647
The following are examples of page selectors (declaration block intentionally
688648
left blank)
@@ -978,17 +938,16 @@ millimeter margins and 14 point type in the page-margin boxes:
978938
<h3 id="margin-at-rules">At-rules for page-margin boxes</h3>
979939

980940
Page-margin boxes are created by
981-
<a href="#margin-at-rules">margin at-rules</a>
941+
<a>margin at-rules</a>
982942
inside the <a href="#page-context">page context</a>.
983943
Authors should put these rules after any declarations in the page context
984944
as legacy clients may not handle declarations
985945
after margin at-rules correctly.
986946

987-
A <dfn id="margin-at-rule" lt="@margin" at-rule>margin at-rule</dfn> consists of an
988-
<a href="#specializatons-of-ATKEYWORD">ATKEYWORD</a>
947+
A <dfn id="margin-at-rule">margin at-rule</dfn> is an <a>at-rule</a>
989948
that identifies the page-margin box
990-
(e.g. ''@top-left'') and a block of declarations (said
991-
to be in the <dfn export id="margin-context">margin context</dfn>).
949+
(e.g. ''@top-left'') and a block of descriptors
950+
(said to be in the <dfn export id="margin-context">margin context</dfn>).
992951

993952
<div class="example">
994953

@@ -1013,9 +972,9 @@ right side:
1013972
<h3 id="populating-margin-boxes">Populating page-margin boxes</h3>
1014973

1015974
As with the '':before'' and '':after'' pseudo-elements,
1016-
a specified 'content: normal' on a page-margin box computes to ''none''.
975+
a specified ''content: normal'' on a page-margin box computes to ''content/none''.
1017976
A page-margin box is <dfn>generated</dfn>
1018-
if and only if the computed value of its 'content' property is not ''none''.
977+
if and only if the computed value of its 'content' property is not ''content/none''.
1019978
Otherwise, no box is generated, as for elements with ''display: none''.
1020979

1021980
<p class=note>
@@ -1048,7 +1007,8 @@ violate their constraints.
10481007
If the UA does not support the 'min-height' or 'min-width' properties
10491008
then it must behave as if 'min-height' and 'min-width' were always zero.
10501009

1051-
<h4 id="margin-box-terms"><span id="max-margin-dimension"></span>Page-Margin Box Layout Terminology</h4>
1010+
<h4 id="margin-box-terms" oldids="max-margin-dimension">
1011+
Page-Margin Box Layout Terminology</h4>
10521012

10531013
In addition to the box model definitions in CSS2.1 [[!CSS21]],
10541014
and the sizing terms in CSS Intrinsic Sizing [[!CSS3-SIZING]],
@@ -1472,7 +1432,7 @@ Page Properties</h2>
14721432

14731433
<li>
14741434
As on the '::before' and '::after' pseudo-elements,
1475-
the ''content/normal'' value of the 'content' property computes to ''none''
1435+
the ''content/normal'' value of the 'content' property computes to ''content/none''
14761436
on page-margin boxes.
14771437

14781438
<li>
@@ -2170,7 +2130,8 @@ Appendix A: Applicable CSS2.1 Properties</h2>
21702130
<h3 class="no-num" id="page-property-list">
21712131
CSS 2.1 Properties that apply within the page context</h3>
21722132

2173-
This list is described in [[#page-properties]].
2133+
This list defines the <dfn export lt="page property">page properties</dfn>.
2134+
They are further described in [[#page-properties]].
21742135

21752136
<table class="data">
21762137
<tbody>
@@ -2285,7 +2246,8 @@ Appendix A: Applicable CSS2.1 Properties</h2>
22852246
<h3 class="no-num" id="margin-property-list">
22862247
CSS 2.1 properties that apply within the margin contexts</h3>
22872248

2288-
This list is described in the [[#page-properties]].
2249+
This list defines the <dfn export lt="page-margin property">page-margin properties</dfn>.
2250+
They are further described in [[#page-properties]].
22892251

22902252
<table class="data">
22912253
<tbody>
@@ -2420,7 +2382,7 @@ Changes</h2>
24202382

24212383
<ul>
24222384
<li>Imported the 'marks' and 'bleed' properties from [[CSS3GCPM]].
2423-
<li>Added ''bleed/auto'' as the initial value of 'bleed' and allowed it to apply even when 'marks' is ''none''.
2385+
<li>Added ''bleed/auto'' as the initial value of 'bleed' and allowed it to apply even when 'marks' is ''marks/none''.
24242386
<li>Added JIS-B4 and JIS-B5
24252387
</ul>
24262388

0 commit comments

Comments
 (0)