Open Bug 1964005 Opened 19 days ago Updated 13 days ago

Text rendering garbled near the end with long text files

Categories

(Core :: Layout: Text and Fonts, defect)

Firefox 138
x86_64
Linux
defect

Tracking

()

Tracking Status
firefox140 --- affected

People

(Reporter: bojan, Unassigned)

References

(Depends on 1 open bug)

Details

Attachments

(1 file)

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

Steps to reproduce:

Open a very large file (e.g. https://kojipkgs.fedoraproject.org//packages/firefox/138.0.1/1.fc42/data/logs/x86_64/build.log), then scroll all the way down to the end of it. The text near the end will appear garbled (see screenshot).

This affect pretty much any current version of Firefox in F42 (and F41, F40) on the machine I use (ThinkPad T450s). Not quite sure whether this is a problem in the Firefox itself or some underlying component, so opening here first. Desktop environment is gnome. Fonts are default.

Reproducible: Always

Steps to Reproduce:

  1. Open a very large text file (e.g. a build log in koji/copr).
  2. Scroll to the very end.
  3. Observed incorrectly rendered text.
    Actual Results:
    Text rendered incorrectly.

Expected Results:
This works fine on MacOS with the same versions of Firefox.

Additional Information:
Please see attached screenshot.

Actual results:

Garbled text.

Expected results:

Works on other platforms.

Component: Untriaged → General
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Component: General → Layout: Text and Fonts
Product: Firefox → Core

Thanks for the bug report. For what it's worth, I can't reproduce on Ubuntu 24.04 (on a display with 100% pixel scaling, i.e. no HiDPI). I can trigger a version of this bug if I zoom in all the way though with full-page-zoom (500% scale factor).

The last few lines of the log are supposed to look like this:

Wrote: /builddir/build/RPMS/firefox-debuginfo-138.0.1-1.fc42.x86_64.rpm
RPM build warnings:
    Duplicate build-ids /builddir/build/BUILD/firefox-138.0.1-build/BUILDROOT/usr/lib64/firefox/firefox and /builddir/build/BUILD/firefox-138.0.1-build/BUILDROOT/usr/lib64/firefox/firefox-bin
    absolute symlink: /usr/lib64/firefox/dictionaries -> /usr/share/hunspell
    Duplicate build-ids /builddir/build/BUILD/firefox-138.0.1-build/BUILDROOT/usr/lib/debug/usr/lib64/firefox/firefox-138.0.1-1.fc42.x86_64.debug and /builddir/build/BUILD/firefox-138.0.1-build/BUILDROOT/usr/lib/debug/usr/lib64/firefox/firefox-bin-138.0.1-1.fc42.x86_64.debug
Child return code was: 0

But in the screenshot and in my local testing with 500% scale factor, there's other text at the end of the log instead (and various other character-positioning glitches).

A few observations:

  • The text file here (linked in comment 0) is 145MB in size.
  • When I view the file at the default 100% zoom level, window.document.documentElement.scrollHeight is 12749200 (which nearly reaches nscoord_MAX in CSS pixels, which is the upper limit of lengths that we reliably track for layout). (That's 2^30-1 nscoord units, which are 1/60th of a pixel, at 100% zoom/pixel-scaling level -- so that threshold is 17895697 css pixels).
  • That means full-page-zoom and/or HiDPI could easily push us over that nscoord_MAX limit at which point stuff is liable to get garbled.

So this is sort of a version of bug 265084. Gecko's layout representation isn't robust for documents of this size.

Depends on: 265084
Severity: -- → S3

See also bug 1726431, where we observed that rendering became erratic when the height of the content exceeds 16M device pixels.

See Also: → 1726431

I was testing on a 4K external monitor and I think the scaling I set there was not 100%, but something like 125% (from memory - not on that machine now).

It is indeed 125% on that monitor.

I was able to reproduce the issue on Ubuntu24.04 using Firefox build 140.0a1 with 100%scale.
Marking issue as new.

Status: UNCONFIRMED → NEW
Ever confirmed: true
QA Contact: mchiorean
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: