Move nsFontCache from the device context to pres context
Categories
(Core :: Layout: Text and Fonts, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox93 | --- | fixed |
People
(Reporter: jfkthame, Assigned: jfkthame)
References
Details
Attachments
(2 files)
To look up/instantiate platform fonts based on CSS font properties, we create a gfxFontGroup
from an nsFont
and other attributes; this is currently cached in an nsFontCache
attached to the nsDeviceContext
.
However, this assumes that the mapping to platform fonts will be the same for all documents using the given device context. In a world where visibility of platform fonts to the page may be restricted, and may depend on the individual document (e.g. if the user disables tracking protection for a particular site), the mapping represented by nsFontCache
may vary, and determining how to resolve a given font request will need access to the requesting document in order to know what visibility it is allowed.
To support this, I propose to move the nsFontCache
from nsDeviceContext
to nsPresContext
. In itself, this should cause no visible change in behavior, but it provides a basis for the patches that will follow in bug 1715501.
It's likely that this will have some effects on individual performance tests, depending on the exact content and sequencing of page loads, because of changed caching behavior. E.g. having a per-presContext cache may sometimes mean that we no longer take advantage of a cached gfxFontGroup
that a previously-loaded page created; but on the other hand the caches will tend to be smaller and have faster lookups.
My testing so far suggests that we will see some apparent regressions, alongside some improvements, but that overall there should be little change. I'd like to get this change landed separately, before any of the actual font-visibility behavior changes, so that we can more clearly see and isolate any unexpected effects.
Assignee | ||
Comment 1•3 years ago
|
||
Updated•3 years ago
|
Assignee | ||
Comment 2•3 years ago
|
||
Depends on D122714
Comment 4•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/59d9dccded08
https://hg.mozilla.org/mozilla-central/rev/d1d61576616e
Description
•