You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What browsers actually do when it comes to sizing pages and sizing sheets for @page size is quite complicated. A simplified description would be that CSS page size is always applied to the pages. But what happens to the sheets depends on whether the output target is a PDF file or a printer. If it is a PDF file, and if the user is printing one page per sheet, then the CSS page size is also applied to the "sheets" written into the PDF (the size of the page and sheet then match exactly). If the target is something else (perhaps a physical or virtual printer), then the page is scaled to fit whatever size of sheet is in use (perhaps what an output printer supports, or a size specified by the user) as described in the section of the spec that I linked above.
Prior to pull 173, sheets would all be the same size in WPT Print Reftests, which meant that only the scaling behavior was tested, and testing of the application of CSS page size rules to sheets could not be tested. That pull request changes the requirements on the test harness to apply CSS page size to the PDF sheets that are output. But that means that the scaling behavior described in section of the spec linked above now can't be tested.
I've encountered this issue while looking to test a bug that Firefox has where, if a page is much smaller than a sheet, Firefox will scale it up to fit the sheet rather than centering it or positioning it in the upper-left corner. This is pretty undesirable behavior from a user's point of view, and I plan to fix Firefox to match Chrome's centering behavior. But I would like to be able to add tests for that.
I think it is sensible for WPT Print Reftests to default to applying CSS page size to the sheets too, but given that browser's have the two different behaviors (size-the-sheet vs. scale-the-page), it would be useful if WPT Print Reftests had the flexibility to test the scale-the-page behavior.
Could we have some sort of mechanism for Print Reftests to specify that they would like to have the scale-the-page behavior when encountering CSS page size? Perhaps a meta tag, something like:
Firefox and Chrome certainly don't always agree here, but as long as there's no standard, should we really add WPT tests for it? And I think it's quite deliberate that the spec doesn't want to define this, since it's not just for browsers.
That said, I'm not happy about having to write internal Chromium tests (often they aren't even web tests) every time I change / fix something not covered by the spec.
For pagination/printing we need to consider both virtual pages and sheets of paper (multiple pages may be printed on a single sheet of paper).
This section of CSS Paged Media 3 talks about how to position pages on a sheet:
https://drafts.csswg.org/css-page-3/#positioning-page-box
What browsers actually do when it comes to sizing pages and sizing sheets for
@page size
is quite complicated. A simplified description would be that CSS page size is always applied to the pages. But what happens to the sheets depends on whether the output target is a PDF file or a printer. If it is a PDF file, and if the user is printing one page per sheet, then the CSS page size is also applied to the "sheets" written into the PDF (the size of the page and sheet then match exactly). If the target is something else (perhaps a physical or virtual printer), then the page is scaled to fit whatever size of sheet is in use (perhaps what an output printer supports, or a size specified by the user) as described in the section of the spec that I linked above.Prior to pull 173, sheets would all be the same size in WPT Print Reftests, which meant that only the scaling behavior was tested, and testing of the application of CSS page size rules to sheets could not be tested. That pull request changes the requirements on the test harness to apply CSS page size to the PDF sheets that are output. But that means that the scaling behavior described in section of the spec linked above now can't be tested.
I've encountered this issue while looking to test a bug that Firefox has where, if a page is much smaller than a sheet, Firefox will scale it up to fit the sheet rather than centering it or positioning it in the upper-left corner. This is pretty undesirable behavior from a user's point of view, and I plan to fix Firefox to match Chrome's centering behavior. But I would like to be able to add tests for that.
I think it is sensible for WPT Print Reftests to default to applying CSS page size to the sheets too, but given that browser's have the two different behaviors (size-the-sheet vs. scale-the-page), it would be useful if WPT Print Reftests had the flexibility to test the scale-the-page behavior.
Could we have some sort of mechanism for Print Reftests to specify that they would like to have the scale-the-page behavior when encountering CSS page size? Perhaps a meta tag, something like:
<meta name=page-size-fitting content=[match-sheet-to-page|scale-page-to-sheet]>
or just:
<meta name=size-sheets content=[yes|no]>
@jgraham @mstensho
The text was updated successfully, but these errors were encountered: