W3C home > Mailing lists > Public > www-style@w3.org > March 2013

Re: [css3-page] Add way for webpage to signal UA to disable default footer/header

From: Simon Sapin <simon.sapin@exyr.org>
Date: Mon, 04 Mar 2013 17:01:31 +0100
Message-ID: <5134C55B.5080400@exyr.org>
To: Julian Viereck <julian.viereck@googlemail.com>
CC: www-style@w3.org, Robert O'Callahan <robert@ocallahan.org>
Le 03/03/2013 00:54, Julian Viereck a écrit :
> Reading the spec I cannot find a part that defines what should happen
> with the UA's default header/footer of a HTML page when it is printed.
> In the usecase of the PDF viewer, as a user prints a PDF page s/he
> doesn't expect to see the default UA's print header/footer. To disable
> the default header/footer in Gecko/Firefox, I've implemented a new flag
> "moznomarginboxes" on the <html> tag [1]. With this flag, a webpage
> signals Gecko/Firefox to set the footer/header to "blank" by default.
> The user has still the possibility to change the footer/header to a
> different value then "blank" from the print-option dialog.
>
> I'm aware that this is the CSS mailing list and not a HTML one, which
> might look more suited to discuss adding new flags on HTML tags at first
> sight. However, as CSS Paged Media spec defines a lot of the printing
> properties, I considered it worth raising this issue on this list.
>
> Summing up, here are some questions that I hope lead to a good
> discussion of this issue:
>
> - Does adding a flag like "nomarginboxes" makes sense?

What’s a flag in this context? Is it something that can be switched from 
JavaScript? From CSS?


> - Is there a better way to specify "disable the browsers default
> header/footer when printing" by using CSS?

No. At least not in the Paged Media module.


> - Should there be a section added to the CSS Paged Media spec that
> specifies the UA's default footer/header behavior if there is a
> page-margin box defined using CSS (e.g. disable the UA's footer/header
> by default as soon as there is at least one page-margin box defined in
> the printed document)?

This issue was brought up recently:
http://lists.w3.org/Archives/Public/www-style/2013Feb/0478.html

But not much before, since so far no UA had both "default" 
headers/footers like Firefox’s and support for author-defined 
page-margin boxes as in css3-page.


One way to unify all this would be to have the default headers be 
implemented through a generated stylesheet of user or UA "origin", and 
let the cascade resolve conflicts.

PDF.js could disable all page-margin boxes like this:

@page {
   @top-left-corner { content: none }
   @top-left { content: none }
   @top-center { content: none }
   @top-right { content: none }
   @top-right-corner { content: none }
   @bottom-left-corner { content: none }
   @bottom-left { content: none }
   @bottom-center { content: none }
   @bottom-right { content: none }
   @bottom-right-corner { content: none }
   @left-top { content: none }
   @left-middle { content: none }
   @left-bottom { content: none }
   @right-top { content: none }
   @right-middle { content: none }
   @right-bottom { content: none }
}

… not very pretty, but well-defined.

However I don’t like the possibility of having both author-defined and 
"default" headers end up on the same printed page.


So another option could be, as you say, to completely disable the 
default headers and footers in some situation:

a. If at least one page-margin box is generated [1] on the current page. 
(I don’t like the inconsistency between pages of the document)

b. … on any page of the same document (costly to implement, you need to 
look for "propagated" values of the 'page' property in the box tree.)

c. If any margin at-rule is used in author stylesheets (simpler)

d. With an explicit switch, maybe a new property in the @page context. 
(Not very elegant.)

e. Some other condition?

[1] http://dev.w3.org/csswg/css3-page/#generated


What do you think?

-- 
Simon Sapin
Received on Monday, 4 March 2013 16:02:03 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:06 GMT