Bug 1573268 - Convert font.size.systemFontScale to static pref. r=njn

Converts font.size.systemFontScale to a static pref. Removes the function in nsLayoutUtils and does the float division directly in PresShell.

Differential Revision: https://phabricator.services.mozilla.com/D41824

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kristen Wright 2019-08-14 18:27:11 +00:00
Родитель cccb97beb8
Коммит 1e91da4122
5 изменённых файлов: 14 добавлений и 23 удалений

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

@ -10751,7 +10751,8 @@ nsSize PresShell::GetLayoutViewportSize() const {
void PresShell::RecomputeFontSizeInflationEnabled() { void PresShell::RecomputeFontSizeInflationEnabled() {
mFontSizeInflationEnabled = DetermineFontSizeInflationState(); 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) { if (fontScale == 0.0f) {
return; return;
} }

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

@ -183,8 +183,6 @@ bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
typedef ScrollableLayerGuid::ViewID ViewID; typedef ScrollableLayerGuid::ViewID ViewID;
typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox; typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
/* static */
uint32_t nsLayoutUtils::sSystemFontScale;
/* static */ /* static */
uint32_t nsLayoutUtils::sZoomMaxPercent; uint32_t nsLayoutUtils::sZoomMaxPercent;
/* static */ /* static */
@ -7973,8 +7971,6 @@ size_t nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
/* static */ /* static */
void nsLayoutUtils::Initialize() { void nsLayoutUtils::Initialize() {
Preferences::AddUintVarCache(&sSystemFontScale, "font.size.systemFontScale",
100);
Preferences::AddUintVarCache(&sZoomMaxPercent, "zoom.maxPercent", 300); Preferences::AddUintVarCache(&sZoomMaxPercent, "zoom.maxPercent", 300);
Preferences::AddUintVarCache(&sZoomMinPercent, "zoom.minPercent", 30); Preferences::AddUintVarCache(&sZoomMinPercent, "zoom.minPercent", 30);
Preferences::AddBoolVarCache(&sInvalidationDebuggingIsEnabled, Preferences::AddBoolVarCache(&sInvalidationDebuggingIsEnabled,

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

@ -2445,12 +2445,6 @@ class nsLayoutUtils {
static bool FontSizeInflationEnabled(nsPresContext* aPresContext); 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 MaxZoom() { return sZoomMaxPercent / 100.0f; }
static float MinZoom() { return sZoomMinPercent / 100.0f; } static float MinZoom() { return sZoomMinPercent / 100.0f; }
@ -3009,7 +3003,6 @@ class nsLayoutUtils {
const nsIFrame* aFrame); const nsIFrame* aFrame);
private: private:
static uint32_t sSystemFontScale;
static uint32_t sZoomMaxPercent; static uint32_t sZoomMaxPercent;
static uint32_t sZoomMinPercent; static uint32_t sZoomMinPercent;
static bool sInvalidationDebuggingIsEnabled; static bool sInvalidationDebuggingIsEnabled;

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

@ -2639,6 +2639,18 @@
value: 0 value: 0
mirror: always 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." # Prefs starting with "full-screen-api."
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------

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

@ -3357,17 +3357,6 @@ pref("font.minimum-size.x-math", 0);
pref("font.size.variable.x-math", 16); pref("font.size.variable.x-math", 16);
pref("font.size.monospace.x-math", 13); 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 * 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. * to nearby elements that are sensitive to the event. See PositionedEventTargeting.cpp.