Closed Bug 1715501 Opened 11 months ago Closed 8 months ago

Pass the presContext through to gfx font selection code so we can query it for font-visibility settings

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
94 Branch
Tracking Status
firefox94 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

References

(Regressed 1 open bug)

Details

Attachments

(2 files)

Currently, the layout.css.font-visibility.level pref is a global setting that is handled purely by the gfx font-list code to control which fonts are available to the browser.

However, for a more flexible rollout of font restrictions, we want to be able to apply different settings depending on the context -- e.g. a stricter setting in Private Browsing windows -- and will also want to be able to relax the restrictions on a per-context basis for when a user has explicitly opted out of ETP on a site. So some documents may "see" only base system fonts, while other trusted sites might have access to all the user's fonts.

Therefore, the setting can't just be implemented "blindly" in gfxPlatformFontList by reading the pref; we need to pass the desired setting down from the document, and have the font-selection code use this to behave appropriately for the given context.

Depends on: 1725940
Summary: Pass font-visibility setting from the presContext through to gfx font selection code → Pass the presContext through to gfx font selection code so we can query it for font-visibility settings
Blocks: 1715507

This does not change existing behavior, but will be required once font visibility
is no longer simply a global setting. The data cached in these members depends on
the font visibility level, so currently we just flush it if the visibility pref is
modified. But in future we may be using multiple levels at the same time (in
separate contexts), so we want to maintain separate per-level caches here.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED

This does not in itself change user-visible behavior, but is a foundation for bug
1715507 where we will make the behavior per-context instead of global. This is basically
just plumbing, passing a pointer to the presContext that's asking for fonts to be
resolved all the way down to the gfx code that handles the font list and looks up
fonts.

For the immediate goal of making font visibility work per-context, it would be
sufficient to pass the desired visibility level in to the font-selection methods.
However, passing the actual presContext down (and not just its visibility level)
will enable us to report back via the dev console when a font is blocked (see bug
1715537), so the approach here provides the basis for that upcoming enhancement.

Depends on D124194

Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cfdd1c5d8d3f
patch 1 - Track codepoints with no available fonts and replacement-char family separately for each font-visibility level. r=emilio
https://hg.mozilla.org/integration/autoland/rev/e3f8526e0e2a
patch 2 - Pass the presContext to platform font lookup methods so they can query it for font visibility. r=emilio

Backed out for causing mochitest failures on test_bug418986-2.html

Flags: needinfo?(jfkthame)

The (intermittent) failure there must be related to bug 1715507, I think, so I'm re-landing the two patches here by themselves.

Flags: needinfo?(jfkthame)
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bed82cc6a625
patch 1 - Track codepoints with no available fonts and replacement-char family separately for each font-visibility level. r=emilio
https://hg.mozilla.org/integration/autoland/rev/a8b9260fbdef
patch 2 - Pass the presContext to platform font lookup methods so they can query it for font visibility. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 94 Branch
Regressions: 1730460
Regressions: 1745719
You need to log in before you can comment on or make changes to this bug.