Bug 1759686 - patch 3 - Ensure prefs that may be accessed by canvas2d text code are atomic. r=lsalzman

These need to be atomic so that they can be accessed by canvas code when running on a worker thread
without calling main-thread-only Preferences APIs.

Depends on D144185

Differential Revision: https://phabricator.services.mozilla.com/D144186
This commit is contained in:
Jonathan Kew 2022-05-03 12:39:09 +00:00
Родитель 723077462f
Коммит 0cf6fb1bdd
4 изменённых файлов: 14 добавлений и 11 удалений

Просмотреть файл

@ -3696,7 +3696,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor
mOp(CanvasRenderingContext2D::TextDrawOperation::FILL),
mTextRunFlags(),
mDoMeasureBoundingBox(false) {
if (Preferences::GetBool(GFX_MISSING_FONTS_NOTIFY_PREF)) {
if (StaticPrefs::gfx_missing_fonts_notify()) {
mMissingFonts = MakeUnique<gfxMissingFontRecorder>();
}
}

Просмотреть файл

@ -304,7 +304,7 @@ nsPresContext::nsPresContext(dom::Document* aDocument, nsPresContextType aType)
mTextPerf = MakeUnique<gfxTextPerfMetrics>();
}
if (Preferences::GetBool(GFX_MISSING_FONTS_NOTIFY_PREF)) {
if (StaticPrefs::gfx_missing_fonts_notify()) {
mMissingFonts = MakeUnique<gfxMissingFontRecorder>();
}
@ -580,7 +580,7 @@ void nsPresContext::PreferenceChanged(const char* aPrefName) {
MediaFeatureChangePropagation::JustThisDocument);
}
if (prefName.EqualsLiteral(GFX_MISSING_FONTS_NOTIFY_PREF)) {
if (Preferences::GetBool(GFX_MISSING_FONTS_NOTIFY_PREF)) {
if (StaticPrefs::gfx_missing_fonts_notify()) {
if (!mMissingFonts) {
mMissingFonts = MakeUnique<gfxMissingFontRecorder>();
// trigger reflow to detect missing fonts on the current page

Просмотреть файл

@ -3696,22 +3696,22 @@
mirror: always
- name: dom.textMetrics.actualBoundingBox.enabled
type: bool
type: RelaxedAtomicBool
value: true
mirror: always
- name: dom.textMetrics.baselines.enabled
type: bool
type: RelaxedAtomicBool
value: false
mirror: always
- name: dom.textMetrics.emHeight.enabled
type: bool
type: RelaxedAtomicBool
value: false
mirror: always
- name: dom.textMetrics.fontBoundingBox.enabled
type: bool
type: RelaxedAtomicBool
value: false
mirror: always
@ -5412,6 +5412,13 @@
value: true
mirror: once
# Do we fire a notification about missing fonts, so the front-end can decide
# whether to try and do something about it (e.g. download additional fonts)?
- name: gfx.missing_fonts.notify
type: RelaxedAtomicBool
value: false
mirror: always
#if !defined(MOZ_WIDGET_ANDROID)
- name: gfx.egl.prefer-gles.enabled
type: bool

Просмотреть файл

@ -592,10 +592,6 @@ pref("gfx.downloadable_fonts.fallback_delay_short", 100);
// the uncached load behavior across pages (useful for testing reflow problems)
pref("gfx.downloadable_fonts.disable_cache", false);
// Do we fire a notification about missing fonts, so the front-end can decide
// whether to try and do something about it (e.g. download additional fonts)?
pref("gfx.missing_fonts.notify", false);
// whether to always search all font cmaps during system font fallback
pref("gfx.font_rendering.fallback.always_use_cmaps", false);