Open Bug 2013884 Opened 9 months ago Updated 9 months ago

In fragmentation fallback codepath, content with `clip-path` doesn't render at all after page 1

Categories

(Core :: Printing: Output, defect)

defect

Tracking

()

People

(Reporter: pestophagous, Unassigned)

References

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:149.0) Gecko/20100101 Firefox/149.0

Steps to reproduce:

Try to print this page: https://openstax.org/books/calculus-volume-1/pages/2-3-the-limit-laws

It may be necessary to restrict/customize the page numbers being printed so that you are requesting only the last 4 or 5 pages of the doc.

(others from that same openstax book showcase same issue)

Actual results:

print preview shows math formulas (I am particulary interested in the final few pages of exercises). But when I print-to-pdf, the resulting pdf does not contain the formulas, but only blank spaces. [other browsers that i have installed side-by-side can generate the pdf properly]

Expected results:

The pdf should contain math formulas.

The user agent string does not seem to indicate that I am on NIGHTLY.

I am using: 149.0a1 (2026-02-01) (64-bit) NIGHTLY on Ubuntu 22.04.5 LTS "jammy"

The Bugbug bot thinks this bug should belong to the 'Core::Printing: Output' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Printing: Output
Product: Firefox → Core

Thanks for the bug report. A few diagnostic things I've observed when poking at the page:

  • When Firefox prints / print-previews this document, it also looks like we slice some lines of text in half at pagebreaks (if the text happens to overlap a pagebreak), so this is likely triggering Firefox's "fragmentation fallback", probably because it's wrapped in a giant single-row grid item (.fRDSoc) -- more notes on this in bug 1759926.

  • If I untick that display:grid declaration in DevTools, this avoids the fragmentation-fallback codepath that I discussed above (as expected) and it also seems to make the formulas print nicely.

  • Or, instead: if I add * {clip-path: initial !important } to override some MathJax styles[1], then the formulas print nicely.

So: this seems to be a bug where we're getting confused about the geometry of clip-path styles in our "fragmentation fallback" codepath.

[1] e.g. here's one example MathJax style that's applying a clip-path to some of the content here:

mjx-mo > mjx-c, mjx-mi > mjx-c, mjx-mn > mjx-c, mjx-ms > mjx-c, mjx-mtext > mjx-c {
  clip-path: padding-box xywh(-1em -2px calc(100% + 2em) calc(100% + 4px));
}
Attached file testcase 1 —

Here's a reduced testcase.

When I print this testcase to Firefox's save-to-PDF backend, the clipped content doesn't end up painting at all on page 2 in the resulting PDF (even though it shows up in print preview).

I'm using a recent Nightly 149 on Ubuntu 25.04, in case it ends up being relevant.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Depends on: 1640197
Ever confirmed: true
See Also: → 1759926
Summary: (preview shows them) but Print-to-pdf with Mathjax/Latex does not print math formulas → In fragmentation fallback codepath, content with `clip-path` doesn't render at all after page 1
Version: Firefox 149 → Trunk
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: