webdriver icon indicating copy to clipboard operation
webdriver copied to clipboard

Better define Print "formatting hints"

Open gsnedders opened this issue 7 months ago • 3 comments

https://w3c.github.io/webdriver/#print-page has:

In addition, the following formatting hints should be applied by the UA:

If scale is not equal to 1: Zoom the size of the content by a factor scale

If background is false: Suppress output of background images

If shrinkToFit is true: Resize the content to match the page width, overriding any page width specified in the content

These seem basically entirely undefined.

What does "zoom the size of the content" mean? Does this effectively just "set the zoom property on the root element"?

While "suppress output of the background images" is clear, I expect we should actually just define this by reference to https://drafts.csswg.org/css-color-adjust-1/#propdef-print-color-adjust (which is admittedly very open-ended!).

"Resize the content to match the page width" is also incredibly vague. Like, we're always setting a page width and height, thus aren't we setting the size of the page box, and thus the content won't be larger than the width?

gsnedders avatar Apr 23 '25 23:04 gsnedders

Related https://github.com/w3c/webdriver-bidi/issues/686

OrKoN avatar Apr 24 '25 04:04 OrKoN

Also related: https://github.com/web-platform-tests/rfcs/pull/221 (because it's hard to do in wptrunner as long as the formatting hints are so broadly defined).

gsnedders avatar May 06 '25 15:05 gsnedders

While "suppress output of the background images" is clear, I expect we should actually just define this by reference to https://drafts.csswg.org/css-color-adjust-1/#propdef-print-color-adjust (which is admittedly very open-ended!).

The other thing about the spec there is it says:

If user agents allow users to control this aspect of the document’s display, the user preference must be respected more strongly than the hint provided by print-color-adjust.

If background is true/false, defaulting to false, and if it is considered a user preference for print-color-adjust, then there is no way to test print-color-adjust support.

gsnedders avatar May 06 '25 15:05 gsnedders