diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 30e2f1bc485e..3f7f636f4c29 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -10751,7 +10751,8 @@ nsSize PresShell::GetLayoutViewportSize() const { void PresShell::RecomputeFontSizeInflationEnabled() { mFontSizeInflationEnabled = DetermineFontSizeInflationState(); - float fontScale = nsLayoutUtils::SystemFontScale(); + // Divide by 100 to convert the pref from a percentage to a fraction. + float fontScale = StaticPrefs::font_size_systemFontScale() / 100.0f; if (fontScale == 0.0f) { return; } diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 8ccc92dd019b..87cd42382a50 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -183,8 +183,6 @@ bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false; typedef ScrollableLayerGuid::ViewID ViewID; typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox; -/* static */ -uint32_t nsLayoutUtils::sSystemFontScale; /* static */ uint32_t nsLayoutUtils::sZoomMaxPercent; /* static */ @@ -7973,8 +7971,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame, /* static */ void nsLayoutUtils::Initialize() { - Preferences::AddUintVarCache(&sSystemFontScale, "font.size.systemFontScale", - 100); Preferences::AddUintVarCache(&sZoomMaxPercent, "zoom.maxPercent", 300); Preferences::AddUintVarCache(&sZoomMinPercent, "zoom.minPercent", 30); Preferences::AddBoolVarCache(&sInvalidationDebuggingIsEnabled, diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 4dfae1bf3e7b..5abb8043d788 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -2445,12 +2445,6 @@ class nsLayoutUtils { static bool FontSizeInflationEnabled(nsPresContext* aPresContext); - /** - * See comment above "font.size.systemFontScale" in - * modules/libpref/init/all.js. - */ - static float SystemFontScale() { return sSystemFontScale / 100.0f; } - static float MaxZoom() { return sZoomMaxPercent / 100.0f; } static float MinZoom() { return sZoomMinPercent / 100.0f; } @@ -3009,7 +3003,6 @@ class nsLayoutUtils { const nsIFrame* aFrame); private: - static uint32_t sSystemFontScale; static uint32_t sZoomMaxPercent; static uint32_t sZoomMinPercent; static bool sInvalidationDebuggingIsEnabled; diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 60b67f5cdafe..bb4d6ffec80c 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -2639,6 +2639,18 @@ value: 0 mirror: always +# This setting corresponds to a global text zoom setting affecting +# all content that is not already subject to font size inflation. +# It is interpreted as a percentage value that is applied on top +# of the document's current text zoom setting. +# +# The resulting total zoom factor (text zoom * system font scale) +# will be limited by zoom.minPercent and maxPercent. +- name: font.size.systemFontScale + type: uint32_t + value: 100 + mirror: always + #--------------------------------------------------------------------------- # Prefs starting with "full-screen-api." #--------------------------------------------------------------------------- diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index f7d9d3fef7a7..6e50e1202fef 100755 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -3357,17 +3357,6 @@ pref("font.minimum-size.x-math", 0); pref("font.size.variable.x-math", 16); pref("font.size.monospace.x-math", 13); -/** - * This setting corresponds to a global text zoom setting affecting - * all content that is not already subject to font size inflation. - * It is interpreted as a percentage value that is applied on top - * of the document's current text zoom setting. - * - * The resulting total zoom factor (text zoom * system font scale) - * will be limited by zoom.minPercent and maxPercent. - */ -pref("font.size.systemFontScale", 100); - /* * When enabled, the touch.radius and mouse.radius prefs allow events to be dispatched * to nearby elements that are sensitive to the event. See PositionedEventTargeting.cpp.