Add support for page margin boxes, when printing a web document, or exporting it as PDF. @page margin boxes allows an author to define the contents in the margin area of a page, for instance to provide custom headers and footers, rather than using the built-in headers and footers generated by the browser. A margin box is defined via an at-rule inside a CSS @page rule. There are 16 rules defined, one for each page margin box. There's one margin box for each of the 4 corners on the page, and three (start, middle, end) for each of the 4 sides. The appearance and the contents of a margin box are specified with CSS properties inside the at-rule, including the "content" property. Counters are also to be supported, for page numbering. The specification defines two special counter names: "page" for the current page number, and "pages" for the total number of pages.
The spec defines the CSS counter names 'page' and 'pages'. Both are accessible by the document's contents, so that any element may use the counters to tell the current page number, or the total number of pages. Documents that use these counter names without being aware of this feature may be in for a surprise. Most browsers offer to generate some default headers and footers, and they are usually enabled by default. If the document has margin at-rules, they may come in conflict. We need some way of making sure that we either use the browser-default headers and footers, or the author-defined @page margins.
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
None
None
WPT tests will be written and submitted while working on this feature.
Shipping on desktop | 131 |
Shipping on Android | 131 |
Shipping on WebView | 131 |
Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).
None
Contact emails
mste...@chromium.org
Explainer
https://github.com/mstensho/page-margin-boxes
Specification
https://drafts.csswg.org/css-page-3/#margin-boxes
Summary
Add support for page margin boxes, when printing a web document, or exporting it as PDF. @page margin boxes allows an author to define the contents in the margin area of a page, for instance to provide custom headers and footers, rather than using the built-in headers and footers generated by the browser. A margin box is defined via an at-rule inside a CSS @page rule. There are 16 rules defined, one for each page margin box. There's one margin box for each of the 4 corners on the page, and three (start, middle, end) for each of the 4 sides. The appearance and the contents of a margin box are specified with CSS properties inside the at-rule, including the "content" property. Counters are also to be supported, for page numbering. The specification defines two special counter names: "page" for the current page number, and "pages" for the total number of pages.
Blink component
Blink>Layout>Printing
TAG review
https://github.com/w3ctag/design-reviews/issues/918
TAG review status
Issues addressed
Risks
Interoperability and Compatibility
The spec defines the CSS counter names 'page' and 'pages'. Both are accessible by the document's contents, so that any element may use the counters to tell the current page number, or the total number of pages. Documents that use these counter names without being aware of this feature may be in for a surprise. Most browsers offer to generate some default headers and footers, and they are usually enabled by default. If the document has margin at-rules, they may come in conflict. We need some way of making sure that we either use the browser-default headers and footers, or the author-defined @page margins.
Can you clarify what you mean by "in for a surprise"? I don't
think I understand the compat implications of @page+ margin boxes
here.
Also, do you have a plan for default header/footer conflicts w/
developer-provided ones?
Gecko: No signal (https://github.com/mozilla/standards-positions/issues/921)
WebKit: No signal (https://github.com/WebKit/standards-positions/issues/275)
Web developers: Positive https://bugs.chromium.org/p/chromium/issues/detail?id=320370 currently has 98 stars.
Other signals:
WebView application risks
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
None
Debuggability
None
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/66ec9090.2b0a0220.b3b1b.006b.GAE%40google.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/dff2c291-19d5-452a-a71e-3f4f0a35c1d4%40chromium.org.
LGTM3
/Daniel
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOMQ%2Bw8UsROUMmf3J%3DqWuWoYQhLKSXimipxhz_uWVHJOgXU6tQ%40mail.gmail.com.