Closed Bug 1639698 Opened 5 years ago Closed 5 years ago

font-display fails for first text with line-height

Categories

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

46 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox-esr68 --- wontfix
firefox76 --- wontfix
firefox77 --- wontfix
firefox78 --- wontfix
firefox79 --- fixed

People

(Reporter: tjeu.kayim, Assigned: heycam)

References

()

Details

(Keywords: regression)

Attachments

(2 files)

Attached file font-block-inline.html

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0

Steps to reproduce:

Create a document containing several text elements, apply CSS to the body "line-height: 1" and a @font-face with "font-display: block".
See the HTML attachment for a minimal demo.
Tested in Firefox 72.0.1 and Nightly 78.0a1 (2020-05-19).

Actual results:

The first visible text element is showing the fallback font for a brief moment, while the other elements stay hidden until the font is downloaded.

Expected results:

The first element should render the same as the others and adhere "font-display: block".

Component: Untriaged → Layout
Product: Firefox → Core
Component: Layout → Layout: Text and Fonts
Severity: -- → S3

Here's the same test pointing to a font URL that waits 5 seconds before responding, to make the issue more obvious.

At the time we render the first line in the fallback font, its text run has mSkipDrawing = false, while the other two text runs have mSkipDrawing = true.

Assignee: nobody → cam
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Ultimately, the problem is that we set mSkipDrawing = false on the first text run, in its constructor, before the font group starts loading any fonts. We should be able to ask the font group each time in gfxTextRun::Draw what its mSkipDrawing status is.

This is actually a regression from when font-display was originally implemented, in bug 1157064.

Keywords: regression
Version: 78 Branch → 46 Branch
Pushed by cmccormack@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8fcbd624276b Ensure that the first text run that triggers a font load has its drawing skipped if needed. r=jfkthame
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79

The patch landed in nightly and beta is affected.
:heycam, is this bug important enough to require an uplift?
If not please set status_beta to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(cam)

Longstanding bug, doesn't need uplift.

Flags: needinfo?(cam)
QA Whiteboard: [qa-79b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: