Closed Bug 1900028 Opened 29 days ago Closed 27 days ago

[macOS] PDF saved from CSS Text page displays blank page

Categories

(Core :: Printing: Output, defect)

Desktop
macOS
defect

Tracking

()

VERIFIED FIXED
128 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox126 --- unaffected
firefox127 + verified
firefox128 --- verified

People

(Reporter: bhidecuti, Assigned: jfkthame)

References

(Regression)

Details

(Keywords: regression)

Attachments

(5 files)

Attached file attachment.cgi.pdf

Found in

  • 127.0b8

Affected versions

  • 128.0a1 (2024-05-30)
  • 127.0b8

Tested platforms

  • Affected platforms: macOS 14.4
  • Unaffected platforms: Windows 11, Ubuntu 22.04

Steps to reproduce

  1. Go to https://bug1722457.bmoattachments.org/attachment.cgi?id=9233262
  2. Print preview the page (from application menu or by pressing cmd+P leys)
  3. Select “Save to PDF” and then press the “Save” button
  4. Open the saved PDF and observe its content

Expected result

  • The content of the PDF is correctly displayed as seen in the print preview

Actual result

  • The saved PDF is empty - a blank page is displayed

Regression range

Additional notes

  • See the attached pdf

:jfkthame, since you are the author of the regressor, bug 1892913, could you take a look?

For more information, please visit BugBot documentation.

Flags: needinfo?(jfkthame)

Looks like the use of background-clip: text may be leading to a failure in the cairo-quartz backend. :(

Component: Print Preview → Printing: Output
Flags: needinfo?(jfkthame)

[Tracking Requested - why for this release]:

That seems like a fairly bad regression for users when this gets to release. Is background-clip:text something that you think will be common for people to run into?

Flags: needinfo?(jfkthame)

Use of background-clip: text is likely to be fairly rare, I'd guess, but I'm also concerned that there could be other constructions involving masking operations that hit a similar failure. Currently investigating....

Severity: S3 → S2
Flags: needinfo?(jfkthame)

The failure here is happening while we're handling the masking effect for background-clip: text, during replaying the recording for the print job in the parent process.

In DrawTargetCairo::PopLayer(), we call cairo_mask() which leads eventually to _cairo_quartz_cg_mask_with_surface() using a mask that is a cairo_image_surface with format CAIRO_FORMAT_A8. This calls _cairo_surface_to_cgimage to get a CGImageRef. Prior to the cairo 1.18.0 update, this used a helper CairoQuartzCreateCGImage to create the CGImage to return, as seen in the mozilla-release tree here.

The new code here instead tries to use cairo_quartz_image_surface_create followed by _cairo_quartz_surface_snapshot_get_image to get a CGImage. Unfortunately, cairo_quartz_image_surface_create only handles ARGB32 and RGB24 formats, and what we have here is an A8 mask, so it fails.

This results in _cairo_quartz_cg_mask returning UNSUPPORTED, and fallback from the quartz compositor to the cairo_fallback_compositor functions, which then fail to handle the (quartz) surface we're trying to use.

Rather than attempting to completely revert the changes to cairo-quartz-surface (which would lose other valuable improvements, such as the CGLayer support now provided in create_similar), I think a workaround that minimizes the risk here would be to check for CAIRO_FORMAT_A8 before calling cairo_quartz_image_surface_create, and instead use a (simplified version of) the older code with CairoQuartzCreateCGImage just for this case. This avoids touching the working code for the formats that cairo_quartz_image_surface_create supports, and only changes behavior in the case where we're about to hit an error state.

(I suspect this may be a bug that should be handled upstream, but currently am having problems building & testing cairo standalone on my macOS system, so don't have a simplified testcase suitable for reporting yet.)

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Attachment #9405152 - Attachment description: Bug 1900028 - Handle CAIRO_FORMAT_A8 in _cairo_surface_to_cgimage for masking operations. → Bug 1900028 - Handle CAIRO_FORMAT_A8 in _cairo_surface_to_cgimage for masking operations. r=#gfx-reviewers
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fc72de1d9d29
Handle CAIRO_FORMAT_A8 in _cairo_surface_to_cgimage for masking operations. r=gfx-reviewers,lsalzman
https://hg.mozilla.org/integration/autoland/rev/3b50ddf342c4
Add a simple print-reftest to check that background-clip:text doesn't break print/pdf output. r=jwatt

Backed out for causing reftest failures on 1900028-text-mask-pdf.html.

[task 2024-06-02T01:50:49.697Z] 01:50:49     INFO -  REFTEST TEST-START | gfx/tests/reftest/1900028-text-mask-pdf.html print gfx/tests/reftest/1900028-text-mask-pdf-ref.html
[task 2024-06-02T01:50:49.697Z] 01:50:49     INFO -  REFTEST TEST-LOAD | http://10.0.2.2:8854/tests/gfx/tests/reftest/1900028-text-mask-pdf.html | 639 / 2198 (29%)
[task 2024-06-02T01:57:13.552Z] 01:57:13     INFO -  REFTEST INFO | wait for org.mozilla.geckoview.test_runner complete; top activity=org.mozilla.geckoview.test_runner
[task 2024-06-02T01:57:13.553Z] 01:57:13     INFO -  REFTEST INFO | org.mozilla.geckoview.test_runner unexpectedly found running. Killing...
[task 2024-06-02T01:57:26.723Z] 01:57:26  WARNING -  REFTEST ERROR | TEST-UNEXPECTED-FAIL | gfx/tests/reftest/1900028-text-mask-pdf.html print gfx/tests/reftest/1900028-text-mask-pdf-ref.html | application timed out after 370 seconds with no output
[task 2024-06-02T01:57:26.723Z] 01:57:26     INFO -  REFTEST INFO | remotereftest.py | Application ran for: 0:10:54.661009
[task 2024-06-02T01:57:26.793Z] 01:57:26     INFO -  REFTEST INFO | Copy/paste: /builds/worker/fetches/minidump-stackwalk/minidump-stackwalk --symbols-url=https://symbols.mozilla.org/ --cyborg=/tmp/tmpvqg7fb4y/05d60f59-997d-b75d-160c-116c89423024.trace /tmp/tmps_vokrig/05d60f59-997d-b75d-160c-116c89423024.dmp /builds/worker/workspace/build/symbols
[task 2024-06-02T01:57:31.761Z] 01:57:31     INFO -  REFTEST INFO | Saved minidump as /builds/worker/workspace/build/blobber_upload_dir/05d60f59-997d-b75d-160c-116c89423024.dmp
[task 2024-06-02T01:57:31.761Z] 01:57:31     INFO -  REFTEST INFO | Saved app info as /builds/worker/workspace/build/blobber_upload_dir/05d60f59-997d-b75d-160c-116c89423024.extra
[task 2024-06-02T01:57:31.763Z] 01:57:31  WARNING -  REFTEST PROCESS-CRASH | application crashed [@ libc.so + 0x000000000008c66a] | gfx/tests/reftest/1900028-text-mask-pdf.html print gfx/tests/reftest/1900028-text-mask-pdf-ref.html
[task 2024-06-02T01:57:31.763Z] 01:57:31     INFO -  Process type: main
[task 2024-06-02T01:57:31.763Z] 01:57:31     INFO -  Process pid: 3445
[task 2024-06-02T01:57:31.763Z] 01:57:31     INFO -  Crash dump filename: /tmp/tmps_vokrig/05d60f59-997d-b75d-160c-116c89423024.dmp
[task 2024-06-02T01:57:31.763Z] 01:57:31     INFO -  Operating system: Android
[task 2024-06-02T01:57:31.763Z] 01:57:31     INFO -                    0.0.0 Linux 3.10.0+ #260 SMP PREEMPT Fri May 19 12:48:14 PDT 2017 x86_64
[task 2024-06-02T01:57:31.763Z] 01:57:31     INFO -  CPU: amd64
[task 2024-06-02T01:57:31.763Z] 01:57:31     INFO -       family 6 model 6 stepping 3
[task 2024-06-02T01:57:31.763Z] 01:57:31     INFO -       4 CPUs
[task 2024-06-02T01:57:31.763Z] 01:57:31     INFO -  Crash reason:  SIGABRT
[task 2024-06-02T01:57:31.763Z] 01:57:31     INFO -  Crash address: 0x0000000000001192
[task 2024-06-02T01:57:31.763Z] 01:57:31     INFO -  Crashing instruction: `cmp rax, -0xfff`
[task 2024-06-02T01:57:31.763Z] 01:57:31     INFO -  No memory accessed by instruction
[task 2024-06-02T01:57:31.763Z] 01:57:31     INFO -  Crashing address may be the result of a flipped bit:
[task 2024-06-02T01:57:31.764Z] 01:57:31     INFO -    0. Valid address: 0x0000000020001192 (0.250)
[task 2024-06-02T01:57:31.764Z] 01:57:31     INFO -    1. Valid address: 0x0000000040001192 (0.250)
[task 2024-06-02T01:57:31.764Z] 01:57:31     INFO -  Process uptime: not available
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -  Thread 0 AndroidUI (crashed)
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -   0  libc.so + 0x8c66a
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rax = 0xfffffffffffffffc    rdx = 0x0000000000000010
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rcx = 0xffffffffffffffff    rbx = 0x00000000ffffffff
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsi = 0x00007fff41105bc0    rdi = 0x000000000000001c
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rbp = 0x00000000ffffffff    rsp = 0x00007fff41105b48
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -        r8 = 0x0000000000000000     r9 = 0x0000000000000008
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       r10 = 0x00000000ffffffff    r11 = 0x0000000000000246
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       r12 = 0x00000000ffffffff    r13 = 0x000075b7fdf29f40
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       r14 = 0x0000000000000000    r15 = 0x0000000000000000
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rip = 0x000075b801adf66a
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: given as instruction pointer in context
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -   1  libc.so + 0x2a0e5
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105b50    rip = 0x000075b801a7d0e6
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -   2  libutils.so + 0x184e6
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105b70    rip = 0x000075b8003344e7
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -   3  libart.so + 0x14cd90
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105b80    rip = 0x000075b7fd858d91
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -   4  system@framework@boot-framework.art + 0x3d534f
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105b98    rip = 0x0000000070018350
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -   5  boot-framework.oat + 0xfff
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105ba8    rip = 0x00000000718f7000
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -   6  dalvik-main space (deleted) + 0x3309f
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105bc0    rip = 0x0000000012c330a0
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -   7  libart.so + 0x14cd90
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105c20    rip = 0x000075b7fd858d91
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -   8  libart.so + 0x39c37e
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105c60    rip = 0x000075b7fdaa837f
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -   9  libart.so + 0x6e3c3f
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105c68    rip = 0x000075b7fddefc40
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -  10  libutils.so + 0x1837a
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105cc0    rip = 0x000075b80033437b
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -  11  system@framework@boot-framework.art + 0x3f5b0f
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105ce8    rip = 0x0000000070038b10
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -  12  dalvik-main space (deleted) + 0x95d7
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105cf0    rip = 0x0000000012c095d8
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -  13  libandroid_runtime.so + 0xff855
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105d00    rip = 0x000075b8010f8856
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -  14  system@framework@boot-framework.art + 0x3f5b0f
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105d08    rip = 0x0000000070038b10
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -  15  boot-framework.oat + 0x1e1721f
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105d20    rip = 0x000000007370d220
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -  16  system@framework@boot-framework.art + 0x3f5b0f
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105d38    rip = 0x0000000070038b10
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -  17  dalvik-main space (deleted) + 0x95d7
[task 2024-06-02T01:57:31.766Z] 01:57:31     INFO -       rsp = 0x00007fff41105d40    rip = 0x0000000012c095d8
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -  18  system@framework@boot-framework.art + 0x3f578f
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -       rsp = 0x00007fff41105d48    rip = 0x0000000070038790
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -  19  system@framework@boot.art + 0x50f2c7
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -       rsp = 0x00007fff41105d68    rip = 0x000000006f9612c8
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -  20  system@framework@boot-framework.art + 0x3f5b0f
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -       rsp = 0x00007fff41105db0    rip = 0x0000000070038b10
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -  21  dalvik-main space (deleted) + 0x95d7
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -       rsp = 0x00007fff41105db8    rip = 0x0000000012c095d8
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -      Found by: stack scanning
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -  22  boot-framework.oat + 0x1e19033
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -       rsp = 0x00007fff41105dc0    rip = 0x000000007370f034
[task 2024-06-02T01:57:31.771Z] 01:57:31     INFO -      Found by: stack scanning
<...>
Flags: needinfo?(jfkthame)

Ah -- checking layout/reftests/reftest.list, I see that we currently skip print-reftests on Android and Linux, so it's unsurprising there were failures here.

I'll move the new test into the reftests/printing directory so that it is covered by the same skip annotations.

Flags: needinfo?(jfkthame)
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e15b43edcfc1
Handle CAIRO_FORMAT_A8 in _cairo_surface_to_cgimage for masking operations. r=gfx-reviewers,lsalzman
https://hg.mozilla.org/integration/autoland/rev/aae773c0940b
Add a simple print-reftest to check that background-clip:text doesn't break print/pdf output. r=jwatt
Attachment #9405194 - Flags: approval-mozilla-beta?
Attachment #9405195 - Flags: approval-mozilla-beta?

beta Uplift Approval Request

  • User impact if declined: print/save-to-pdf failure on macOS for some content
  • Code covered by automated testing: yes
  • Fix verified in Nightly: no
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: n/a
  • Risk associated with taking this patch: low
  • Explanation of risk level: restores behavior from previous version in the case that is failing
  • String changes made/needed: none
  • Is Android affected?: no
Status: ASSIGNED → RESOLVED
Closed: 27 days ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
Attachment #9405195 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9405194 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Approved for the beta branch before the beta to release merge and RC given that it is S2 and a new regression.

Verified as fixed on Firefox RC 127.0-build1 (build ID 20240603152359) and on Firefox Nightly 128.0a1 (2024-06-03) (build ID 20240603160728), using macOS 14.4 and macOS 13.6.7.
The content of the saved PDF from https://bug1722457.bmoattachments.org/attachment.cgi?id=9233262 is now displayed.

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

Attachment

General

Creator:
Created:
Updated:
Size: