Closed Bug 1660857 Opened 1 year ago Closed 1 year ago

In black&white print mode, there's an unexpected border around the page content

Categories

(Core :: Print Preview, defect, P2)

defect

Tracking

()

VERIFIED FIXED
82 Branch
Tracking Status
firefox81 --- verified
firefox82 --- verified

People

(Reporter: dholbert, Assigned: emilio)

References

Details

(Whiteboard: [print2020_v81] [old-ui+])

Attachments

(4 files, 1 obsolete file)

STR:

  1. Ensure you have print.tab_modal.enabled = true in about:config
  2. View a simple page, e.g. about:blank or data:text/html,<title>Hi</title>ohai
  3. Print with Ctrl+P
  4. In the "Color mode" dropdown, choose "Black & White"
  5. Choose "Save to PDF" as your printer, and click "Save" at the bottom.
  6. View the resulting PDF.

ACTUAL RESULTS:
You end up with a page with a dark border around the page content.

EXPECTED RESULTS:
No such dark border.

This only happens in Black & White mode, as far as I can tell.

Flags: needinfo?(emilio)

I'm on Ubuntu 20.04, with Nightly 81.0a1 (2020-08-24) (64-bit)

(Also, the text seems to be blurry in black & white mode -- you can see that in the header/footer-text in my attached about:blank PDF. That may be a separate issue, though.)

Ugh. The B&W filter should be applied on the preview only. It should never be applied to the document that actually prints or is saved to PDF since the filter will cause us to pre-rasterize at a very low resolution.

In the case of Save-to-PDF we should probably not allow the user to select B&W while we implement this using a filter, since then we're caught between saving at low resolution due to the filter, or unexpectedly saving in color when the user chose B&W.

Priority: -- → P2
Whiteboard: [print2020] → [print2020_v81]
Assignee: nobody → emilio

I sent two patches, but for the second to land we need to actually fix nsPrintSettings::SetPrintInColor for the different back-ends that aren't gtk.

This helps to prevent some snapping issues on the cairo back-end, and
seems harmless anyway because we don't have non-grey text for the
headers / footers of a page.

See Also: → 1660875
See Also: 1660875
Duplicate of this bug: 1660875

(In reply to Emilio Cobos Álvarez (:emilio) from comment #5)

I sent two patches, but for the second to land we need to actually fix nsPrintSettings::SetPrintInColor for the different back-ends that aren't gtk.

Would you mind filing a helper bug for that nsPrintSettings::SetPrintInColor change?

Severity: -- → S3

(In reply to Daniel Holbert [:dholbert] from comment #9)

Would you mind filing a helper bug for that nsPrintSettings::SetPrintInColor change?

I kinda was planning on doing the work here tomorrow, but sure, I can do that.

Status: NEW → ASSIGNED
Depends on: 1660986

(In reply to Emilio Cobos Álvarez (:emilio) from comment #10)

(In reply to Daniel Holbert [:dholbert] from comment #9)

Would you mind filing a helper bug for that nsPrintSettings::SetPrintInColor change?

I kinda was planning on doing the work here tomorrow, but sure, I can do that.

Thanks! I just wanted to make sure it was tracked somewhere. :)

Also FWIW: I confirmed that the "fuzzy text" aspect of this bug (described in dupe bug 1660875) does manifest in actual printed output (not entirely surprisingly), in yesterday's Nightly.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #13)

Created attachment 9172199 [details]
Bug 1660857 - Disable color switch for print-to-pdf and on mac. r=emalysz

Will this help with the photo shown in comment 12? (fuzzy/low-quality text when printing to real printers, on Linux, if B&W is selected)

(I'm guessing not... Should I file a separate bug on Linux real-printer fuzziness? Or should this patch expand to also disable on linux? [if windows is fine])

(In reply to Daniel Holbert [:dholbert] from comment #14)

(I'm guessing not... Should I file a separate bug on Linux real-printer fuzziness? Or should this patch expand to also disable on linux? [if windows is fine])

Yes it should. By not applying the filter to the print document we shouldn't rasterize it, and we should use the native b&w support.

Flags: needinfo?(emilio)

Oh, right - I take it we'll get that improvement (ditching the filter during actual printing) via the earlier patch, https://phabricator.services.mozilla.com/D88065 .

Attachment #9171781 - Attachment is obsolete: true
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6c8985ac1d4c
Only apply grayscale filter for printing on print preview. r=jwatt,dholbert
https://hg.mozilla.org/integration/autoland/rev/1378546cc0db
Disable color switch for print-to-pdf and on mac. r=emalysz
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5f76c97b6f20
Only apply grayscale filter for printing on print preview. r=jwatt,dholbert
https://hg.mozilla.org/integration/autoland/rev/734239903719
Disable color switch for print-to-pdf and on mac. r=emalysz
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch

(FWIW in the macOS system print dialog when you select 'Black & White' then save to PDF, it creates a PDF with color.)

Reminder to request Beta uplift.

Flags: needinfo?(emilio)
Depends on: 1661645
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/02088daa4be2
Port bug 1660857 - Adjust browser_parsable_css.js white-list. rs=bustage-fix DONTBUILD
Whiteboard: [print2020_v81] → [print2020_v81] [old-ui+]

Let's wait for bug 1661645 first.

Flags: needinfo?(emilio)
Regressions: 1661722

Comment on attachment 9172199 [details]
Bug 1660857 - Disable color switch for print-to-pdf and on mac. r=emalysz

Beta/Release Uplift Approval Request

  • User impact if declined: The color switching behavior will be incorrect
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: On mac:
  1. Open firefox with print.tab_modal.enabled to true
  2. Print a page
  3. Notice the color switching section is disabled
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): no strings
  • String changes made/needed: n/a
Attachment #9172199 - Flags: approval-mozilla-beta?
Attachment #9171782 - Flags: approval-mozilla-beta?
Flags: qe-verify+

Comment on attachment 9171782 [details]
Bug 1660857 - Only apply grayscale filter for printing on print preview. r=jwatt,dholbert

Approved for 81.0b6.

Attachment #9171782 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9172199 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [qa-triaged]

Confirming this issue as verified fixed on macOS 10.15, Ubuntu 18.04 and Windows 10x64. Verified using 82.0a1 (2020-09-09) and 81.0b8

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.