-
Notifications
You must be signed in to change notification settings - Fork 83
safe-printable-inset META value proposal #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mstensho
wants to merge
5
commits into
web-platform-tests:main
Choose a base branch
from
mstensho:mstensho/safe-printable-inset
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # RFC #233: Simulate safe printable inset | ||
|
|
||
| ## Summary | ||
|
|
||
| We need a way of testing the [safe-printable-inset](https://github.com/w3c/csswg-drafts/pull/13190/files) property. | ||
|
|
||
| ## Details | ||
|
|
||
| Most printers have a small region along each edge of the paper edges that's not | ||
| reliably printable, usually due to the printer's paper handling mechanism. | ||
| Authors can steer clear of such unprintable areas using the | ||
| `safe-printable-inset` property, which applies in `@page` and `@page` margin | ||
| contexts. | ||
|
|
||
| There should be a way for print reftests to test this, by simulating unprintable | ||
| areas. | ||
|
|
||
| One rather straight-forward solution would be a META value that sets the width | ||
| of the unprintable area on all four sides. For instance: | ||
|
|
||
| `<meta name="safe-printable-inset" content="[inset-specifier]">` | ||
|
|
||
| where `inset-specifier` is a numeric value. This values is in centimeters, to | ||
| match the other inputs to webdriver when printing. Using centimeters isn't | ||
| great, since they don't convert nicely into CSS pixels (unlike inches), but | ||
| since everything else is already in centimeters, better follow suit. | ||
|
|
||
| Why just one value for all four edges? Although many printers indeed don't | ||
| necessarily have a uniform unprintable area width along each of the four paper | ||
| edges (although many do), so that just providing one value for all is an | ||
| oversimplification of reality, printers may rotate the print output at their own | ||
| discretion. The user agent may therefore not be able to make assumptions about | ||
| which edge (long or short?) will be fed first into the printer, or what | ||
| orientation the sheet of paper has. Therefore using just one value (which should | ||
| represent the larger of the four) seems reasonable. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does leave us unable to test all the different at-rules the descriptor applies to —
@page,@top-left-corner,@top-left,@top-center,@top-right,@top-right-corner,@right-top,@right-middle,@right-bottom,@bottom-right-corner,@bottom-right,@bottom-center,@bottom-left,@bottom-left-corner,@left-bottom,@left-middle,@left-top.The spec says, along these lines:
It's not entirely clear to me from the spec how you go from potentially seventeen values (if specified in
@pageand all the margin at-rules) to only one, because the "larger of these four values" makes an assumption that you've already gone from seventeen to four.Maybe starting with taking a single value is fine — but I could easily see us wanting to extend the metadata to take four values (potentially with semantics similar to the
marginproperty?) to be able to actually test the case where the user agent can make assumptions about what edge will be fed first.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not unable to test any of those at-rules. The safe printable inset will just be the same along each of the four edges.
@pageis adjacent to all four edges of a paper sheet, so all ofmargin-top,margin-right,margin-bottomandmargin-leftmay be affected by page margin safety.@blah-corneris adjacent to two of the edges. The remaining at-rules are adjacent to only one edge. For e.g.@top-center, onlymargin-topmay be affected by page margin safety. For@bottom-right-corner,margin-rightandmargin-bottommay be affected.Here's a test (not yet landed): https://chromium-review.googlesource.com/c/chromium/src/+/7415846/4/third_party/blink/web_tests/external/wpt/css/css-page/safe-printable-inset-003-print.html