Closed Bug 1870243 Opened 1 year ago Closed 1 year ago

Highlighting text multiple times and using Print Save the file as a PDF will hide the Text behind the Highlight

Categories

(Core :: Printing: Output, defect)

Desktop
Unspecified
defect

Tracking

()

VERIFIED FIXED
123 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox120 --- unaffected
firefox121 --- unaffected
firefox122 --- disabled
firefox123 --- verified

People

(Reporter: rdoghi, Assigned: calixte)

References

(Regression)

Details

(Keywords: regression)

Attachments

(4 files)

Attached video Highlight2.mp4

Found in

  • Nightly 122.0a1 (2023-12-15)

Affected versions

  • Nightly 122.0a1 (2023-12-15)

Affected platforms

  • all

Steps to reproduce

  1. Open a PDF file with text in Firefox.
  2. Enable the Highlight tool.
  3. Highlight different pieces of text from the same page. (at least 2 different rows)
  4. Select Print > Save File as PDF.

Expected result

  • The Text should be visible with the highlight applied.

Actual result

  • The second or third Highlighted Text is hidden behind the Highlight.

Please note that If we save the file as PDF directly from the Save button, or with the Foxit Reader PDF Printer, the issue does not occur.

Regression range
16:48.53 INFO: No more integration revisions, bisection finished.
16:48.53 INFO: Last good revision: 4ef47a21279ae3d961d506f21be3b92c9d2fabff
16:48.54 INFO: First bad revision: 4f3e8abf7c7bac489ed5349ae3036306abf8a865
16:48.54 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=4ef47a21279ae3d961d506f21be3b92c9d2fabff&tochange=4f3e8abf7c7bac489ed5349ae3036306abf8a865

:rdoghi, if you think that's a regression, could you try to find a regression range using for example mozregression?

I think Bug 1868594 could be the culprit here but im not sure.

Keywords: regression
Regressed by: 1868594

:calixte, since you are the author of the regressor, bug 1868594, could you take a look?

For more information, please visit BugBot documentation.

Flags: needinfo?(cdenizet)

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

Attached file bug1870243.pdf

STR:

  • open the attached pdf
  • highlight "Hello"
  • highlight "World"
  • print and save to PDF
  • open the resulting pdf

The second highlight is opaque.

Flags: needinfo?(cdenizet)
Attached file bug1870243_printed.pdf

The resulting pdf contains the following code:

...
q
171.488 195.359 57.883 30.855 re W n
/b14 gs
0.329412 1 0.741176 rg /a0 gs
171.48 195.355 57.895 30.852 re f*
Q q
171.488 271.426 68.594 30.855 re W n
0.329412 1 0.741176 rg /a0 gs
171.48 271.418 68.602 30.852 re f*
Q

The first group has a /b14 gs and b14 is for composing with Multiply but the second doesn't have any composing operation.
I cannot reproduce the bug on mac but on windows 11.
I think this bug isn't specific to pdf.js, I tend to think that's related to the Cairo printing backend.
:jfkthame, any thoughts ?

Flags: needinfo?(jfkthame)

The bug is marked as tracked for firefox122 (beta) and tracked for firefox123 (nightly). We have limited time to fix this, the soft freeze is in 8 days. However, the bug still isn't assigned.

:marco, could you please find an assignee for this tracked bug? Given that it is a regression and we know the cause, we could also simply backout the regressor. If you disagree with the tracking decision, please talk with the release managers.

For more information, please visit BugBot documentation.

Flags: needinfo?(mcastelluccio)

When the first group is drawn, the current operator is set to multiply but when the states are restored the current operator is not resetted.
Consequently, when drawing the second group the current operator is unchanged and we don't have to set it.

Resetting the current operator just after (i.e. surface->current_operator = -1;):
https://searchfox.org/mozilla-central/rev/24ea2579c4a94d5da8db4bb529cbefe5e5e3c2d3/gfx/cairo/cairo/src/cairo-pdf-surface.c#419
is fixing the issue.

Component: PDF Viewer → Printing: Output
Product: Firefox → Core
Assignee: nobody → cdenizet
Status: NEW → ASSIGNED
Flags: needinfo?(mcastelluccio)

Removing tracking since pdfjs.enableHighlightEditor is only true in early beta and earlier.
I will update the Fx122 status to disabled after 122.0b6

Flags: needinfo?(jfkthame)
Pushed by cdenizet@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/13096f9cee84 Cherry-pick https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/256 to correctly reset the current operator when several added highlights in a pdf are printed r=jfkthame
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch

Verified as fixed in our latest Nightly build 123.0a1 (2024-01-07).

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

Attachment

General

Created:
Updated:
Size: