Closed Bug 851441 Opened 11 years ago Closed 3 years ago

[css3-page] implement @page rule size attribute

Categories

(Core :: CSS Parsing and Computation, enhancement, P1)

enhancement

Tracking

()

VERIFIED FIXED
Webcompat Priority P1
Tracking Status
firefox122 --- verified

People

(Reporter: teoli, Assigned: alaskanemily)

References

(Blocks 7 open bugs, )

Details

(5 keywords, Whiteboard: [DevRel:P3][layout:backlog][print2020])

CSS Paged Media Level 3 define the size attribute that allows to define the orientation of a page when printing it.

 @page{
     size:landscape;
 }

or (default value)

@page{
     size:portrait;
 }

I'm cc/ Brendan as I'm wondering if fixing this is necessary to fix some pdf.js bugs like bug 844090 .

Finally, it looks (but I weren't able to confirm/infirm it) that WebKit implement this property unprefixed.
(In reply to Jean-Yves Perrier [:teoli] from comment #0)

> 
> Finally, it looks (but I weren't able to confirm/infirm it) that WebKit
> implement this property unprefixed.

It is un-prefixed, at least on Chrome 27.0.1438.7 dev / OS X 10.8.3. 
(Note that, on OS X, it only works inside Chrome's own print-dialog. The OS X print dialog settings override it, tested both in Chrome and Webkit nightly. It is not unexpected - user setting)
Jean-Yves,

Consider these as suggestions.

1-
bug 137367 comment 8 suggests to set this kind of bug report's component field to Printing: Output and not Style System (CSS)

2-
You can expect some people to search for this bug with the string "@page" and/or with "size: landscape" (with a blank space separating the 2 words). CSS3 Paged Media may have better chances to be used for searching since the spec uses "Paged Media" and bug 286443 uses such terminology. And bug 286443 should definitely be a meta type of bug report.

So, I suggest the following as new summary:

[CSS3 Paged Media] Support for @page { size: landscape }


3-
Maybe add testcase-wanted keyword; I would.

Gérard
Are you only considering supporting 'landscape' and 'portrait'?

I'd love to enable native printing for Firefox in Google Docs (to print directly and not have to generate PDF server-side). But the lack of 'size' prevents that.

We set rules like size: 8.5in 11in; or pixel-sized rules, since we allow adjustment of page size and need precise control over how the page is printed. These values are specified for the property: http://www.w3.org/TR/css3-page/#page-size-prop

@philippe, the OS dialog doesn't respect the size property, although it's possible to use @media queries together with @page to target different page size targets. See: http://www.w3.org/TR/css3-page/#page-size-media-query

-Fil
> Are you only considering supporting 'landscape' and 'portrait'?

This bug 851441 report is only about supporting
@page {size: landscape }
where landscape is a reserved keyword.

> I'd love to enable native printing for Firefox in Google Docs (to print
> directly and not have to generate PDF server-side). But the lack of 'size'
> prevents that.
> 
> We set rules like size: 8.5in 11in; or pixel-sized rules, since we allow
> adjustment of page size and need precise control over how the page is
> printed. These values are specified for the property:
> http://www.w3.org/TR/css3-page/#page-size-prop

Fil, if you want to help, you can be helpful here: please create another bug report for this.

Give it the summary:

[CSS3 Paged Media] Support for @page { size: <page-size> } (eg. size: 4in 6in)

and make it blocking bug 286443 and Component field should be Printing: Output


How to Write a Proper Bug
https://quality.mozilla.org/docs/bugzilla/starter-kit/how-to-write-a-proper-bug/

Bug writing guidelines
https://developer.mozilla.org/en-US/docs/Mozilla/QA/Bug_writing_guidelines


Gérard
Blocks: 862677
> please create another bug report for this.

Bug 851937: [CSS3 Paged Media] Support for @page size
has been created for this.
Does this block or depend on bug #851937?
Yes, I'd say this bug blocks bug 851937.
We created this bug 851441 because several people in another bug report (can't find which now) were strongly requesting support for @page {size: landscape }.
Blocks: 851937
> We created this bug 851441 because several people in another bug report
> (can't find which now) 

bug 115199 comment #141

> were strongly requesting support for @page {size:
> landscape }.
Any news about this issue guys? :)
Note that CSS.supports('size', 'landscape'); and @supports incorrectly reports support for the size property. CSS.supports('size', 'bogus') correctly returns false, so somehow Firefox's CSS parser recognizes this property. Why is the property parsed but not used?
It's not clear to me whether @page-specific properties like size should be handled by @supports and CSS.supports() even if we implemented support for them.  We currently parse and expose these properties on regular declarations, like |p { size: landscape; }| and again I'm not sure whether that's correct.  I've asked here about that:

  https://lists.w3.org/Archives/Public/www-style/2015Mar/0387.html

We have parsed marks, orphans, size and widows for a long time, without actual support for their behaviour.  I don't know why that is.
In the very early days of Gecko, all the properties in CSS 2 were added at the style system level.  The print-specific ones are the only ones that we haven't taken out.  (Basically everything that's CSS_PROP_BACKENDONLY, plus any @page stuff.)  We should fix it, but just never got around to it.
Summary: [CSS-Page Level 3]Implement the size: property (ability to define 'landscape' for printing) → [css3-page] implement @page { size: portrait | landscape }
No longer blocks: 1246805
Whiteboard: [parity-webkit] → [parity-webkit][DevRel:P2]
Flags: platform-rel?
platform-rel: --- → ?
Whiteboard: [parity-webkit][DevRel:P2] → [parity-webkit][DevRel:P3]
platform-rel: ? → ---
See Also: → 1363148
> Simple test:
> http://www.gtalbot.org/BugzillaSection/Bug1363148-page-size-landscape.html

Argh... got confused with bug number. Please use instead:

size: landscape
http://www.gtalbot.org/BugzillaSection/Bug851441-page-size-landscape.html


3 additional tests:

size: 4in 6in landscape
http://www.gtalbot.org/BugzillaSection/Bug851441-page-size-landscape-002.html

size: letter landscape
http://www.gtalbot.org/BugzillaSection/Bug851441-page-size-landscape-003.html

size: legal landscape
http://www.gtalbot.org/BugzillaSection/Bug851441-page-size-landscape-004.html

Chrome 58 does not pass Bug851441-page-size-landscape-002 but passes the other 3 tests.
I am removing page-size-landscape-002 (size: 4in 6in landscape) because it uses invalid syntax.

Value: 	<length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ] 

means that portrait or landscape can only be added alongside of one of page-size reserved keywords.
Mass bug change to replace various 'parity' whiteboard flags with the new canonical keywords. (See bug 1443764 comment 13.)
Keywords: parity-safari
Whiteboard: [parity-webkit][DevRel:P3] → [DevRel:P3]
Whiteboard: [DevRel:P3] → [DevRel:P3][layout:backlog]
Whiteboard: [DevRel:P3][layout:backlog] → [DevRel:P3][layout:backlog:2020]
Whiteboard: [DevRel:P3][layout:backlog:2020] → [print2020]
Whiteboard: [print2020] → [DevRel:P3][layout:backlog:2020][print2020]
See Also: → 1631452
See Also: → 1631460

Now that we triage by severity, setting priority to P1 to reflect backlog prioritization on this bug as either in-progress, or planned development in the near term. See https://wiki.mozilla.org/Platform/Layout#Backlog_Tracking_in_Bugzilla

Priority: -- → P1
Assignee: nobody → emcdonough
Status: NEW → ASSIGNED

[print2020_v79] here means that this is being worked on in the v79 timescale, not that it is expected to be completed for v79.

Whiteboard: [DevRel:P3][layout:backlog:2020][print2020] → [DevRel:P3][layout:backlog:2020][print2020_v79]
Summary: [css3-page] implement @page { size: portrait | landscape } → [css3-page] implement @page rule size attribute
Depends on: 1647843
Depends on: 1647845
Depends on: 1647849
Depends on: 1647851
Whiteboard: [DevRel:P3][layout:backlog:2020][print2020_v79] → [DevRel:P3][layout:backlog:2020][print2020_v80]
Whiteboard: [DevRel:P3][layout:backlog:2020][print2020_v80] → [DevRel:P3][layout:backlog][print2020]
Webcompat Priority: --- → P1
Depends on: 1717703
Depends on: 1721265
Depends on: 1723239
Depends on: 1732802
Depends on: 1738358
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED

This bug appears to address situations where specific test pages have an attribute that forces either portrait or landscape orientation on print preview and print itself. It would also appear that this issue was fixed in Nightly v94.0a1 from 2021-09-30. A specific pushlog could not be provided due to the very old change (mozregression is unable to finish bisection because autoland builds are too old to still be around).

The following cases were tested on Windows 10, MacOS 11 and Ubuntu 22:
size: landscape http://www.gtalbot.org/BugzillaSection/Bug851441-page-size-landscape.html
size: portrait (by modifying the page above)
3 additional tests:
size: letter landscape http://www.gtalbot.org/BugzillaSection/Bug851441-page-size-landscape-003.html
size: legal landscape http://www.gtalbot.org/BugzillaSection/Bug851441-page-size-landscape-004.html

Landscape (or portrait) orientation is forced in print preview and portrait (or landscape) orientation cannot be enabled.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.