-
Notifications
You must be signed in to change notification settings - Fork 46
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
browsingContext.print
: should emit InvalidArgument
when printing an empty content area
#473
Comments
would this clause apply for this case? If I understood the issue right, I would be in favour of changing the spec to indicate that printing empty content might not be supported and change the test. Unless there is a use case for doing those print operations? |
These "for any reason" clauses mean that strictly any test for the feature could be allowed to throw "unsupported operation" However practically we don't do that, and it probably wouldn't be helpful in general (e.g. it would make it look like an implementaton that always threw unsupported operation was conforming, which isn't the intent). But I think "because the page is zero size" is a totally reasonable reason to not generate a PDF and we could test for in the spec directly. Is it literally zero size that's the problem, or any size smaller than some value? Alternatively, if we don't want a spec change, we could adjust the specific tests to also pass if there's an "Unsupported Operation" exception. |
Let me make a few experiments and get back to this thread.
Shouldn't this be "Invalid Argument"? |
Please note that there is also some unclarity how a page size of 0 should be handled in general. There is the following csswg-drafts issue: There is also a bug in Firefox which covers this current issue that we allow printing of a 0x0 sized content area. |
https://chromium-review.googlesource.com/c/chromium/src/+/4611587 (and underlying crbug):
From the PR comment above, it seems that only literally zero size is the problem. |
Do you think it's worth to bring this topic to the monthly WG meeting? I'd just like to know what the next steps are, and it seems we don't yet have a consensus. I believe the AIs are:
|
Updated the WPT tests in the direction this thread is going to: web-platform-tests/wpt#40872 |
@thiagowfx would you mind bringing up this topic in the next monthly meeting? |
@whimboo We have already decided the direction of this topic. Unfortunately css-meeting-bot posted the minutes to the wrong issue, see them here: #481 (comment) There are currently no blockers for it, I just didn't have time to start it yet. |
I see. Thanks for pointing that out. Given that I wasn't around I missed that it has been discussed. As it looks like we are going to not allow sizes smaller than 1x1 pixels. |
Recap of #481 (comment):
If less than that, throw either In order to yield 1 point, we use this formula: px = cm * 96 / 2.54 ...wherein 96 is the PPI. For 1px (point), the cm equivalent is Is it appropriate to assume PPI=96 in the spec? |
Answering my own question: yes, it's appropriate to assume so, as per the W3C definition: https://www.w3.org/TR/css3-values/#absolute-lengths The question is now whether the minimum should be 1x1 point or 1x1 px. I hadn't realized there were two distinct units and were treating them as synonyms. If we do pixels, then we want the minimum possible If we do points, then it is: |
The minimum possible page size is 1x1 point. 1 point is equal to (2.54 / 72) cm. Docs: https://www.w3.org/TR/css3-values/#absolute-lengths Docs: https://stackoverflow.com/questions/139655/convert-pixels-to-points Fixed: #473
* browsing context: print: enforce minimum page size dimensions The minimum possible page size is 1x1 point. 1 point is equal to (2.54 / 72) cm. Docs: https://www.w3.org/TR/css3-values/#absolute-lengths Docs: https://stackoverflow.com/questions/139655/convert-pixels-to-points Fixed: #473 * add css-values-3 reference
webdriver/tests/bidi/browsing_context/print /margin.py
:test_margin_same_as_page_dimension
implementation is problematic with Chromium web-platform-tests/wpt#40870The
test_margin_same_as_page_dimension
test inwebdriver/tests/bidi/browsing_context/print /margin.py
in WPT currently emits a PDF and checks that it has empty content:For context, this happens to works on Firefox, but it does not work on Chromium, but this is not the point (the spec should be browser agnostic). On Chromium, it throws
webdriver.bidi.error.UnknownErrorException: unknown error (invalid print parameters: content area is empty)
, which is technically correct. Chromium cannot handle printing an empty content area.Putting vendors aside, the purpose of this issue is to question the validity of printing a page in either of these scenarios, which all produce an empty content area:
width
is zeroheight
is zerowidth
(=effectively zero width)height
(=effectively zero height)My understanding is that currently the BiDi spec implicitly allows this condition (@whimboo seems to agree).
That said, with further investigation...
@whimboo (source)
Hereby my proposal is to amend https://w3c.github.io/webdriver-bidi/#command-browsingContext-print with the following change (exact wording TBD, not sure how to express this in the precise way the spec requires):
Then we could change the WPT test accordingly.
Thoughts?
The text was updated successfully, but these errors were encountered: