Closed Bug 1917715 Opened 1 year ago Closed 1 year ago

Print preview doesn't work properly for some SVG unless "print backgrounds" is checked

Categories

(Core :: Print Preview, defect)

defect

Tracking

()

VERIFIED FIXED
132 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 --- verified
firefox130 --- wontfix
firefox131 --- verified
firefox132 --- verified

People

(Reporter: glandium, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(5 files)

Attached file testcase.html

The attached HTML is reduced from an HTML file containing many things, including a full QR code as an embedded SVG image with more M instructions in the <path>. Print preview shows a big black box instead of the SVG as it can be seen on the page, unless "print backgrounds" is checked.

Attached file testcase 2 (reduced)

It looks like we're rendering

  <rect x="10" y="10" width="80" height="80" fill="white"></rect>

as having a black fill-color, for some reason (only when "Print Backgrounds" is un-checked).

Here's a testcase. Expected rendering (for a color printer target like our "Save to PDF" print backend) is a lime circle in a cyan square. Actual rendering is that plus an unwanted black square.

Seems like a regression..

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

Seems like a regression..

Indeed. For some reason there are a year or so worth of mozregression builds that aren't launching at all for me for some reason right now (no Firefox window appears at all), but I narrowed it to this still-quite-wide window:
Good: 2021-09-01
Bad: 2023-04-21

Also: from local testing, I think this is specific to rect which makes me suspect it's a bug in the rect-specific WebRender path builder, like bug 1892786 is. Per bug 1892786 comment 35, we have a special codepath for <rect>-with-fill-set-to-a-color, which runs some utility code to convert the specified fill to a color that WebRender can understand. Maybe that's broken in this case for some reason (e.g. because we're compositing over a document with no background, or something).

See Also: → 1892786

confirmed by flipping the pref from bug 1686654.

Keywords: regression
Regressed by: 1686654

Set release status flags based on info from the regressing bug 1686654

:nical, since you are the author of the regressor, bug 1686654, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

It's intended for text colors only (and it applies auto-darkening in
printing), see nsLayoutUtils::DarkenColorIfNeeded.

Assignee: nobody → emilio
Status: NEW → ASSIGNED

It's suitable for foreground colors only.

no need to needinfo nical; emilio's already taken this.

Flags: needinfo?(nical.bugzilla)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/465db4e0254f Don't use nsLayoutUtils::GetColor for SVG rects. r=dholbert https://hg.mozilla.org/integration/autoland/rev/8065270635ad Rename nsLayoutUtils::GetColor. r=longsonr,dholbert
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 132 Branch

The patch landed in nightly and beta is affected.
:emilio, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox131 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)

Comment on attachment 9423696 [details]
Bug 1917715 - Don't use nsLayoutUtils::GetColor for SVG rects. r=nical,dholbert

Beta/Release Uplift Approval Request

  • User impact if declined: comment 0
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: comment 0
  • List of other uplifts needed: none
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): It's a long-standing regression, but the patch is rather trivial.
  • String changes made/needed: none
  • Is Android affected?: Yes
Flags: needinfo?(emilio)
Attachment #9423696 - Flags: approval-mozilla-beta?
Flags: qe-verify+
Attachment #9423696 - Flags: approval-mozilla-esr128?

Comment on attachment 9423696 [details]
Bug 1917715 - Don't use nsLayoutUtils::GetColor for SVG rects. r=nical,dholbert

Approved for 131.0b5

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

Comment on attachment 9423696 [details]
Bug 1917715 - Don't use nsLayoutUtils::GetColor for SVG rects. r=nical,dholbert

Approved for 128.3esr. I'm also taking the second patch for easier ESR128 uplift ergonomics down the road.

Attachment #9423696 - Flags: approval-mozilla-esr128? → approval-mozilla-esr128+
Attachment #9423697 - Flags: approval-mozilla-esr128+

Reproduced the issue on Windows 10x64 on Fx 130.0 by using the provided testcase.html from comment 0.
Verified as fixed for testcase.hmtl from comment 0 on Windows 10x64 and MacOS 11.7.4 using Fx 131.0b5 and Nightly 132.0a1( 20240911).

Verified as fixed for testcase.hmtl from comment 0 on Windows 10x64 using Fx 128esr(treeherder build).

Status: RESOLVED → VERIFIED
Duplicate of this bug: 1892786
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: