Open Bug 1782268 Opened 2 years ago Updated 2 years ago

Honor user-specified print margins that are smaller than are beyond the printable area (i.e. don't clamp to unwriteable area anymore)

Categories

(Core :: Printing: Output, task)

task

Tracking

()

People

(Reporter: dholbert, Unassigned)

References

Details

Spinning this off from bug 1681183 comment 8...

Right now, if a user specifies "Margins: Custom" and chooses very-small values, we clamp it to the printable area of the printer (internally referred to as unwriteableMargin). This means that user-specified custom-margins of 0, 0.01, 0.02, 0.03, etc. all behave the same (and so on, up until you reach what we believe to be your printer's printable area).

There's a case to be made that maybe we should stop doing this clamping. If a user requests a particular margin, maybe we should just go ahead and use it (and potentially clip if they've got content right at the edge of their viewport, oh well).

This seems to be what Chrome does, FWIW.

(If we decide to do this, we need to consider what -- if anything -- to do about users who inadvertently have zero/small margins that have been saved to their about:config prefs and which are currently just being gracefully clamped. This would include users who have selected e.g. Margins: None, which currently is just an alias for custom margins of 0/0/0/0. If we ship an update that removes our clamping behavior, these users will start getting clipped content when printing and will have to poke around at their print dialog [and e.g. remove their custom margin settings] in order to fix it. We may want to do some telemetry to get an idea for how many users would be in this situation, and/or ship a mitigation if we can come up with a not-terrible one, and/or just be ready for support requests and bug reports.)

Summary: Honor user-specified print margins that are smaller than are beyond the printable area (i.e. don't clamp to unwriteable area) → Honor user-specified print margins that are smaller than are beyond the printable area (i.e. don't clamp to unwriteable area anymore)

RE hypothetical mitigations, jfkthame suggested drawing a faint red line (or some other sort of indicator) to show the page's printable area, if the margins are set beyond that area.

(This would also be a good feature to have e.g. when printing a PDF with "Margins:Default" which may also overshoot the printable area. It would help mitigate stuff like bug 1692926, to clue users in that their PDF's going to get clipped and they may want to intervene & set some custom margins before actually printing.)

:emilio & :alaskanemily mentioned that we may have some debug code to visualize margins.

Yes, for regular margins (not [yet] for unwriteable margins). That's from bug 1631460:
https://searchfox.org/mozilla-central/rev/d45dd05bf412e7468b3770a52519e9d546d6325c/layout/generic/nsPageFrame.cpp#478-479

static void PaintMarginGuides(nsIFrame* aFrame, DrawTarget* aDrawTarget,
                              const nsRect& aDirtyRect, nsPoint aPt) {
You need to log in before you can comment on or make changes to this bug.