Closed Bug 1664178 Opened 1 year ago Closed 1 year ago

PDF documents previewed via Printer icon are not displayed correctly

Categories

(Core :: Print Preview, defect, P2)

Desktop
All
defect

Tracking

()

RESOLVED FIXED
82 Branch
Tracking Status
firefox-esr68 --- unaffected
firefox-esr78 --- unaffected
firefox80 --- unaffected
firefox81 --- wontfix
firefox82 --- fixed

People

(Reporter: vlucaci, Assigned: emilio)

References

(Blocks 2 open bugs, Regression)

Details

(Keywords: regression, Whiteboard: [print2020_v82] [old-ui-] )

Attachments

(2 files)

Attached image pdf995.gif

Affected versions

  • 81.0b8
  • 82.0a1 (2020-09-10)

Affected platforms

  • Windows 10x64
  • Ubuntu 18.04
  • macOS 10.14

Steps to reproduce

  1. Launch FF.
  2. Go to http://pdf995.com/samples/pdf.pdf
  3. Print preview the page via burger menu or CTRL+P
  4. Close the PP modal.
  5. Click on the PDF Print button.

Expected result

  • Document is displayed in the same way in .js module as it is presented in Print Preview.

Actual result

  • Document opened in pdf.js module displays pages randomly(sometimes inverted, sometimes zoomed in, sometimes zoomed out, etc)

Suggested Severity

  • Seeing as how this issue only occurs with this specific document, I would suggest an S3

Regression range

  • Will return with regression ASAP

Additional notes

  • Did not manage to reproduce this issue with other pdf documents.
  • This issue does not occur for the old UI.

I was unable to narrow the regression down even more than :

https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=4a18696ce81f949bd4fea1a68966a4e335d8fbad&tochange=5a77c0b857048d46fe4bced46b2234b49dcc84a2

I suspect 1661627 is the culprit here. Hiro, could you take a look?

Has Regression Range: --- → yes
Has STR: --- → yes
Flags: needinfo?(hikezoe.birchill)
Keywords: regression
Severity: -- → S3
Priority: -- → P2
Whiteboard: [print2020_v81] [old-ui-] → [print2020_v82] [old-ui-]

I think this is caused by the same root cause of bug 1663448.

Flags: needinfo?(hikezoe.birchill)
Regressed by: 1662914
See Also: → 1663448

Emilio is totally right (as in bug 1663448 comment 4).

In this pdf case, there remain stateStack when endDrawing is called from cancel().

  for (let i = this.stateStack.length; i > 0; i--) {                        
      this.restore();                                                         
  }

I've confirmed that adding above code in endDrawing fixes this case and bug 1663448, but I am totally unsure about the relationship between stateStack and this.current.activeSMask (mask operations).

Brendan, can you please take care of this bug, or tell me what the right approach to fix this bug? Thanks!

Flags: needinfo?(bdahl)

Whatever that state is restoring, this function should clear it to. Probably the transform matrix should be set to an identity.

Probably just calling ctx.resetTransform() should do.

Attached file PDF.js PR
Assignee: nobody → emilio
Status: NEW → ASSIGNED
Flags: needinfo?(bdahl)

Should be fixed by bug 1665812.

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Depends on: 1665812
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
You need to log in before you can comment on or make changes to this bug.