Bug 1448225 - Convert StylePrefs to StaticPrefs. r=emilio
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 20 Mar 2018 10:56:37 +1100
changeset 411430 2ee160335e150f20df3471b60b5e58ce873e2ff6
parent 411429 3fe0b81bd9de17b369e6f4eb189babf4b65a5203
child 411437 4a3275936ddf871103b53e00608e2b8d5aee7e69
child 411442 edbbd00906426ed221f277f44bd7b8fac70e450d
push id33755
push useraiakab@mozilla.com
push dateTue, 03 Apr 2018 09:29:11 +0000
treeherdermozilla-central@2ee160335e15 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1448225
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1448225 - Convert StylePrefs to StaticPrefs. r=emilio The new StaticPrefs machinery means that StylePrefs can be removed. Note that this approach mirrors all static prefs into Rust, but I have only updated structs.rs for the prefs that Stylo uses. On a CLOSED TREE, since a sheriff closed the tree while I was about to land this via autoland. MozReview-Commit-ID: G1SY0987WJ7
browser/base/content/test/performance/browser_preferences_usage.js
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsLayoutUtils.cpp
layout/build/nsLayoutStatics.cpp
layout/style/FontFace.cpp
layout/style/FontFaceSet.cpp
layout/style/ServoBindings.toml
layout/style/StylePrefs.cpp
layout/style/StylePrefs.h
layout/style/moz.build
layout/style/nsCSSProps.cpp
layout/style/nsFontFaceLoader.cpp
modules/libpref/init/StaticPrefList.h
modules/libpref/init/all.js
--- a/browser/base/content/test/performance/browser_preferences_usage.js
+++ b/browser/base/content/test/performance/browser_preferences_usage.js
@@ -73,17 +73,17 @@ add_task(async function startup() {
   let max = 40;
 
   let whitelist = {
     "browser.startup.record": {
       min: 200,
       max: 350,
     },
     "layout.css.prefixes.webkit": {
-      min: 140,
+      min: 135,
       max: 150,
     },
     "browser.search.log": {
       min: 100,
       max: 150,
     },
     "layout.css.dpi": {
       min: 45,
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -20,16 +20,17 @@
 #include "mozilla/dom/HTMLSummaryElement.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/Likely.h"
 #include "mozilla/LinkedList.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/PresShell.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/ServoStyleSetInlines.h"
+#include "mozilla/StaticPrefs.h"
 #include "nsAbsoluteContainingBlock.h"
 #include "nsCSSPseudoElements.h"
 #include "nsAtom.h"
 #include "nsIFrameInlines.h"
 #include "nsGkAtoms.h"
 #include "nsPresContext.h"
 #include "nsIDocument.h"
 #include "nsIDocumentInlines.h"
@@ -84,17 +85,16 @@
 #include "mozilla/dom/CharacterData.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/ElementInlines.h"
 #include "nsAutoLayoutPhase.h"
 #include "nsStyleStructInlines.h"
 #include "nsPageContentFrame.h"
 #include "mozilla/RestyleManager.h"
 #include "mozilla/RestyleManagerInlines.h"
-#include "mozilla/StylePrefs.h"
 #include "StickyScrollContainer.h"
 #include "nsFieldSetFrame.h"
 #include "nsInlineFrame.h"
 #include "nsBlockFrame.h"
 #include "nsCanvasFrame.h"
 #include "nsFirstLetterFrame.h"
 #include "nsGfxScrollFrame.h"
 #include "nsPageFrame.h"
@@ -2553,17 +2553,17 @@ nsCSSFrameConstructor::ConstructDocEleme
     contentFrame = static_cast<nsContainerFrame*>(
       ConstructOuterSVG(state, item, mDocElementContainingBlock,
                         computedStyle->StyleDisplay(),
                         frameItems));
     newFrame = frameItems.FirstChild();
     NS_ASSERTION(frameItems.OnlyChild(), "multiple root element frames");
   } else if (display->mDisplay == StyleDisplay::Flex ||
              display->mDisplay == StyleDisplay::WebkitBox ||
-             (StylePrefs::sEmulateMozBoxWithFlex &&
+             (StaticPrefs::layout_css_emulate_moz_box_with_flex() &&
               display->mDisplay == StyleDisplay::MozBox)) {
     contentFrame = NS_NewFlexContainerFrame(mPresShell, computedStyle);
     InitAndRestoreFrame(state, aDocElement, mDocElementContainingBlock,
                         contentFrame);
     newFrame = contentFrame;
     processChildren = true;
 
     newFrame->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN);
@@ -4245,19 +4245,19 @@ nsCSSFrameConstructor::GetAnonymousConte
 
   return NS_OK;
 }
 
 static
 bool IsXULDisplayType(const nsStyleDisplay* aDisplay)
 {
   // -moz-{inline-}box is XUL, unless we're emulating it with flexbox.
-  if  (!StylePrefs::sEmulateMozBoxWithFlex &&
-       (aDisplay->mDisplay == StyleDisplay::MozInlineBox ||
-        aDisplay->mDisplay == StyleDisplay::MozBox)) {
+  if (!StaticPrefs::layout_css_emulate_moz_box_with_flex() &&
+      (aDisplay->mDisplay == StyleDisplay::MozInlineBox ||
+       aDisplay->mDisplay == StyleDisplay::MozBox)) {
     return true;
   }
 
 #ifdef MOZ_XUL
   return (aDisplay->mDisplay == StyleDisplay::MozInlineGrid ||
           aDisplay->mDisplay == StyleDisplay::MozInlineStack ||
           aDisplay->mDisplay == StyleDisplay::MozGrid ||
           aDisplay->mDisplay == StyleDisplay::MozStack ||
@@ -4516,17 +4516,17 @@ nsCSSFrameConstructor::FindXULDisplayDat
   if (aDisplay->mDisplay < StyleDisplay::MozBox) {
     return nullptr;
   }
 
   // If we're emulating -moz-box with flexbox, then treat it as non-XUL and
   // return null (except for scrollcorners which have to be XUL becuase their
   // parent reflows them with BoxReflow() which means they have to get
   // actual-XUL frames).
-  if (StylePrefs::sEmulateMozBoxWithFlex &&
+  if (StaticPrefs::layout_css_emulate_moz_box_with_flex() &&
       aElement && !aElement->IsXULElement(nsGkAtoms::scrollcorner) &&
       (aDisplay->mDisplay == StyleDisplay::MozBox ||
        aDisplay->mDisplay == StyleDisplay::MozInlineBox)) {
     return nullptr;
   }
 
   MOZ_ASSERT(aDisplay->mDisplay <= StyleDisplay::MozPopup,
              "Someone added a new display value?");
@@ -4744,17 +4744,17 @@ nsCSSFrameConstructor::FindDisplayData(c
   }
 
   // If this is for a <body> node and we've propagated the scroll-frame to the
   // viewport, we need to make sure not to add another layer of scrollbars, so
   // we use a different FCData struct without FCDATA_MAY_NEED_SCROLLFRAME.
   if (propagatedScrollToViewport && aDisplay->IsScrollableOverflow()) {
     if (aDisplay->mDisplay == StyleDisplay::Flex ||
         aDisplay->mDisplay == StyleDisplay::WebkitBox ||
-        (StylePrefs::sEmulateMozBoxWithFlex &&
+        (StaticPrefs::layout_css_emulate_moz_box_with_flex() &&
          aDisplay->mDisplay == StyleDisplay::MozBox)) {
       static const FrameConstructionData sNonScrollableFlexData =
         FCDATA_DECL(0, NS_NewFlexContainerFrame);
       return &sNonScrollableFlexData;
     }
     if (aDisplay->mDisplay == StyleDisplay::Grid) {
       static const FrameConstructionData sNonScrollableGridData =
         FCDATA_DECL(0, NS_NewGridContainerFrame);
@@ -4845,17 +4845,17 @@ nsCSSFrameConstructor::FindDisplayData(c
       FCDATA_DECL(FCDATA_MAY_NEED_SCROLLFRAME, NS_NewFlexContainerFrame)),
     FCDATA_FOR_DISPLAY(StyleDisplay::MozBox,
       FCDATA_DECL(FCDATA_MAY_NEED_SCROLLFRAME, NS_NewFlexContainerFrame)),
     FCDATA_FOR_DISPLAY(StyleDisplay::MozInlineBox,
       FCDATA_DECL(FCDATA_MAY_NEED_SCROLLFRAME, NS_NewFlexContainerFrame)),
   };
   static_assert(ArrayLength(sDisplayData) == size_t(StyleDisplay::MozInlineBox) + 1,
                 "Be sure to update sDisplayData if you touch StyleDisplay");
-  MOZ_ASSERT(StylePrefs::sEmulateMozBoxWithFlex ||
+  MOZ_ASSERT(StaticPrefs::layout_css_emulate_moz_box_with_flex() ||
              (aDisplay->mDisplay != StyleDisplay::MozBox &&
               aDisplay->mDisplay != StyleDisplay::MozInlineBox),
              "-moz-{inline-}box as XUL should have already been handled");
   MOZ_ASSERT(size_t(aDisplay->mDisplay) < ArrayLength(sDisplayData),
              "XUL display data should have already been handled");
 
   // See the mDisplay fixup code in nsRuleNode::ComputeDisplayData.
   MOZ_ASSERT(aDisplay->mDisplay != StyleDisplay::Contents ||
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -15,16 +15,17 @@
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/gfx/PathHelpers.h"
 #include "mozilla/layers/PAPZ.h"
 #include "mozilla/Likely.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/dom/ContentChild.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Unused.h"
 #include "nsCharTraits.h"
 #include "nsDocument.h"
 #include "nsFontMetrics.h"
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "nsFrameList.h"
 #include "nsGenericHTMLElement.h"
@@ -123,17 +124,16 @@
 #include "DisplayItemClip.h"
 #include "mozilla/layers/StackingContextHelper.h"
 #include "mozilla/layers/WebRenderLayerManager.h"
 #include "prenv.h"
 #include "RetainedDisplayListBuilder.h"
 #include "DisplayListChecker.h"
 #include "TextDrawTarget.h"
 #include "nsDeckFrame.h"
-#include "mozilla/StylePrefs.h"
 #include "mozilla/dom/InspectorFontFace.h"
 
 #ifdef MOZ_XUL
 #include "nsXULPopupManager.h"
 #endif
 
 #include "GeckoProfiler.h"
 #include "nsAnimationManager.h"
@@ -10126,17 +10126,17 @@ nsLayoutUtils::ComputeOffsetToUserSpace(
             nsPresContext::CSSPixelsToAppUnits(float(toUserSpaceGfx.y)));
 
   return (offsetToBoundingBox - toUserSpace);
 }
 
 /* static */ uint8_t
 nsLayoutUtils::ControlCharVisibilityDefault()
 {
-  return StylePrefs::sControlCharVisibility
+  return StaticPrefs::layout_css_control_characters_visible()
     ? NS_STYLE_CONTROL_CHARACTER_VISIBILITY_VISIBLE
     : NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN;
 }
 
 /* static */
 already_AddRefed<nsFontMetrics>
 nsLayoutUtils::GetMetricsFor(nsPresContext* aPresContext,
                              bool aIsVertical,
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -104,17 +104,16 @@
 #include "mozilla/IMEStateManager.h"
 #include "mozilla/dom/HTMLVideoElement.h"
 #include "TouchManager.h"
 #include "DecoderDoctorLogger.h"
 #include "MediaDecoder.h"
 #include "MediaPrefs.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/StaticPresData.h"
-#include "mozilla/StylePrefs.h"
 #include "mozilla/dom/WebIDLGlobalNameHash.h"
 #include "mozilla/dom/ipc/IPCBlobInputStreamStorage.h"
 #include "mozilla/dom/U2FTokenManager.h"
 #include "mozilla/dom/PointerEventHandler.h"
 #include "nsHostObjectProtocolHandler.h"
 #include "nsThreadManager.h"
 
 using namespace mozilla;
@@ -214,18 +213,16 @@ nsLayoutStatics::Initialize()
   }
 
   rv = nsCCUncollectableMarker::Init();
   if (NS_FAILED(rv)) {
     NS_ERROR("Could not initialize nsCCUncollectableMarker");
     return rv;
   }
 
-  StylePrefs::Init();
-
 #ifdef MOZ_XUL
   rv = nsXULPopupManager::Init();
   if (NS_FAILED(rv)) {
     NS_ERROR("Could not initialize nsXULPopupManager");
     return rv;
   }
 #endif
 
--- a/layout/style/FontFace.cpp
+++ b/layout/style/FontFace.cpp
@@ -11,21 +11,21 @@
 #include "mozilla/dom/FontFaceSet.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/TypedArray.h"
 #include "mozilla/dom/UnionTypes.h"
 #include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/ServoCSSParser.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/ServoUtils.h"
+#include "mozilla/StaticPrefs.h"
 #include "nsCSSFontFaceRule.h"
 #include "nsCSSParser.h"
 #include "nsIDocument.h"
 #include "nsStyleUtil.h"
-#include "StylePrefs.h"
 
 namespace mozilla {
 namespace dom {
 
 // -- FontFaceBufferSource ---------------------------------------------------
 
 /**
  * An object that wraps a FontFace object and exposes its ArrayBuffer
@@ -593,17 +593,17 @@ FontFace::SetDescriptors(const nsAString
                        aDescriptors.mStretch,
                        mDescriptors->mStretch) ||
       !ParseDescriptor(eCSSFontDesc_UnicodeRange,
                        aDescriptors.mUnicodeRange,
                        mDescriptors->mUnicodeRange) ||
       !ParseDescriptor(eCSSFontDesc_FontFeatureSettings,
                        aDescriptors.mFeatureSettings,
                        mDescriptors->mFontFeatureSettings) ||
-      (StylePrefs::sFontVariationsEnabled &&
+      (StaticPrefs::layout_css_font_variations_enabled() &&
        !ParseDescriptor(eCSSFontDesc_FontVariationSettings,
                         aDescriptors.mVariationSettings,
                         mDescriptors->mFontVariationSettings)) ||
       !ParseDescriptor(eCSSFontDesc_Display,
                        aDescriptors.mDisplay,
                        mDescriptors->mDisplay)) {
     // XXX Handle font-variant once we support it (bug 1055385).
 
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -18,16 +18,17 @@
 #include "mozilla/net/ReferrerPolicy.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/Logging.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ServoCSSParser.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/ServoUtils.h"
 #include "mozilla/Sprintf.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/LoadInfo.h"
 #include "nsAutoPtr.h"
 #include "nsContentPolicyUtils.h"
 #include "nsCSSParser.h"
 #include "nsDeviceContext.h"
 #include "nsFontFaceLoader.h"
 #include "nsIConsoleService.h"
@@ -45,17 +46,16 @@
 #include "nsNetUtil.h"
 #include "nsIProtocolHandler.h"
 #include "nsIInputStream.h"
 #include "nsLayoutUtils.h"
 #include "nsPresContext.h"
 #include "nsPrintfCString.h"
 #include "nsUTF8Utils.h"
 #include "nsDOMNavigationTiming.h"
-#include "StylePrefs.h"
 
 using namespace mozilla;
 using namespace mozilla::css;
 using namespace mozilla::dom;
 
 #define LOG(args) MOZ_LOG(gfxUserFontSet::GetUserFontsLog(), mozilla::LogLevel::Debug, args)
 #define LOG_ENABLED() MOZ_LOG_TEST(gfxUserFontSet::GetUserFontsLog(), \
                                   LogLevel::Debug)
@@ -1137,27 +1137,27 @@ FontFaceSet::FindOrCreateUserFontEntryFr
             } else if (valueString.LowerCaseEqualsASCII("truetype")) {
               face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_TRUETYPE;
             } else if (valueString.LowerCaseEqualsASCII("truetype-aat")) {
               face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_TRUETYPE_AAT;
             } else if (valueString.LowerCaseEqualsASCII("embedded-opentype")) {
               face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_EOT;
             } else if (valueString.LowerCaseEqualsASCII("svg")) {
               face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_SVG;
-            } else if (StylePrefs::sFontVariationsEnabled &&
+            } else if (StaticPrefs::layout_css_font_variations_enabled() &&
                        valueString.LowerCaseEqualsASCII("woff-variations")) {
               face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_WOFF_VARIATIONS;
-            } else if (StylePrefs::sFontVariationsEnabled &&
+            } else if (StaticPrefs::layout_css_font_variations_enabled() &&
                        Preferences::GetBool(GFX_PREF_WOFF2_ENABLED) &&
                        valueString.LowerCaseEqualsASCII("woff2-variations")) {
               face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_WOFF2_VARIATIONS;
-            } else if (StylePrefs::sFontVariationsEnabled &&
+            } else if (StaticPrefs::layout_css_font_variations_enabled() &&
                        valueString.LowerCaseEqualsASCII("opentype-variations")) {
               face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_OPENTYPE_VARIATIONS;
-            } else if (StylePrefs::sFontVariationsEnabled &&
+            } else if (StaticPrefs::layout_css_font_variations_enabled() &&
                        valueString.LowerCaseEqualsASCII("truetype-variations")) {
               face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_TRUETYPE_VARIATIONS;
             } else {
               // unknown format specified, mark to distinguish from the
               // case where no format hints are specified
               face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_UNKNOWN;
             }
             i++;
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -66,17 +66,17 @@ headers = [
     "mozilla/Keyframe.h",
     "mozilla/ServoElementSnapshot.h",
     "mozilla/ServoElementSnapshotTable.h",
     "mozilla/css/ErrorReporter.h",
     "mozilla/dom/Element.h",
     "mozilla/dom/ChildIterator.h",
     "mozilla/dom/NameSpaceConstants.h",
     "mozilla/LookAndFeel.h",
-    "mozilla/StylePrefs.h",
+    "mozilla/StaticPrefs.h",
     "mozilla/ServoBindings.h",
     "mozilla/ServoMediaList.h",
     "mozilla/ComputedStyle.h",
     "mozilla/ServoDeclarationBlock.h",
     "mozilla/ServoTraversalStatistics.h",
     "mozilla/SizeOfState.h",
     "nsCSSCounterStyleRule.h",
     "nsCSSFontFaceRule.h",
@@ -238,17 +238,17 @@ whitelist-types = [
     "mozilla::css::URLMatchingFunction",
     "mozilla::dom::IterationCompositeOperation",
     "mozilla::dom::StyleChildrenIterator",
     "mozilla::HalfCorner",
     "mozilla::MallocSizeOf",
     "mozilla::OriginFlags",
     "mozilla::PropertyStyleAnimationValuePair",
     "mozilla::ServoTraversalFlags",
-    "mozilla::StylePrefs",
+    "mozilla::StaticPrefs",
     "mozilla::StyleShapeRadius",
     "mozilla::StyleGrid.*",
     "mozilla::UpdateAnimationsTasks",
     "mozilla::LookAndFeel",
     "mozilla::gfx::Float",
     "mozilla::gfx::FontVariation",
     ".*ThreadSafe.*Holder",
     "AnonymousContent",
deleted file mode 100644
--- a/layout/style/StylePrefs.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/StylePrefs.h"
-
-#include "mozilla/Preferences.h"
-
-namespace mozilla {
-
-bool StylePrefs::sFontDisplayEnabled;
-bool StylePrefs::sOpentypeSVGEnabled;
-bool StylePrefs::sWebkitPrefixedAliasesEnabled;
-bool StylePrefs::sWebkitDevicePixelRatioEnabled;
-bool StylePrefs::sMozGradientsEnabled;
-bool StylePrefs::sControlCharVisibility;
-bool StylePrefs::sFramesTimingFunctionEnabled;
-bool StylePrefs::sUnprefixedFullscreenApiEnabled;
-bool StylePrefs::sVisitedLinksEnabled;
-bool StylePrefs::sMozDocumentEnabledInContent;
-bool StylePrefs::sMozDocumentURLPrefixHackEnabled;
-bool StylePrefs::sGridTemplateSubgridValueEnabled;
-bool StylePrefs::sFontVariationsEnabled;
-bool StylePrefs::sEmulateMozBoxWithFlex;
-
-/* static */ void
-StylePrefs::Init()
-{
-  Preferences::AddBoolVarCache(&sFontDisplayEnabled,
-                               "layout.css.font-display.enabled");
-  Preferences::AddBoolVarCache(&sOpentypeSVGEnabled,
-                               "gfx.font_rendering.opentype_svg.enabled");
-  Preferences::AddBoolVarCache(&sWebkitPrefixedAliasesEnabled,
-                               "layout.css.prefixes.webkit");
-  Preferences::AddBoolVarCache(&sWebkitDevicePixelRatioEnabled,
-                               "layout.css.prefixes.device-pixel-ratio-webkit");
-  Preferences::AddBoolVarCache(&sMozGradientsEnabled,
-                               "layout.css.prefixes.gradients");
-  Preferences::AddBoolVarCache(&sControlCharVisibility,
-                               "layout.css.control-characters.visible");
-  Preferences::AddBoolVarCache(&sFramesTimingFunctionEnabled,
-                               "layout.css.frames-timing.enabled");
-  Preferences::AddBoolVarCache(&sUnprefixedFullscreenApiEnabled,
-                               "full-screen-api.unprefix.enabled");
-  Preferences::AddBoolVarCache(&sVisitedLinksEnabled,
-                               "layout.css.visited_links_enabled");
-  Preferences::AddBoolVarCache(&sMozDocumentEnabledInContent,
-                               "layout.css.moz-document.content.enabled");
-  Preferences::AddBoolVarCache(&sMozDocumentURLPrefixHackEnabled,
-                               "layout.css.moz-document.url-prefix-hack.enabled");
-  Preferences::AddBoolVarCache(&sGridTemplateSubgridValueEnabled,
-                               "layout.css.grid-template-subgrid-value.enabled");
-  Preferences::AddBoolVarCache(&sFontVariationsEnabled,
-                               "layout.css.font-variations.enabled");
-
-  // Only honor layout.css.emulate-moz-box-with-flex in prerelease builds.
-  // (In release builds, sEmulateMozBoxWithFlex will be implicitly false.)
-#ifndef RELEASE_OR_BETA
-  Preferences::AddBoolVarCache(&sEmulateMozBoxWithFlex,
-                               "layout.css.emulate-moz-box-with-flex");
-#endif
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/layout/style/StylePrefs.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* A namespace class for style system prefs */
-
-#ifndef mozilla_StylePrefs_h
-#define mozilla_StylePrefs_h
-
-namespace mozilla {
-
-struct StylePrefs
-{
-  static bool sFontDisplayEnabled;
-  static bool sOpentypeSVGEnabled;
-  static bool sWebkitPrefixedAliasesEnabled;
-  static bool sWebkitDevicePixelRatioEnabled;
-  static bool sMozGradientsEnabled;
-  static bool sControlCharVisibility;
-  static bool sFramesTimingFunctionEnabled;
-  static bool sUnprefixedFullscreenApiEnabled;
-  static bool sVisitedLinksEnabled;
-  static bool sMozDocumentEnabledInContent;
-  static bool sMozDocumentURLPrefixHackEnabled;
-  static bool sGridTemplateSubgridValueEnabled;
-  static bool sFontVariationsEnabled;
-  static bool sEmulateMozBoxWithFlex;
-
-  static void Init();
-};
-
-} // namespace mozilla
-
-#endif // mozilla_StylePrefs_h
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -106,17 +106,16 @@ EXPORTS.mozilla += [
     'ServoStyleSheet.h',
     'ServoSupportsRule.h',
     'ServoTraversalStatistics.h',
     'ServoTypes.h',
     'ServoUtils.h',
     'SheetType.h',
     'StyleAnimationValue.h',
     'StyleComplexColor.h',
-    'StylePrefs.h',
     'StyleSheet.h',
     'StyleSheetInfo.h',
     'StyleSheetInlines.h',
     'URLExtraData.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'CSS.h',
@@ -223,17 +222,16 @@ UNIFIED_SOURCES += [
     'ServoPageRule.cpp',
     'ServoSpecifiedValues.cpp',
     'ServoStyleRule.cpp',
     'ServoStyleSet.cpp',
     'ServoStyleSheet.cpp',
     'ServoSupportsRule.cpp',
     'StreamLoader.cpp',
     'StyleAnimationValue.cpp',
-    'StylePrefs.cpp',
     'StyleSheet.cpp',
     'URLExtraData.cpp',
 ]
 
 SOURCES += [
     'nsCSSAnonBoxes.cpp',
     'nsCSSPseudoElements.cpp',
     # nsLayoutStylesheetCache.cpp uses nsExceptionHandler.h, which includes
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -22,17 +22,17 @@
 
 #include "mozilla/dom/AnimationEffectReadOnlyBinding.h" // for PlaybackDirection
 #include "mozilla/LookAndFeel.h" // for system colors
 
 #include "nsString.h"
 #include "nsStaticNameTable.h"
 
 #include "mozilla/Preferences.h"
-#include "mozilla/StylePrefs.h"
+#include "mozilla/StaticPrefs.h"
 
 using namespace mozilla;
 
 typedef nsCSSProps::KTableEntry KTableEntry;
 
 // By wrapping internal-only properties in this macro, we are not
 // exposing them in the CSSOM. Since currently it is not necessary to
 // allow accessing them in that way, it is easier and cheaper to just
@@ -362,17 +362,18 @@ nsCSSProps::LookupPropertyByIDLName(cons
 }
 
 nsCSSFontDesc
 nsCSSProps::LookupFontDesc(const nsAString& aFontDesc)
 {
   MOZ_ASSERT(gFontDescTable, "no lookup table, needs addref");
   nsCSSFontDesc which = nsCSSFontDesc(gFontDescTable->Lookup(aFontDesc));
 
-  if (which == eCSSFontDesc_Display && !StylePrefs::sFontDisplayEnabled) {
+  if (which == eCSSFontDesc_Display &&
+      !StaticPrefs::layout_css_font_display_enabled()) {
     which = eCSSFontDesc_UNKNOWN;
   }
   return which;
 }
 
 const nsCString&
 nsCSSProps::GetStringValue(nsCSSPropertyID aProperty)
 {
--- a/layout/style/nsFontFaceLoader.cpp
+++ b/layout/style/nsFontFaceLoader.cpp
@@ -9,17 +9,17 @@
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/Logging.h"
 
 #include "nsFontFaceLoader.h"
 
 #include "nsError.h"
 #include "nsContentUtils.h"
 #include "mozilla/Preferences.h"
-#include "mozilla/StylePrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Unused.h"
 #include "FontFaceSet.h"
 #include "nsPresContext.h"
 #include "nsIPrincipal.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIHttpChannel.h"
 #include "nsIContentPolicy.h"
@@ -333,13 +333,13 @@ nsFontFaceLoader::Cancel()
   }
   mChannel->Cancel(NS_BINDING_ABORTED);
 }
 
 uint8_t
 nsFontFaceLoader::GetFontDisplay()
 {
   uint8_t fontDisplay = NS_FONT_DISPLAY_AUTO;
-  if (StylePrefs::sFontDisplayEnabled) {
+  if (StaticPrefs::layout_css_font_display_enabled()) {
     fontDisplay = mUserFontEntry->GetFontDisplay();
   }
   return fontDisplay;
 }
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -73,16 +73,42 @@
 // - <default-value> is the same as for normal prefs.
 //
 // Note that Rust code must access the global variable directly, rather than via
 // the getter.
 
 // clang-format off
 
 //---------------------------------------------------------------------------
+// Full-screen prefs
+//---------------------------------------------------------------------------
+
+#ifdef RELEASE_OR_BETA
+# define PREF_VALUE false
+#else
+# define PREF_VALUE true
+#endif
+VARCACHE_PREF(
+  "full-screen-api.unprefix.enabled",
+   full_screen_api_unprefix_enabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+//---------------------------------------------------------------------------
+// Graphics prefs
+//---------------------------------------------------------------------------
+
+VARCACHE_PREF(
+  "gfx.font_rendering.opentype_svg.enabled",
+   gfx_font_rendering_opentype_svg_enabled,
+  bool, true
+)
+
+//---------------------------------------------------------------------------
 // HTML5 parser prefs
 //---------------------------------------------------------------------------
 
 // Toggle which thread the HTML5 parser uses for stream parsing.
 VARCACHE_PREF(
   "html5.offmainthread",
    html5_offmainthread,
   bool, true
@@ -101,16 +127,125 @@ VARCACHE_PREF(
 // firing when the timer has already fired previously in this parse.
 VARCACHE_PREF(
   "html5.flushtimer.subsequentdelay",
    html5_flushtimer_subsequentdelay,
   int32_t, 120
 )
 
 //---------------------------------------------------------------------------
+// Layout prefs
+//---------------------------------------------------------------------------
+
+// Is support for the font-display @font-face descriptor enabled?
+VARCACHE_PREF(
+  "layout.css.font-display.enabled",
+   layout_css_font_display_enabled,
+  bool, true
+)
+
+// Are webkit-prefixed properties & property-values supported?
+VARCACHE_PREF(
+  "layout.css.prefixes.webkit",
+   layout_css_prefixes_webkit,
+  bool, true
+)
+
+// Are "-webkit-{min|max}-device-pixel-ratio" media queries supported? (Note:
+// this pref has no effect if the master 'layout.css.prefixes.webkit' pref is
+// set to false.)
+VARCACHE_PREF(
+  "layout.css.prefixes.device-pixel-ratio-webkit",
+   layout_css_prefixes_device_pixel_ratio_webkit,
+  bool, false
+)
+
+// Is -moz-prefixed gradient functions enabled?
+VARCACHE_PREF(
+  "layout.css.prefixes.gradients",
+   layout_css_prefixes_gradients,
+  bool, true
+)
+
+// Should stray control characters be rendered visibly?
+#ifdef RELEASE_OR_BETA
+# define PREF_VALUE false
+#else
+# define PREF_VALUE true
+#endif
+VARCACHE_PREF(
+  "layout.css.control-characters.visible",
+   layout_css_control_characters_visible,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Is support for the frames() timing function enabled?
+#ifdef RELEASE_OR_BETA
+# define PREF_VALUE false
+#else
+# define PREF_VALUE true
+#endif
+VARCACHE_PREF(
+  "layout.css.frames-timing.enabled",
+   layout_css_frames_timing_enabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Should the :visited selector ever match (otherwise :link matches instead)?
+VARCACHE_PREF(
+  "layout.css.visited_links_enabled",
+   layout_css_visited_links_enabled,
+  bool, true
+)
+
+// Pref to control whether @-moz-document rules are enabled in content pages.
+VARCACHE_PREF(
+  "layout.css.moz-document.content.enabled",
+   layout_css_moz_document_content_enabled,
+  bool, false
+)
+
+// Pref to control whether @-moz-document url-prefix() is parsed in content
+// pages. Only effective when layout.css.moz-document.content.enabled is false.
+#ifdef EARLY_BETA_OR_EARLIER
+#define PREF_VALUE false
+#else
+#define PREF_VALUE true
+#endif
+VARCACHE_PREF(
+  "layout.css.moz-document.url-prefix-hack.enabled",
+   layout_css_moz_document_url_prefix_hack_enabled,
+  bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
+// Is support for CSS "grid-template-{columns,rows}: subgrid X" enabled?
+VARCACHE_PREF(
+  "layout.css.grid-template-subgrid-value.enabled",
+   layout_css_grid_template_subgrid_value_enabled,
+  bool, false
+)
+
+// Is support for variation fonts enabled?
+VARCACHE_PREF(
+  "layout.css.font-variations.enabled",
+   layout_css_font_variations_enabled,
+  bool, true
+)
+
+// Are we emulating -moz-{inline}-box layout using CSS flexbox?
+VARCACHE_PREF(
+  "layout.css.emulate-moz-box-with-flex",
+   layout_css_emulate_moz_box_with_flex,
+  bool, false
+)
+
+//---------------------------------------------------------------------------
 // Network prefs
 //---------------------------------------------------------------------------
 
 // Sub-resources HTTP-authentication:
 //   0 - don't allow sub-resources to open HTTP authentication credentials
 //       dialogs
 //   1 - allow sub-resources to open HTTP authentication credentials dialogs,
 //       but don't allow it for cross-origin sub-resources
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -869,18 +869,16 @@ pref("gfx.font_rendering.wordcache.charl
 pref("gfx.font_rendering.wordcache.maxentries", 10000);
 
 pref("gfx.font_rendering.graphite.enabled", true);
 
 #ifdef XP_WIN
 pref("gfx.font_rendering.directwrite.use_gdi_table_loading", true);
 #endif
 
-pref("gfx.font_rendering.opentype_svg.enabled", true);
-
 #ifdef XP_WIN
 // comma separated list of backends to use in order of preference
 // e.g., pref("gfx.canvas.azure.backends", "direct2d,skia,cairo");
 pref("gfx.canvas.azure.backends", "direct2d1.1,skia,cairo");
 pref("gfx.content.azure.backends", "direct2d1.1,skia,cairo");
 #else
 #ifdef XP_MACOSX
 pref("gfx.content.azure.backends", "skia");
@@ -2924,30 +2922,16 @@ pref("layout.word_select.stop_at_undersc
 // 3 = caret moves and blinks as when there is no selection; word delete
 //     deletes the selection
 // Windows default is 1 for word delete behavior, the rest as for 2.
 pref("layout.selection.caret_style", 0);
 
 // pref to report CSS errors to the error console
 pref("layout.css.report_errors", true);
 
-// Should the :visited selector ever match (otherwise :link matches instead)?
-pref("layout.css.visited_links_enabled", true);
-
-// Pref to control whether @-moz-document rules are enabled in content pages.
-pref("layout.css.moz-document.content.enabled",  false);
-
-// Pref to control whether @-moz-document url-prefix() is parsed in content
-// pages. Only effective when layout.css.moz-document.content.enabled is false.
-#ifdef EARLY_BETA_OR_EARLIER
-pref("layout.css.moz-document.url-prefix-hack.enabled", false);
-#else
-pref("layout.css.moz-document.url-prefix-hack.enabled", true);
-#endif
-
 #ifdef NIGHTLY_BUILD
 pref("layout.css.getPropertyCSSValue.enabled", false);
 #else
 pref("layout.css.getPropertyCSSValue.enabled", true);
 #endif
 
 // Override DPI. A value of -1 means use the maximum of 96 and the system DPI.
 // A value of 0 means use the system DPI. A positive value is used as the DPI.
@@ -3021,59 +3005,28 @@ pref("layout.css.text-justify.enabled", 
 
 // Is support for CSS "float: inline-{start,end}" and
 // "clear: inline-{start,end}" enabled?
 pref("layout.css.float-logical-values.enabled", true);
 
 // Is support for the CSS4 image-orientation property enabled?
 pref("layout.css.image-orientation.enabled", true);
 
-// Is support for the font-display @font-face descriptor enabled?
-pref("layout.css.font-display.enabled", true);
-
-// Is support for variation fonts enabled?
-pref("layout.css.font-variations.enabled", true);
-
-// Is support for the frames() timing function enabled?
-#ifdef RELEASE_OR_BETA
-pref("layout.css.frames-timing.enabled", false);
-#else
-pref("layout.css.frames-timing.enabled", true);
-#endif
-
-// Are we emulating -moz-{inline}-box layout using CSS flexbox?
-// (This pref only takes effect in prerelease builds, so we only
-// bother specifying a default in prerelease builds as well.)
-#ifndef RELEASE_OR_BETA
-pref("layout.css.emulate-moz-box-with-flex", false);
-#endif
-
 // Is the paint-order property supported for HTML text?
 // (It is always supported for SVG.)
 pref("layout.css.paint-order.enabled", true);
 
 // Are sets of prefixed properties supported?
 pref("layout.css.prefixes.border-image", true);
 pref("layout.css.prefixes.transforms", true);
 pref("layout.css.prefixes.transitions", true);
 pref("layout.css.prefixes.animations", true);
 pref("layout.css.prefixes.box-sizing", true);
 pref("layout.css.prefixes.font-features", true);
 
-// Is -moz-prefixed gradient functions enabled?
-pref("layout.css.prefixes.gradients", true);
-
-// Are webkit-prefixed properties & property-values supported?
-pref("layout.css.prefixes.webkit", true);
-
-// Are "-webkit-{min|max}-device-pixel-ratio" media queries supported?
-// (Note: this pref has no effect if the master 'layout.css.prefixes.webkit'
-// pref is set to false.)
-pref("layout.css.prefixes.device-pixel-ratio-webkit", false);
-
 // Is support for background-blend-mode enabled?
 pref("layout.css.background-blend-mode.enabled", true);
 
 // Is support for CSS text-combine-upright (tate-chu-yoko) enabled?
 pref("layout.css.text-combine-upright.enabled", true);
 // Is support for CSS text-combine-upright: digits 2-4 enabled?
 pref("layout.css.text-combine-upright-digits.enabled", false);
 
@@ -3089,19 +3042,16 @@ pref("layout.css.osx-font-smoothing.enab
 pref("layout.css.unset-value.enabled", true);
 
 // Is support for the "all" shorthand enabled?
 pref("layout.css.all-shorthand.enabled", true);
 
 // Is support for CSS overflow-clip-box enabled for non-UA sheets?
 pref("layout.css.overflow-clip-box.enabled", false);
 
-// Is support for CSS "grid-template-{columns,rows}: subgrid X" enabled?
-pref("layout.css.grid-template-subgrid-value.enabled", false);
-
 // Is support for CSS contain enabled?
 pref("layout.css.contain.enabled", false);
 
 // Is support for CSS box-decoration-break enabled?
 pref("layout.css.box-decoration-break.enabled", true);
 
 // Is layout of CSS outline-style:auto enabled?
 pref("layout.css.outline-style-auto.enabled", false);
@@ -3132,23 +3082,16 @@ pref("layout.css.scroll-behavior.damping
 pref("layout.css.scroll-snap.enabled", true);
 
 // Is support for CSS shape-outside enabled?
 pref("layout.css.shape-outside.enabled", false);
 
 // Is support for document.fonts enabled?
 pref("layout.css.font-loading-api.enabled", true);
 
-// Should stray control characters be rendered visibly?
-#ifdef RELEASE_OR_BETA
-pref("layout.css.control-characters.visible", false);
-#else
-pref("layout.css.control-characters.visible", true);
-#endif
-
 // Is support for column-span enabled?
 pref("layout.css.column-span.enabled", false);
 
 // Are inter-character ruby annotations enabled?
 pref("layout.css.ruby.intercharacter.enabled", false);
 
 // Is support for overscroll-behavior enabled?
 pref("layout.css.overscroll-behavior.enabled", true);
@@ -5123,21 +5066,16 @@ pref("alerts.showFavicons", false);
 
 // Whether to use platform-specific backends for showing desktop notifications.
 // If no such backend is available, or if the pref is false, then XUL
 // notifications are used.
 pref("alerts.useSystemBackend", true);
 
 // DOM full-screen API.
 pref("full-screen-api.enabled", false);
-#ifdef RELEASE_OR_BETA
-pref("full-screen-api.unprefix.enabled", false);
-#else
-pref("full-screen-api.unprefix.enabled", true);
-#endif
 pref("full-screen-api.allow-trusted-requests-only", true);
 // whether to prevent the top level widget from going fullscreen
 pref("full-screen-api.ignore-widgets", false);
 pref("full-screen-api.pointer-lock.enabled", true);
 // transition duration of fade-to-black and fade-from-black, unit: ms
 #ifndef MOZ_WIDGET_GTK
 pref("full-screen-api.transition-duration.enter", "200 200");
 pref("full-screen-api.transition-duration.leave", "200 200");