Bug 1550422 - P12. Convert Live gfxPrefs into StaticPrefs. r?jrmuizel! draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 13 May 2019 21:09:28 +1000
changeset 2008589 0f5c7e2c981433e460b7afab96cfe4d1aa4f69ad
parent 2008588 1f51118a5843147af0784215fab26007dcda31e9
child 2008590 ec0a38113cabe8476e9c3acc37f62c96cbbfb0a8
push id363925
push userjyavenard@mozilla.com
push dateSat, 18 May 2019 07:53:18 +0000
treeherdertry@5082cd581229 [default view] [failures only]
reviewersjrmuizel
bugs1550422
milestone68.0a1
Bug 1550422 - P12. Convert Live gfxPrefs into StaticPrefs. r?jrmuizel! gfxPrefs Live preferences are almost identical to StaticPrefs. We leave aside for now those that set a custom change callback as this feature isn't yet supported in StaticPrefs. Differential Revision: https://phabricator.services.mozilla.com/D31256
dom/base/Document.cpp
dom/base/TextInputProcessor.cpp
dom/base/nsContentUtils.cpp
dom/base/nsDOMWindowUtils.cpp
dom/base/nsImageLoadingContent.cpp
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/WebGL2Context.cpp
dom/canvas/WebGL2ContextSync.cpp
dom/canvas/WebGLContext.cpp
dom/canvas/WebGLContextExtensions.cpp
dom/canvas/WebGLContextValidate.cpp
dom/canvas/WebGLExtensions.cpp
dom/canvas/WebGLQuery.cpp
dom/canvas/WebGLShaderValidator.cpp
dom/canvas/WebGLTextureUpload.cpp
dom/ipc/BrowserChild.cpp
dom/media/platforms/PDMFactory.cpp
dom/media/platforms/wmf/DXVA2Manager.cpp
dom/media/platforms/wmf/WMFVideoMFTManager.cpp
dom/plugins/ipc/PluginInstanceParent.cpp
dom/vr/VRDisplay.cpp
gfx/2d/DrawTargetCairo.cpp
gfx/gl/GLContext.cpp
gfx/gl/GLContextProviderCGL.mm
gfx/gl/GLContextProviderGLX.cpp
gfx/gl/GLContextProviderWGL.cpp
gfx/gl/GLLibraryEGL.cpp
gfx/gl/GLScreenBuffer.cpp
gfx/gl/SharedSurfaceD3D11Interop.cpp
gfx/ipc/GPUParent.cpp
gfx/ipc/GPUProcessManager.cpp
gfx/layers/D3D11ShareHandleImage.cpp
gfx/layers/LayerScope.cpp
gfx/layers/PaintThread.cpp
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/APZInputBridge.cpp
gfx/layers/apz/src/AndroidAPZ.cpp
gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp
gfx/layers/apz/src/AndroidFlingPhysics.cpp
gfx/layers/apz/src/AndroidVelocityTracker.cpp
gfx/layers/apz/src/AsyncPanZoomController.cpp
gfx/layers/apz/src/DesktopFlingPhysics.h
gfx/layers/apz/src/FocusTarget.cpp
gfx/layers/apz/src/GenericFlingAnimation.h
gfx/layers/apz/src/GenericScrollAnimation.cpp
gfx/layers/apz/src/GestureEventListener.cpp
gfx/layers/apz/src/HitTestingTreeNode.cpp
gfx/layers/apz/src/InputBlockState.cpp
gfx/layers/apz/src/InputQueue.cpp
gfx/layers/apz/src/KeyboardScrollAnimation.cpp
gfx/layers/apz/src/SimpleVelocityTracker.cpp
gfx/layers/apz/src/WheelScrollAnimation.cpp
gfx/layers/apz/test/gtest/APZTestCommon.h
gfx/layers/apz/test/gtest/TestBasic.cpp
gfx/layers/apz/test/gtest/TestGestureDetector.cpp
gfx/layers/apz/test/gtest/TestHitTesting.cpp
gfx/layers/apz/test/gtest/TestPinching.cpp
gfx/layers/apz/test/gtest/TestSnapping.cpp
gfx/layers/apz/testutil/APZTestData.h
gfx/layers/apz/util/APZEventState.cpp
gfx/layers/apz/util/CheckerboardReportService.cpp
gfx/layers/basic/BasicCompositor.cpp
gfx/layers/basic/BasicLayerManager.cpp
gfx/layers/client/ClientLayerManager.cpp
gfx/layers/client/ClientLayerManager.h
gfx/layers/client/ClientTiledPaintedLayer.cpp
gfx/layers/client/MultiTiledContentClient.cpp
gfx/layers/client/TextureClient.cpp
gfx/layers/client/TiledContentClient.cpp
gfx/layers/composite/AsyncCompositionManager.cpp
gfx/layers/composite/ContainerLayerComposite.cpp
gfx/layers/composite/Diagnostics.h
gfx/layers/composite/FPSCounter.cpp
gfx/layers/composite/LayerManagerComposite.cpp
gfx/layers/composite/TextureHost.cpp
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/d3d11/MLGDeviceD3D11.cpp
gfx/layers/d3d11/TextureD3D11.cpp
gfx/layers/ipc/CompositorBridgeParent.cpp
gfx/layers/ipc/CompositorVsyncScheduler.cpp
gfx/layers/ipc/LayerTransactionParent.cpp
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/mlgpu/ContainerLayerMLGPU.cpp
gfx/layers/mlgpu/LayerManagerMLGPU.cpp
gfx/layers/opengl/CompositorOGL.cpp
gfx/layers/wr/WebRenderBridgeChild.cpp
gfx/layers/wr/WebRenderBridgeParent.cpp
gfx/layers/wr/WebRenderCommandBuilder.cpp
gfx/layers/wr/WebRenderLayerManager.cpp
gfx/layers/wr/WebRenderLayerManager.h
gfx/src/DriverCrashGuard.cpp
gfx/tests/gtest/TestGfxPrefs.cpp
gfx/thebes/D3D11Checks.cpp
gfx/thebes/DeviceManagerDx.cpp
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
gfx/thebes/gfxPrefs.h
gfx/thebes/gfxUserFontSet.cpp
gfx/thebes/gfxUtils.cpp
gfx/thebes/gfxWindowsPlatform.cpp
gfx/vr/VRDisplayClient.cpp
gfx/vr/VRDisplayHost.cpp
gfx/vr/VRManager.cpp
gfx/vr/gfxVRPuppet.cpp
gfx/vr/service/OculusSession.cpp
gfx/vr/service/OpenVRSession.cpp
gfx/vr/service/VRService.cpp
gfx/webrender_bindings/Moz2DImageRenderer.cpp
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/ycbcr/yuv_convert.cpp
image/AnimationSurfaceProvider.cpp
image/DecoderFactory.cpp
image/FrameAnimator.cpp
image/ImageFactory.cpp
image/ImageMemoryReporter.cpp
image/RasterImage.cpp
image/SurfaceCache.cpp
image/imgFrame.cpp
image/imgLoader.cpp
image/imgRequest.cpp
image/test/gtest/TestSurfaceCache.cpp
layout/base/AccessibleCaretEventHub.cpp
layout/base/PresShell.cpp
layout/base/ZoomConstraintsClient.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsRefreshDriver.cpp
layout/generic/ScrollAnimationBezierPhysics.cpp
layout/generic/ScrollAnimationMSDPhysics.cpp
layout/generic/ScrollSnap.cpp
layout/generic/ScrollVelocityQueue.cpp
layout/generic/nsFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsSubDocumentFrame.cpp
layout/generic/nsTextFrame.cpp
layout/painting/DisplayListChecker.cpp
layout/painting/FrameLayerBuilder.cpp
layout/painting/RetainedDisplayListBuilder.cpp
layout/painting/nsDisplayList.cpp
layout/svg/nsFilterInstance.cpp
layout/svg/nsSVGIntegrationUtils.cpp
modules/libpref/StaticPrefs.h
modules/libpref/init/StaticPrefList.h
tallGdkErrorHandler();
widget/WidgetEventImpl.cpp
widget/cocoa/nsChildView.mm
widget/cocoa/nsCocoaWindow.mm
widget/nsBaseWidget.cpp
widget/windows/WinCompositorWidget.cpp
widget/windows/nsWindow.cpp
widget/windows/nsWindowBase.cpp
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -6872,17 +6872,17 @@ nsViewportInfo Document::GetViewportInfo
       context ? context->CSSToDevPixelScale() : CSSToLayoutDeviceScale(1);
 
   CSSToScreenScale defaultScale =
       layoutDeviceScale * LayoutDeviceToScreenScale(1.0);
 
   // Special behaviour for desktop mode, provided we are not on an about: page
   nsPIDOMWindowOuter* win = GetWindow();
   if (win && win->IsDesktopModeViewport() && !IsAboutPage()) {
-    CSSCoord viewportWidth = gfxPrefs::DesktopViewportWidth() / fullZoom;
+    CSSCoord viewportWidth = StaticPrefs::DesktopViewportWidth() / fullZoom;
     CSSToScreenScale scaleToFit(aDisplaySize.width / viewportWidth);
     float aspectRatio = (float)aDisplaySize.height / aDisplaySize.width;
     CSSSize viewportSize(viewportWidth, viewportWidth * aspectRatio);
     ScreenIntSize fakeDesktopSize = RoundedToInt(viewportSize * scaleToFit);
     return nsViewportInfo(fakeDesktopSize, scaleToFit,
                           nsViewportInfo::ZoomFlag::AllowZoom);
   }
 
@@ -7010,17 +7010,17 @@ nsViewportInfo Document::GetViewportInfo
     default:
       LayoutDeviceToScreenScale effectiveMinScale = mScaleMinFloat;
       LayoutDeviceToScreenScale effectiveMaxScale = mScaleMaxFloat;
       bool effectiveValidMaxScale = mValidMaxScale;
 
       nsViewportInfo::ZoomFlag effectiveZoomFlag =
           mAllowZoom ? nsViewportInfo::ZoomFlag::AllowZoom
                      : nsViewportInfo::ZoomFlag::DisallowZoom;
-      if (gfxPrefs::ForceUserScalable()) {
+      if (StaticPrefs::ForceUserScalable()) {
         // If the pref to force user-scalable is enabled, we ignore the values
         // from the meta-viewport tag for these properties and just assume they
         // allow the page to be scalable. Note in particular that this code is
         // in the "Specified" branch of the enclosing switch statement, so that
         // calls to GetViewportInfo always use the latest value of the
         // ForceUserScalable pref. Other codepaths that return nsViewportInfo
         // instances are all consistent with ForceUserScalable() already.
         effectiveMinScale = kViewportMinScale;
@@ -7123,17 +7123,17 @@ nsViewportInfo Document::GetViewportInfo
             // default, because a narrow viewport based on typical mobile device
             // screen sizes (especially in portrait mode) will frequently break
             // the layout of such pages. To keep text readable in that case, we
             // rely on font inflation instead.
 
             // Divide by fullZoom to stretch CSS pixel size of viewport in order
             // to keep device pixel size unchanged after full zoom applied.
             // See bug 974242.
-            width = gfxPrefs::DesktopViewportWidth() / fullZoom;
+            width = StaticPrefs::DesktopViewportWidth() / fullZoom;
           } else {
             // Some viewport information was provided; follow the spec.
             width = displaySize.width;
           }
         } else {
           width = height * aDisplaySize.width / aDisplaySize.height;
         }
       }
--- a/dom/base/TextInputProcessor.cpp
+++ b/dom/base/TextInputProcessor.cpp
@@ -385,17 +385,17 @@ nsresult TextInputProcessor::BeginInputT
       // Forcibly initialize the members if we failed to end the input
       // transaction.
       UnlinkFromTextEventDispatcher();
     }
   }
 
   nsresult rv = NS_OK;
   if (aForTests) {
-    bool isAPZAware = gfxPrefs::TestEventsAsyncEnabled();
+    bool isAPZAware = StaticPrefs::TestEventsAsyncEnabled();
     rv = dispatcher->BeginTestInputTransaction(this, isAPZAware);
   } else {
     rv = dispatcher->BeginInputTransaction(this);
   }
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -25,17 +25,17 @@
 #include "js/RegExp.h"  // JS::ExecuteRegExpNoStatics, JS::NewUCRegExpObject, JS::RegExpFlags
 #include "js/Value.h"
 #include "Layers.h"
 #include "nsAppRunner.h"
 // nsNPAPIPluginInstance must be included before mozilla/dom/Document.h, which
 // is included in mozAutoDocUpdate.h.
 #include "nsNPAPIPluginInstance.h"
 #include "gfxDrawable.h"
-#include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "ImageOps.h"
 #include "mozAutoDocUpdate.h"
 #include "mozilla/AntiTrackingCommon.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/AutoTimelineMarker.h"
 #include "mozilla/BackgroundHangMonitor.h"
@@ -7870,17 +7870,17 @@ nsresult nsContentUtils::SendMouseEvent(
     RefPtr<PresShell> presShell;
     nsView* view =
         GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
     if (!presShell || !view) {
       return NS_ERROR_FAILURE;
     }
     return presShell->HandleEvent(view->GetFrame(), &event, false, &status);
   }
-  if (gfxPrefs::TestEventsAsyncEnabled()) {
+  if (StaticPrefs::TestEventsAsyncEnabled()) {
     status = widget->DispatchInputEvent(&event);
   } else {
     nsresult rv = widget->DispatchEvent(&event, status);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   if (aPreventDefault) {
     *aPreventDefault = (status == nsEventStatus_eConsumeNoDefault);
   }
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -41,16 +41,17 @@
 #include "nsJSEnvironment.h"
 #include "nsJSUtils.h"
 
 #include "mozilla/ChaosMode.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/MiscEvents.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/PresShell.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/TextEventDispatcher.h"
 #include "mozilla/TouchEvents.h"
 
 #include "nsViewManager.h"
 
 #include "nsLayoutUtils.h"
 #include "nsComputedDOMStyle.h"
@@ -64,17 +65,16 @@
 #include <algorithm>
 
 #if defined(MOZ_X11) && defined(MOZ_WIDGET_GTK)
 #  include <gdk/gdk.h>
 #  include <gdk/gdkx.h>
 #endif
 
 #include "Layers.h"
-#include "gfxPrefs.h"
 
 #include "mozilla/dom/AudioDeviceInfo.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/BrowserChild.h"
 #include "mozilla/dom/IDBFactoryBinding.h"
 #include "mozilla/dom/IDBMutableFileBinding.h"
 #include "mozilla/dom/IDBMutableFile.h"
 #include "mozilla/dom/IndexedDatabaseManager.h"
@@ -465,17 +465,17 @@ nsDOMWindowUtils::SetDisplayPortForEleme
                      nsPresContext::CSSPixelsToAppUnits(aYPx),
                      nsPresContext::CSSPixelsToAppUnits(aWidthPx),
                      nsPresContext::CSSPixelsToAppUnits(aHeightPx));
 
   aElement->SetProperty(nsGkAtoms::DisplayPort,
                         new DisplayPortPropertyData(displayport, aPriority),
                         nsINode::DeleteProperty<DisplayPortPropertyData>);
 
-  if (gfxPrefs::LayoutUseContainersForRootFrames()) {
+  if (StaticPrefs::LayoutUseContainersForRootFrames()) {
     nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();
     if (rootScrollFrame && aElement == rootScrollFrame->GetContent() &&
         nsLayoutUtils::UsesAsyncScrolling(rootScrollFrame)) {
       // We are setting a root displayport for a document.
       // The pres shell needs a special flag set.
       presShell->SetIgnoreViewportScrolling(true);
     }
   }
--- a/dom/base/nsImageLoadingContent.cpp
+++ b/dom/base/nsImageLoadingContent.cpp
@@ -524,17 +524,17 @@ void nsImageLoadingContent::MaybeForceSy
   }
 
   bool forceSync = mSyncDecodingHint;
   if (!forceSync && aPrepareNextRequest) {
     // Detect JavaScript-based animations created by changing the |src|
     // attribute on a timer.
     TimeStamp now = TimeStamp::Now();
     TimeDuration threshold = TimeDuration::FromMilliseconds(
-        gfxPrefs::ImageInferSrcAnimationThresholdMS());
+        StaticPrefs::ImageInferSrcAnimationThresholdMS());
 
     // If the length of time between request changes is less than the threshold,
     // then force sync decoding to eliminate flicker from the animation.
     forceSync = (now - mMostRecentRequestChange < threshold);
     mMostRecentRequestChange = now;
   }
 
   if (imageFrame) {
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -46,17 +46,16 @@
 
 #include "ImageEncoder.h"
 #include "ImageRegion.h"
 
 #include "gfxContext.h"
 #include "gfxPlatform.h"
 #include "gfxFont.h"
 #include "gfxBlur.h"
-#include "gfxPrefs.h"
 #include "gfxTextRun.h"
 #include "gfxUtils.h"
 
 #include "nsFrameLoader.h"
 #include "nsBidiPresUtils.h"
 #include "Layers.h"
 #include "LayerUserData.h"
 #include "CanvasUtils.h"
@@ -88,16 +87,17 @@
 #include "mozilla/gfx/PathHelpers.h"
 #include "mozilla/gfx/DataSurfaceHelpers.h"
 #include "mozilla/gfx/PatternHelpers.h"
 #include "mozilla/gfx/Swizzle.h"
 #include "mozilla/layers/PersistentBufferProvider.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ServoBindings.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/Unused.h"
 #include "nsCCUncollectableMarker.h"
 #include "nsWrapperCacheInlines.h"
 #include "mozilla/dom/CanvasRenderingContext2DBinding.h"
 #include "mozilla/dom/CanvasPath.h"
@@ -1226,18 +1226,18 @@ bool CanvasRenderingContext2D::EnsureTar
     return false;
   }
 
   if (mTarget) {
     return true;
   }
 
   // Check that the dimensions are sane
-  if (mWidth > gfxPrefs::MaxCanvasSize() ||
-      mHeight > gfxPrefs::MaxCanvasSize() || mWidth < 0 || mHeight < 0) {
+  if (mWidth > StaticPrefs::MaxCanvasSize() ||
+      mHeight > StaticPrefs::MaxCanvasSize() || mWidth < 0 || mHeight < 0) {
     SetErrorState();
     return false;
   }
 
   // If the next drawing command covers the entire canvas, we can skip copying
   // from the previous frame and/or clearing the canvas.
   gfx::Rect canvasRect(0, 0, mWidth, mHeight);
   bool canDiscardContent =
--- a/dom/canvas/WebGL2Context.cpp
+++ b/dom/canvas/WebGL2Context.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "WebGL2Context.h"
 
-#include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "GLContext.h"
 #include "mozilla/dom/WebGL2RenderingContextBinding.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Telemetry.h"
 #include "nsPrintfCString.h"
 #include "WebGLBuffer.h"
 #include "WebGLFormats.h"
 #include "WebGLTransformFeedback.h"
@@ -26,17 +26,17 @@ WebGL2Context::WebGL2Context() : WebGLCo
 WebGL2Context::~WebGL2Context() {}
 
 UniquePtr<webgl::FormatUsageAuthority> WebGL2Context::CreateFormatUsage(
     gl::GLContext* gl) const {
   return webgl::FormatUsageAuthority::CreateForWebGL2(gl);
 }
 
 /*static*/
-bool WebGL2Context::IsSupported() { return gfxPrefs::WebGL2Enabled(); }
+bool WebGL2Context::IsSupported() { return StaticPrefs::WebGL2Enabled(); }
 
 /*static*/
 WebGL2Context* WebGL2Context::Create() { return new WebGL2Context(); }
 
 JSObject* WebGL2Context::WrapObject(JSContext* cx,
                                     JS::Handle<JSObject*> givenProto) {
   return dom::WebGL2RenderingContext_Binding::Wrap(cx, this, givenProto);
 }
--- a/dom/canvas/WebGL2ContextSync.cpp
+++ b/dom/canvas/WebGL2ContextSync.cpp
@@ -62,17 +62,17 @@ GLenum WebGL2Context::ClientWaitSync(con
 
   if (timeout > kMaxClientWaitSyncTimeoutNS) {
     ErrorInvalidOperation("`timeout` must not exceed %s nanoseconds.",
                           "MAX_CLIENT_WAIT_TIMEOUT_WEBGL");
     return LOCAL_GL_WAIT_FAILED;
   }
 
   const bool canBeAvailable =
-      (sync.mCanBeAvailable || gfxPrefs::WebGLImmediateQueries());
+      (sync.mCanBeAvailable || StaticPrefs::WebGLImmediateQueries());
   if (!canBeAvailable) {
     if (timeout) {
       GenerateWarning(
           "Sync object not yet queryable. Please wait for the event"
           " loop.");
     }
     return LOCAL_GL_WAIT_FAILED;
   }
@@ -113,17 +113,17 @@ void WebGL2Context::GetSyncParameter(JSC
   retval.setNull();
   if (IsContextLost()) return;
 
   if (!ValidateObject("sync", sync)) return;
 
   ////
 
   const bool canBeAvailable =
-      (sync.mCanBeAvailable || gfxPrefs::WebGLImmediateQueries());
+      (sync.mCanBeAvailable || StaticPrefs::WebGLImmediateQueries());
   if (!canBeAvailable && pname == LOCAL_GL_SYNC_STATUS) {
     retval.set(JS::Int32Value(LOCAL_GL_UNSIGNALED));
     return;
   }
 
   GLint result = 0;
   switch (pname) {
     case LOCAL_GL_OBJECT_TYPE:
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -8,17 +8,16 @@
 #include <algorithm>
 #include <queue>
 
 #include "AccessCheck.h"
 #include "gfxConfig.h"
 #include "gfxContext.h"
 #include "gfxCrashReporterUtils.h"
 #include "gfxPattern.h"
-#include "gfxPrefs.h"
 #include "gfxUtils.h"
 #include "MozFramebuffer.h"
 #include "GLBlitHelper.h"
 #include "GLContext.h"
 #include "GLContextProvider.h"
 #include "GLReadTexImageHelper.h"
 #include "GLScreenBuffer.h"
 #include "ImageContainer.h"
@@ -30,16 +29,17 @@
 #include "mozilla/dom/HTMLVideoElement.h"
 #include "mozilla/dom/ImageData.h"
 #include "mozilla/dom/WebGLContextEvent.h"
 #include "mozilla/EnumeratedArrayCycleCollection.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ProcessPriorityManager.h"
 #include "mozilla/ScopeExit.h"
 #include "mozilla/Services.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "nsContentUtils.h"
 #include "nsDisplayList.h"
 #include "nsError.h"
 #include "nsIClassInfoImpl.h"
 #include "nsIConsoleService.h"
 #include "nsIGfxInfo.h"
 #include "nsIObserverService.h"
@@ -92,17 +92,17 @@ namespace mozilla {
 
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
 using namespace mozilla::gl;
 using namespace mozilla::layers;
 
 WebGLContextOptions::WebGLContextOptions() {
   // Set default alpha state based on preference.
-  if (gfxPrefs::WebGLDefaultNoAlpha()) alpha = false;
+  if (StaticPrefs::WebGLDefaultNoAlpha()) alpha = false;
 }
 
 bool WebGLContextOptions::operator==(const WebGLContextOptions& r) const {
   bool eq = true;
   eq &= (alpha == r.alpha);
   eq &= (depth == r.depth);
   eq &= (stencil == r.stencil);
   eq &= (premultipliedAlpha == r.premultipliedAlpha);
@@ -111,28 +111,28 @@ bool WebGLContextOptions::operator==(con
   eq &= (failIfMajorPerformanceCaveat == r.failIfMajorPerformanceCaveat);
   eq &= (powerPreference == r.powerPreference);
   return eq;
 }
 
 WebGLContext::WebGLContext()
     : gl(mGL_OnlyClearInDestroyResourcesAndContext)  // const reference
       ,
-      mMaxPerfWarnings(gfxPrefs::WebGLMaxPerfWarnings()),
+      mMaxPerfWarnings(StaticPrefs::WebGLMaxPerfWarnings()),
       mNumPerfWarnings(0),
       mMaxAcceptableFBStatusInvals(
-          gfxPrefs::WebGLMaxAcceptableFBStatusInvals()),
+          StaticPrefs::WebGLMaxAcceptableFBStatusInvals()),
       mDataAllocGLCallCount(0),
       mEmptyTFO(0),
       mContextLossHandler(this),
       mNeedsFakeNoAlpha(false),
       mNeedsFakeNoDepth(false),
       mNeedsFakeNoStencil(false),
-      mAllowFBInvalidation(gfxPrefs::WebGLFBInvalidation()),
-      mMsaaSamples((uint8_t)gfxPrefs::WebGLMsaaSamples()) {
+      mAllowFBInvalidation(StaticPrefs::WebGLFBInvalidation()),
+      mMsaaSamples((uint8_t)StaticPrefs::WebGLMsaaSamples()) {
   mGeneration = 0;
   mInvalidated = false;
   mCapturedFrameInvalidated = false;
   mShouldPresent = true;
   mResetLayer = true;
   mOptionsFrozen = false;
   mDisableExtensions = false;
   mIsMesa = false;
@@ -158,17 +158,17 @@ WebGLContext::WebGLContext()
   mLastLossWasSimulated = false;
   mLoseContextOnMemoryPressure = false;
   mCanLoseContextInForeground = true;
 
   mAlreadyGeneratedWarnings = 0;
   mAlreadyWarnedAboutFakeVertexAttrib0 = false;
   mAlreadyWarnedAboutViewportLargerThanDest = false;
 
-  mMaxWarnings = gfxPrefs::WebGLMaxWarningsPerContext();
+  mMaxWarnings = StaticPrefs::WebGLMaxWarningsPerContext();
   if (mMaxWarnings < -1) {
     GenerateWarning(
         "webgl.max-warnings-per-context size is too large (seems like a "
         "negative value wrapped)");
     mMaxWarnings = 0;
   }
 
   mLastUseIndex = 0;
@@ -354,21 +354,21 @@ WebGLContext::SetContextOptions(JSContex
       attributes.mFailIfMajorPerformanceCaveat;
   newOpts.powerPreference = attributes.mPowerPreference;
 
   if (attributes.mAlpha.WasPassed()) {
     newOpts.alpha = attributes.mAlpha.Value();
   }
 
   // Don't do antialiasing if we've disabled MSAA.
-  if (!gfxPrefs::MSAALevel()) {
+  if (!StaticPrefs::MSAALevel()) {
     newOpts.antialias = false;
   }
 
-  if (!gfxPrefs::WebGLForceMSAA()) {
+  if (!StaticPrefs::WebGLForceMSAA()) {
     const nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
 
     nsCString blocklistId;
     if (IsFeatureInBlacklist(gfxInfo, nsIGfxInfo::FEATURE_WEBGL_MSAA,
                              &blocklistId)) {
       GenerateWarning(
           "Disallowing antialiased backbuffers due to blacklisting.");
       newOpts.antialias = false;
@@ -470,17 +470,17 @@ bool WebGLContext::CreateAndInitGL(
   bool tryANGLE = false;
 
   if (forceEnabled) {
     flags |= gl::CreateContextFlags::FORCE_ENABLE_HARDWARE;
   }
 
   if (IsWebGL2()) {
     flags |= gl::CreateContextFlags::PREFER_ES3;
-  } else if (!gfxPrefs::WebGL1AllowCoreProfile()) {
+  } else if (!StaticPrefs::WebGL1AllowCoreProfile()) {
     flags |= gl::CreateContextFlags::REQUIRE_COMPAT_PROFILE;
   }
 
   switch (mOptions.powerPreference) {
     case dom::WebGLPowerPreference::Low_power:
       break;
 
     case dom::WebGLPowerPreference::High_performance:
@@ -491,17 +491,17 @@ bool WebGLContext::CreateAndInitGL(
       // We can even make it dynamic by holding on to a
       // ForceDiscreteGPUHelperCGL iff we decide it's a high-performance
       // application:
       // - Non-trivial canvas size
       // - Many draw calls
       // - Same origin with root page (try to stem bleeding from WebGL
       // ads/trackers)
     default:
-      if (!gfxPrefs::WebGLDefaultLowPower()) {
+      if (!StaticPrefs::WebGLDefaultLowPower()) {
         flags |= gl::CreateContextFlags::HIGH_POWER;
       }
       break;
   }
 
   // If "Use hardware acceleration when available" option is disabled:
   if (!gfxConfig::IsEnabled(Feature::HW_COMPOSITING)) {
     flags &= ~gl::CreateContextFlags::HIGH_POWER;
@@ -536,21 +536,21 @@ bool WebGLContext::CreateAndInitGL(
   // --
 
   const bool useEGL = PR_GetEnv("MOZ_WEBGL_FORCE_EGL");
 
 #ifdef XP_WIN
   tryNativeGL = false;
   tryANGLE = true;
 
-  if (gfxPrefs::WebGLDisableWGL()) {
+  if (StaticPrefs::WebGLDisableWGL()) {
     tryNativeGL = false;
   }
 
-  if (gfxPrefs::WebGLDisableANGLE() || PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL") ||
+  if (StaticPrefs::WebGLDisableANGLE() || PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL") ||
       useEGL) {
     tryNativeGL = true;
     tryANGLE = false;
   }
 #endif
 
   if (tryNativeGL && !forceEnabled) {
     const nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
@@ -796,50 +796,50 @@ WebGLContext::SetDimensions(int32_t sign
     return NS_ERROR_FAILURE;
   }
 
   // increment the generation number - Do this early because later
   // in CreateOffscreenGL(), "default" objects are created that will
   // pick up the old generation.
   ++mGeneration;
 
-  bool disabled = gfxPrefs::WebGLDisabled();
+  bool disabled = StaticPrefs::WebGLDisabled();
 
   // TODO: When we have software webgl support we should use that instead.
   disabled |= gfxPlatform::InSafeMode();
 
   if (disabled) {
     if (gfxPlatform::InSafeMode()) {
       failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WEBGL_SAFEMODE");
     } else {
       failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WEBGL_DISABLED");
     }
     const nsLiteralCString text("WebGL is currently disabled.");
     ThrowEvent_WebGLContextCreationError(text);
     return NS_ERROR_FAILURE;
   }
 
-  if (gfxPrefs::WebGLDisableFailIfMajorPerformanceCaveat()) {
+  if (StaticPrefs::WebGLDisableFailIfMajorPerformanceCaveat()) {
     mOptions.failIfMajorPerformanceCaveat = false;
   }
 
   if (mOptions.failIfMajorPerformanceCaveat) {
     nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
     if (!HasAcceleratedLayers(gfxInfo)) {
       failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WEBGL_PERF_CAVEAT");
       const nsLiteralCString text(
           "failIfMajorPerformanceCaveat: Compositor is not"
           " hardware-accelerated.");
       ThrowEvent_WebGLContextCreationError(text);
       return NS_ERROR_FAILURE;
     }
   }
 
   // Alright, now let's start trying.
-  bool forceEnabled = gfxPrefs::WebGLForceEnabled();
+  bool forceEnabled = StaticPrefs::WebGLForceEnabled();
   ScopedGfxFeatureReporter reporter("WebGL", forceEnabled);
 
   MOZ_ASSERT(!gl);
   std::vector<FailureReason> failReasons;
   if (!CreateAndInitGL(forceEnabled, &failReasons)) {
     nsCString text("WebGL creation failed: ");
     for (const auto& cur : failReasons) {
       // Don't try to accumulate using an empty key if |cur.key| is empty.
@@ -961,18 +961,19 @@ WebGLContext::SetDimensions(int32_t sign
 
   failureId = NS_LITERAL_CSTRING("SUCCESS");
 
   gl->ResetSyncCallCount("WebGLContext Initialization");
   return NS_OK;
 }
 
 void WebGLContext::LoseOldestWebGLContextIfLimitExceeded() {
-  const auto maxWebGLContexts = gfxPrefs::WebGLMaxContexts();
-  auto maxWebGLContextsPerPrincipal = gfxPrefs::WebGLMaxContextsPerPrincipal();
+  const auto maxWebGLContexts = StaticPrefs::WebGLMaxContexts();
+  auto maxWebGLContextsPerPrincipal =
+      StaticPrefs::WebGLMaxContextsPerPrincipal();
 
   // maxWebGLContextsPerPrincipal must be less than maxWebGLContexts
   MOZ_ASSERT(maxWebGLContextsPerPrincipal <= maxWebGLContexts);
   maxWebGLContextsPerPrincipal =
       std::min(maxWebGLContextsPerPrincipal, maxWebGLContexts);
 
   if (!NS_IsMainThread()) {
     // XXX mtseng: bug 709490, WebGLMemoryTracker is not thread safe.
@@ -1324,17 +1325,17 @@ ScopedPrepForResourceClear::~ScopedPrepF
   gl->fClearStencil(webgl.mStencilClearValue);
 }
 
 }  // namespace webgl
 
 // -
 
 void WebGLContext::OnEndOfFrame() const {
-  if (gfxPrefs::WebGLSpewFrameAllocs()) {
+  if (StaticPrefs::WebGLSpewFrameAllocs()) {
     GeneratePerfWarning("[webgl.perf.spew-frame-allocs] %" PRIu64
                         " data allocations this frame.",
                         mDataAllocGLCallCount);
   }
   mDataAllocGLCallCount = 0;
   gl->ResetSyncCallCount("WebGLContext PresentScreenBuffer");
 }
 
--- a/dom/canvas/WebGLContextExtensions.cpp
+++ b/dom/canvas/WebGLContextExtensions.cpp
@@ -76,17 +76,17 @@ bool WebGLContext::IsExtensionSupported(
 
   // Chrome contexts need access to debug information even when
   // webgl.disable-extensions is set. This is used in the graphics
   // section of about:support
   if (callerType == dom::CallerType::System) {
     allowPrivilegedExts = true;
   }
 
-  if (gfxPrefs::WebGLPrivilegedExtensionsEnabled()) {
+  if (StaticPrefs::WebGLPrivilegedExtensionsEnabled()) {
     allowPrivilegedExts = true;
   }
 
   if (allowPrivilegedExts) {
     switch (ext) {
       case WebGLExtensionID::EXT_disjoint_timer_query:
         return WebGLExtensionDisjointTimerQuery::IsSupported(this);
       case WebGLExtensionID::MOZ_debug:
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -3,21 +3,21 @@
  * 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 "WebGLContext.h"
 
 #include <algorithm>
 #include "GLSLANG/ShaderLang.h"
 #include "CanvasUtils.h"
-#include "gfxPrefs.h"
 #include "GLContext.h"
 #include "jsfriendapi.h"
 #include "mozilla/CheckedInt.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/StaticPrefs.h"
 #include "nsIObserverService.h"
 #include "nsPrintfCString.h"
 #include "WebGLActiveInfo.h"
 #include "WebGLBuffer.h"
 #include "WebGLContextUtils.h"
 #include "WebGLFramebuffer.h"
 #include "WebGLProgram.h"
 #include "WebGLRenderbuffer.h"
@@ -283,19 +283,20 @@ bool WebGLContext::InitAndValidateGL(Fai
     const nsPrintfCString reason(
         "GL error 0x%x occurred during OpenGL context"
         " initialization, before WebGL initialization!",
         error);
     *out_failReason = {"FEATURE_FAILURE_WEBGL_GLERR_1", reason};
     return false;
   }
 
-  mDisableExtensions = gfxPrefs::WebGLDisableExtensions();
-  mLoseContextOnMemoryPressure = gfxPrefs::WebGLLoseContextOnMemoryPressure();
-  mCanLoseContextInForeground = gfxPrefs::WebGLCanLoseContextInForeground();
+  mDisableExtensions = StaticPrefs::WebGLDisableExtensions();
+  mLoseContextOnMemoryPressure =
+      StaticPrefs::WebGLLoseContextOnMemoryPressure();
+  mCanLoseContextInForeground = StaticPrefs::WebGLCanLoseContextInForeground();
 
   // These are the default values, see 6.2 State tables in the
   // OpenGL ES 2.0.25 spec.
   mColorWriteMask = 0x0f;
   mDriverColorMask = mColorWriteMask;
   mColorClearValue[0] = 0.f;
   mColorClearValue[1] = 0.f;
   mColorClearValue[2] = 0.f;
@@ -479,17 +480,17 @@ bool WebGLContext::InitAndValidateGL(Fai
                      // If we're constructed from an offscreen canvas
           (mOffscreenCanvas->GetOwnerGlobal()
                ? nsContentUtils::ShouldResistFingerprinting(
                      mOffscreenCanvas->GetOwnerGlobal()->PrincipalOrNull())
                :
                // Last resort, just check the global preference
                nsContentUtils::ShouldResistFingerprinting());
 
-  if (gfxPrefs::WebGLMinCapabilityMode()) {
+  if (StaticPrefs::WebGLMinCapabilityMode()) {
     bool ok = true;
 
     ok &= RestrictCap(&mGLMaxVertexTextureImageUnits,
                       kMinMaxVertexTextureImageUnits);
     ok &= RestrictCap(&mGLMaxFragmentTextureImageUnits,
                       kMinMaxFragmentTextureImageUnits);
     ok &= RestrictCap(&mGLMaxCombinedTextureImageUnits,
                       kMinMaxCombinedTextureImageUnits);
@@ -656,25 +657,25 @@ bool WebGLContext::InitAndValidateGL(Fai
   static const float kDefaultGenericVertexAttribData[4] = {0, 0, 0, 1};
   memcpy(mGenericVertexAttrib0Data, kDefaultGenericVertexAttribData,
          sizeof(mGenericVertexAttrib0Data));
 
   mFakeVertexAttrib0BufferObject = 0;
 
   mNeedsIndexValidation =
       !gl->IsSupported(gl::GLFeature::robust_buffer_access_behavior);
-  switch (gfxPrefs::WebGLForceIndexValidation()) {
+  switch (StaticPrefs::WebGLForceIndexValidation()) {
     case -1:
       mNeedsIndexValidation = false;
       break;
     case 1:
       mNeedsIndexValidation = true;
       break;
     default:
-      MOZ_ASSERT(gfxPrefs::WebGLForceIndexValidation() == 0);
+      MOZ_ASSERT(StaticPrefs::WebGLForceIndexValidation() == 0);
       break;
   }
 
   return true;
 }
 
 bool WebGLContext::ValidateFramebufferTarget(GLenum target) {
   bool isValid = true;
--- a/dom/canvas/WebGLExtensions.cpp
+++ b/dom/canvas/WebGLExtensions.cpp
@@ -1,18 +1,18 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "WebGLExtensions.h"
 
-#include "gfxPrefs.h"
 #include "GLContext.h"
 #include "mozilla/dom/WebGLRenderingContextBinding.h"
+#include "mozilla/StaticPrefs.h"
 #include "WebGLContext.h"
 
 namespace mozilla {
 
 WebGLExtensionBase::WebGLExtensionBase(WebGLContext* context)
     : WebGLContextBoundObject(context), mIsLost(false) {}
 
 WebGLExtensionBase::~WebGLExtensionBase() {}
@@ -57,17 +57,17 @@ WebGLExtensionFBORenderMipmap::WebGLExte
   MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
 }
 
 WebGLExtensionFBORenderMipmap::~WebGLExtensionFBORenderMipmap() = default;
 
 bool WebGLExtensionFBORenderMipmap::IsSupported(
     const WebGLContext* const webgl) {
   if (webgl->IsWebGL2()) return false;
-  if (!gfxPrefs::WebGLDraftExtensionsEnabled()) return false;
+  if (!StaticPrefs::WebGLDraftExtensionsEnabled()) return false;
 
   const auto& gl = webgl->gl;
   if (!gl->IsGLES()) return true;
   if (gl->Version() >= 300) return true;
   return gl->IsExtensionSupported(gl::GLContext::OES_fbo_render_mipmap);
 }
 
 IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionFBORenderMipmap, OES_fbo_render_mipmap)
--- a/dom/canvas/WebGLQuery.cpp
+++ b/dom/canvas/WebGLQuery.cpp
@@ -112,17 +112,17 @@ void WebGLQuery::GetQueryParameter(GLenu
   if (mActiveSlot)
     return mContext->ErrorInvalidOperation("Query is still active.");
 
   // End of validation
   ////
 
   // We must usually wait for an event loop before the query can be available.
   const bool canBeAvailable =
-      (mCanBeAvailable || gfxPrefs::WebGLImmediateQueries());
+      (mCanBeAvailable || StaticPrefs::WebGLImmediateQueries());
   if (!canBeAvailable) {
     if (pname == LOCAL_GL_QUERY_RESULT_AVAILABLE) {
       retval.set(JS::BooleanValue(false));
     }
     return;
   }
 
   const auto& gl = mContext->gl;
--- a/dom/canvas/WebGLShaderValidator.cpp
+++ b/dom/canvas/WebGLShaderValidator.cpp
@@ -1,19 +1,19 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "WebGLShaderValidator.h"
 
-#include "gfxPrefs.h"
 #include "GLContext.h"
 #include "mozilla/gfx/Logging.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/StaticPrefs.h"
 #include "MurmurHash3.h"
 #include "nsPrintfCString.h"
 #include <string>
 #include <vector>
 #include "WebGLContext.h"
 
 namespace mozilla {
 namespace webgl {
@@ -62,17 +62,17 @@ static ShCompileOptions ChooseValidatorC
 
     if (!gl->IsANGLE() && gl->Vendor() == gl::GLVendor::Intel) {
       // Failures on at least Windows+Intel+OGL on:
       // conformance/glsl/constructors/glsl-construct-mat2.html
       options |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS;
     }
   }
 
-  if (gfxPrefs::WebGLAllANGLEOptions()) {
+  if (StaticPrefs::WebGLAllANGLEOptions()) {
     options = -1;
 
     options ^= SH_INTERMEDIATE_TREE;
     options ^= SH_LINE_DIRECTIVES;
     options ^= SH_SOURCE_PATH;
 
     options ^= SH_LIMIT_EXPRESSION_COMPLEXITY;
     options ^= SH_LIMIT_CALL_STACK_DEPTH;
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -3,27 +3,27 @@
  * 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 "WebGLTexture.h"
 
 #include <algorithm>
 
 #include "CanvasUtils.h"
-#include "gfxPrefs.h"
 #include "GLBlitHelper.h"
 #include "GLContext.h"
 #include "mozilla/Casting.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/dom/HTMLCanvasElement.h"
 #include "mozilla/dom/HTMLVideoElement.h"
 #include "mozilla/dom/ImageBitmap.h"
 #include "mozilla/dom/ImageData.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Scoped.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Unused.h"
 #include "ScopedGLHelpers.h"
 #include "TexUnpackBlob.h"
 #include "WebGLBuffer.h"
 #include "WebGLContext.h"
 #include "WebGLContextUtils.h"
 #include "WebGLFramebuffer.h"
 #include "WebGLTexelConversions.h"
@@ -323,17 +323,17 @@ UniquePtr<webgl::TexUnpackBlob> WebGLCon
   auto sfer = nsLayoutUtils::SurfaceFromElement(
       const_cast<dom::Element*>(&elem), flags, idealDrawTarget);
 
   //////
 
   uint32_t elemWidth = 0;
   uint32_t elemHeight = 0;
   layers::Image* layersImage = nullptr;
-  if (!gfxPrefs::WebGLDisableDOMBlitUploads() && sfer.mLayersImage) {
+  if (!StaticPrefs::WebGLDisableDOMBlitUploads() && sfer.mLayersImage) {
     layersImage = sfer.mLayersImage;
     elemWidth = layersImage->GetSize().width;
     elemHeight = layersImage->GetSize().height;
   }
 
   RefPtr<gfx::DataSourceSurface> dataSurf;
   if (!layersImage && sfer.GetSourceSurface()) {
     const auto surf = sfer.GetSourceSurface();
--- a/dom/ipc/BrowserChild.cpp
+++ b/dom/ipc/BrowserChild.cpp
@@ -1804,17 +1804,17 @@ mozilla::ipc::IPCResult BrowserChild::Re
   WidgetTouchEvent localEvent(aEvent);
   localEvent.mWidget = mPuppetWidget;
 
   APZCCallbackHelper::ApplyCallbackTransform(localEvent, aGuid,
                                              mPuppetWidget->GetDefaultScale());
 
   if (localEvent.mMessage == eTouchStart && AsyncPanZoomEnabled()) {
     nsCOMPtr<Document> document = GetTopLevelDocument();
-    if (gfxPrefs::TouchActionEnabled()) {
+    if (StaticPrefs::TouchActionEnabled()) {
       APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(
           mPuppetWidget, document, localEvent, aInputBlockId,
           mSetAllowedTouchBehaviorCallback);
     }
     UniquePtr<DisplayportSetListener> postLayerization =
         APZCCallbackHelper::SendSetTargetAPZCNotification(
             mPuppetWidget, document, localEvent, aGuid.mLayersId,
             aInputBlockId);
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -10,17 +10,16 @@
 #include "DecoderDoctorDiagnostics.h"
 #include "EMEDecoderModule.h"
 #include "GMPDecoderModule.h"
 #include "H264.h"
 #include "MP4Decoder.h"
 #include "MediaChangeMonitor.h"
 #include "MediaInfo.h"
 #include "VPXDecoder.h"
-#include "gfxPrefs.h"
 #include "nsIXULRuntime.h" // for BrowserTabsRemoteAutostart
 #include "mozilla/CDMProxy.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/GpuDecoderModule.h"
 #include "mozilla/RemoteDecoderModule.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/StaticPrefs.h"
 #include "mozilla/StaticPtr.h"
@@ -169,17 +168,16 @@ void PDMFactory::EnsureInit() {
   }
 
   auto initalization = []() {
     MOZ_DIAGNOSTIC_ASSERT(NS_IsMainThread());
     StaticMutexAutoLock mon(sMonitor);
     if (!sInstance) {
       // Ensure that all system variables are initialized.
       gfx::gfxVars::Initialize();
-      gfxPrefs::GetSingleton();
       // On the main thread and holding the lock -> Create instance.
       sInstance = new PDMFactoryImpl();
       ClearOnShutdown(&sInstance);
     }
   };
   if (NS_IsMainThread()) {
     initalization();
     return;
--- a/dom/media/platforms/wmf/DXVA2Manager.cpp
+++ b/dom/media/platforms/wmf/DXVA2Manager.cpp
@@ -13,16 +13,17 @@
 #include "MFTDecoder.h"
 #include "MediaTelemetryConstants.h"
 #include "VideoUtils.h"
 #include "WMFUtils.h"
 #include "gfxCrashReporterUtils.h"
 #include "gfxPrefs.h"
 #include "gfxWindowsPlatform.h"
 #include "mfapi.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/gfx/DeviceManagerDx.h"
 #include "mozilla/layers/D3D11ShareHandleImage.h"
 #include "mozilla/layers/ImageBridgeChild.h"
 #include "mozilla/layers/TextureD3D11.h"
 #include "mozilla/layers/TextureForwarder.h"
 #include "mozilla/mscom/EnsureMTA.h"
 #include "nsPrintfCString.h"
@@ -411,17 +412,17 @@ D3D9DXVA2Manager::Init(layers::KnowsComp
   hr = d3d9Ex->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &adapter);
   if (!SUCCEEDED(hr)) {
     aFailureReason = nsPrintfCString(
         "IDirect3D9Ex::GetAdapterIdentifier failed with error %X", hr);
     return hr;
   }
 
   if ((adapter.VendorId == 0x1022 || adapter.VendorId == 0x1002) &&
-      !gfxPrefs::PDMWMFSkipBlacklist()) {
+      !StaticPrefs::PDMWMFSkipBlacklist()) {
     for (const auto& model : sAMDPreUVD4) {
       if (adapter.DeviceId == model) {
         mIsAMDPreUVD4 = true;
         break;
       }
     }
   }
 
@@ -501,17 +502,17 @@ static uint32_t sDXVAVideosCount = 0;
 /* static */
 DXVA2Manager* DXVA2Manager::CreateD3D9DXVA(
     layers::KnowsCompositor* aKnowsCompositor, nsACString& aFailureReason) {
   MOZ_ASSERT(NS_IsMainThread());
   HRESULT hr;
 
   // DXVA processing takes up a lot of GPU resources, so limit the number of
   // videos we use DXVA with at any one time.
-  uint32_t dxvaLimit = gfxPrefs::PDMWMFMaxDXVAVideos();
+  uint32_t dxvaLimit = StaticPrefs::PDMWMFMaxDXVAVideos();
 
   if (sDXVAVideosCount == dxvaLimit) {
     aFailureReason.AssignLiteral("Too many DXVA videos playing");
     return nullptr;
   }
 
   nsAutoPtr<D3D9DXVA2Manager> d3d9Manager(new D3D9DXVA2Manager());
   hr = d3d9Manager->Init(aKnowsCompositor, aFailureReason);
@@ -843,17 +844,17 @@ D3D11DXVA2Manager::InitInternal(layers::
   hr = adapter->GetDesc(&adapterDesc);
   if (!SUCCEEDED(hr)) {
     aFailureReason =
         nsPrintfCString("IDXGIAdapter::GetDesc failed with code %X", hr);
     return hr;
   }
 
   if ((adapterDesc.VendorId == 0x1022 || adapterDesc.VendorId == 0x1002) &&
-      !gfxPrefs::PDMWMFSkipBlacklist()) {
+      !StaticPrefs::PDMWMFSkipBlacklist()) {
     for (const auto& model : sAMDPreUVD4) {
       if (adapterDesc.DeviceId == model) {
         mIsAMDPreUVD4 = true;
         break;
       }
     }
   }
 
@@ -1213,17 +1214,17 @@ already_AddRefed<ID3D11VideoDecoder> D3D
 }
 
 /* static */
 DXVA2Manager* DXVA2Manager::CreateD3D11DXVA(
     layers::KnowsCompositor* aKnowsCompositor, nsACString& aFailureReason,
     ID3D11Device* aDevice) {
   // DXVA processing takes up a lot of GPU resources, so limit the number of
   // videos we use DXVA with at any one time.
-  uint32_t dxvaLimit = gfxPrefs::PDMWMFMaxDXVAVideos();
+  uint32_t dxvaLimit = StaticPrefs::PDMWMFMaxDXVAVideos();
 
   if (sDXVAVideosCount == dxvaLimit) {
     aFailureReason.AssignLiteral("Too many DXVA videos playing");
     return nullptr;
   }
 
   nsAutoPtr<D3D11DXVA2Manager> manager(new D3D11DXVA2Manager());
   HRESULT hr = manager->Init(aKnowsCompositor, aFailureReason, aDevice);
@@ -1245,17 +1246,17 @@ DXVA2Manager::~DXVA2Manager() {
 }
 
 bool DXVA2Manager::IsUnsupportedResolution(const uint32_t& aWidth,
                                            const uint32_t& aHeight,
                                            const float& aFramerate) const {
   // AMD cards with UVD3 or earlier perform poorly trying to decode 1080p60 in
   // hardware, so use software instead. Pick 45 as an arbitrary upper bound for
   // the framerate we can handle.
-  return !gfxPrefs::PDMWMFAMDHighResEnabled() && mIsAMDPreUVD4 &&
+  return !StaticPrefs::PDMWMFAMDHighResEnabled() && mIsAMDPreUVD4 &&
          (aWidth >= 1920 || aHeight >= 1088) && aFramerate > 45;
 }
 
 /* static */
 bool DXVA2Manager::IsNV12Supported(uint32_t aVendorID, uint32_t aDeviceID,
                                    const nsAString& aDriverVersionString) {
   if (aVendorID == 0x1022 || aVendorID == 0x1002) {
     // AMD
--- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
+++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp
@@ -17,21 +17,21 @@
 #include "MP4Decoder.h"
 #include "MediaInfo.h"
 #include "MediaTelemetryConstants.h"
 #include "VPXDecoder.h"
 #include "VideoUtils.h"
 #include "WMFDecoderModule.h"
 #include "WMFUtils.h"
 #include "gfx2DGlue.h"
-#include "gfxPrefs.h"
 #include "gfxWindowsPlatform.h"
 #include "mozilla/AbstractThread.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Logging.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/SyncRunnable.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/WindowsVersion.h"
 #include "mozilla/gfx/DeviceManagerDx.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "nsPrintfCString.h"
 #include "nsThreadUtils.h"
@@ -438,21 +438,21 @@ class CreateDXVAManagerEvent : public Ru
         mBackend(LayersBackend::LAYERS_D3D11),
         mKnowsCompositor(aKnowsCompositor),
         mFailureReason(aFailureReason) {}
 
   NS_IMETHOD Run() override {
     NS_ASSERTION(NS_IsMainThread(), "Must be on main thread.");
     const bool deblacklistingForTelemetry =
         XRE_IsGPUProcess() &&
-        gfxPrefs::PDMWMFDeblacklistingForTelemetryInGPUProcess();
+        StaticPrefs::PDMWMFDeblacklistingForTelemetryInGPUProcess();
     nsACString* failureReason = &mFailureReason;
     nsCString secondFailureReason;
     if (mBackend == LayersBackend::LAYERS_D3D11 &&
-        gfxPrefs::PDMWMFAllowD3D11() && IsWin8OrLater()) {
+        StaticPrefs::PDMWMFAllowD3D11() && IsWin8OrLater()) {
       const nsCString& blacklistedDLL = FindD3D11BlacklistedDLL();
       if (!deblacklistingForTelemetry && !blacklistedDLL.IsEmpty()) {
         failureReason->AppendPrintf("D3D11 blacklisted with DLL %s",
                                     blacklistedDLL.get());
       } else {
         mDXVA2Manager =
             DXVA2Manager::CreateD3D11DXVA(mKnowsCompositor, *failureReason);
         if (mDXVA2Manager) {
@@ -510,17 +510,17 @@ bool WMFVideoMFTManager::InitializeDXVA(
         SystemGroup::EventTargetFor(mozilla::TaskCategory::Other), event);
   }
   mDXVA2Manager = event->mDXVA2Manager;
 
   return mDXVA2Manager != nullptr;
 }
 
 MediaResult WMFVideoMFTManager::ValidateVideoInfo() {
-  if (mStreamType != H264 || gfxPrefs::PDMWMFAllowUnsupportedResolutions()) {
+  if (mStreamType != H264 || StaticPrefs::PDMWMFAllowUnsupportedResolutions()) {
     return NS_OK;
   }
 
   // The WMF H.264 decoder is documented to have a minimum resolution 48x48
   // pixels for resolution, but we won't enable hw decoding for the resolution <
   // 132 pixels. It's assumed the software decoder doesn't have this limitation,
   // but it still might have maximum resolution limitation.
   // https://msdn.microsoft.com/en-us/library/windows/desktop/dd797815(v=vs.85).aspx
@@ -581,18 +581,18 @@ MediaResult WMFVideoMFTManager::InitInte
 
   RefPtr<IMFAttributes> attr(decoder->GetAttributes());
   UINT32 aware = 0;
   if (attr) {
     attr->GetUINT32(MF_SA_D3D_AWARE, &aware);
     attr->SetUINT32(CODECAPI_AVDecNumWorkerThreads,
                     WMFDecoderModule::GetNumDecoderThreads());
     bool lowLatency =
-        (gfxPrefs::PDMWMFLowLatencyEnabled() || IsWin10OrLater()) &&
-        !gfxPrefs::PDMWMFLowLatencyForceDisabled();
+        (StaticPrefs::PDMWMFLowLatencyEnabled() || IsWin10OrLater()) &&
+        !StaticPrefs::PDMWMFLowLatencyForceDisabled();
     if (mLowLatency || lowLatency) {
       hr = attr->SetUINT32(CODECAPI_AVLowLatencyMode, TRUE);
       if (SUCCEEDED(hr)) {
         LOG("Enabling Low Latency Mode");
       } else {
         LOG("Couldn't enable Low Latency Mode");
       }
     }
@@ -1145,16 +1145,16 @@ bool WMFVideoMFTManager::IsHardwareAccel
   return mDecoder && mUseHwAccel;
 }
 
 nsCString WMFVideoMFTManager::GetDescriptionName() const {
   nsCString failureReason;
   bool hw = IsHardwareAccelerated(failureReason);
   return nsPrintfCString("wmf %s video decoder - %s",
                          hw ? "hardware" : "software",
-                         hw ? gfxPrefs::PDMWMFUseNV12Format() &&
+                         hw ? StaticPrefs::PDMWMFUseNV12Format() &&
                                       gfx::DeviceManagerDx::Get()->CanUseNV12()
                                   ? "nv12"
                                   : "rgba32"
                             : "yuv420");
 }
 
 }  // namespace mozilla
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -309,24 +309,24 @@ PluginInstanceParent::AnswerNPN_GetValue
   *result = mNPNIface->getvalue(mNPP, NPNVdocumentOrigin, &v);
   if (*result == NPERR_NO_ERROR && v) {
     value->Adopt(static_cast<char*>(v));
   }
   return IPC_OK();
 }
 
 static inline bool AllowDirectBitmapSurfaceDrawing() {
-  if (!gfxPrefs::PluginAsyncDrawingEnabled()) {
+  if (!StaticPrefs::PluginAsyncDrawingEnabled()) {
     return false;
   }
   return gfxPlatform::GetPlatform()->SupportsPluginDirectBitmapDrawing();
 }
 
 static inline bool AllowDirectDXGISurfaceDrawing() {
-  if (!gfxPrefs::PluginAsyncDrawingEnabled()) {
+  if (!StaticPrefs::PluginAsyncDrawingEnabled()) {
     return false;
   }
 #if defined(XP_WIN)
   return gfxWindowsPlatform::GetPlatform()->SupportsPluginDirectDXGIDrawing();
 #else
   return false;
 #endif
 }
--- a/dom/vr/VRDisplay.cpp
+++ b/dom/vr/VRDisplay.cpp
@@ -9,19 +9,19 @@
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/ElementBinding.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/VRDisplay.h"
 #include "mozilla/HoldDropJSObjects.h"
 #include "mozilla/dom/VRDisplayBinding.h"
 #include "mozilla/Base64.h"
 #include "mozilla/EventStateManager.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/gfx/DataSurfaceHelpers.h"
 #include "Navigator.h"
-#include "gfxPrefs.h"
 #include "gfxUtils.h"
 #include "gfxVR.h"
 #include "VRDisplayClient.h"
 #include "VRManagerChild.h"
 #include "VRDisplayPresentation.h"
 #include "nsIObserverService.h"
 #include "nsIFrame.h"
 #include "nsISupportsPrimitives.h"
@@ -440,17 +440,17 @@ already_AddRefed<VRPose> VRDisplay::GetP
 void VRDisplay::ResetPose() { mClient->ZeroSensor(); }
 
 void VRDisplay::StartVRNavigation() { mClient->StartVRNavigation(); }
 
 void VRDisplay::StartHandlingVRNavigationEvent() {
   mHandlingVRNavigationEventStart = TimeStamp::Now();
   ++mVRNavigationEventDepth;
   TimeDuration timeout =
-      TimeDuration::FromMilliseconds(gfxPrefs::VRNavigationTimeout());
+      TimeDuration::FromMilliseconds(StaticPrefs::VRNavigationTimeout());
   // A 0 or negative TimeDuration indicates that content may take
   // as long as it wishes to respond to the event, as long as
   // it happens before the event exits.
   if (timeout.ToMilliseconds() > 0) {
     mClient->StopVRNavigation(timeout);
   }
 }
 
@@ -465,17 +465,17 @@ void VRDisplay::StopHandlingVRNavigation
 bool VRDisplay::IsHandlingVRNavigationEvent() {
   if (mVRNavigationEventDepth == 0) {
     return false;
   }
   if (mHandlingVRNavigationEventStart.IsNull()) {
     return false;
   }
   TimeDuration timeout =
-      TimeDuration::FromMilliseconds(gfxPrefs::VRNavigationTimeout());
+      TimeDuration::FromMilliseconds(StaticPrefs::VRNavigationTimeout());
   return timeout.ToMilliseconds() <= 0 ||
          (TimeStamp::Now() - mHandlingVRNavigationEventStart) <= timeout;
 }
 
 void VRDisplay::OnPresentationGenerationChanged() { ExitPresentInternal(); }
 
 already_AddRefed<Promise> VRDisplay::RequestPresent(
     const nsTArray<VRLayer>& aLayers, CallerType aCallerType,
@@ -489,17 +489,17 @@ already_AddRefed<Promise> VRDisplay::Req
   RefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
   bool isChromePresentation = aCallerType == CallerType::System;
   uint32_t presentationGroup =
       isChromePresentation ? gfx::kVRGroupChrome : gfx::kVRGroupContent;
 
   if (!EventStateManager::IsHandlingUserInput() && !isChromePresentation &&
-      !IsHandlingVRNavigationEvent() && gfxPrefs::VRRequireGesture() &&
+      !IsHandlingVRNavigationEvent() && StaticPrefs::VRRequireGesture() &&
       !IsPresenting()) {
     // The WebVR API states that if called outside of a user gesture, the
     // promise must be rejected.  We allow VR presentations to start within
     // trusted events such as vrdisplayactivate, which triggers in response to
     // HMD proximity sensors and when navigating within a VR presentation.
     // This user gesture requirement is not enforced for chrome/system code.
     promise->MaybeRejectWithUndefined();
   } else if (!IsPresenting() && IsAnyPresenting(presentationGroup)) {
--- a/gfx/2d/DrawTargetCairo.cpp
+++ b/gfx/2d/DrawTargetCairo.cpp
@@ -10,17 +10,17 @@
 #include "PathCairo.h"
 #include "HelpersCairo.h"
 #include "ScaledFontBase.h"
 #include "BorrowedContext.h"
 #include "FilterNodeSoftware.h"
 #include "mozilla/Scoped.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/Vector.h"
-#include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 
 #include "cairo.h"
 #include "cairo-tee.h"
 #include <string.h>
 
 #include "Blur.h"
 #include "Logging.h"
 #include "Tools.h"
@@ -1304,17 +1304,17 @@ void DrawTargetCairo::FillGlyphs(ScaledF
   }
   for (uint32_t i = 0; i < aBuffer.mNumGlyphs; ++i) {
     glyphs[i].index = aBuffer.mGlyphs[i].mIndex;
     glyphs[i].x = aBuffer.mGlyphs[i].mPosition.x;
     glyphs[i].y = aBuffer.mGlyphs[i].mPosition.y;
   }
 
   if (!SupportsVariationSettings(mSurface) && aFont->HasVariationSettings() &&
-      gfxPrefs::PrintFontVariationsAsPaths()) {
+      StaticPrefs::PrintFontVariationsAsPaths()) {
     cairo_set_fill_rule(mContext, CAIRO_FILL_RULE_WINDING);
     cairo_new_path(mContext);
     cairo_glyph_path(mContext, &glyphs[0], aBuffer.mNumGlyphs);
     cairo_set_operator(mContext, CAIRO_OPERATOR_OVER);
     cairo_fill(mContext);
   } else {
     cairo_show_glyphs(mContext, &glyphs[0], aBuffer.mNumGlyphs);
   }
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -202,19 +202,19 @@ static const char* const sExtensionNames
     "GL_OES_texture_float",
     "GL_OES_texture_float_linear",
     "GL_OES_texture_half_float",
     "GL_OES_texture_half_float_linear",
     "GL_OES_texture_npot",
     "GL_OES_vertex_array_object"};
 
 static bool ShouldUseTLSIsCurrent(bool useTLSIsCurrent) {
-  if (gfxPrefs::UseTLSIsCurrent() == 0) return useTLSIsCurrent;
-
-  return gfxPrefs::UseTLSIsCurrent() > 0;
+  if (StaticPrefs::UseTLSIsCurrent() == 0) return useTLSIsCurrent;
+
+  return StaticPrefs::UseTLSIsCurrent() > 0;
 }
 
 static bool ParseVersion(const std::string& versionStr,
                          uint32_t* const out_major, uint32_t* const out_minor) {
   static const std::regex kVersionRegex("([0-9]+)\\.([0-9]+)");
   std::smatch match;
   if (!std::regex_search(versionStr, match, kVersionRegex)) return false;
 
@@ -1741,17 +1741,17 @@ GLFormats GLContext::ChooseGLFormats(con
       formats.color_rbFormat = LOCAL_GL_RGBA8;
     } else {
       formats.color_texInternalFormat = IsGLES() ? LOCAL_GL_RGB : LOCAL_GL_RGB8;
       formats.color_texFormat = LOCAL_GL_RGB;
       formats.color_rbFormat = LOCAL_GL_RGB8;
     }
   }
 
-  uint32_t msaaLevel = gfxPrefs::MSAALevel();
+  uint32_t msaaLevel = StaticPrefs::MSAALevel();
   GLsizei samples = msaaLevel * msaaLevel;
   samples = std::min(samples, mMaxSamples);
 
   // Bug 778765.
   if (WorkAroundDriverBugs() && samples == 1) {
     samples = 0;
   }
   formats.samples = samples;
--- a/gfx/gl/GLContextProviderCGL.mm
+++ b/gfx/gl/GLContextProviderCGL.mm
@@ -5,16 +5,17 @@
 
 #include "GLContextProvider.h"
 #include "GLContextCGL.h"
 #include "nsDebug.h"
 #include "nsIWidget.h"
 #include <OpenGL/gl.h>
 #include "gfxFailure.h"
 #include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "prenv.h"
 #include "GeckoProfiler.h"
 #include "mozilla/gfx/MacIOSurface.h"
 #include "mozilla/layers/CompositorOptions.h"
 #include "mozilla/widget/CompositorWidget.h"
 
 #include <OpenGL/OpenGL.h>
 
@@ -197,17 +198,17 @@ already_AddRefed<GLContext> GLContextPro
   } else {
     attribs = aForceAccelerated ? kAttribs_singleBuffered_accel : kAttribs_singleBuffered;
   }
   NSOpenGLContext* context = CreateWithFormat(attribs);
   if (!context) {
     return nullptr;
   }
 
-  GLint opaque = gfxPrefs::CompositorGLContextOpaque();
+  GLint opaque = StaticPrefs::CompositorGLContextOpaque();
   [context setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
 
   RefPtr<GLContextCGL> glContext =
       new GLContextCGL(CreateContextFlags::NONE, SurfaceCaps::ForRGBA(), context, false);
 
   if (!glContext->Init()) {
     glContext = nullptr;
     [context release];
@@ -221,27 +222,27 @@ static already_AddRefed<GLContextCGL> Cr
   if (!sCGLLibrary.EnsureInitialized()) {
     return nullptr;
   }
 
   NSOpenGLContext* context = nullptr;
 
   std::vector<NSOpenGLPixelFormatAttribute> attribs;
 
-  if (!gfxPrefs::GLAllowHighPower()) {
+  if (!StaticPrefs::GLAllowHighPower()) {
     flags &= ~CreateContextFlags::HIGH_POWER;
   }
   if (flags & CreateContextFlags::ALLOW_OFFLINE_RENDERER ||
       !(flags & CreateContextFlags::HIGH_POWER)) {
     // This is really poorly named on Apple's part, but "AllowOfflineRenderers" means
     // that we want to allow running on the iGPU instead of requiring the dGPU.
     attribs.push_back(NSOpenGLPFAAllowOfflineRenderers);
   }
 
-  if (gfxPrefs::RequireHardwareGL()) {
+  if (StaticPrefs::RequireHardwareGL()) {
     attribs.push_back(NSOpenGLPFAAccelerated);
   }
 
   if (!(flags & CreateContextFlags::REQUIRE_COMPAT_PROFILE)) {
     auto coreAttribs = attribs;
     coreAttribs.push_back(NSOpenGLPFAOpenGLProfile);
     coreAttribs.push_back(NSOpenGLProfileVersion3_2Core);
     coreAttribs.push_back(0);
@@ -255,17 +256,17 @@ static already_AddRefed<GLContextCGL> Cr
 
   if (!context) {
     NS_WARNING("Failed to create NSOpenGLContext.");
     return nullptr;
   }
 
   RefPtr<GLContextCGL> glContext = new GLContextCGL(flags, SurfaceCaps::Any(), context, true);
 
-  if (gfxPrefs::GLMultithreaded()) {
+  if (StaticPrefs::GLMultithreaded()) {
     CGLEnable(glContext->GetCGLContext(), kCGLCEMPEngine);
   }
   return glContext.forget();
 }
 
 already_AddRefed<GLContext> GLContextProviderCGL::CreateHeadless(CreateContextFlags flags,
                                                                  nsACString* const out_failureId) {
   RefPtr<GLContextCGL> gl;
--- a/gfx/gl/GLContextProviderGLX.cpp
+++ b/gfx/gl/GLContextProviderGLX.cpp
@@ -14,16 +14,17 @@
 #include <X11/Xutil.h>
 #include "X11UndefineNone.h"
 
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/layers/CompositorOptions.h"
 #include "mozilla/Range.h"
 #include "mozilla/ScopeExit.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/widget/CompositorWidget.h"
 #include "mozilla/widget/GtkCompositorWidget.h"
 #include "mozilla/Unused.h"
 
 #include "prenv.h"
 #include "GLContextProvider.h"
 #include "GLLibraryLoader.h"
 #include "nsDebug.h"
@@ -180,17 +181,17 @@ bool GLXLibrary::EnsureInitialized() {
 
   const char* clientVendor = fGetClientString(display, LOCAL_GLX_VENDOR);
   const char* serverVendor =
       fQueryServerString(display, screen, LOCAL_GLX_VENDOR);
   const char* extensionsStr = fQueryExtensionsString(display, screen);
 
   if (HasExtension(extensionsStr, "GLX_EXT_texture_from_pixmap") &&
       fnLoadSymbols(symbols_texturefrompixmap)) {
-    mUseTextureFromPixmap = gfxPrefs::UseGLXTextureFromPixmap();
+    mUseTextureFromPixmap = StaticPrefs::UseGLXTextureFromPixmap();
   } else {
     mUseTextureFromPixmap = false;
     NS_WARNING("Texture from pixmap disabled");
   }
 
   if (HasExtension(extensionsStr, "GLX_ARB_create_context") &&
       HasExtension(extensionsStr, "GLX_ARB_create_context_profile") &&
       fnLoadSymbols(symbols_createcontext)) {
--- a/gfx/gl/GLContextProviderWGL.cpp
+++ b/gfx/gl/GLContextProviderWGL.cpp
@@ -210,17 +210,18 @@ bool WGLLibrary::EnsureInitialized() {
           "WGL_ARB_create_context announced without supplying its functions.");
       ClearSymbols(createContextSymbols);
     }
   }
 
   // --
 
   bool hasDXInterop2 = HasExtension(extString, "WGL_NV_DX_interop2");
-  if (gfxVars::DXInterop2Blocked() && !gfxPrefs::IgnoreDXInterop2Blacklist()) {
+  if (gfxVars::DXInterop2Blocked() &&
+      !StaticPrefs::IgnoreDXInterop2Blacklist()) {
     hasDXInterop2 = false;
   }
 
   if (hasDXInterop2) {
     const SymLoadStruct dxInteropSymbols[] = {
         SYMBOL(DXSetResourceShareHandleNV),
         SYMBOL(DXOpenDeviceNV),
         SYMBOL(DXCloseDeviceNV),
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -285,21 +285,21 @@ static EGLDisplay GetAndInitDisplayForAc
   EGLDisplay ret = 0;
 
   if (wr::RenderThread::IsInRenderThread()) {
     return GetAndInitDisplayForWebRender(egl, EGL_DEFAULT_DISPLAY);
   }
 
   FeatureState& d3d11ANGLE = gfxConfig::GetFeature(Feature::D3D11_HW_ANGLE);
 
-  if (!gfxPrefs::WebGLANGLETryD3D11())
+  if (!StaticPrefs::WebGLANGLETryD3D11())
     d3d11ANGLE.UserDisable("User disabled D3D11 ANGLE by pref",
                            NS_LITERAL_CSTRING("FAILURE_ID_ANGLE_PREF"));
 
-  if (gfxPrefs::WebGLANGLEForceD3D11())
+  if (StaticPrefs::WebGLANGLEForceD3D11())
     d3d11ANGLE.UserForceEnable(
         "User force-enabled D3D11 ANGLE on disabled hardware");
 
   gAngleErrorReporter.SetFailureId(out_failureId);
 
   auto guardShutdown = mozilla::MakeScopeExit([&] {
     gAngleErrorReporter.SetFailureId(nullptr);
     // NOTE: Ideally we should be calling ANGLEPlatformShutdown after the
@@ -737,17 +737,17 @@ EGLDisplay GLLibraryEGL::CreateDisplay(b
   if (IsExtensionSupported(ANGLE_platform_angle_d3d)) {
     nsCString accelAngleFailureId;
     bool accelAngleSupport =
         IsAccelAngleSupported(gfxInfo, &accelAngleFailureId);
     bool shouldTryAccel = forceAccel || accelAngleSupport;
     bool shouldTryWARP = !forceAccel;  // Only if ANGLE not supported or fails
 
     // If WARP preferred, will override ANGLE support
-    if (gfxPrefs::WebGLANGLEForceWARP()) {
+    if (StaticPrefs::WebGLANGLEForceWARP()) {
       shouldTryWARP = true;
       shouldTryAccel = false;
       if (accelAngleFailureId.IsEmpty()) {
         accelAngleFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_FORCE_WARP");
       }
     }
 
     // Hardware accelerated ANGLE path (supported or force accel)
--- a/gfx/gl/GLScreenBuffer.cpp
+++ b/gfx/gl/GLScreenBuffer.cpp
@@ -83,17 +83,17 @@ UniquePtr<SurfaceFactory> GLScreenBuffer
     factory = SurfaceFactory_IOSurface::Create(gl, caps, ipcChannel, flags);
 #elif defined(MOZ_X11)
     if (sGLXLibrary.UseTextureFromPixmap())
       factory = SurfaceFactory_GLXDrawable::Create(gl, caps, ipcChannel, flags);
 #elif defined(MOZ_WIDGET_UIKIT)
     factory = MakeUnique<SurfaceFactory_GLTexture>(mGLContext, caps, ipcChannel,
                                                    mFlags);
 #elif defined(MOZ_WIDGET_ANDROID)
-    if (XRE_IsParentProcess() && !gfxPrefs::WebGLSurfaceTextureEnabled()) {
+    if (XRE_IsParentProcess() && !StaticPrefs::WebGLSurfaceTextureEnabled()) {
       factory = SurfaceFactory_EGLImage::Create(gl, caps, ipcChannel, flags);
     } else {
       factory =
           SurfaceFactory_SurfaceTexture::Create(gl, caps, ipcChannel, flags);
     }
 #else
     if (gl->GetContextType() == GLContextType::EGL) {
       if (XRE_IsParentProcess()) {
@@ -112,17 +112,17 @@ UniquePtr<SurfaceFactory> GLScreenBuffer
     // are both WARP or both not WARP
     gfx::DeviceManagerDx* dm = gfx::DeviceManagerDx::Get();
     if (gl->IsANGLE() && (gl->IsWARP() == dm->IsWARP()) &&
         dm->TextureSharingWorks()) {
       factory =
           SurfaceFactory_ANGLEShareHandle::Create(gl, caps, ipcChannel, flags);
     }
 
-    if (!factory && gfxPrefs::WebGLDXGLEnabled()) {
+    if (!factory && StaticPrefs::WebGLDXGLEnabled()) {
       factory =
           SurfaceFactory_D3D11Interop::Create(gl, caps, ipcChannel, flags);
     }
 #endif
   }
 
 #ifdef MOZ_X11
   if (!factory && sGLXLibrary.UseTextureFromPixmap()) {
--- a/gfx/gl/SharedSurfaceD3D11Interop.cpp
+++ b/gfx/gl/SharedSurfaceD3D11Interop.cpp
@@ -410,17 +410,17 @@ SharedSurface_D3D11Interop::SharedSurfac
           gl, size, hasAlpha, true),
       mProdTex(prodTex),
       mInteropFB(interopFB),
       mInteropRB(interopRB),
       mInterop(interop),
       mLockHandle(lockHandle),
       mTexD3D(texD3D),
       mDXGIHandle(dxgiHandle),
-      mNeedsFinish(gfxPrefs::WebGLDXGLNeedsFinish()),
+      mNeedsFinish(StaticPrefs::WebGLDXGLNeedsFinish()),
       mLockedForGL(false) {
   MOZ_ASSERT(bool(mProdTex) == bool(mInteropFB));
 }
 
 SharedSurface_D3D11Interop::~SharedSurface_D3D11Interop() {
   MOZ_ASSERT(!IsProducerAcquired());
 
   if (!mGL || !mGL->MakeCurrent()) return;
--- a/gfx/ipc/GPUParent.cpp
+++ b/gfx/ipc/GPUParent.cpp
@@ -261,17 +261,17 @@ mozilla::ipc::IPCResult GPUParent::RecvI
 
   // Make sure to do this *after* we update gfxVars above.
   if (gfxVars::UseWebRender()) {
     wr::RenderThread::Start();
     image::ImageMemoryReporter::InitForWebRender();
   }
 #ifdef XP_WIN
   else {
-    if (gfxPrefs::Direct3D11UseDoubleBuffering() && IsWin10OrLater()) {
+    if (StaticPrefs::Direct3D11UseDoubleBuffering() && IsWin10OrLater()) {
       // This is needed to avoid freezing the window on a device crash on double
       // buffering, see bug 1549674.
       widget::WinCompositorWindowThread::Start();
     }
   }
 #endif
 
   VRManager::ManagerInit();
@@ -523,17 +523,17 @@ void GPUParent::ActorDestroy(ActorDestro
   VideoDecoderManagerParent::ShutdownVideoBridge();
   CompositorThreadHolder::Shutdown();
   // There is a case that RenderThread exists when gfxVars::UseWebRender() is
   // false. This could happen when WebRender was fallbacked to compositor.
   if (wr::RenderThread::Get()) {
     wr::RenderThread::ShutDown();
   }
 #ifdef XP_WIN
-  else if (gfxPrefs::Direct3D11UseDoubleBuffering() && IsWin10OrLater()) {
+  else if (StaticPrefs::Direct3D11UseDoubleBuffering() && IsWin10OrLater()) {
     widget::WinCompositorWindowThread::ShutDown();
   }
 #endif
 
   image::ImageMemoryReporter::ShutdownForWebRender();
 
   // Shut down the default GL context provider.
   gl::GLContextProvider::Shutdown();
--- a/gfx/ipc/GPUProcessManager.cpp
+++ b/gfx/ipc/GPUProcessManager.cpp
@@ -507,23 +507,23 @@ void GPUProcessManager::NotifyListenersO
 }
 
 void GPUProcessManager::OnProcessUnexpectedShutdown(GPUProcessHost* aHost) {
   MOZ_ASSERT(mProcess && mProcess == aHost);
 
   CompositorManagerChild::OnGPUProcessLost(aHost->GetProcessToken());
   DestroyProcess();
 
-  if (mNumProcessAttempts > uint32_t(gfxPrefs::GPUProcessMaxRestarts())) {
+  if (mNumProcessAttempts > uint32_t(StaticPrefs::GPUProcessMaxRestarts())) {
     char disableMessage[64];
     SprintfLiteral(disableMessage, "GPU process disabled after %d attempts",
                    mNumProcessAttempts);
     DisableGPUProcess(disableMessage);
   } else if (mNumProcessAttempts >
-                 uint32_t(gfxPrefs::GPUProcessMaxRestartsWithDecoder()) &&
+                 uint32_t(StaticPrefs::GPUProcessMaxRestartsWithDecoder()) &&
              mDecodeVideoOnGpuProcess) {
     mDecodeVideoOnGpuProcess = false;
     Telemetry::Accumulate(Telemetry::GPU_PROCESS_CRASH_FALLBACKS,
                           uint32_t(FallbackType::DECODINGDISABLED));
     HandleProcessLost();
   } else {
     Telemetry::Accumulate(Telemetry::GPU_PROCESS_CRASH_FALLBACKS,
                           uint32_t(FallbackType::NONE));
--- a/gfx/layers/D3D11ShareHandleImage.cpp
+++ b/gfx/layers/D3D11ShareHandleImage.cpp
@@ -218,21 +218,21 @@ class MOZ_RAII D3D11TextureClientAllocat
   const RefPtr<ID3D11Device> mDevice;
 };
 
 D3D11RecycleAllocator::D3D11RecycleAllocator(
     KnowsCompositor* aAllocator, ID3D11Device* aDevice,
     gfx::SurfaceFormat aPreferredFormat)
     : TextureClientRecycleAllocator(aAllocator),
       mDevice(aDevice),
-      mCanUseNV12(gfxPrefs::PDMWMFUseNV12Format() &&
+      mCanUseNV12(StaticPrefs::PDMWMFUseNV12Format() &&
                   gfx::DeviceManagerDx::Get()->CanUseNV12()),
-      mCanUseP010(gfxPrefs::PDMWMFUseNV12Format() &&
+      mCanUseP010(StaticPrefs::PDMWMFUseNV12Format() &&
                   gfx::DeviceManagerDx::Get()->CanUseP010()),
-      mCanUseP016(gfxPrefs::PDMWMFUseNV12Format() &&
+      mCanUseP016(StaticPrefs::PDMWMFUseNV12Format() &&
                   gfx::DeviceManagerDx::Get()->CanUseP016()) {
   SetPreferredSurfaceFormat(aPreferredFormat);
 }
 
 void D3D11RecycleAllocator::SetPreferredSurfaceFormat(
     gfx::SurfaceFormat aPreferredFormat) {
   if ((aPreferredFormat == gfx::SurfaceFormat::NV12 && mCanUseNV12) ||
       (aPreferredFormat == gfx::SurfaceFormat::P010 && mCanUseP010) ||
--- a/gfx/layers/LayerScope.cpp
+++ b/gfx/layers/LayerScope.cpp
@@ -1415,17 +1415,17 @@ void LayerScopeWebSocketManager::SocketH
 // ----------------------------------------------
 // LayerScopeWebSocketManager implementation
 // ----------------------------------------------
 LayerScopeWebSocketManager::LayerScopeWebSocketManager()
     : mHandlerMutex("LayerScopeWebSocketManager::mHandlerMutex") {
   NS_NewNamedThread("LayerScope", getter_AddRefs(mDebugSenderThread));
 
   mServerSocket = do_CreateInstance(NS_SERVERSOCKET_CONTRACTID);
-  int port = gfxPrefs::LayerScopePort();
+  int port = StaticPrefs::LayerScopePort();
   mServerSocket->Init(port, false, -1);
   mServerSocket->AsyncListen(new SocketListener);
 }
 
 LayerScopeWebSocketManager::~LayerScopeWebSocketManager() {
   mServerSocket->Close();
 }
 
@@ -1460,17 +1460,17 @@ NS_IMETHODIMP LayerScopeWebSocketManager
   return NS_OK;
 }
 
 // ----------------------------------------------
 // LayerScope implementation
 // ----------------------------------------------
 /*static*/
 void LayerScope::Init() {
-  if (!gfxPrefs::LayerScopeEnabled() || XRE_IsGPUProcess()) {
+  if (!StaticPrefs::LayerScopeEnabled() || XRE_IsGPUProcess()) {
     return;
   }
 
   gLayerScopeManager.CreateServerSocket();
 }
 
 /*static*/
 void LayerScope::DrawBegin() {
@@ -1558,17 +1558,17 @@ void LayerScope::SendLayerDump(UniquePtr
       new DebugGLLayersData(std::move(aPacket)));
 }
 
 /*static*/
 bool LayerScope::CheckSendable() {
   // Only compositor threads check LayerScope status
   MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread() || gIsGtest);
 
-  if (!gfxPrefs::LayerScopeEnabled()) {
+  if (!StaticPrefs::LayerScopeEnabled()) {
     return false;
   }
   if (!gLayerScopeManager.GetSocketManager()) {
     Init();
     return false;
   }
   if (!gLayerScopeManager.GetSocketManager()->IsConnected()) {
     return false;
--- a/gfx/layers/PaintThread.cpp
+++ b/gfx/layers/PaintThread.cpp
@@ -157,17 +157,17 @@ void PaintThread::UpdateRenderMode() {
     }
   }
 }
 
 void PaintThread::QueuePaintTask(UniquePtr<PaintTask>&& aTask) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aTask);
 
-  if (gfxPrefs::LayersOMTPDumpCapture() && aTask->mCapture) {
+  if (StaticPrefs::LayersOMTPDumpCapture() && aTask->mCapture) {
     aTask->mCapture->Dump();
   }
 
   MOZ_RELEASE_ASSERT(aTask->mCapture->hasOneRef());
 
   RefPtr<CompositorBridgeChild> cbc(CompositorBridgeChild::Get());
   cbc->NotifyBeginAsyncPaint(aTask.get());
 
@@ -202,17 +202,17 @@ void PaintThread::AsyncPaintTask(Composi
   if (target->IsValid()) {
     // Do not replay to invalid targets. This can happen on device resets and
     // the browser will ensure the graphics stack is reinitialized on the main
     // thread.
     target->DrawCapturedDT(capture, Matrix());
     target->Flush();
   }
 
-  if (gfxPrefs::LayersOMTPReleaseCaptureOnMainThread()) {
+  if (StaticPrefs::LayersOMTPReleaseCaptureOnMainThread()) {
     // This should ensure the capture drawtarget, which may hold on to
     // UnscaledFont objects, gets destroyed on the main thread (See bug
     // 1404742). This assumes (unflushed) target DrawTargets do not themselves
     // hold on to UnscaledFonts.
     NS_ReleaseOnMainThreadSystemGroup("PaintTask::DrawTargetCapture",
                                       aTask->mCapture.forget());
   }
 
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <stack>
 #include <unordered_set>
 #include "APZCTreeManager.h"
 #include "AsyncPanZoomController.h"
 #include "Compositor.h"                     // for Compositor
 #include "DragTracker.h"                    // for DragTracker
-#include "gfxPrefs.h"                       // for gfxPrefs
 #include "GenericFlingAnimation.h"          // for FLING_LOG
 #include "HitTestingTreeNode.h"             // for HitTestingTreeNode
 #include "InputBlockState.h"                // for InputBlockState
 #include "InputData.h"                      // for InputData, etc
 #include "Layers.h"                         // for Layer, etc
 #include "mozilla/dom/MouseEventBinding.h"  // for MouseEvent constants
 #include "mozilla/dom/BrowserParent.h"      // for AreRecordReplayTabsActive
 #include "mozilla/dom/Touch.h"              // for Touch
@@ -32,18 +31,19 @@
 #include "mozilla/layers/AsyncCompositionManager.h"  // for ViewTransform
 #include "mozilla/layers/AsyncDragMetrics.h"         // for AsyncDragMetrics
 #include "mozilla/layers/CompositorBridgeParent.h"  // for CompositorBridgeParent, etc
 #include "mozilla/layers/LayerMetricsWrapper.h"
 #include "mozilla/layers/MatrixMessage.h"
 #include "mozilla/layers/WebRenderScrollDataWrapper.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/mozalloc.h"  // for operator new
+#include "mozilla/Preferences.h"        // for Preferences
+#include "mozilla/StaticPrefs.h"        // for StaticPrefs
 #include "mozilla/TouchEvents.h"
-#include "mozilla/Preferences.h"        // for Preferences
 #include "mozilla/EventStateManager.h"  // for WheelPrefs
 #include "mozilla/webrender/WebRenderAPI.h"
 #include "nsDebug.h"                 // for NS_WARNING
 #include "nsPoint.h"                 // for nsIntPoint
 #include "nsThreadUtils.h"           // for NS_IsMainThread
 #include "OverscrollHandoffState.h"  // for OverscrollHandoffState
 #include "TreeTraversal.h"           // for ForEachNode, BreadthFirstSearch, etc
 #include "LayersLogging.h"           // for Stringify
@@ -267,17 +267,17 @@ APZCTreeManager::APZCTreeManager(LayersI
       mApzcTreeLog("apzctree"),
       mTestDataLock("APZTestDataLock"),
       mDPI(160.0) {
   RefPtr<APZCTreeManager> self(this);
   NS_DispatchToMainThread(NS_NewRunnableFunction(
       "layers::APZCTreeManager::APZCTreeManager",
       [self] { self->mFlushObserver = new CheckerboardFlushObserver(self); }));
   AsyncPanZoomController::InitializeGlobalState();
-  mApzcTreeLog.ConditionOnPrefFunction(gfxPrefs::APZPrintTree);
+  mApzcTreeLog.ConditionOnPrefFunction(StaticPrefs::APZPrintTree);
 #if defined(MOZ_WIDGET_ANDROID)
   if (jni::IsFennec()) {
     mToolbarAnimator = new AndroidDynamicToolbarAnimator(this);
   }
 #endif  // (MOZ_WIDGET_ANDROID)
 }
 
 APZCTreeManager::~APZCTreeManager() = default;
@@ -364,17 +364,17 @@ APZCTreeManager::UpdateHitTestingTreeImp
                                           bool aIsFirstPaint,
                                           WRRootId aOriginatingWrRootId,
                                           uint32_t aPaintSequenceNumber) {
   RecursiveMutexAutoLock lock(mTreeLock);
 
   // For testing purposes, we log some data to the APZTestData associated with
   // the layers id that originated this update.
   APZTestData* testData = nullptr;
-  if (gfxPrefs::APZTestLoggingEnabled()) {
+  if (StaticPrefs::APZTestLoggingEnabled()) {
     MutexAutoLock lock(mTestDataLock);
     UniquePtr<APZTestData> ptr = MakeUnique<APZTestData>();
     auto result = mTestData.insert(
         std::make_pair(aOriginatingWrRootId.mLayersId, std::move(ptr)));
     testData = result.first->second.get();
     testData->StartNewPaint(aPaintSequenceNumber);
   }
 
@@ -1298,29 +1298,29 @@ nsEventStatus APZCTreeManager::ReceiveIn
       {  // scope lock
         RecursiveMutexAutoLock lock(mTreeLock);
         if (!apzc && mRootNode) {
           apzc = mRootNode->GetApzc();
         }
       }
 
       if (apzc) {
-        if (gfxPrefs::APZTestLoggingEnabled() &&
+        if (StaticPrefs::APZTestLoggingEnabled() &&
             mouseInput.mType == MouseInput::MOUSE_HITTEST) {
           ScrollableLayerGuid guid = apzc->GetGuid();
 
           MutexAutoLock lock(mTestDataLock);
           auto it = mTestData.find(guid.mLayersId);
           MOZ_ASSERT(it != mTestData.end());
           it->second->RecordHitResult(mouseInput.mOrigin, hitResult,
                                       guid.mScrollId);
         }
 
         TargetConfirmationFlags confFlags{hitResult};
-        bool apzDragEnabled = gfxPrefs::APZDragEnabled();
+        bool apzDragEnabled = StaticPrefs::APZDragEnabled();
         if (apzDragEnabled && hitScrollbar) {
           // If scrollbar dragging is enabled and we hit a scrollbar, wait
           // for the main-thread confirmation because it contains drag metrics
           // that we need.
           confFlags.mTargetConfirmed = false;
         }
         result = mInputQueue->ReceiveInputEvent(apzc, confFlags, mouseInput,
                                                 aOutInputBlockId);
@@ -1536,17 +1536,17 @@ nsEventStatus APZCTreeManager::ReceiveIn
         tapInput.mPoint = *untransformedPoint;
       }
       break;
     }
     case KEYBOARD_INPUT: {
       // Disable async keyboard scrolling when accessibility.browsewithcaret is
       // enabled
       if (!gfxPrefs::APZKeyboardEnabled() ||
-          gfxPrefs::AccessibilityBrowseWithCaret()) {
+          StaticPrefs::AccessibilityBrowseWithCaret()) {
         APZ_KEY_LOG("Skipping key input from invalid prefs\n");
         return result;
       }
 
       KeyboardInput& keyInput = aEvent.AsKeyboardInput();
 
       // Try and find a matching shortcut for this keyboard input
       Maybe<KeyboardShortcut> shortcut = mKeyboardMap.FindMatch(keyInput);
@@ -1732,17 +1732,17 @@ nsEventStatus APZCTreeManager::ProcessTo
     mApzcForInputBlock = GetTouchInputBlockAPZC(
         aInput, &touchBehaviors, &mHitResultForInputBlock, &aInput.mLayersId,
         &hitScrollbarNode);
 
     // Check if this event starts a scrollbar touch-drag. The conditions
     // checked are similar to the ones we check for MOUSE_INPUT starting
     // a scrollbar mouse-drag.
     mInScrollbarTouchDrag =
-        gfxPrefs::APZDragEnabled() && gfxPrefs::APZTouchDragEnabled() &&
+        StaticPrefs::APZDragEnabled() && StaticPrefs::APZTouchDragEnabled() &&
         hitScrollbarNode && hitScrollbarNode->IsScrollThumbNode() &&
         hitScrollbarNode->GetScrollbarData().mThumbIsAsyncDraggable;
 
     MOZ_ASSERT(touchBehaviors.Length() == aInput.mTouches.Length());
     for (size_t i = 0; i < touchBehaviors.Length(); i++) {
       APZCTM_LOG("Touch point has allowed behaviours 0x%02x\n",
                  touchBehaviors[i]);
       if (touchBehaviors[i] == AllowedTouchBehavior::UNKNOWN) {
@@ -1915,17 +1915,17 @@ void APZCTreeManager::SetupScrollbarDrag
 
   // Record the thumb's position at the start of the drag.
   // We snap back to this position if, during the drag, the mouse
   // gets sufficiently far away from the scrollbar.
   dragBlock->SetInitialThumbPos(thumbData.mThumbStart);
 
   // Under some conditions, we can confirm the drag block right away.
   // Otherwise, we have to wait for a main-thread confirmation.
-  if (gfxPrefs::APZDragInitiationEnabled() &&
+  if (StaticPrefs::APZDragInitiationEnabled() &&
       // check that the scrollbar's target scroll frame is layerized
       aScrollThumbNode->GetScrollTargetId() == aApzc->GetGuid().mScrollId &&
       !aApzc->IsScrollInfoLayer()) {
     uint64_t dragBlockId = dragBlock->GetBlockId();
     // AsyncPanZoomController::HandleInputEvent() will call
     // TransformToLocal() on the event, but we need its mLocalOrigin now
     // to compute a drag start offset for the AsyncDragMetrics.
     aMouseInput.TransformToLocal(aApzc->GetTransformToThis());
@@ -2379,17 +2379,17 @@ void APZCTreeManager::DispatchScroll(
     }
   }
 }
 
 ParentLayerPoint APZCTreeManager::DispatchFling(
     AsyncPanZoomController* aPrev, const FlingHandoffState& aHandoffState) {
   // If immediate handoff is disallowed, do not allow handoff beyond the
   // single APZC that's scrolled by the input block that triggered this fling.
-  if (aHandoffState.mIsHandoff && !gfxPrefs::APZAllowImmediateHandoff() &&
+  if (aHandoffState.mIsHandoff && !StaticPrefs::APZAllowImmediateHandoff() &&
       aHandoffState.mScrolledApzc == aPrev) {
     FLING_LOG("APZCTM dropping handoff due to disallowed immediate handoff\n");
     return aHandoffState.mVelocity;
   }
 
   const OverscrollHandoffChain* chain = aHandoffState.mChain;
   RefPtr<AsyncPanZoomController> current;
   uint32_t overscrollHandoffChainLength = chain->Length();
@@ -3286,17 +3286,18 @@ LayerToParentLayerMatrix4x4 APZCTreeMana
   MOZ_RELEASE_ASSERT(aApzc);
 
   AsyncTransformComponentMatrix asyncTransform =
       aApzc->GetCurrentAsyncTransform(AsyncPanZoomController::eForCompositing);
 
   // With container scrolling, the RCD-RSF scrollbars are subject to the
   // content resolution, which requires some special handling.
   bool scrollbarSubjectToResolution =
-      aMetrics.IsRootContent() && gfxPrefs::LayoutUseContainersForRootFrames();
+      aMetrics.IsRootContent() &&
+      StaticPrefs::LayoutUseContainersForRootFrames();
 
   // |asyncTransform| represents the amount by which we have scrolled and
   // zoomed since the last paint. Because the scrollbar was sized and positioned
   // based on the painted content, we need to adjust it based on asyncTransform
   // so that it reflects what the user is actually seeing now.
   AsyncTransformComponentMatrix scrollbarTransform;
   if (*aScrollbarData.mDirection == ScrollDirection::eVertical) {
     const ParentLayerCoord asyncScrollY = asyncTransform._42;
--- a/gfx/layers/apz/src/APZInputBridge.cpp
+++ b/gfx/layers/apz/src/APZInputBridge.cpp
@@ -18,17 +18,17 @@
                                             //     WheelDeltaAdjustmentStrategy
 
 namespace mozilla {
 namespace layers {
 
 static bool WillHandleMouseEvent(const WidgetMouseEventBase& aEvent) {
   return aEvent.mMessage == eMouseMove || aEvent.mMessage == eMouseDown ||
          aEvent.mMessage == eMouseUp || aEvent.mMessage == eDragEnd ||
-         (gfxPrefs::TestEventsAsyncEnabled() &&
+         (StaticPrefs::TestEventsAsyncEnabled() &&
           aEvent.mMessage == eMouseHitTest);
 }
 
 /* static */
 Maybe<APZWheelAction> APZInputBridge::ActionForWheelEvent(
     WidgetWheelEvent* aEvent) {
   if (!(aEvent->mDeltaMode == dom::WheelEvent_Binding::DOM_DELTA_LINE ||
         aEvent->mDeltaMode == dom::WheelEvent_Binding::DOM_DELTA_PIXEL ||
@@ -61,17 +61,17 @@ nsEventStatus APZInputBridge::ReceiveInp
 
       // If zooming is enabled, mark the mouse event as "ignore root
       // scroll frame". This ensures that the main-thread hit test the
       // mouse event undergoes (in PositionedEventTargeting.cpp) uses
       // the IGNORE_ROOT_SCROLL_FRAME flag, which is needed for correct
       // hit testing in a zoomed-in or zoomed-out state.
       // FIXME: bug 1525793 -- this may need to handle zooming or not on a
       // per-document basis.
-      if (gfxPrefs::APZAllowZooming()) {
+      if (StaticPrefs::APZAllowZooming()) {
         mouseEvent.mIgnoreRootScrollFrame = true;
       }
 
       if (WillHandleMouseEvent(mouseEvent)) {
         MouseInput input(mouseEvent);
         input.mOrigin =
             ScreenPoint(mouseEvent.mRefPoint.x, mouseEvent.mRefPoint.y);
 
@@ -111,23 +111,23 @@ nsEventStatus APZInputBridge::ReceiveInp
       return result;
     }
     case eWheelEventClass: {
       WidgetWheelEvent& wheelEvent = *aEvent.AsWheelEvent();
 
       if (Maybe<APZWheelAction> action = ActionForWheelEvent(&wheelEvent)) {
         ScrollWheelInput::ScrollMode scrollMode =
             ScrollWheelInput::SCROLLMODE_INSTANT;
-        if (gfxPrefs::SmoothScrollEnabled() &&
+        if (StaticPrefs::SmoothScrollEnabled() &&
             ((wheelEvent.mDeltaMode ==
                   dom::WheelEvent_Binding::DOM_DELTA_LINE &&
-              gfxPrefs::WheelSmoothScrollEnabled()) ||
+              StaticPrefs::WheelSmoothScrollEnabled()) ||
              (wheelEvent.mDeltaMode ==
                   dom::WheelEvent_Binding::DOM_DELTA_PAGE &&
-              gfxPrefs::PageSmoothScrollEnabled()))) {
+              StaticPrefs::PageSmoothScrollEnabled()))) {
           scrollMode = ScrollWheelInput::SCROLLMODE_SMOOTH;
         }
 
         WheelDeltaAdjustmentStrategy strategy =
             EventStateManager::GetWheelDeltaAdjustmentStrategy(wheelEvent);
         // Adjust the delta values of the wheel event if the current default
         // action is to horizontalize scrolling. I.e., deltaY values are set to
         // deltaX and deltaY and deltaZ values are set to 0.
--- a/gfx/layers/apz/src/AndroidAPZ.cpp
+++ b/gfx/layers/apz/src/AndroidAPZ.cpp
@@ -10,16 +10,17 @@
 #include "AndroidVelocityTracker.h"
 #include "AsyncPanZoomController.h"
 #include "GeneratedJNIWrappers.h"
 #include "GenericFlingAnimation.h"
 #include "gfxPrefs.h"
 #include "OverscrollHandoffState.h"
 #include "SimpleVelocityTracker.h"
 #include "ViewConfiguration.h"
+#include "mozilla/StaticPrefs.h"
 
 #define ANDROID_APZ_LOG(...)
 // #define ANDROID_APZ_LOG(...) printf_stderr("ANDROID_APZ: " __VA_ARGS__)
 
 static float sMaxFlingSpeed = 0.0f;
 
 namespace mozilla {
 namespace layers {
@@ -50,38 +51,38 @@ AndroidSpecificState::AndroidSpecificSta
     return;
   }
   mOverScroller = scroller;
 }
 
 AsyncPanZoomAnimation* AndroidSpecificState::CreateFlingAnimation(
     AsyncPanZoomController& aApzc, const FlingHandoffState& aHandoffState,
     float aPLPPI) {
-  if (gfxPrefs::APZUseChromeFlingPhysics()) {
+  if (StaticPrefs::APZUseChromeFlingPhysics()) {
     return new GenericFlingAnimation<AndroidFlingPhysics>(
         aApzc, aHandoffState.mChain, aHandoffState.mIsHandoff,
         aHandoffState.mScrolledApzc, aPLPPI);
   } else {
     return new StackScrollerFlingAnimation(aApzc, this, aHandoffState.mChain,
                                            aHandoffState.mIsHandoff,
                                            aHandoffState.mScrolledApzc);
   }
 }
 
 UniquePtr<VelocityTracker> AndroidSpecificState::CreateVelocityTracker(
     Axis* aAxis) {
-  if (gfxPrefs::APZUseChromeFlingPhysics()) {
+  if (StaticPrefs::APZUseChromeFlingPhysics()) {
     return MakeUnique<AndroidVelocityTracker>();
   }
   return MakeUnique<SimpleVelocityTracker>(aAxis);
 }
 
 /* static */
 void AndroidSpecificState::InitializeGlobalState() {
-  // Not conditioned on gfxPrefs::APZUseChromeFlingPhysics() because
+  // Not conditioned on StaticPrefs::APZUseChromeFlingPhysics() because
   // the pref is live.
   AndroidFlingPhysics::InitializeGlobalState();
 }
 
 const float BOUNDS_EPSILON = 1.0f;
 
 // This function is used to convert the scroll offset from a float to an integer
 // suitable for using with the Android OverScroller Class.
@@ -162,18 +163,18 @@ StackScrollerFlingAnimation::StackScroll
   int32_t originY =
       ClampStart(mStartOffset.y, scrollRangeStartY, scrollRangeEndY);
   if (!state->mLastFling.IsNull()) {
     // If it's been too long since the previous fling, or if the new fling's
     // velocity is too low, don't allow flywheel to kick in. If we do allow
     // flywheel to kick in, then we need to update the timestamp on the
     // StackScroller because otherwise it might use a stale velocity.
     TimeDuration flingDuration = TimeStamp::Now() - state->mLastFling;
-    if (flingDuration.ToMilliseconds() < gfxPrefs::APZFlingAccelInterval() &&
-        velocity.Length() >= gfxPrefs::APZFlingAccelMinVelocity()) {
+    if (flingDuration.ToMilliseconds() < StaticPrefs::APZFlingAccelInterval() &&
+        velocity.Length() >= StaticPrefs::APZFlingAccelMinVelocity()) {
       bool unused = false;
       mOverScroller->ComputeScrollOffset(flingDuration.ToMilliseconds(),
                                          &unused);
     } else {
       mOverScroller->ForceFinished(true);
     }
   }
   mOverScroller->Fling(
@@ -237,18 +238,19 @@ bool StackScrollerFlingAnimation::DoSamp
     shouldContinueFling = false;
   } else if (hitBoundX && hitBoundY) {
     // We can't scroll any farther along either axis.
     shouldContinueFling = false;
   }
 
   float speed = velocity.Length();
 
-  // gfxPrefs::APZFlingStoppedThreshold is only used in tests.
-  if (!shouldContinueFling || (speed < gfxPrefs::APZFlingStoppedThreshold())) {
+  // StaticPrefs::APZFlingStoppedThreshold is only used in tests.
+  if (!shouldContinueFling ||
+      (speed < StaticPrefs::APZFlingStoppedThreshold())) {
     if (shouldContinueFling) {
       // The OverScroller thinks it should continue but the speed is below
       // the stopping threshold so abort the animation.
       mOverScroller->AbortAnimation();
     }
     // This animation is going to end. If DeferHandleFlingOverscroll
     // has not been called and there is still some velocity left,
     // call it so that fling hand off may occur if applicable.
--- a/gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp
+++ b/gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp
@@ -5,30 +5,30 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/layers/AndroidDynamicToolbarAnimator.h"
 
 #include <cmath>
 
 #include "APZCTreeManager.h"
 #include "FrameMetrics.h"
-#include "gfxPrefs.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/Types.h"
 #include "mozilla/layers/APZThreadUtils.h"
 #include "mozilla/layers/AsyncCompositionManager.h"
 #include "mozilla/layers/CompositorBridgeParent.h"
 #include "mozilla/layers/CompositorOGL.h"
 #include "mozilla/layers/CompositorThread.h"
 #include "mozilla/layers/UiCompositorControllerMessageTypes.h"
 #include "mozilla/layers/UiCompositorControllerParent.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Move.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Unused.h"
 
 namespace {
 
 // Internal flags and constants
 static const float ANIMATION_DURATION =
     0.15f;  // How many seconds the complete animation should span
 static const int32_t MOVE_TOOLBAR_DOWN =
@@ -195,20 +195,20 @@ nsEventStatus AndroidDynamicToolbarAnima
           ScreenIntCoord direction =
               (delta > 0 ? MOVE_TOOLBAR_DOWN : MOVE_TOOLBAR_UP);
           if (mControllerLastDragDirection &&
               (direction != mControllerLastDragDirection)) {
             mControllerDragChangedDirection = true;
           }
           mControllerLastDragDirection = direction;
         }
-        // NOTE: gfxPrefs::ToolbarScrollThreshold() returns a percentage as an
-        // int32_t. So multiply it by 0.01f to convert.
+        // NOTE: StaticPrefs::ToolbarScrollThreshold() returns a percentage as
+        // an int32_t. So multiply it by 0.01f to convert.
         const uint32_t dragThreshold =
-            Abs(std::lround(0.01f * gfxPrefs::ToolbarScrollThreshold() *
+            Abs(std::lround(0.01f * StaticPrefs::ToolbarScrollThreshold() *
                             mControllerCompositionHeight));
         if ((Abs(mControllerTotalDistance.value) > dragThreshold) &&
             (delta != 0)) {
           mControllerDragThresholdReached = true;
           status = ProcessTouchDelta(aApz, currentToolbarState, delta,
                                      multiTouch.mTime);
         }
         mControllerLastEventTimeStamp = multiTouch.mTime;
--- a/gfx/layers/apz/src/AndroidFlingPhysics.cpp
+++ b/gfx/layers/apz/src/AndroidFlingPhysics.cpp
@@ -4,16 +4,17 @@
  * 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 "AndroidFlingPhysics.h"
 
 #include <cmath>
 
 #include "mozilla/ClearOnShutdown.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/StaticPtr.h"
 
 namespace mozilla {
 namespace layers {
 
 // The fling physics calculations implemented here are adapted from
 // Chrome's implementation of fling physics on Android:
 // https://cs.chromium.org/chromium/src/ui/events/android/scroller.cc?rcl=3ae3aaff927038a5c644926842cb0c31dea60c79
@@ -27,38 +28,38 @@ static double ComputeDeceleration(float 
          * kFriction;
 }
 
 // == std::log(0.78f) / std::log(0.9f)
 const float kDecelerationRate = 2.3582018f;
 
 // Default friction constant in android.view.ViewConfiguration.
 static float GetFlingFriction() {
-  return gfxPrefs::APZChromeFlingPhysicsFriction();
+  return StaticPrefs::APZChromeFlingPhysicsFriction();
 }
 
 // Tension lines cross at (GetInflexion(), 1).
 static float GetInflexion() {
   // Clamp the inflexion to the range [0,1]. Values outside of this range
   // do not make sense in the physics model, and for negative values the
   // approximation used to compute the spline curve does not converge.
-  const float inflexion = gfxPrefs::APZChromeFlingPhysicsInflexion();
+  const float inflexion = StaticPrefs::APZChromeFlingPhysicsInflexion();
   if (inflexion < 0.0f) {
     return 0.0f;
   }
   if (inflexion > 1.0f) {
     return 1.0f;
   }
   return inflexion;
 }
 
 // Fling scroll is stopped when the scroll position is |kThresholdForFlingEnd|
 // pixels or closer from the end.
 static float GetThresholdForFlingEnd() {
-  return gfxPrefs::APZChromeFlingPhysicsStopThreshold();
+  return StaticPrefs::APZChromeFlingPhysicsStopThreshold();
 }
 
 static double ComputeSplineDeceleration(ParentLayerCoord aVelocity,
                                         double aTuningCoeff) {
   float velocityPerSec = aVelocity * 1000.0f;
   return std::log(GetInflexion() * velocityPerSec /
                   (GetFlingFriction() * aTuningCoeff));
 }
--- a/gfx/layers/apz/src/AndroidVelocityTracker.cpp
+++ b/gfx/layers/apz/src/AndroidVelocityTracker.cpp
@@ -1,17 +1,17 @@
 /* -*- 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 "AndroidVelocityTracker.h"
 
-#include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 namespace layers {
 
 // This velocity tracker implementation was adapted from Chromium's
 // second-order unweighted least-squares velocity tracker strategy
 // (https://cs.chromium.org/chromium/src/ui/events/gesture_detection/velocity_tracker.cc?l=101&rcl=9ea9a086d4f54c702ec9a38e55fb3eb8bbc2401b).
 
@@ -246,17 +246,17 @@ Maybe<float> AndroidVelocityTracker::Com
   }
 
   // Iterate over movement samples in reverse time order and collect samples.
   float pos[kHistorySize];
   float w[kHistorySize];
   float time[kHistorySize];
   uint32_t m = 0;
   int index = mHistory.Length() - 1;
-  const uint32_t horizon = gfxPrefs::APZVelocityRelevanceTime();
+  const uint32_t horizon = StaticPrefs::APZVelocityRelevanceTime();
   const auto& newest_movement = mHistory[index];
 
   do {
     const auto& movement = mHistory[index];
     uint32_t age = newest_movement.first - movement.first;
     if (age > horizon) break;
 
     ParentLayerCoord position = movement.second;
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -28,17 +28,17 @@
 #include "InputQueue.h"                 // for InputQueue
 #include "Overscroll.h"                 // for OverscrollAnimation
 #include "OverscrollHandoffState.h"     // for OverscrollHandoffState
 #include "SimpleVelocityTracker.h"      // for SimpleVelocityTracker
 #include "Units.h"                      // for CSSRect, CSSPoint, etc
 #include "UnitTransforms.h"             // for TransformTo
 #include "base/message_loop.h"          // for MessageLoop
 #include "base/task.h"                  // for NewRunnableMethod, etc
-#include "gfxPrefs.h"                   // for gfxPrefs
+#include "mozilla/StaticPrefs.h"        // for StaticPrefs
 #include "gfxTypes.h"                   // for gfxFloat
 #include "LayersLogging.h"              // for print_stderr
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
 #include "mozilla/BasicEvents.h"        // for Modifiers, MODIFIER_*
 #include "mozilla/ClearOnShutdown.h"    // for ClearOnShutdown
 #include "mozilla/ComputedTimingFunction.h"  // for ComputedTimingFunction
 #include "mozilla/EventForwards.h"           // for nsEventStatus_*
 #include "mozilla/EventStateManager.h"       // for EventStateManager
@@ -126,17 +126,17 @@ typedef GenericOverscrollEffect Overscro
 typedef PlatformSpecificStateBase
     PlatformSpecificState;  // no extra state, just use the base class
 #endif
 
 /**
  * \page APZCPrefs APZ preferences
  *
  * The following prefs are used to control the behaviour of the APZC.
- * The default values are provided in gfxPrefs.h.
+ * The default values are provided in StaticPrefs.h.
  *
  * \li\b apz.allow_double_tap_zooming
  * Pref that allows or disallows double tap to zoom
  *
  * \li\b apz.allow_immediate_handoff
  * If set to true, scroll can be handed off from one APZC to another within
  * a single input block. If set to false, a single input block can only
  * scroll one APZC.
@@ -609,17 +609,17 @@ AutoApplyAsyncTestAttributes::~AutoApply
 class ZoomAnimation : public AsyncPanZoomAnimation {
  public:
   ZoomAnimation(AsyncPanZoomController& aApzc, const CSSPoint& aStartOffset,
                 const CSSToParentLayerScale2D& aStartZoom,
                 const CSSPoint& aEndOffset,
                 const CSSToParentLayerScale2D& aEndZoom)
       : mApzc(aApzc),
         mTotalDuration(TimeDuration::FromMilliseconds(
-            gfxPrefs::APZZoomAnimationDuration())),
+            StaticPrefs::APZZoomAnimationDuration())),
         mStartOffset(aStartOffset),
         mStartZoom(aStartZoom),
         mEndOffset(aEndOffset),
         mEndZoom(aEndZoom) {}
 
   virtual bool DoSample(FrameMetrics& aFrameMetrics,
                         const TimeDuration& aDelta) override {
     mDuration += aDelta;
@@ -932,35 +932,35 @@ float AsyncPanZoomController::GetDPI() c
   }
   // If this APZC has been destroyed then this value is not going to be
   // used for anything that the user will end up seeing, so we can just
   // return 0.
   return 0.0;
 }
 
 ScreenCoord AsyncPanZoomController::GetTouchStartTolerance() const {
-  return (gfxPrefs::APZTouchStartTolerance() * GetDPI());
+  return (StaticPrefs::APZTouchStartTolerance() * GetDPI());
 }
 
 ScreenCoord AsyncPanZoomController::GetTouchMoveTolerance() const {
-  return (gfxPrefs::APZTouchMoveTolerance() * GetDPI());
+  return (StaticPrefs::APZTouchMoveTolerance() * GetDPI());
 }
 
 ScreenCoord AsyncPanZoomController::GetSecondTapTolerance() const {
-  return (gfxPrefs::APZSecondTapTolerance() * GetDPI());
+  return (StaticPrefs::APZSecondTapTolerance() * GetDPI());
 }
 
 /* static */ AsyncPanZoomController::AxisLockMode
 AsyncPanZoomController::GetAxisLockMode() {
-  return static_cast<AxisLockMode>(gfxPrefs::APZAxisLockMode());
+  return static_cast<AxisLockMode>(StaticPrefs::APZAxisLockMode());
 }
 
 /* static */ AsyncPanZoomController::PinchLockMode
 AsyncPanZoomController::GetPinchLockMode() {
-  return static_cast<PinchLockMode>(gfxPrefs::APZPinchLockMode());
+  return static_cast<PinchLockMode>(StaticPrefs::APZPinchLockMode());
 }
 
 bool AsyncPanZoomController::ArePointerEventsConsumable(
     TouchBlockState* aBlock, const MultiTouchInput& aInput) {
   uint32_t touchPoints = aInput.mTouches.Length();
   if (touchPoints == 0) {
     // Cant' do anything with zero touch points
     return false;
@@ -1006,17 +1006,17 @@ bool AsyncPanZoomController::ArePointerE
   zoomable &= (aBlock->TouchActionAllowsPinchZoom());
 
   return pannable || zoomable;
 }
 
 nsEventStatus AsyncPanZoomController::HandleDragEvent(
     const MouseInput& aEvent, const AsyncDragMetrics& aDragMetrics,
     CSSCoord aInitialThumbPos) {
-  if (!gfxPrefs::APZDragEnabled()) {
+  if (!StaticPrefs::APZDragEnabled()) {
     return nsEventStatus_eIgnore;
   }
 
   if (!GetApzcTreeManager()) {
     return nsEventStatus_eConsumeNoDefault;
   }
 
   if (aEvent.mType == MouseInput::MouseType::MOUSE_UP) {
@@ -1399,17 +1399,17 @@ nsEventStatus AsyncPanZoomController::On
       if (panThreshold > 0.0f) {
         UpdateWithTouchAtDevicePoint(aEvent);
         if (PanVector(extPoint).Length() < panThreshold) {
           return nsEventStatus_eIgnore;
         }
       }
 
       MOZ_ASSERT(GetCurrentTouchBlock());
-      if (gfxPrefs::TouchActionEnabled() &&
+      if (StaticPrefs::TouchActionEnabled() &&
           GetCurrentTouchBlock()->TouchActionAllowsPanningXY()) {
         // User tries to trigger a touch behavior. If allowed touch behavior is
         // vertical pan
         // + horizontal pan (touch-action value is equal to AUTO) we can return
         // ConsumeNoDefault status immediately to trigger cancel event further.
         // It should happen independent of the parent type (whether it is
         // scrolling or not).
         StartPanning(extPoint);
@@ -1560,17 +1560,17 @@ nsEventStatus AsyncPanZoomController::On
     mX.StartTouch(aEvent.mLocalFocusPoint.x, aEvent.mTime);
     mY.StartTouch(aEvent.mLocalFocusPoint.y, aEvent.mTime);
   }
 
   // For platforms that don't support APZ zooming, dispatch a message to the
   // content controller, it may want to do something else with this gesture.
   // FIXME: bug 1525793 -- this may need to handle zooming or not on a
   // per-document basis.
-  if (!gfxPrefs::APZAllowZooming()) {
+  if (!StaticPrefs::APZAllowZooming()) {
     if (RefPtr<GeckoContentController> controller =
             GetGeckoContentController()) {
       controller->NotifyPinchGesture(aEvent.mType, GetGuid(), 0,
                                      aEvent.modifiers);
     }
   }
 
   SetState(PINCHING);
@@ -1607,17 +1607,17 @@ nsEventStatus AsyncPanZoomController::On
   // it cannot be called while the mRecursiveMutex lock is held.
   if (!allowZoom) {
     mX.UpdateWithTouchAtDevicePoint(aEvent.mLocalFocusPoint.x, aEvent.mTime);
     mY.UpdateWithTouchAtDevicePoint(aEvent.mLocalFocusPoint.y, aEvent.mTime);
   }
 
   // FIXME: bug 1525793 -- this may need to handle zooming or not on a
   // per-document basis.
-  if (!gfxPrefs::APZAllowZooming()) {
+  if (!StaticPrefs::APZAllowZooming()) {
     if (RefPtr<GeckoContentController> controller =
             GetGeckoContentController()) {
       controller->NotifyPinchGesture(
           aEvent.mType, GetGuid(),
           ViewAs<LayoutDevicePixel>(
               aEvent.mCurrentSpan - aEvent.mPreviousSpan,
               PixelCastJustification::LayoutDeviceIsParentLayerForRCDRSF),
           aEvent.modifiers);
@@ -1697,17 +1697,17 @@ nsEventStatus AsyncPanZoomController::On
       ScaleWithFocus(spanRatio, cssFocusPoint);
 
       if (neededDisplacement != CSSPoint()) {
         ScrollBy(neededDisplacement);
       }
 
       // We don't want to redraw on every scale, so throttle it.
       if (!mPinchPaintTimerSet) {
-        const int delay = gfxPrefs::APZScaleRepaintDelay();
+        const int delay = StaticPrefs::APZScaleRepaintDelay();
         if (delay >= 0) {
           if (RefPtr<GeckoContentController> controller =
                   GetGeckoContentController()) {
             mPinchPaintTimerSet = true;
             controller->PostDelayedTask(
                 NewRunnableMethod(
                     "layers::AsyncPanZoomController::"
                     "DoDelayedRequestContentRepaint",
@@ -1741,17 +1741,17 @@ nsEventStatus AsyncPanZoomController::On
 
   if (HasReadyTouchBlock() &&
       !GetCurrentTouchBlock()->TouchActionAllowsPinchZoom()) {
     return nsEventStatus_eIgnore;
   }
 
   // FIXME: bug 1525793 -- this may need to handle zooming or not on a
   // per-document basis.
-  if (!gfxPrefs::APZAllowZooming()) {
+  if (!StaticPrefs::APZAllowZooming()) {
     if (RefPtr<GeckoContentController> controller =
             GetGeckoContentController()) {
       controller->NotifyPinchGesture(aEvent.mType, GetGuid(), 0,
                                      aEvent.modifiers);
     }
   }
 
   {
@@ -1834,19 +1834,19 @@ nsEventStatus AsyncPanZoomController::Ha
   // if DispatchFling() gives the fling to somone else. However,
   // don't send the state change notification until we've determined
   // what our final state is to avoid notification churn.
   StateChangeNotificationBlocker blocker(this);
   SetState(NOTHING);
 
   APZC_LOG("%p starting a fling animation if %f >= %f\n", this,
            flingVelocity.Length().value,
-           gfxPrefs::APZFlingMinVelocityThreshold());
-
-  if (flingVelocity.Length() < gfxPrefs::APZFlingMinVelocityThreshold()) {
+           StaticPrefs::APZFlingMinVelocityThreshold());
+
+  if (flingVelocity.Length() < StaticPrefs::APZFlingMinVelocityThreshold()) {
     // Relieve overscroll now if needed, since we will not transition to a fling
     // animation and then an overscroll animation, and relieve it then.
     GetCurrentTouchBlock()
         ->GetOverscrollHandoffChain()
         ->SnapBackOverscrolledApzc(this);
     return nsEventStatus_eConsumeNoDefault;
   }
 
@@ -1955,31 +1955,31 @@ ParentLayerPoint AsyncPanZoomController:
   // Apply user-set multipliers.
   delta.x *= aMultiplierX;
   delta.y *= aMultiplierY;
 
   // For the conditions under which we allow system scroll overrides, see
   // EventStateManager::DeltaAccumulator::ComputeScrollAmountForDefaultAction
   // and WheelTransaction::OverrideSystemScrollSpeed. Note that we do *not*
   // restrict this to the root content, see bug 1217715 for discussion on this.
-  if (gfxPrefs::MouseWheelHasRootScrollDeltaOverride() &&
+  if (StaticPrefs::MouseWheelHasRootScrollDeltaOverride() &&
       !aEvent.IsCustomizedByUserPrefs() &&
       aEvent.mDeltaType == ScrollWheelInput::SCROLLDELTA_LINE &&
       aEvent.mAllowToOverrideSystemScrollSpeed) {
     delta.x = WidgetWheelEvent::ComputeOverriddenDelta(delta.x, false);
     delta.y = WidgetWheelEvent::ComputeOverriddenDelta(delta.y, true);
   }
 
   // If this is a line scroll, and this event was part of a scroll series, then
   // it might need extra acceleration. See WheelHandlingHelper.cpp.
   if (aEvent.mDeltaType == ScrollWheelInput::SCROLLDELTA_LINE &&
       aEvent.mScrollSeriesNumber > 0) {
-    int32_t start = gfxPrefs::MouseWheelAccelerationStart();
+    int32_t start = StaticPrefs::MouseWheelAccelerationStart();
     if (start >= 0 && aEvent.mScrollSeriesNumber >= uint32_t(start)) {
-      int32_t factor = gfxPrefs::MouseWheelAccelerationFactor();
+      int32_t factor = StaticPrefs::MouseWheelAccelerationFactor();
       if (factor > 0) {
         delta.x = ComputeAcceleratedWheelDelta(
             delta.x, aEvent.mScrollSeriesNumber, factor);
         delta.y = ComputeAcceleratedWheelDelta(
             delta.y, aEvent.mScrollSeriesNumber, factor);
       }
     }
   }
@@ -2003,17 +2003,17 @@ nsEventStatus AsyncPanZoomController::On
   mTestHasAsyncKeyScrolled = true;
 
   // Calculate the destination for this keyboard scroll action
   CSSPoint destination = GetKeyboardDestination(aEvent.mAction);
   bool scrollSnapped =
       MaybeAdjustDestinationForScrollSnapping(aEvent, destination);
 
   // If smooth scrolling is disabled, then scroll immediately to the destination
-  if (!gfxPrefs::SmoothScrollEnabled()) {
+  if (!StaticPrefs::SmoothScrollEnabled()) {
     CancelAnimation();
 
     // CallDispatchScroll interprets the start and end points as the start and
     // end of a touch scroll so they need to be reversed.
     ParentLayerPoint startPoint = destination * Metrics().GetZoom();
     ParentLayerPoint endPoint =
         Metrics().GetScrollOffset() * Metrics().GetZoom();
     ParentLayerPoint delta = endPoint - startPoint;
@@ -2103,27 +2103,27 @@ CSSPoint AsyncPanZoomController::GetKeyb
     scrollRect = Metrics().GetScrollableRect();
   }
 
   // Calculate the scroll destination based off of the scroll type and direction
   CSSPoint scrollDestination = scrollOffset;
 
   switch (aAction.mType) {
     case KeyboardScrollAction::eScrollCharacter: {
-      int32_t scrollDistance = gfxPrefs::ToolkitHorizontalScrollDistance();
+      int32_t scrollDistance = StaticPrefs::ToolkitHorizontalScrollDistance();
 
       if (aAction.mForward) {
         scrollDestination.x += scrollDistance * lineScrollSize.width;
       } else {
         scrollDestination.x -= scrollDistance * lineScrollSize.width;
       }
       break;
     }
     case KeyboardScrollAction::eScrollLine: {
-      int32_t scrollDistance = gfxPrefs::ToolkitVerticalScrollDistance();
+      int32_t scrollDistance = StaticPrefs::ToolkitVerticalScrollDistance();
 
       if (aAction.mForward) {
         scrollDestination.y += scrollDistance * lineScrollSize.height;
       } else {
         scrollDestination.y -= scrollDistance * lineScrollSize.height;
       }
       break;
     }
@@ -2248,17 +2248,17 @@ bool AsyncPanZoomController::IsContentOf
     return mScrollMetadata.IsAutoDirRootContentRTL();
   }
   RecursiveMutexAutoLock lock(mRecursiveMutex);
   return Metrics().IsHorizontalContentRightToLeft();
 }
 
 bool AsyncPanZoomController::AllowScrollHandoffInCurrentBlock() const {
   bool result = mInputQueue->AllowScrollHandoff();
-  if (!gfxPrefs::APZAllowImmediateHandoff()) {
+  if (!StaticPrefs::APZAllowImmediateHandoff()) {
     if (InputBlockState* currentBlock = GetCurrentInputBlock()) {
       // Do not allow handoff beyond the first APZC to scroll.
       if (currentBlock->GetScrolledApzc() == this) {
         result = false;
         APZC_LOG("%p dropping handoff; AllowImmediateHandoff=false\n", this);
       }
     }
   }
@@ -2333,17 +2333,17 @@ nsEventStatus AsyncPanZoomController::On
   if (adjustedByAutoDir) {
     MOZ_ASSERT(delta.x || delta.y,
                "Adjusted auto-dir delta values can never be all-zero.");
     APZC_LOG("%p got a scroll-wheel with adjusted auto-dir delta values\n",
              this);
   } else if ((delta.x || delta.y) && !CanScrollWithWheel(delta)) {
     // We can't scroll this apz anymore, so we simply drop the event.
     if (mInputQueue->GetActiveWheelTransaction() &&
-        gfxPrefs::MouseScrollTestingEnabled()) {
+        StaticPrefs::MouseScrollTestingEnabled()) {
       if (RefPtr<GeckoContentController> controller =
               GetGeckoContentController()) {
         controller->NotifyMozMouseScrollEvent(
             GetScrollId(), NS_LITERAL_STRING("MozMouseScrollFailed"));
       }
     }
     return nsEventStatus_eConsumeNoDefault;
   }
@@ -2889,45 +2889,47 @@ void AsyncPanZoomController::HandlePanni
   bool canScrollHorizontal =
       !mX.IsAxisLocked() && overscrollHandoffChain->CanScrollInDirection(
                                 this, ScrollDirection::eHorizontal);
   bool canScrollVertical =
       !mY.IsAxisLocked() && overscrollHandoffChain->CanScrollInDirection(
                                 this, ScrollDirection::eVertical);
   if (GetCurrentTouchBlock()->TouchActionAllowsPanningXY()) {
     if (canScrollHorizontal && canScrollVertical) {
-      if (apz::IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
+      if (apz::IsCloseToHorizontal(aAngle, StaticPrefs::APZAxisLockAngle())) {
         mY.SetAxisLocked(true);
         SetState(PANNING_LOCKED_X);
-      } else if (apz::IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
+      } else if (apz::IsCloseToVertical(aAngle,
+                                        StaticPrefs::APZAxisLockAngle())) {
         mX.SetAxisLocked(true);
         SetState(PANNING_LOCKED_Y);
       } else {
         SetState(PANNING);
       }
     } else if (canScrollHorizontal || canScrollVertical) {
       SetState(PANNING);
     } else {
       SetState(NOTHING);
     }
   } else if (GetCurrentTouchBlock()->TouchActionAllowsPanningX()) {
     // Using bigger angle for panning to keep behavior consistent
     // with IE.
     if (apz::IsCloseToHorizontal(aAngle,
-                                 gfxPrefs::APZAllowedDirectPanAngle())) {
+                                 StaticPrefs::APZAllowedDirectPanAngle())) {
       mY.SetAxisLocked(true);
       SetState(PANNING_LOCKED_X);
       mPanDirRestricted = true;
     } else {
       // Don't treat these touches as pan/zoom movements since 'touch-action'
       // value requires it.
       SetState(NOTHING);
     }
   } else if (GetCurrentTouchBlock()->TouchActionAllowsPanningY()) {
-    if (apz::IsCloseToVertical(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
+    if (apz::IsCloseToVertical(aAngle,
+                               StaticPrefs::APZAllowedDirectPanAngle())) {
       mX.SetAxisLocked(true);
       SetState(PANNING_LOCKED_Y);
       mPanDirRestricted = true;
     } else {
       SetState(NOTHING);
     }
   } else {
     SetState(NOTHING);
@@ -2950,22 +2952,23 @@ void AsyncPanZoomController::HandlePanni
       !mX.IsAxisLocked() && overscrollHandoffChain->CanScrollInDirection(
                                 this, ScrollDirection::eHorizontal);
   bool canScrollVertical =
       !mY.IsAxisLocked() && overscrollHandoffChain->CanScrollInDirection(
                                 this, ScrollDirection::eVertical);
 
   if (!canScrollHorizontal || !canScrollVertical) {
     SetState(PANNING);
-  } else if (apz::IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
+  } else if (apz::IsCloseToHorizontal(aAngle,
+                                      StaticPrefs::APZAxisLockAngle())) {
     mY.SetAxisLocked(true);
     if (canScrollHorizontal) {
       SetState(PANNING_LOCKED_X);
     }
-  } else if (apz::IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
+  } else if (apz::IsCloseToVertical(aAngle, StaticPrefs::APZAxisLockAngle())) {
     mX.SetAxisLocked(true);
     if (canScrollVertical) {
       SetState(PANNING_LOCKED_Y);
     }
   } else {
     SetState(PANNING);
   }
 }
@@ -2975,28 +2978,29 @@ void AsyncPanZoomController::HandlePanni
   // If we're axis-locked, check if the user is trying to break the lock
   if (GetAxisLockMode() == STICKY && !mPanDirRestricted) {
     ParentLayerPoint vector =
         ToParentLayerCoordinates(aPanDistance, mStartTouch);
 
     double angle = atan2(vector.y, vector.x);  // range [-pi, pi]
     angle = fabs(angle);                       // range [0, pi]
 
-    float breakThreshold = gfxPrefs::APZAxisBreakoutThreshold() * GetDPI();
+    float breakThreshold = StaticPrefs::APZAxisBreakoutThreshold() * GetDPI();
 
     if (fabs(aPanDistance.x) > breakThreshold ||
         fabs(aPanDistance.y) > breakThreshold) {
       if (mState == PANNING_LOCKED_X) {
         if (!apz::IsCloseToHorizontal(angle,
-                                      gfxPrefs::APZAxisBreakoutAngle())) {
+                                      StaticPrefs::APZAxisBreakoutAngle())) {
           mY.SetAxisLocked(false);
           SetState(PANNING);
         }
       } else if (mState == PANNING_LOCKED_Y) {
-        if (!apz::IsCloseToVertical(angle, gfxPrefs::APZAxisBreakoutAngle())) {
+        if (!apz::IsCloseToVertical(angle,
+                                    StaticPrefs::APZAxisBreakoutAngle())) {
           mX.SetAxisLocked(false);
           SetState(PANNING);
         }
       }
     }
   }
 }
 
@@ -3030,25 +3034,25 @@ void AsyncPanZoomController::HandlePinch
       ToScreenCoordinates(ParentLayerPoint(0, bufferedSpanDistance), focusPoint)
           .Length();
   ScreenPoint focusChange =
       ToScreenCoordinates(bufferedFocusChange, focusPoint);
 
   if (mPinchLocked) {
     if (GetPinchLockMode() == PINCH_STICKY) {
       ScreenCoord spanBreakoutThreshold =
-          gfxPrefs::APZPinchLockSpanBreakoutThreshold() * GetDPI();
+          StaticPrefs::APZPinchLockSpanBreakoutThreshold() * GetDPI();
       mPinchLocked = !(spanDistance > spanBreakoutThreshold);
     }
   } else {
     if (GetPinchLockMode() != PINCH_FREE) {
       ScreenCoord spanLockThreshold =
-          gfxPrefs::APZPinchLockSpanLockThreshold() * GetDPI();
+          StaticPrefs::APZPinchLockSpanLockThreshold() * GetDPI();
       ScreenCoord scrollLockThreshold =
-          gfxPrefs::APZPinchLockScrollLockThreshold() * GetDPI();
+          StaticPrefs::APZPinchLockScrollLockThreshold() * GetDPI();
 
       if (spanDistance < spanLockThreshold &&
           focusChange.Length() > scrollLockThreshold) {
         mPinchLocked = true;
       }
     }
   }
 }
@@ -3056,17 +3060,17 @@ void AsyncPanZoomController::HandlePinch
 nsEventStatus AsyncPanZoomController::StartPanning(
     const ExternalPoint& aStartPoint) {
   ParentLayerPoint vector =
       ToParentLayerCoordinates(PanVector(aStartPoint), mStartTouch);
   double angle = atan2(vector.y, vector.x);  // range [-pi, pi]
   angle = fabs(angle);                       // range [0, pi]
 
   RecursiveMutexAutoLock lock(mRecursiveMutex);
-  if (gfxPrefs::TouchActionEnabled()) {
+  if (StaticPrefs::TouchActionEnabled()) {
     HandlePanningWithTouchAction(angle);
   } else {
     if (GetAxisLockMode() == FREE) {
       SetState(PANNING);
     } else {
       HandlePanning(angle);
     }
   }
@@ -3211,29 +3215,31 @@ bool AsyncPanZoomController::AttemptScro
 }
 
 void AsyncPanZoomController::OverscrollForPanning(
     ParentLayerPoint& aOverscroll, const ScreenPoint& aPanDistance) {
   // Only allow entering overscroll along an axis if the pan distance along
   // that axis is greater than the pan distance along the other axis by a
   // configurable factor. If we are already overscrolled, don't check this.
   if (!IsOverscrolled()) {
-    if (aPanDistance.x < gfxPrefs::APZMinPanDistanceRatio() * aPanDistance.y) {
+    if (aPanDistance.x <
+        StaticPrefs::APZMinPanDistanceRatio() * aPanDistance.y) {
       aOverscroll.x = 0;
     }
-    if (aPanDistance.y < gfxPrefs::APZMinPanDistanceRatio() * aPanDistance.x) {
+    if (aPanDistance.y <
+        StaticPrefs::APZMinPanDistanceRatio() * aPanDistance.x) {
       aOverscroll.y = 0;
     }
   }
 
   OverscrollBy(aOverscroll);
 }
 
 void AsyncPanZoomController::OverscrollBy(ParentLayerPoint& aOverscroll) {
-  if (!gfxPrefs::APZOverscrollEnabled()) {
+  if (!StaticPrefs::APZOverscrollEnabled()) {
     return;
   }
 
   RecursiveMutexAutoLock lock(mRecursiveMutex);
   // Do not go into overscroll in a direction in which we have no room to
   // scroll to begin with.
   bool xCanScroll = mX.CanScroll();
   bool yCanScroll = mY.CanScroll();
@@ -3290,17 +3296,17 @@ ParentLayerPoint AsyncPanZoomController:
   }
 
   // If we're not scrollable in at least one of the directions in which we
   // were handed velocity, don't start a fling animation.
   // The |IsFinite()| condition should only fail when running some tests
   // that generate events faster than the clock resolution.
   ParentLayerPoint velocity = GetVelocityVector();
   if (!velocity.IsFinite() ||
-      velocity.Length() < gfxPrefs::APZFlingMinVelocityThreshold()) {
+      velocity.Length() < StaticPrefs::APZFlingMinVelocityThreshold()) {
     // Relieve overscroll now if needed, since we will not transition to a fling
     // animation and then an overscroll animation, and relieve it then.
     aHandoffState.mChain->SnapBackOverscrolledApzc(this);
     return residualVelocity;
   }
 
   // If there's a scroll snap point near the predicted fling destination,
   // scroll there using a smooth scroll animation. Otherwise, start a
@@ -3361,17 +3367,17 @@ void AsyncPanZoomController::HandleFling
   if (treeManagerLocal) {
     const FlingHandoffState handoffState{aVelocity, aOverscrollHandoffChain,
                                          true /* handoff */, aScrolledApzc};
     ParentLayerPoint residualVelocity =
         treeManagerLocal->DispatchFling(this, handoffState);
     FLING_LOG("APZC %p left with residual velocity %s\n", this,
               Stringify(residualVelocity).c_str());
     if (!IsZero(residualVelocity) && IsPannable() &&
-        gfxPrefs::APZOverscrollEnabled()) {
+        StaticPrefs::APZOverscrollEnabled()) {
       // Obey overscroll-behavior.
       RecursiveMutexAutoLock lock(mRecursiveMutex);
       if (!mX.OverscrollBehaviorAllowsOverscrollEffect()) {
         residualVelocity.x = 0;
       }
       if (!mY.OverscrollBehaviorAllowsOverscrollEffect()) {
         residualVelocity.y = 0;
       }
@@ -3406,18 +3412,18 @@ void AsyncPanZoomController::SmoothScrol
         CSSPoint::ToAppUnits(ParentLayerPoint(mX.GetVelocity() * 1000.0f,
                                               mY.GetVelocity() * 1000.0f) /
                              Metrics().GetZoom());
 
     nsPoint destination = CSSPoint::ToAppUnits(aDestination);
 
     StartAnimation(new SmoothScrollAnimation(
         *this, initialPosition, initialVelocity, destination,
-        gfxPrefs::ScrollBehaviorSpringConstant(),
-        gfxPrefs::ScrollBehaviorDampingRatio()));
+        StaticPrefs::ScrollBehaviorSpringConstant(),
+        StaticPrefs::ScrollBehaviorDampingRatio()));
   }
 }
 
 void AsyncPanZoomController::StartOverscrollAnimation(
     const ParentLayerPoint& aVelocity) {
   SetState(OVERSCROLL_ANIMATION);
   StartAnimation(new OverscrollAnimation(*this, aVelocity));
 }
@@ -3608,50 +3614,52 @@ void AsyncPanZoomController::ScaleWithFo
   SetScrollOffset((Metrics().GetScrollOffset() + aFocus) - (aFocus / aScale));
 }
 
 /**
  * Enlarges the displayport along both axes based on the velocity.
  */
 static CSSSize CalculateDisplayPortSize(const CSSSize& aCompositionSize,
                                         const CSSPoint& aVelocity) {
-  bool xIsStationarySpeed = fabsf(aVelocity.x) < gfxPrefs::APZMinSkateSpeed();
-  bool yIsStationarySpeed = fabsf(aVelocity.y) < gfxPrefs::APZMinSkateSpeed();
+  bool xIsStationarySpeed =
+      fabsf(aVelocity.x) < StaticPrefs::APZMinSkateSpeed();
+  bool yIsStationarySpeed =
+      fabsf(aVelocity.y) < StaticPrefs::APZMinSkateSpeed();
   float xMultiplier = xIsStationarySpeed
-                          ? gfxPrefs::APZXStationarySizeMultiplier()
-                          : gfxPrefs::APZXSkateSizeMultiplier();
+                          ? StaticPrefs::APZXStationarySizeMultiplier()
+                          : StaticPrefs::APZXSkateSizeMultiplier();
   float yMultiplier = yIsStationarySpeed
-                          ? gfxPrefs::APZYStationarySizeMultiplier()
-                          : gfxPrefs::APZYSkateSizeMultiplier();
+                          ? StaticPrefs::APZYStationarySizeMultiplier()
+                          : StaticPrefs::APZYSkateSizeMultiplier();
 
   if (IsHighMemSystem() && !xIsStationarySpeed) {
-    xMultiplier += gfxPrefs::APZXSkateHighMemAdjust();
+    xMultiplier += StaticPrefs::APZXSkateHighMemAdjust();
   }
 
   if (IsHighMemSystem() && !yIsStationarySpeed) {
-    yMultiplier += gfxPrefs::APZYSkateHighMemAdjust();
+    yMultiplier += StaticPrefs::APZYSkateHighMemAdjust();
   }
 
   return aCompositionSize * CSSSize(xMultiplier, yMultiplier);
 }
 
 /**
  * Ensures that the displayport is at least as large as the visible area
  * inflated by the danger zone. If this is not the case then the
  * "AboutToCheckerboard" function in TiledContentClient.cpp will return true
  * even in the stable state.
  */
 static CSSSize ExpandDisplayPortToDangerZone(
     const CSSSize& aDisplayPortSize, const FrameMetrics& aFrameMetrics) {
   CSSSize dangerZone(0.0f, 0.0f);
   if (aFrameMetrics.LayersPixelsPerCSSPixel().xScale != 0 &&
       aFrameMetrics.LayersPixelsPerCSSPixel().yScale != 0) {
-    dangerZone =
-        LayerSize(gfxPrefs::APZDangerZoneX(), gfxPrefs::APZDangerZoneY()) /
-        aFrameMetrics.LayersPixelsPerCSSPixel();
+    dangerZone = LayerSize(StaticPrefs::APZDangerZoneX(),
+                           StaticPrefs::APZDangerZoneY()) /
+                 aFrameMetrics.LayersPixelsPerCSSPixel();
   }
   const CSSSize compositionSize =
       aFrameMetrics.CalculateBoundedCompositedSizeInCssPixels();
 
   const float xSize = std::max(aDisplayPortSize.width,
                                compositionSize.width + (2 * dangerZone.width));
 
   const float ySize =
@@ -3700,17 +3708,17 @@ const ScreenMargin AsyncPanZoomControlle
 
   // Calculate the displayport size based on how fast we're moving along each
   // axis.
   CSSSize displayPortSize = CalculateDisplayPortSize(compositionSize, velocity);
 
   displayPortSize =
       ExpandDisplayPortToDangerZone(displayPortSize, aFrameMetrics);
 
-  if (gfxPrefs::APZEnlargeDisplayPortWhenClipped()) {
+  if (StaticPrefs::APZEnlargeDisplayPortWhenClipped()) {
     RedistributeDisplayPortExcess(displayPortSize, scrollableRect);
   }
 
   // We calculate a "displayport" here which is relative to the scroll offset.
   // Note that the scroll offset we have here in the APZ code may not be the
   // same as the base rect that gets used on the layout side when the
   // displayport margins are actually applied, so it is important to only
   // consider the displayport as margins relative to a scroll offset rather than
@@ -3719,17 +3727,17 @@ const ScreenMargin AsyncPanZoomControlle
   // Center the displayport based on its expansion over the composition size.
   CSSRect displayPort((compositionSize.width - displayPortSize.width) / 2.0f,
                       (compositionSize.height - displayPortSize.height) / 2.0f,
                       displayPortSize.width, displayPortSize.height);
 
   // Offset the displayport, depending on how fast we're moving and the
   // estimated time it takes to paint, to try to minimise checkerboarding.
   float paintFactor = kDefaultEstimatedPaintDurationMs;
-  displayPort.MoveBy(velocity * paintFactor * gfxPrefs::APZVelocityBias());
+  displayPort.MoveBy(velocity * paintFactor * StaticPrefs::APZVelocityBias());
 
   APZC_LOG_FM(
       aFrameMetrics,
       "Calculated displayport as %s from velocity %s paint time %f metrics",
       Stringify(displayPort).c_str(), ToString(aVelocity).c_str(), paintFactor);
 
   CSSMargin cssMargins;
   cssMargins.left = -displayPort.X();
@@ -3783,18 +3791,18 @@ bool AsyncPanZoomController::SnapBackIfO
   if (mState != FLING) {
     ScrollSnap();
   }
   return false;
 }
 
 bool AsyncPanZoomController::IsFlingingFast() const {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
-  if (mState == FLING &&
-      GetVelocityVector().Length() > gfxPrefs::APZFlingStopOnTapThreshold()) {
+  if (mState == FLING && GetVelocityVector().Length() >
+                             StaticPrefs::APZFlingStopOnTapThreshold()) {
     APZC_LOG("%p is moving fast\n", this);
     return true;
   }
   return false;
 }
 
 bool AsyncPanZoomController::IsPannable() const {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
@@ -4138,17 +4146,17 @@ AsyncPanZoomController::GetCurrentAsyncT
   // double applied.
   AutoApplyAsyncTestAttributes testAttributeApplier(this);
 
   // Use the layout viewport to adjust fixed position elements if and only if
   // it's larger than the visual viewport (assuming we're scrolling the RCD-RSF
   // with apz.allow_zooming enabled).
   // FIXME: bug 1525793 -- this may need to handle zooming or not on a
   // per-document basis.
-  return (gfxPrefs::APZAllowZooming() && Metrics().IsRootContent() &&
+  return (StaticPrefs::APZAllowZooming() && Metrics().IsRootContent() &&
           Metrics().GetVisualViewport().Size() <=
               Metrics().GetLayoutViewport().Size())
              ? GetCurrentAsyncViewportTransform(aMode)
              : GetCurrentAsyncTransform(aMode);
 }
 
 AsyncTransformComponentMatrix
 AsyncPanZoomController::GetCurrentAsyncTransformWithOverscroll(
@@ -4166,33 +4174,33 @@ LayoutDeviceToParentLayerScale AsyncPanZ
   // Note that in general the zoom might have different x- and y-scales.
   // However, this function in particular is only used on the WebRender codepath
   // for which the scales should always be the same.
   return scale.ToScaleFactor() / Metrics().GetDevPixelsPerCSSPixel();
 }
 
 CSSRect AsyncPanZoomController::GetEffectiveLayoutViewport(
     AsyncTransformConsumer aMode) const {
-  if (gfxPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
+  if (StaticPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
     return mCompositedLayoutViewport;
   }
   return Metrics().GetLayoutViewport();
 }
 
 CSSPoint AsyncPanZoomController::GetEffectiveScrollOffset(
     AsyncTransformConsumer aMode) const {
-  if (gfxPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
+  if (StaticPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
     return mCompositedScrollOffset;
   }
   return Metrics().GetScrollOffset();
 }
 
 CSSToParentLayerScale2D AsyncPanZoomController::GetEffectiveZoom(
     AsyncTransformConsumer aMode) const {
-  if (gfxPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
+  if (StaticPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
     return mCompositedZoom;
   }
   return Metrics().GetZoom();
 }
 
 bool AsyncPanZoomController::SampleCompositedAsyncTransform() {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
   if (!mCompositedLayoutViewport.IsEqualEdges(Metrics().GetLayoutViewport()) ||
@@ -4278,17 +4286,17 @@ void AsyncPanZoomController::ReportCheck
   if (mLastCheckerboardReport == aSampleTime) {
     // This function will get called multiple times for each APZC on a single
     // composite (once for each layer it is attached to). Only report the
     // checkerboard once per composite though.
     return;
   }
   mLastCheckerboardReport = aSampleTime;
 
-  bool recordTrace = gfxPrefs::APZRecordCheckerboarding();
+  bool recordTrace = StaticPrefs::APZRecordCheckerboarding();
   bool forTelemetry = Telemetry::CanRecordExtended();
   uint32_t magnitude = GetCheckerboardMagnitude();
 
   MutexAutoLock lock(mCheckerboardEventLock);
   if (!mCheckerboardEvent && (recordTrace || forTelemetry)) {
     mCheckerboardEvent = MakeUnique<CheckerboardEvent>(recordTrace);
   }
   mPotentialCheckerboardTracker.InTransform(IsTransformingState(mState));
@@ -4307,17 +4315,17 @@ void AsyncPanZoomController::UpdateCheck
     mozilla::Telemetry::Accumulate(mozilla::Telemetry::CHECKERBOARD_PEAK,
                                    mCheckerboardEvent->GetPeak());
     mozilla::Telemetry::Accumulate(
         mozilla::Telemetry::CHECKERBOARD_DURATION,
         (uint32_t)mCheckerboardEvent->GetDuration().ToMilliseconds());
 
     mPotentialCheckerboardTracker.CheckerboardDone();
 
-    if (gfxPrefs::APZRecordCheckerboarding()) {
+    if (StaticPrefs::APZRecordCheckerboarding()) {
       // if the pref is enabled, also send it to the storage class. it may be
       // chosen for public display on about:checkerboard, the hall of fame for
       // checkerboard events.
       uint32_t severity = mCheckerboardEvent->GetSeverity();
       std::string log = mCheckerboardEvent->GetLog();
       CheckerboardEventStorage::Report(severity, log);
     }
     mCheckerboardEvent = nullptr;
@@ -4612,17 +4620,17 @@ void AsyncPanZoomController::NotifyLayer
       // Send an acknowledgement with the new scroll generation so that any
       // repaint requests later in this function go through.
       // Because of the scroll generation update, any inflight paint requests
       // are going to be ignored by layout, and so mExpectedGeckoMetrics becomes
       // incorrect for the purposes of calculating the LD transform. To correct
       // this we need to update mExpectedGeckoMetrics to be the last thing we
       // know was painted by Gecko.
       Maybe<CSSPoint> relativeDelta;
-      if (gfxPrefs::APZRelativeUpdate() && aLayerMetrics.IsRelative()) {
+      if (StaticPrefs::APZRelativeUpdate() && aLayerMetrics.IsRelative()) {
         APZC_LOG("%p relative updating scroll offset from %s by %s\n", this,
                  ToString(Metrics().GetScrollOffset()).c_str(),
                  ToString(aLayerMetrics.GetScrollOffset() -
                           aLayerMetrics.GetBaseScrollOffset())
                      .c_str());
 
         // It's possible that the main thread has ignored an APZ scroll offset
         // update for the pending relative scroll that we have just received.
@@ -4686,17 +4694,17 @@ void AsyncPanZoomController::NotifyLayer
     // the scroll update acknowledgement.
 
     APZC_LOG("%p smooth scrolling from %s to %s in state %d\n", this,
              Stringify(Metrics().GetScrollOffset()).c_str(),
              Stringify(aLayerMetrics.GetSmoothScrollOffset()).c_str(), mState);
 
     // See comment on the similar code in the |if (scrollOffsetUpdated)| block
     // above.
-    if (gfxPrefs::APZRelativeUpdate() && aLayerMetrics.IsRelative()) {
+    if (StaticPrefs::APZRelativeUpdate() && aLayerMetrics.IsRelative()) {
       Metrics().ApplyRelativeSmoothScrollUpdateFrom(aLayerMetrics);
     } else {
       Metrics().ApplySmoothScrollUpdateFrom(aLayerMetrics);
     }
     needContentRepaint = true;
     mExpectedGeckoMetrics = aLayerMetrics;
 
     SmoothScrollTo(Metrics().GetSmoothScrollOffset());
@@ -5121,31 +5129,31 @@ ScrollableLayerGuid AsyncPanZoomControll
 void AsyncPanZoomController::UpdateSharedCompositorFrameMetrics() {
   mRecursiveMutex.AssertCurrentThreadIn();
 
   FrameMetrics* frame =
       mSharedFrameMetricsBuffer
           ? static_cast<FrameMetrics*>(mSharedFrameMetricsBuffer->memory())
           : nullptr;
 
-  if (frame && mSharedLock && gfxPrefs::ProgressivePaint()) {
+  if (frame && mSharedLock && StaticPrefs::ProgressivePaint()) {
     mSharedLock->Lock();
     *frame = Metrics();
     mSharedLock->Unlock();
   }
 }
 
 void AsyncPanZoomController::ShareCompositorFrameMetrics() {
   AssertOnUpdaterThread();
 
   // Only create the shared memory buffer if it hasn't already been created,
   // we are using progressive tile painting, and we have a
   // controller to pass the shared memory back to the content process/thread.
   if (!mSharedFrameMetricsBuffer && mMetricsSharingController &&
-      gfxPrefs::ProgressivePaint()) {
+      StaticPrefs::ProgressivePaint()) {
     // Create shared memory and initialize it with the current FrameMetrics
     // value
     mSharedFrameMetricsBuffer = new ipc::SharedMemoryBasic;
     FrameMetrics* frame = nullptr;
     mSharedFrameMetricsBuffer->Create(sizeof(FrameMetrics));
     mSharedFrameMetricsBuffer->Map(sizeof(FrameMetrics));
     frame = static_cast<FrameMetrics*>(mSharedFrameMetricsBuffer->memory());
 
@@ -5223,17 +5231,17 @@ void AsyncPanZoomController::ScrollSnapN
 void AsyncPanZoomController::ScrollSnap() {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
   ScrollSnapNear(Metrics().GetScrollOffset());
 }
 
 void AsyncPanZoomController::ScrollSnapToDestination() {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
 
-  float friction = gfxPrefs::APZFlingFriction();
+  float friction = StaticPrefs::APZFlingFriction();
   ParentLayerPoint velocity(mX.GetVelocity(), mY.GetVelocity());
   ParentLayerPoint predictedDelta;
   // "-velocity / log(1.0 - friction)" is the integral of the deceleration
   // curve modeled for flings in the "Axis" class.
   if (velocity.x != 0.0f) {
     predictedDelta.x = -velocity.x / log(1.0 - friction);
   }
   if (velocity.y != 0.0f) {
--- a/gfx/layers/apz/src/DesktopFlingPhysics.h
+++ b/gfx/layers/apz/src/DesktopFlingPhysics.h
@@ -21,18 +21,18 @@ namespace layers {
 class DesktopFlingPhysics {
  public:
   void Init(const ParentLayerPoint& aStartingVelocity,
             float aPLPPI /* unused */) {
     mVelocity = aStartingVelocity;
   }
   void Sample(const TimeDuration& aDelta, ParentLayerPoint* aOutVelocity,
               ParentLayerPoint* aOutOffset) {
-    float friction = gfxPrefs::APZFlingFriction();
-    float threshold = gfxPrefs::APZFlingStoppedThreshold();
+    float friction = StaticPrefs::APZFlingFriction();
+    float threshold = StaticPrefs::APZFlingStoppedThreshold();
 
     mVelocity = ParentLayerPoint(
         ApplyFrictionOrCancel(mVelocity.x, aDelta, friction, threshold),
         ApplyFrictionOrCancel(mVelocity.y, aDelta, friction, threshold));
 
     *aOutVelocity = mVelocity;
     *aOutOffset = mVelocity * aDelta.ToMilliseconds();
   }
--- a/gfx/layers/apz/src/FocusTarget.cpp
+++ b/gfx/layers/apz/src/FocusTarget.cpp
@@ -134,17 +134,17 @@ FocusTarget::FocusTarget(PresShell* aRoo
   // If there is no focused element then event dispatch goes to the body of
   // the page if it exists or the root element.
   if (!keyEventTarget) {
     keyEventTarget = document->GetUnfocusedKeyEventTarget();
   }
 
   // Check if there are key event listeners that could prevent default or change
   // the focus or selection of the page.
-  if (gfxPrefs::APZKeyboardPassiveListeners()) {
+  if (StaticPrefs::APZKeyboardPassiveListeners()) {
     mFocusHasKeyEventListeners =
         HasListenersForNonPassiveKeyEvents(keyEventTarget.get());
   } else {
     mFocusHasKeyEventListeners = HasListenersForKeyEvents(keyEventTarget.get());
   }
 
   // Check if the key event target is content editable or if the document
   // is in design mode.
--- a/gfx/layers/apz/src/GenericFlingAnimation.h
+++ b/gfx/layers/apz/src/GenericFlingAnimation.h
@@ -90,18 +90,18 @@ class GenericFlingAnimation : public Asy
     // y-fling to get accelerated. Note that the acceleration code is only
     // applied on the APZC that initiates the fling; the accelerated velocities
     // are then handed off using the normal DispatchFling codepath. Acceleration
     // is only applied in the APZC that originated the fling, not in APZCs
     // further down the handoff chain during handoff.
     bool applyAcceleration = !aFlingIsHandedOff;
     if (applyAcceleration && !mApzc.mLastFlingTime.IsNull() &&
         (now - mApzc.mLastFlingTime).ToMilliseconds() <
-            gfxPrefs::APZFlingAccelInterval() &&
-        velocity.Length() >= gfxPrefs::APZFlingAccelMinVelocity()) {
+            StaticPrefs::APZFlingAccelInterval() &&
+        velocity.Length() >= StaticPrefs::APZFlingAccelMinVelocity()) {
       if (velocity.x != 0 &&
           SameDirection(velocity.x, mApzc.mLastFlingVelocity.x)) {
         velocity.x = Accelerate(velocity.x, mApzc.mLastFlingVelocity.x);
         FLING_LOG("%p Applying fling x-acceleration from %f to %f (delta %f)\n",
                   &mApzc, mApzc.mX.GetVelocity(), velocity.x,
                   mApzc.mLastFlingVelocity.x);
         mApzc.mX.SetVelocity(velocity.x);
       }
@@ -216,18 +216,18 @@ class GenericFlingAnimation : public Asy
 
  private:
   static bool SameDirection(float aVelocity1, float aVelocity2) {
     return (aVelocity1 == 0.0f) || (aVelocity2 == 0.0f) ||
            (IsNegative(aVelocity1) == IsNegative(aVelocity2));
   }
 
   static float Accelerate(float aBase, float aSupplemental) {
-    return (aBase * gfxPrefs::APZFlingAccelBaseMultiplier()) +
-           (aSupplemental * gfxPrefs::APZFlingAccelSupplementalMultiplier());
+    return (aBase * StaticPrefs::APZFlingAccelBaseMultiplier()) +
+           (aSupplemental * StaticPrefs::APZFlingAccelSupplementalMultiplier());
   }
 
   AsyncPanZoomController& mApzc;
   RefPtr<const OverscrollHandoffChain> mOverscrollHandoffChain;
   RefPtr<const AsyncPanZoomController> mScrolledApzc;
 };
 
 }  // namespace layers
--- a/gfx/layers/apz/src/GenericScrollAnimation.cpp
+++ b/gfx/layers/apz/src/GenericScrollAnimation.cpp
@@ -16,17 +16,17 @@
 
 namespace mozilla {
 namespace layers {
 
 GenericScrollAnimation::GenericScrollAnimation(
     AsyncPanZoomController& aApzc, const nsPoint& aInitialPosition,
     const ScrollAnimationBezierPhysicsSettings& aSettings)
     : mApzc(aApzc), mFinalDestination(aInitialPosition) {
-  if (gfxPrefs::SmoothScrollMSDPhysicsEnabled()) {
+  if (StaticPrefs::SmoothScrollMSDPhysicsEnabled()) {
     mAnimationPhysics = MakeUnique<ScrollAnimationMSDPhysics>(aInitialPosition);
   } else {
     mAnimationPhysics =
         MakeUnique<ScrollAnimationBezierPhysics>(aInitialPosition, aSettings);
   }
 }
 
 void GenericScrollAnimation::UpdateDelta(TimeStamp aTime, const nsPoint& aDelta,
--- a/gfx/layers/apz/src/GestureEventListener.cpp
+++ b/gfx/layers/apz/src/GestureEventListener.cpp
@@ -292,17 +292,17 @@ nsEventStatus GestureEventListener::Hand
     // The user has performed a double tap, but not lifted her finger.
     case GESTURE_SECOND_SINGLE_TOUCH_DOWN: {
       // If touch has moved noticeably (within gfxPrefs::APZMaxTapTime()),
       // change state.
       if (MoveDistanceIsLarge()) {
         CancelLongTapTimeoutTask();
         CancelMaxTapTimeoutTask();
         mSingleTapSent = Nothing();
-        if (!gfxPrefs::APZOneTouchPinchEnabled()) {
+        if (!StaticPrefs::APZOneTouchPinchEnabled()) {
           // If the one-touch-pinch feature is disabled, bail out of the double-
           // tap gesture instead.
           SetState(GESTURE_NONE);
           break;
         }
 
         SetState(GESTURE_ONE_TOUCH_PINCH);
 
@@ -596,17 +596,17 @@ void GestureEventListener::CancelLongTap
 
 void GestureEventListener::CreateLongTapTimeoutTask() {
   RefPtr<CancelableRunnable> task = NewCancelableRunnableMethod(
       "layers::GestureEventListener::HandleInputTimeoutLongTap", this,
       &GestureEventListener::HandleInputTimeoutLongTap);
 
   mLongTapTimeoutTask = task;
   mAsyncPanZoomController->PostDelayedTask(
-      task.forget(), gfxPrefs::UiClickHoldContextMenusDelay());
+      task.forget(), StaticPrefs::UiClickHoldContextMenusDelay());
 }
 
 void GestureEventListener::CancelMaxTapTimeoutTask() {
   if (mState == GESTURE_FIRST_SINGLE_TOUCH_MAX_TAP_DOWN) {
     // being in this state means the timer has just been triggered
     return;
   }
 
@@ -624,13 +624,13 @@ void GestureEventListener::CreateMaxTapT
   MOZ_ASSERT(block);
   RefPtr<CancelableRunnable> task = NewCancelableRunnableMethod<bool>(
       "layers::GestureEventListener::HandleInputTimeoutMaxTap", this,
       &GestureEventListener::HandleInputTimeoutMaxTap,
       block->IsDuringFastFling());
 
   mMaxTapTimeoutTask = task;
   mAsyncPanZoomController->PostDelayedTask(task.forget(),
-                                           gfxPrefs::APZMaxTapTime());
+                                           StaticPrefs::APZMaxTapTime());
 }
 
 }  // namespace layers
 }  // namespace mozilla
--- a/gfx/layers/apz/src/HitTestingTreeNode.cpp
+++ b/gfx/layers/apz/src/HitTestingTreeNode.cpp
@@ -268,17 +268,17 @@ CompositorHitTestInfo HitTestingTreeNode
     // eApzAwareListeners, and eIrregularArea, because the round-trip through
     // mEventRegions is lossy. We just convert it back to eIrregularArea
     // because that's the most conservative option (i.e. eIrregularArea makes
     // APZ rely on the main thread for everything).
     result += CompositorHitTestFlags::eIrregularArea;
     if (mEventRegions.mDTCRequiresTargetConfirmation) {
       result += CompositorHitTestFlags::eRequiresTargetConfirmation;
     }
-  } else if (gfxPrefs::TouchActionEnabled()) {
+  } else if (StaticPrefs::TouchActionEnabled()) {
     if (mEventRegions.mNoActionRegion.Contains(point.x, point.y)) {
       // set all the touch-action flags as disabled
       result += CompositorHitTestTouchActionMask;
     } else {
       bool panX = mEventRegions.mHorizontalPanRegion.Contains(point.x, point.y);
       bool panY = mEventRegions.mVerticalPanRegion.Contains(point.x, point.y);
       if (panX && panY) {
         // touch-action: pan-x pan-y
--- a/gfx/layers/apz/src/InputBlockState.cpp
+++ b/gfx/layers/apz/src/InputBlockState.cpp
@@ -144,17 +144,17 @@ bool InputBlockState::IsDownchainOf(Asyn
       seenA = true;
     }
   }
   return false;
 }
 
 void InputBlockState::SetScrolledApzc(AsyncPanZoomController* aApzc) {
   // An input block should only have one scrolled APZC.
-  MOZ_ASSERT(!mScrolledApzc || (gfxPrefs::APZAllowImmediateHandoff()
+  MOZ_ASSERT(!mScrolledApzc || (StaticPrefs::APZAllowImmediateHandoff()
                                     ? IsDownchainOf(mScrolledApzc, aApzc)
                                     : mScrolledApzc == aApzc));
 
   mScrolledApzc = aApzc;
 }
 
 AsyncPanZoomController* InputBlockState::GetScrolledApzc() const {
   return mScrolledApzc;
@@ -399,39 +399,41 @@ bool WheelBlockState::MaybeTimeout(const
   if (MaybeTimeout(aEvent.mTimeStamp)) {
     return true;
   }
 
   if (!mLastMouseMove.IsNull()) {
     // If there's a recent mouse movement, we can time out the transaction
     // early.
     TimeDuration duration = TimeStamp::Now() - mLastMouseMove;
-    if (duration.ToMilliseconds() >= gfxPrefs::MouseWheelIgnoreMoveDelayMs()) {
+    if (duration.ToMilliseconds() >=
+        StaticPrefs::MouseWheelIgnoreMoveDelayMs()) {
       TBS_LOG("%p wheel transaction timed out after mouse move\n", this);
       EndTransaction();
       return true;
     }
   }
 
   return false;
 }
 
 bool WheelBlockState::MaybeTimeout(const TimeStamp& aTimeStamp) {
   MOZ_ASSERT(InTransaction());
 
   // End the transaction if the event occurred > 1.5s after the most recently
   // seen wheel event.
   TimeDuration duration = aTimeStamp - mLastEventTime;
-  if (duration.ToMilliseconds() < gfxPrefs::MouseWheelTransactionTimeoutMs()) {
+  if (duration.ToMilliseconds() <
+      StaticPrefs::MouseWheelTransactionTimeoutMs()) {
     return false;
   }
 
   TBS_LOG("%p wheel transaction timed out\n", this);
 
-  if (gfxPrefs::MouseScrollTestingEnabled()) {
+  if (StaticPrefs::MouseScrollTestingEnabled()) {
     RefPtr<AsyncPanZoomController> apzc = GetTargetApzc();
     apzc->NotifyMozMouseScrollEvent(
         NS_LITERAL_STRING("MozMouseScrollTransactionTimeout"));
   }
 
   EndTransaction();
   return true;
 }
@@ -445,17 +447,18 @@ void WheelBlockState::OnMouseMove(const 
   }
 
   if (mLastMouseMove.IsNull()) {
     // If the cursor is moving inside the frame, and it is more than the
     // ignoremovedelay time since the last scroll operation, we record
     // this as the most recent mouse movement.
     TimeStamp now = TimeStamp::Now();
     TimeDuration duration = now - mLastEventTime;
-    if (duration.ToMilliseconds() >= gfxPrefs::MouseWheelIgnoreMoveDelayMs()) {
+    if (duration.ToMilliseconds() >=
+        StaticPrefs::MouseWheelIgnoreMoveDelayMs()) {
       mLastMouseMove = now;
     }
   }
 }
 
 void WheelBlockState::UpdateTargetApzc(
     const RefPtr<AsyncPanZoomController>& aTargetApzc) {
   InputBlockState::UpdateTargetApzc(aTargetApzc);
@@ -576,17 +579,17 @@ TouchBlockState::TouchBlockState(
     TargetConfirmationFlags aFlags, TouchCounter& aCounter)
     : CancelableBlockState(aTargetApzc, aFlags),
       mAllowedTouchBehaviorSet(false),
       mDuringFastFling(false),
       mSingleTapOccurred(false),
       mInSlop(false),
       mTouchCounter(aCounter) {
   TBS_LOG("Creating %p\n", this);
-  if (!gfxPrefs::TouchActionEnabled()) {
+  if (!StaticPrefs::TouchActionEnabled()) {
     mAllowedTouchBehaviorSet = true;
   }
 }
 
 bool TouchBlockState::SetAllowedTouchBehaviors(
     const nsTArray<TouchBehaviorFlags>& aBehaviors) {
   if (mAllowedTouchBehaviorSet) {
     return false;
@@ -608,36 +611,36 @@ bool TouchBlockState::GetAllowedTouchBeh
 }
 
 bool TouchBlockState::HasAllowedTouchBehaviors() const {
   return mAllowedTouchBehaviorSet;
 }
 
 void TouchBlockState::CopyPropertiesFrom(const TouchBlockState& aOther) {
   TBS_LOG("%p copying properties from %p\n", this, &aOther);
-  if (gfxPrefs::TouchActionEnabled()) {
+  if (StaticPrefs::TouchActionEnabled()) {
     MOZ_ASSERT(aOther.mAllowedTouchBehaviorSet ||
                aOther.IsContentResponseTimerExpired());
     SetAllowedTouchBehaviors(aOther.mAllowedTouchBehaviors);
   }
   mTransformToApzc = aOther.mTransformToApzc;
 }
 
 bool TouchBlockState::HasReceivedAllContentNotifications() const {
   return CancelableBlockState::HasReceivedAllContentNotifications()
          // See comment in TouchBlockState::IsReadyforHandling()
-         && (!gfxPrefs::TouchActionEnabled() || mAllowedTouchBehaviorSet);
+         && (!StaticPrefs::TouchActionEnabled() || mAllowedTouchBehaviorSet);
 }
 
 bool TouchBlockState::IsReadyForHandling() const {
   if (!CancelableBlockState::IsReadyForHandling()) {
     return false;
   }
 
-  if (!gfxPrefs::TouchActionEnabled()) {
+  if (!StaticPrefs::TouchActionEnabled()) {
     // If TouchActionEnabled() was false when this block was created, then
     // mAllowedTouchBehaviorSet is guaranteed to the true. However, the pref
     // may have been flipped to false after the block was created. In that case,
     // we should eventually get the touch-behaviour notification, or expire the
     // content response timeout, but we don't really need to wait for those,
     // since we don't care about the touch-behaviour values any more.
     return true;
   }
@@ -665,66 +668,66 @@ const char* TouchBlockState::Type() { re
 
 void TouchBlockState::DispatchEvent(const InputData& aEvent) const {
   MOZ_ASSERT(aEvent.mInputType == MULTITOUCH_INPUT);
   mTouchCounter.Update(aEvent.AsMultiTouchInput());
   CancelableBlockState::DispatchEvent(aEvent);
 }
 
 bool TouchBlockState::TouchActionAllowsPinchZoom() const {
-  if (!gfxPrefs::TouchActionEnabled()) {
+  if (!StaticPrefs::TouchActionEnabled()) {
     return true;
   }
   // Pointer events specification requires that all touch points allow zoom.
   for (size_t i = 0; i < mAllowedTouchBehaviors.Length(); i++) {
     if (!(mAllowedTouchBehaviors[i] & AllowedTouchBehavior::PINCH_ZOOM)) {
       return false;
     }
   }
   return true;
 }
 
 bool TouchBlockState::TouchActionAllowsDoubleTapZoom() const {
-  if (!gfxPrefs::TouchActionEnabled()) {
+  if (!StaticPrefs::TouchActionEnabled()) {
     return true;
   }
   for (size_t i = 0; i < mAllowedTouchBehaviors.Length(); i++) {
     if (!(mAllowedTouchBehaviors[i] & AllowedTouchBehavior::DOUBLE_TAP_ZOOM)) {
       return false;
     }
   }
   return true;
 }
 
 bool TouchBlockState::TouchActionAllowsPanningX() const {
-  if (!gfxPrefs::TouchActionEnabled()) {
+  if (!StaticPrefs::TouchActionEnabled()) {
     return true;
   }
   if (mAllowedTouchBehaviors.IsEmpty()) {
     // Default to allowed
     return true;
   }
   TouchBehaviorFlags flags = mAllowedTouchBehaviors[0];
   return (flags & AllowedTouchBehavior::HORIZONTAL_PAN);
 }
 
 bool TouchBlockState::TouchActionAllowsPanningY() const {
-  if (!gfxPrefs::TouchActionEnabled()) {
+  if (!StaticPrefs::TouchActionEnabled()) {
     return true;
   }
   if (mAllowedTouchBehaviors.IsEmpty()) {
     // Default to allowed
     return true;
   }
   TouchBehaviorFlags flags = mAllowedTouchBehaviors[0];
   return (flags & AllowedTouchBehavior::VERTICAL_PAN);
 }
 
 bool TouchBlockState::TouchActionAllowsPanningXY() const {
-  if (!gfxPrefs::TouchActionEnabled()) {
+  if (!StaticPrefs::TouchActionEnabled()) {
     return true;
   }
   if (mAllowedTouchBehaviors.IsEmpty()) {
     // Default to allowed
     return true;
   }
   TouchBehaviorFlags flags = mAllowedTouchBehaviors[0];
   return (flags & AllowedTouchBehavior::HORIZONTAL_PAN) &&
@@ -772,18 +775,18 @@ Maybe<ScrollDirection> TouchBlockState::
       aInput.mTouches.Length() != 1) {
     return Nothing();
   }
   ScreenPoint vector = aInput.mTouches[0].mScreenPoint - mSlopOrigin;
   double angle = atan2(vector.y, vector.x);  // range [-pi, pi]
   angle = fabs(angle);                       // range [0, pi]
 
   double angleThreshold = TouchActionAllowsPanningXY()
-                              ? gfxPrefs::APZAxisLockAngle()
-                              : gfxPrefs::APZAllowedDirectPanAngle();
+                              ? StaticPrefs::APZAxisLockAngle()
+                              : StaticPrefs::APZAllowedDirectPanAngle();
   if (apz::IsCloseToHorizontal(angle, angleThreshold)) {
     return Some(ScrollDirection::eHorizontal);
   }
   if (apz::IsCloseToVertical(angle, angleThreshold)) {
     return Some(ScrollDirection::eVertical);
   }
   return Nothing();
 }
--- a/gfx/layers/apz/src/InputQueue.cpp
+++ b/gfx/layers/apz/src/InputQueue.cpp
@@ -77,17 +77,17 @@ nsEventStatus InputQueue::ReceiveTouchIn
     const RefPtr<AsyncPanZoomController>& aTarget,
     TargetConfirmationFlags aFlags, const MultiTouchInput& aEvent,
     uint64_t* aOutInputBlockId,
     const Maybe<nsTArray<TouchBehaviorFlags>>& aTouchBehaviors) {
   TouchBlockState* block = nullptr;
   if (aEvent.mType == MultiTouchInput::MULTITOUCH_START) {
     nsTArray<TouchBehaviorFlags> currentBehaviors;
     bool haveBehaviors = false;
-    if (!gfxPrefs::TouchActionEnabled()) {
+    if (!StaticPrefs::TouchActionEnabled()) {
       haveBehaviors = true;
     } else if (mActiveTouchBlock) {
       haveBehaviors =
           mActiveTouchBlock->GetAllowedTouchBehaviors(currentBehaviors);
       // If the behaviours aren't set, but the main-thread response timer on
       // the block is expired we still treat it as though it has behaviors,
       // because in that case we still want to interrupt the fast-fling and
       // use the default behaviours.
@@ -109,17 +109,17 @@ nsEventStatus InputQueue::ReceiveTouchIn
       // delivered to content. Note that we don't set this flag when going
       // from a fast fling to a pinch state (i.e. second finger goes down while
       // the first finger is moving).
       block->SetDuringFastFling();
       block->SetConfirmedTargetApzc(
           aTarget, InputBlockState::TargetConfirmationState::eConfirmed,
           nullptr /* the block was just created so it has no events */,
           false /* not a scrollbar drag */);
-      if (gfxPrefs::TouchActionEnabled()) {
+      if (StaticPrefs::TouchActionEnabled()) {
         block->SetAllowedTouchBehaviors(currentBehaviors);
       }
       INPQ_LOG("block %p tagged as fast-motion\n", block);
     } else if (aTouchBehaviors) {
       // If this block isn't started during a fast-fling, and APZCTM has
       // provided touch behavior information, then put it on the block so
       // that the ArePointerEventsConsumable call below can use it.
       block->SetAllowedTouchBehaviors(*aTouchBehaviors);
@@ -313,17 +313,17 @@ nsEventStatus InputQueue::ReceiveKeyboar
   }
 
   mQueuedInputs.AppendElement(MakeUnique<QueuedInput>(aEvent, *block));
 
   ProcessQueue();
 
   // If APZ is allowing passive listeners then we must dispatch the event to
   // content, otherwise we can consume the event.
-  return gfxPrefs::APZKeyboardPassiveListeners()
+  return StaticPrefs::APZKeyboardPassiveListeners()
              ? nsEventStatus_eConsumeDoDefault
              : nsEventStatus_eConsumeNoDefault;
 }
 
 static bool CanScrollTargetHorizontally(const PanGestureInput& aInitialEvent,
                                         PanGestureBlockState* aBlock) {
   PanGestureInput horizontalComponent = aInitialEvent;
   horizontalComponent.mPanDisplacement.y = 0;
@@ -546,17 +546,17 @@ bool InputQueue::IsDragOnScrollbar(bool 
 void InputQueue::ScheduleMainThreadTimeout(
     const RefPtr<AsyncPanZoomController>& aTarget,
     CancelableBlockState* aBlock) {
   INPQ_LOG("scheduling main thread timeout for target %p\n", aTarget.get());
   aBlock->StartContentResponseTimer();
   RefPtr<Runnable> timeoutTask = NewRunnableMethod<uint64_t>(
       "layers::InputQueue::MainThreadTimeout", this,
       &InputQueue::MainThreadTimeout, aBlock->GetBlockId());
-  int32_t timeout = gfxPrefs::APZContentResponseTimeout();
+  int32_t timeout = StaticPrefs::APZContentResponseTimeout();
   if (timeout == 0) {
     // If the timeout is zero, treat it as a request to ignore any main
     // thread confirmation and unconditionally use fallback behaviour for
     // when a timeout is reached. This codepath is used by tests that
     // want to exercise the fallback behaviour.
     // To ensure the fallback behaviour is used unconditionally, the timeout
     // is run right away instead of using PostDelayedTask(). However,
     // we can't run it right here, because MainThreadTimeout() expects that
--- a/gfx/layers/apz/src/KeyboardScrollAnimation.cpp
+++ b/gfx/layers/apz/src/KeyboardScrollAnimation.cpp
@@ -15,35 +15,35 @@ namespace layers {
 static ScrollAnimationBezierPhysicsSettings SettingsForType(
     KeyboardScrollAction::KeyboardScrollActionType aType) {
   int32_t minMS = 0;
   int32_t maxMS = 0;
 
   switch (aType) {
     case KeyboardScrollAction::eScrollCharacter:
     case KeyboardScrollAction::eScrollLine: {
-      maxMS = clamped(gfxPrefs::LineSmoothScrollMaxDurationMs(), 0, 10000);
-      minMS = clamped(gfxPrefs::LineSmoothScrollMinDurationMs(), 0, maxMS);
+      maxMS = clamped(StaticPrefs::LineSmoothScrollMaxDurationMs(), 0, 10000);
+      minMS = clamped(StaticPrefs::LineSmoothScrollMinDurationMs(), 0, maxMS);
       break;
     }
     case KeyboardScrollAction::eScrollPage: {
-      maxMS = clamped(gfxPrefs::PageSmoothScrollMaxDurationMs(), 0, 10000);
-      minMS = clamped(gfxPrefs::PageSmoothScrollMinDurationMs(), 0, maxMS);
+      maxMS = clamped(StaticPrefs::PageSmoothScrollMaxDurationMs(), 0, 10000);
+      minMS = clamped(StaticPrefs::PageSmoothScrollMinDurationMs(), 0, maxMS);
       break;
     }
     case KeyboardScrollAction::eScrollComplete: {
-      maxMS = clamped(gfxPrefs::OtherSmoothScrollMaxDurationMs(), 0, 10000);
-      minMS = clamped(gfxPrefs::OtherSmoothScrollMinDurationMs(), 0, maxMS);
+      maxMS = clamped(StaticPrefs::OtherSmoothScrollMaxDurationMs(), 0, 10000);
+      minMS = clamped(StaticPrefs::OtherSmoothScrollMinDurationMs(), 0, maxMS);
       break;
     }
   }
 
   // The pref is 100-based int percentage, while mIntervalRatio is 1-based ratio
   double intervalRatio =
-      ((double)gfxPrefs::SmoothScrollDurationToIntervalRatio()) / 100.0;
+      ((double)StaticPrefs::SmoothScrollDurationToIntervalRatio()) / 100.0;
   intervalRatio = std::max(1.0, intervalRatio);
   return ScrollAnimationBezierPhysicsSettings{minMS, maxMS, intervalRatio};
 }
 
 KeyboardScrollAnimation::KeyboardScrollAnimation(
     AsyncPanZoomController& aApzc, const nsPoint& aInitialPosition,
     KeyboardScrollAction::KeyboardScrollActionType aType)
     : GenericScrollAnimation(aApzc, aInitialPosition, SettingsForType(aType)) {}
--- a/gfx/layers/apz/src/SimpleVelocityTracker.cpp
+++ b/gfx/layers/apz/src/SimpleVelocityTracker.cpp
@@ -1,18 +1,18 @@
 /* -*- 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 "SimpleVelocityTracker.h"
 
-#include "gfxPrefs.h"
 #include "mozilla/ComputedTimingFunction.h"  // for ComputedTimingFunction
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/StaticPtr.h"               // for StaticAutoPtr
 
 #define SVT_LOG(...)
 // #define SVT_LOG(...) printf_stderr("SimpleVelocityTracker: " __VA_ARGS__)
 
 namespace mozilla {
 namespace layers {
 
@@ -81,17 +81,17 @@ float SimpleVelocityTracker::HandleDynam
   return velocity;
 }
 
 Maybe<float> SimpleVelocityTracker::ComputeVelocity(uint32_t aTimestampMs) {
   float velocity = 0;
   int count = 0;
   for (const auto& e : mVelocityQueue) {
     uint32_t timeDelta = (aTimestampMs - e.first);
-    if (timeDelta < gfxPrefs::APZVelocityRelevanceTime()) {
+    if (timeDelta < StaticPrefs::APZVelocityRelevanceTime()) {
       count++;
       velocity += e.second;
     }
   }
   mVelocityQueue.Clear();
   if (count > 1) {
     velocity /= count;
   }
@@ -105,27 +105,27 @@ void SimpleVelocityTracker::AddVelocityT
   mVelocityQueue.AppendElement(std::make_pair(aTimestampMs, aVelocity));
   if (mVelocityQueue.Length() > gfxPrefs::APZMaxVelocityQueueSize()) {
     mVelocityQueue.RemoveElementAt(0);
   }
 }
 
 float SimpleVelocityTracker::ApplyFlingCurveToVelocity(float aVelocity) const {
   float newVelocity = aVelocity;
-  if (gfxPrefs::APZMaxVelocity() > 0.0f) {
+  if (StaticPrefs::APZMaxVelocity() > 0.0f) {
     bool velocityIsNegative = (newVelocity < 0);
     newVelocity = fabs(newVelocity);
 
-    float maxVelocity = mAxis->ToLocalVelocity(gfxPrefs::APZMaxVelocity());
+    float maxVelocity = mAxis->ToLocalVelocity(StaticPrefs::APZMaxVelocity());
     newVelocity = std::min(newVelocity, maxVelocity);
 
-    if (gfxPrefs::APZCurveThreshold() > 0.0f &&
-        gfxPrefs::APZCurveThreshold() < gfxPrefs::APZMaxVelocity()) {
+    if (StaticPrefs::APZCurveThreshold() > 0.0f &&
+        StaticPrefs::APZCurveThreshold() < StaticPrefs::APZMaxVelocity()) {
       float curveThreshold =
-          mAxis->ToLocalVelocity(gfxPrefs::APZCurveThreshold());
+          mAxis->ToLocalVelocity(StaticPrefs::APZCurveThreshold());
       if (newVelocity > curveThreshold) {
         // here, 0 < curveThreshold < newVelocity <= maxVelocity, so we apply
         // the curve
         float scale = maxVelocity - curveThreshold;
         float funcInput = (newVelocity - curveThreshold) / scale;
         float funcOutput = gVelocityCurveFunction->GetValue(
             funcInput, ComputedTimingFunction::BeforeFlag::Unset);
         float curvedVelocity = (funcOutput * scale) + curveThreshold;
--- a/gfx/layers/apz/src/WheelScrollAnimation.cpp
+++ b/gfx/layers/apz/src/WheelScrollAnimation.cpp
@@ -3,45 +3,45 @@
 /* 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 "WheelScrollAnimation.h"
 #include "ScrollAnimationBezierPhysics.h"
 
 #include "AsyncPanZoomController.h"
-#include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "nsPoint.h"
 
 namespace mozilla {
 namespace layers {
 
 static ScrollAnimationBezierPhysicsSettings SettingsForDeltaType(
     ScrollWheelInput::ScrollDeltaType aDeltaType) {
   int32_t minMS = 0;
   int32_t maxMS = 0;
 
   switch (aDeltaType) {
     case ScrollWheelInput::SCROLLDELTA_PAGE:
-      maxMS = clamped(gfxPrefs::PageSmoothScrollMaxDurationMs(), 0, 10000);
-      minMS = clamped(gfxPrefs::PageSmoothScrollMinDurationMs(), 0, maxMS);
+      maxMS = clamped(StaticPrefs::PageSmoothScrollMaxDurationMs(), 0, 10000);
+      minMS = clamped(StaticPrefs::PageSmoothScrollMinDurationMs(), 0, maxMS);
       break;
     case ScrollWheelInput::SCROLLDELTA_PIXEL:
-      maxMS = clamped(gfxPrefs::PixelSmoothScrollMaxDurationMs(), 0, 10000);
-      minMS = clamped(gfxPrefs::PixelSmoothScrollMinDurationMs(), 0, maxMS);
+      maxMS = clamped(StaticPrefs::PixelSmoothScrollMaxDurationMs(), 0, 10000);
+      minMS = clamped(StaticPrefs::PixelSmoothScrollMinDurationMs(), 0, maxMS);
       break;
     case ScrollWheelInput::SCROLLDELTA_LINE:
-      maxMS = clamped(gfxPrefs::WheelSmoothScrollMaxDurationMs(), 0, 10000);
-      minMS = clamped(gfxPrefs::WheelSmoothScrollMinDurationMs(), 0, maxMS);
+      maxMS = clamped(StaticPrefs::WheelSmoothScrollMaxDurationMs(), 0, 10000);
+      minMS = clamped(StaticPrefs::WheelSmoothScrollMinDurationMs(), 0, maxMS);
       break;
   }
 
   // The pref is 100-based int percentage, while mIntervalRatio is 1-based ratio
   double intervalRatio =
-      ((double)gfxPrefs::SmoothScrollDurationToIntervalRatio()) / 100.0;
+      ((double)StaticPrefs::SmoothScrollDurationToIntervalRatio()) / 100.0;
   intervalRatio = std::max(1.0, intervalRatio);
   return ScrollAnimationBezierPhysicsSettings{minMS, maxMS, intervalRatio};
 }
 
 WheelScrollAnimation::WheelScrollAnimation(
     AsyncPanZoomController& aApzc, const nsPoint& aInitialPosition,
     ScrollWheelInput::ScrollDeltaType aDeltaType)
     : GenericScrollAnimation(aApzc, aInitialPosition,
--- a/gfx/layers/apz/test/gtest/APZTestCommon.h
+++ b/gfx/layers/apz/test/gtest/APZTestCommon.h
@@ -18,26 +18,26 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/layers/AsyncCompositionManager.h"  // for ViewTransform
 #include "mozilla/layers/GeckoContentController.h"
 #include "mozilla/layers/CompositorBridgeParent.h"
 #include "mozilla/layers/LayerMetricsWrapper.h"
 #include "mozilla/layers/APZThreadUtils.h"
 #include "mozilla/layers/MatrixMessage.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/TypedEnumBits.h"
 #include "mozilla/UniquePtr.h"
 #include "apz/src/APZCTreeManager.h"
 #include "apz/src/AsyncPanZoomController.h"
 #include "apz/src/HitTestingTreeNode.h"
 #include "base/task.h"
 #include "Layers.h"
 #include "TestLayers.h"
 #include "UnitTransforms.h"
-#include "gfxPrefs.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::layers;
 using ::testing::_;
 using ::testing::AtLeast;
 using ::testing::AtMost;
 using ::testing::InSequence;
@@ -86,17 +86,17 @@ class ScopedGfxSetting {
 
  private:
   void (*mSetPrefFunc)(SetArg);
   Storage mOldVal;
 };
 
 #define SCOPED_GFX_PREF(prefBase, prefType, prefValue)  \
   ScopedGfxSetting<prefType, prefType> pref_##prefBase( \
-      &(gfxPrefs::prefBase), &(gfxPrefs::Set##prefBase), prefValue)
+      &(StaticPrefs::prefBase), &(StaticPrefs::Set##prefBase), prefValue)
 
 #define SCOPED_GFX_VAR(varBase, varType, varValue)         \
   ScopedGfxSetting<const varType&, varType> var_##varBase( \
       &(gfxVars::varBase), &(gfxVars::Set##varBase), varValue)
 
 static TimeStamp GetStartupTime() {
   static TimeStamp sStartupTime = TimeStamp::Now();
   return sStartupTime;
@@ -510,17 +510,17 @@ void APZCTesterBase::Tap(const RefPtr<In
       TouchDown(aTarget, aPoint, mcc->Time(), aOutInputBlockId);
   if (aOutEventStatuses) {
     (*aOutEventStatuses)[0] = status;
   }
   mcc->AdvanceBy(aTapLength);
 
   // If touch-action is enabled then simulate the allowed touch behaviour
   // notification that the main thread is supposed to deliver.
-  if (gfxPrefs::TouchActionEnabled() &&
+  if (StaticPrefs::TouchActionEnabled() &&
       status != nsEventStatus_eConsumeNoDefault) {
     SetDefaultAllowedTouchBehavior(aTarget, *aOutInputBlockId);
   }
 
   status = TouchUp(aTarget, aPoint, mcc->Time());
   if (aOutEventStatuses) {
     (*aOutEventStatuses)[1] = status;
   }
@@ -542,18 +542,18 @@ void APZCTesterBase::Pan(const RefPtr<In
                          const ScreenIntPoint& aTouchEnd, PanOptions aOptions,
                          nsTArray<uint32_t>* aAllowedTouchBehaviors,
                          nsEventStatus (*aOutEventStatuses)[4],
                          uint64_t* aOutInputBlockId) {
   // Reduce the touch start and move tolerance to a tiny value.
   // We can't use a scoped pref because this value might be read at some later
   // time when the events are actually processed, rather than when we deliver
   // them.
-  gfxPrefs::SetAPZTouchStartTolerance(1.0f / 1000.0f);
-  gfxPrefs::SetAPZTouchMoveTolerance(0.0f);
+  StaticPrefs::SetAPZTouchStartTolerance(1.0f / 1000.0f);
+  StaticPrefs::SetAPZTouchMoveTolerance(0.0f);
   int overcomeTouchToleranceX = 0;
   int overcomeTouchToleranceY = 0;
   if (!(aOptions & PanOptions::ExactCoordinates)) {
     // Have the direction of the adjustment to overcome the touch tolerance
     // match the direction of the entire gesture, otherwise we run into
     // trouble such as accidentally activating the axis lock.
     if (aTouchStart.x != aTouchEnd.x) {
       overcomeTouchToleranceX = 1;
@@ -586,17 +586,17 @@ void APZCTesterBase::Pan(const RefPtr<In
   mcc->AdvanceBy(TIME_BETWEEN_TOUCH_EVENT);
 
   // Allowed touch behaviours must be set after sending touch-start.
   if (status != nsEventStatus_eConsumeNoDefault) {
     if (aAllowedTouchBehaviors) {
       EXPECT_EQ(1UL, aAllowedTouchBehaviors->Length());
       aTarget->SetAllowedTouchBehavior(*aOutInputBlockId,
                                        *aAllowedTouchBehaviors);
-    } else if (gfxPrefs::TouchActionEnabled()) {
+    } else if (StaticPrefs::TouchActionEnabled()) {
       SetDefaultAllowedTouchBehavior(aTarget, *aOutInputBlockId);
     }
   }
 
   status = TouchMove(aTarget, aTouchStart, mcc->Time());
   if (aOutEventStatuses) {
     (*aOutEventStatuses)[1] = status;
   }
@@ -671,17 +671,17 @@ void APZCTesterBase::DoubleTap(const Ref
   }
   if (aOutInputBlockIds) {
     (*aOutInputBlockIds)[0] = blockId;
   }
   mcc->AdvanceByMillis(10);
 
   // If touch-action is enabled then simulate the allowed touch behaviour
   // notification that the main thread is supposed to deliver.
-  if (gfxPrefs::TouchActionEnabled() &&
+  if (StaticPrefs::TouchActionEnabled() &&
       status != nsEventStatus_eConsumeNoDefault) {
     SetDefaultAllowedTouchBehavior(aTarget, blockId);
   }
 
   status = TouchUp(aTarget, aPoint, mcc->Time());
   if (aOutEventStatuses) {
     (*aOutEventStatuses)[1] = status;
   }
@@ -690,17 +690,17 @@ void APZCTesterBase::DoubleTap(const Ref
   if (aOutEventStatuses) {
     (*aOutEventStatuses)[2] = status;
   }
   if (aOutInputBlockIds) {
     (*aOutInputBlockIds)[1] = blockId;
   }
   mcc->AdvanceByMillis(10);
 
-  if (gfxPrefs::TouchActionEnabled() &&
+  if (StaticPrefs::TouchActionEnabled() &&
       status != nsEventStatus_eConsumeNoDefault) {
     SetDefaultAllowedTouchBehavior(aTarget, blockId);
   }
 
   status = TouchUp(aTarget, aPoint, mcc->Time());
   if (aOutEventStatuses) {
     (*aOutEventStatuses)[3] = status;
   }
@@ -763,17 +763,17 @@ void APZCTesterBase::PinchWithTouchInput
   }
 
   mcc->AdvanceBy(TIME_BETWEEN_TOUCH_EVENT);
 
   if (aAllowedTouchBehaviors) {
     EXPECT_EQ(2UL, aAllowedTouchBehaviors->Length());
     aTarget->SetAllowedTouchBehavior(*aOutInputBlockId,
                                      *aAllowedTouchBehaviors);
-  } else if (gfxPrefs::TouchActionEnabled()) {
+  } else if (StaticPrefs::TouchActionEnabled()) {
     SetDefaultAllowedTouchBehavior(aTarget, *aOutInputBlockId, 2);
   }
 
   MultiTouchInput mtiMove1 =
       MultiTouchInput(MultiTouchInput::MULTITOUCH_MOVE, 0, mcc->Time(), 0);
   mtiMove1.mTouches.AppendElement(
       CreateSingleTouchData(inputId, aFocus.x - pinchLength, aFocus.y));
   mtiMove1.mTouches.AppendElement(
--- a/gfx/layers/apz/test/gtest/TestBasic.cpp
+++ b/gfx/layers/apz/test/gtest/TestBasic.cpp
@@ -343,17 +343,17 @@ TEST_F(APZCBasicTester, OverScroll_Bug11
 
   // Do a touch-down to cancel the overscroll animation, and then a touch-up
   // to schedule a new one since we're still overscrolled. We don't pan because
   // panning can trigger functions that clear the overscroll animation state
   // in other ways.
   uint64_t blockId;
   nsEventStatus status =
       TouchDown(apzc, ScreenIntPoint(10, 10), mcc->Time(), &blockId);
-  if (gfxPrefs::TouchActionEnabled() &&
+  if (StaticPrefs::TouchActionEnabled() &&
       status != nsEventStatus_eConsumeNoDefault) {
     SetDefaultAllowedTouchBehavior(apzc, blockId);
   }
   TouchUp(apzc, ScreenIntPoint(10, 10), mcc->Time());
 
   // Sample the second overscroll animation to its end.
   // If the ending of the first overscroll animation fails to clear state
   // properly, this will assert.
--- a/gfx/layers/apz/test/gtest/TestGestureDetector.cpp
+++ b/gfx/layers/apz/test/gtest/TestGestureDetector.cpp
@@ -1,17 +1,16 @@
 /* -*- 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 "APZCBasicTester.h"
 #include "APZTestCommon.h"
-#include "gfxPrefs.h"
 
 class APZCGestureDetectorTester : public APZCBasicTester {
  public:
   APZCGestureDetectorTester()
       : APZCBasicTester(AsyncPanZoomController::USE_GESTURE_DETECTOR) {}
 
  protected:
   FrameMetrics GetPinchableFrameMetrics() {
@@ -388,17 +387,17 @@ class APZCLongPressTester : public APZCG
     MakeApzcUnzoomable();
 
     uint64_t blockId = 0;
 
     nsEventStatus status =
         TouchDown(apzc, ScreenIntPoint(10, 10), mcc->Time(), &blockId);
     EXPECT_EQ(nsEventStatus_eConsumeDoDefault, status);
 
-    if (gfxPrefs::TouchActionEnabled() &&
+    if (StaticPrefs::TouchActionEnabled() &&
         status != nsEventStatus_eConsumeNoDefault) {
       // SetAllowedTouchBehavior() must be called after sending touch-start.
       nsTArray<uint32_t> allowedTouchBehaviors;
       allowedTouchBehaviors.AppendElement(aBehavior);
       apzc->SetAllowedTouchBehavior(blockId, allowedTouchBehaviors);
     }
     // Have content "respond" to the touchstart
     apzc->ContentReceivedInputBlock(blockId, false);
@@ -454,17 +453,17 @@ class APZCLongPressTester : public APZCG
 
     int touchX = 10, touchStartY = 10, touchEndY = 50;
 
     uint64_t blockId = 0;
     nsEventStatus status = TouchDown(apzc, ScreenIntPoint(touchX, touchStartY),
                                      mcc->Time(), &blockId);
     EXPECT_EQ(nsEventStatus_eConsumeDoDefault, status);
 
-    if (gfxPrefs::TouchActionEnabled() &&
+    if (StaticPrefs::TouchActionEnabled() &&
         status != nsEventStatus_eConsumeNoDefault) {
       // SetAllowedTouchBehavior() must be called after sending touch-start.
       nsTArray<uint32_t> allowedTouchBehaviors;
       allowedTouchBehaviors.AppendElement(aBehavior);
       apzc->SetAllowedTouchBehavior(blockId, allowedTouchBehaviors);
     }
     // Have content "respond" to the touchstart
     apzc->ContentReceivedInputBlock(blockId, false);
@@ -702,17 +701,17 @@ TEST_F(APZCGestureDetectorTester, LongPr
   // But more importantly, this shouldn't crash, which is what it did at one
   // point in time.
   EXPECT_CALL(*mcc, HandleTap(TapType::eLongTap, _, _, _, _)).Times(1);
 
   uint64_t touchBlockId = 0;
   uint64_t wheelBlockId = 0;
   nsEventStatus status =
       TouchDown(apzc, ScreenIntPoint(10, 10), mcc->Time(), &touchBlockId);
-  if (gfxPrefs::TouchActionEnabled() &&
+  if (StaticPrefs::TouchActionEnabled() &&
       status != nsEventStatus_eConsumeNoDefault) {
     SetDefaultAllowedTouchBehavior(apzc, touchBlockId);
   }
   mcc->AdvanceByMillis(10);
   Wheel(apzc, ScreenIntPoint(10, 10), ScreenPoint(0, -10), mcc->Time(),
         &wheelBlockId);
   EXPECT_NE(touchBlockId, wheelBlockId);
   mcc->AdvanceByMillis(1000);
--- a/gfx/layers/apz/test/gtest/TestHitTesting.cpp
+++ b/gfx/layers/apz/test/gtest/TestHitTesting.cpp
@@ -632,17 +632,17 @@ TEST_F(APZHitTestingTester, Bug1148350) 
   }
 
   Tap(manager, ScreenIntPoint(100, 100), TimeDuration::FromMilliseconds(100));
   mcc->RunThroughDelayedTasks();
   check.Call("Tapped without transform");
 
   uint64_t blockId;
   TouchDown(manager, ScreenIntPoint(100, 100), mcc->Time(), &blockId);
-  if (gfxPrefs::TouchActionEnabled()) {
+  if (StaticPrefs::TouchActionEnabled()) {
     SetDefaultAllowedTouchBehavior(manager, blockId);
   }
   mcc->AdvanceByMillis(100);
 
   layers[0]->SetVisibleRegion(LayerIntRegion(LayerIntRect(0, 50, 200, 150)));
   layers[0]->SetBaseTransform(Matrix4x4::Translation(0, 50, 0));
   manager->UpdateHitTestingTree(LayersId{0}, root, false, LayersId{0}, 0);
 
--- a/gfx/layers/apz/test/gtest/TestPinching.cpp
+++ b/gfx/layers/apz/test/gtest/TestPinching.cpp
@@ -156,47 +156,47 @@ class APZCPinchLockingTester : public AP
         CreatePinchGestureInput(PinchGestureInput::PINCHGESTURE_START, mFocus,
                                 mSpan, mSpan, mcc->Time()),
         nullptr);
     mcc->AdvanceBy(TimeDuration::FromMilliseconds(51));
   }
 
   void twoFingerPan() {
     ScreenCoord panDistance =
-        gfxPrefs::APZPinchLockScrollLockThreshold() * 1.2 * tm->GetDPI();
+        StaticPrefs::APZPinchLockScrollLockThreshold() * 1.2 * tm->GetDPI();
 
     mFocus = ScreenIntPoint((int)(mFocus.x + panDistance), (int)(mFocus.y));
 
     apzc->ReceiveInputEvent(
         CreatePinchGestureInput(PinchGestureInput::PINCHGESTURE_SCALE, mFocus,
                                 mSpan, mSpan, mcc->Time()),
         nullptr);
     mcc->AdvanceBy(TimeDuration::FromMilliseconds(51));
   }
 
   void twoFingerZoom() {
     float pinchDistance =
-        gfxPrefs::APZPinchLockSpanBreakoutThreshold() * 1.2 * tm->GetDPI();
+        StaticPrefs::APZPinchLockSpanBreakoutThreshold() * 1.2 * tm->GetDPI();
 
     float newSpan = mSpan + pinchDistance;
 
     apzc->ReceiveInputEvent(
         CreatePinchGestureInput(PinchGestureInput::PINCHGESTURE_SCALE, mFocus,
                                 newSpan, mSpan, mcc->Time()),
         nullptr);
     mcc->AdvanceBy(TimeDuration::FromMilliseconds(51));
     mSpan = newSpan;
   }
 
   bool isPinchLockActive() {
     FrameMetrics originalMetrics = apzc->GetFrameMetrics();
 
     // Send a small scale input to the APZC
     float pinchDistance =
-        gfxPrefs::APZPinchLockSpanBreakoutThreshold() * 0.8 * tm->GetDPI();
+        StaticPrefs::APZPinchLockSpanBreakoutThreshold() * 0.8 * tm->GetDPI();
     apzc->ReceiveInputEvent(
         CreatePinchGestureInput(PinchGestureInput::PINCHGESTURE_SCALE, mFocus,
                                 mSpan + pinchDistance, mSpan, mcc->Time()),
         nullptr);
 
     FrameMetrics result = apzc->GetFrameMetrics();
     bool lockActive =
         originalMetrics.GetZoom() == result.GetZoom() &&
--- a/gfx/layers/apz/test/gtest/TestSnapping.cpp
+++ b/gfx/layers/apz/test/gtest/TestSnapping.cpp
@@ -60,17 +60,17 @@ TEST_F(APZCSnappingTester, Bug1265510) {
              .y < 70) {
     mcc->AdvanceByMillis(5);
     outer->AdvanceAnimations(mcc->Time());
   }
   // Now do another wheel in a new transaction. This should start scrolling the
   // inner frame; we verify that it does by checking the inner scroll position.
   TimeStamp newTransactionTime =
       now + TimeDuration::FromMilliseconds(
-                gfxPrefs::MouseWheelTransactionTimeoutMs() + 100);
+                StaticPrefs::MouseWheelTransactionTimeoutMs() + 100);
   SmoothWheel(manager, ScreenIntPoint(50, 80), ScreenPoint(0, 6),
               newTransactionTime);
   inner->AdvanceAnimationsUntilEnd();
   EXPECT_LT(
       0.0f,
       inner
           ->GetCurrentAsyncScrollOffset(
               AsyncPanZoomController::AsyncTransformConsumer::eForHitTesting)
--- a/gfx/layers/apz/testutil/APZTestData.h
+++ b/gfx/layers/apz/testutil/APZTestData.h
@@ -4,22 +4,22 @@
  * 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/. */
 
 #ifndef mozilla_layers_APZTestData_h
 #define mozilla_layers_APZTestData_h
 
 #include <map>
 
-#include "gfxPrefs.h"
 #include "nsDebug.h"  // for NS_WARNING
 #include "nsTArray.h"
 #include "mozilla/Assertions.h"       // for MOZ_ASSERT
 #include "mozilla/DebugOnly.h"        // for DebugOnly
 #include "mozilla/GfxMessageUtils.h"  // for ParamTraits specializations
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/ToString.h"         // for ToString
 #include "mozilla/gfx/CompositorHitTestInfo.h"
 #include "mozilla/layers/ScrollableLayerGuid.h"
 #include "ipc/IPCMessageUtils.h"
 #include "js/TypeDecls.h"
 
 namespace mozilla {
 namespace layers {
@@ -125,17 +125,17 @@ class APZTestData {
   }
 };
 
 // A helper class for logging data for a paint.
 class APZPaintLogHelper {
  public:
   APZPaintLogHelper(APZTestData* aTestData, SequenceNumber aPaintSequenceNumber)
       : mTestData(aTestData), mPaintSequenceNumber(aPaintSequenceNumber) {
-    MOZ_ASSERT(!aTestData || gfxPrefs::APZTestLoggingEnabled(),
+    MOZ_ASSERT(!aTestData || StaticPrefs::APZTestLoggingEnabled(),
                "don't call me");
   }
 
   template <typename Value>
   void LogTestData(ScrollableLayerGuid::ViewID aScrollId,
                    const std::string& aKey, const Value& aValue) const {
     if (mTestData) {  // avoid stringifying if mTestData == nullptr
       LogTestData(aScrollId, aKey, ToString(aValue));
--- a/gfx/layers/apz/util/APZEventState.cpp
+++ b/gfx/layers/apz/util/APZEventState.cpp
@@ -391,17 +391,17 @@ void APZEventState::ProcessTouchEvent(co
 
   mTouchCounter.Update(aEvent);
   if (mTouchCounter.GetActiveTouchCount() == 0) {
     mFirstTouchCancelled = false;
   }
 
   if (sentContentResponse && !isTouchPrevented &&
       aApzResponse == nsEventStatus_eConsumeDoDefault &&
-      gfxPrefs::PointerEventsEnabled()) {
+      StaticPrefs::PointerEventsEnabled()) {
     WidgetTouchEvent cancelEvent(aEvent);
     cancelEvent.mMessage = eTouchPointerCancel;
     cancelEvent.mFlags.mCancelable = false;  // mMessage != eTouchCancel;
     for (uint32_t i = 0; i < cancelEvent.mTouches.Length(); ++i) {
       if (mozilla::dom::Touch* touch = cancelEvent.mTouches[i]) {
         touch->convertToPointer = true;
       }
     }
--- a/gfx/layers/apz/util/CheckerboardReportService.cpp
+++ b/gfx/layers/apz/util/CheckerboardReportService.cpp
@@ -187,21 +187,21 @@ void CheckerboardReportService::GetRepor
     nsTArray<dom::CheckerboardReport>& aOutReports) {
   RefPtr<mozilla::layers::CheckerboardEventStorage> instance =
       mozilla::layers::CheckerboardEventStorage::GetInstance();
   MOZ_ASSERT(instance);
   instance->GetReports(aOutReports);
 }
 
 bool CheckerboardReportService::IsRecordingEnabled() const {
-  return gfxPrefs::APZRecordCheckerboarding();
+  return StaticPrefs::APZRecordCheckerboarding();
 }
 
 void CheckerboardReportService::SetRecordingEnabled(bool aEnabled) {
-  gfxPrefs::SetAPZRecordCheckerboarding(aEnabled);
+  StaticPrefs::SetAPZRecordCheckerboarding(aEnabled);
 }
 
 void CheckerboardReportService::FlushActiveReports() {
   MOZ_ASSERT(XRE_IsParentProcess());
   gfx::GPUProcessManager* gpu = gfx::GPUProcessManager::Get();
   if (gpu && gpu->NotifyGpuObservers("APZ:FlushActiveCheckerboard")) {
     return;
   }
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -363,17 +363,17 @@ BasicCompositor::CreateDataTextureSource
 }
 
 bool BasicCompositor::SupportsEffect(EffectTypes aEffect) {
   return aEffect != EffectTypes::YCBCR &&
          aEffect != EffectTypes::COMPONENT_ALPHA;
 }
 
 bool BasicCompositor::SupportsLayerGeometry() const {
-  return gfxPrefs::BasicLayerGeometry();
+  return StaticPrefs::BasicLayerGeometry();
 }
 
 static RefPtr<gfx::Path> BuildPathFromPolygon(const RefPtr<DrawTarget>& aDT,
                                               const gfx::Polygon& aPolygon) {
   MOZ_ASSERT(!aPolygon.IsEmpty());
 
   RefPtr<PathBuilder> pathBuilder = aDT->CreatePathBuilder();
   const nsTArray<Point4D>& points = aPolygon.GetPoints();
@@ -1019,17 +1019,17 @@ void BasicCompositor::BeginFrame(
 }
 
 void BasicCompositor::EndFrame() {
   Compositor::EndFrame();
 
   // Pop aClipRectIn/bounds rect
   mRenderTarget->mDrawTarget->PopClip();
 
-  if (gfxPrefs::WidgetUpdateFlashing()) {
+  if (StaticPrefs::WidgetUpdateFlashing()) {
     float r = float(rand()) / RAND_MAX;
     float g = float(rand()) / RAND_MAX;
     float b = float(rand()) / RAND_MAX;
     // We're still clipped to mInvalidRegion, so just fill the bounds.
     mRenderTarget->mDrawTarget->FillRect(
         IntRectToRect(mInvalidRegion.GetBounds()).ToUnknownRect(),
         ColorPattern(Color(r, g, b, 0.2f)));
   }
--- a/gfx/layers/basic/BasicLayerManager.cpp
+++ b/gfx/layers/basic/BasicLayerManager.cpp
@@ -656,17 +656,17 @@ bool BasicLayerManager::EndTransactionIn
 
   // XXX - We should probably assert here that for an incomplete transaction
   // out target is the default target.
 
   return !mTransactionIncomplete;
 }
 
 void BasicLayerManager::FlashWidgetUpdateArea(gfxContext* aContext) {
-  if (gfxPrefs::WidgetUpdateFlashing()) {
+  if (StaticPrefs::WidgetUpdateFlashing()) {
     float r = float(rand()) / RAND_MAX;
     float g = float(rand()) / RAND_MAX;
     float b = float(rand()) / RAND_MAX;
     aContext->SetColor(Color(r, g, b, 0.2f));
     aContext->Paint();
   }
 }
 
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -239,17 +239,17 @@ bool ClientLayerManager::BeginTransactio
   }
 
   // If this is a new paint, increment the paint sequence number.
   if (!mIsRepeatTransaction) {
     // Increment the paint sequence number even if test logging isn't
     // enabled in this process; it may be enabled in the parent process,
     // and the parent process expects unique sequence numbers.
     ++mPaintSequenceNumber;
-    if (gfxPrefs::APZTestLoggingEnabled()) {
+    if (StaticPrefs::APZTestLoggingEnabled()) {
       mApzTestData.StartNewPaint(mPaintSequenceNumber);
     }
   }
   return true;
 }
 
 bool ClientLayerManager::BeginTransaction(const nsCString& aURL) {
   return BeginTransactionWithTarget(nullptr, aURL);
@@ -275,17 +275,17 @@ bool ClientLayerManager::EndTransactionI
         PaintTelemetry::Metric::FlushRasterization);
     FlushAsyncPaints();
   }
 
   PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::Rasterization);
   AUTO_PROFILER_TRACING("Paint", "Rasterize", GRAPHICS);
 
   Maybe<TimeStamp> startTime;
-  if (gfxPrefs::LayersDrawFPS()) {
+  if (StaticPrefs::LayersDrawFPS()) {
     startTime = Some(TimeStamp::Now());
   }
 
   AUTO_PROFILER_LABEL("ClientLayerManager::EndTransactionInternal", GRAPHICS);
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   MOZ_LAYERS_LOG(("  ----- (beginning paint)"));
   Log();
@@ -305,17 +305,17 @@ bool ClientLayerManager::EndTransactionI
 
   mPaintedLayerCallback = aCallback;
   mPaintedLayerCallbackData = aCallbackData;
 
   GetRoot()->ComputeEffectiveTransforms(Matrix4x4());
 
   // Skip the painting if the device is in device-reset status.
   if (!gfxPlatform::GetPlatform()->DidRenderingDeviceReset()) {
-    if (gfxPrefs::AlwaysPaint() && XRE_IsContentProcess()) {
+    if (StaticPrefs::AlwaysPaint() && XRE_IsContentProcess()) {
       TimeStamp start = TimeStamp::Now();
       root->RenderLayer();
       mLastPaintTime = TimeStamp::Now() - start;
     } else {
       root->RenderLayer();
     }
   } else {
     gfxCriticalNote << "LayerManager::EndTransaction skip RenderLayer().";
@@ -540,17 +540,17 @@ float ClientLayerManager::RequestPropert
     }
     return value;
   }
   return -1;
 }
 
 void ClientLayerManager::StartNewRepaintRequest(
     SequenceNumber aSequenceNumber) {
-  if (gfxPrefs::APZTestLoggingEnabled()) {
+  if (StaticPrefs::APZTestLoggingEnabled()) {
     mApzTestData.StartNewRepaintRequest(aSequenceNumber);
   }
 }
 
 void ClientLayerManager::GetFrameUniformity(FrameUniformityData* aOutData) {
   MOZ_ASSERT(XRE_IsParentProcess(),
              "Frame Uniformity only supported in parent process");
 
@@ -610,17 +610,17 @@ void ClientLayerManager::MakeSnapshotIfR
   }
   mShadowTarget = nullptr;
 }
 
 void ClientLayerManager::FlushRendering() {
   if (mWidget) {
     if (CompositorBridgeChild* remoteRenderer = mWidget->GetRemoteRenderer()) {
       if (mWidget->SynchronouslyRepaintOnResize() ||
-          gfxPrefs::LayersForceSynchronousResize()) {
+          StaticPrefs::LayersForceSynchronousResize()) {
         remoteRenderer->SendFlushRendering();
       } else {
         remoteRenderer->SendFlushRenderingAsync();
       }
     }
   }
 }
 
@@ -691,17 +691,17 @@ void ClientLayerManager::ForwardTransact
 
   mLatestTransactionId =
       mTransactionIdAllocator->GetTransactionId(!mIsRepeatTransaction);
   TimeStamp refreshStart = mTransactionIdAllocator->GetTransactionStart();
   if (!refreshStart) {
     refreshStart = mTransactionStart;
   }
 
-  if (gfxPrefs::AlwaysPaint() && XRE_IsContentProcess()) {
+  if (StaticPrefs::AlwaysPaint() && XRE_IsContentProcess()) {
     mForwarder->SendPaintTime(mLatestTransactionId, mLastPaintTime);
   }
 
   // forward this transaction's changeset to our LayerManagerComposite
   bool sent = false;
   bool ok = mForwarder->EndTransaction(
       mRegionToClear, mLatestTransactionId, aScheduleComposite,
       mPaintSequenceNumber, mIsRepeatTransaction,
@@ -858,17 +858,17 @@ void ClientLayerManager::RemoveDidCompos
 already_AddRefed<PersistentBufferProvider>
 ClientLayerManager::CreatePersistentBufferProvider(const gfx::IntSize& aSize,
                                                    gfx::SurfaceFormat aFormat) {
   // Don't use a shared buffer provider if compositing is considered "not cheap"
   // because the canvas will most likely be flattened into a thebes layer
   // instead of being sent to the compositor, in which case rendering into
   // shared memory is wasteful.
   if (IsCompositingCheap() &&
-      gfxPrefs::PersistentBufferProviderSharedEnabled()) {
+      StaticPrefs::PersistentBufferProviderSharedEnabled()) {
     RefPtr<PersistentBufferProvider> provider =
         PersistentBufferProviderShared::Create(aSize, aFormat,
                                                AsShadowForwarder());
     if (provider) {
       return provider.forget();
     }
   }
 
--- a/gfx/layers/client/ClientLayerManager.h
+++ b/gfx/layers/client/ClientLayerManager.h
@@ -197,17 +197,17 @@ class ClientLayerManager final : public 
   bool AreComponentAlphaLayersEnabled() override;
 
   // Log APZ test data for the current paint. We supply the paint sequence
   // number ourselves, and take care of calling APZTestData::StartNewPaint()
   // when a new paint is started.
   void LogTestDataForCurrentPaint(ScrollableLayerGuid::ViewID aScrollId,
                                   const std::string& aKey,
                                   const std::string& aValue) {
-    MOZ_ASSERT(gfxPrefs::APZTestLoggingEnabled(), "don't call me");
+    MOZ_ASSERT(StaticPrefs::APZTestLoggingEnabled(), "don't call me");
     mApzTestData.LogTestDataForPaint(mPaintSequenceNumber, aScrollId, aKey,
                                      aValue);
   }
 
   // Log APZ test data for a repaint request. The sequence number must be
   // passed in from outside, and APZTestData::StartNewRepaintRequest() needs
   // to be called from the outside as well when a new repaint request is
   // started.
@@ -215,23 +215,23 @@ class ClientLayerManager final : public 
 
   // TODO(botond): When we start using this and write a wrapper similar to
   // nsLayoutUtils::LogTestDataForPaint(), make sure that wrapper checks
   // gfxPrefs::APZTestLoggingEnabled().
   void LogTestDataForRepaintRequest(SequenceNumber aSequenceNumber,
                                     ScrollableLayerGuid::ViewID aScrollId,
                                     const std::string& aKey,
                                     const std::string& aValue) {
-    MOZ_ASSERT(gfxPrefs::APZTestLoggingEnabled(), "don't call me");
+    MOZ_ASSERT(StaticPrefs::APZTestLoggingEnabled(), "don't call me");
     mApzTestData.LogTestDataForRepaintRequest(aSequenceNumber, aScrollId, aKey,
                                               aValue);
   }
   void LogAdditionalTestData(const std::string& aKey,
                              const std::string& aValue) {
-    MOZ_ASSERT(gfxPrefs::APZTestLoggingEnabled(), "don't call me");
+    MOZ_ASSERT(StaticPrefs::APZTestLoggingEnabled(), "don't call me");
     mApzTestData.RecordAdditionalData(aKey, aValue);
   }
 
   // Get the content-side APZ test data for reading. For writing, use the
   // LogTestData...() functions.
   const APZTestData& GetAPZTestData() const { return mApzTestData; }
 
   // Get a copy of the compositor-side APZ test data for our layers ID.
--- a/gfx/layers/client/ClientTiledPaintedLayer.cpp
+++ b/gfx/layers/client/ClientTiledPaintedLayer.cpp
@@ -80,17 +80,17 @@ static LayerToParentLayerMatrix4x4 GetTr
 
   gfx::Matrix4x4 transform;
   const LayerMetricsWrapper& ancestorParent = root3dAncestor.GetParent();
   for (LayerMetricsWrapper iter(aStart, LayerMetricsWrapper::StartAt::BOTTOM);
        ancestorParent ? iter != ancestorParent : iter.IsValid();
        iter = iter.GetParent()) {
     transform = transform * iter.GetTransform();
 
-    if (gfxPrefs::LayoutUseContainersForRootFrames()) {
+    if (StaticPrefs::LayoutUseContainersForRootFrames()) {
       // When scrolling containers, layout adds a post-scale into the transform
       // of the displayport-ancestor (which we pick up in GetTransform() above)
       // to cancel out the pres shell resolution (for historical reasons). The
       // compositor in turn cancels out this post-scale (i.e., scales by the
       // pres shell resolution), and to get correct calculations, we need to do
       // so here, too.
       //
       // With containerless scrolling, the offending post-scale is on the
@@ -262,17 +262,17 @@ bool ClientTiledPaintedLayer::IsScrollin
                               aParentMetrics.GetScrollOffset().x,
                               COORDINATE_EPSILON) ||
          !FuzzyEqualsAdditive(compositorMetrics.GetScrollOffset().y,
                               aParentMetrics.GetScrollOffset().y,
                               COORDINATE_EPSILON);
 }
 
 bool ClientTiledPaintedLayer::UseProgressiveDraw() {
-  if (!gfxPrefs::ProgressivePaint()) {
+  if (!StaticPrefs::ProgressivePaint()) {
     // pref is disabled, so never do progressive
     return false;
   }
 
   if (!mContentClient->GetTiledBuffer()->SupportsProgressiveUpdate()) {
     return false;
   }
 
@@ -474,17 +474,17 @@ void ClientTiledPaintedLayer::RenderLaye
   // Use single tile when layer is not scrollable, is smaller than one
   // tile, or when more than half of the tiles' pixels in either
   // dimension would be wasted.
   bool wantSingleTiledContentClient =
       (mCreationHint == LayerManager::NONE || layerSize <= tileSize ||
        isHalfTileWidthOrHeight) &&
       SingleTiledContentClient::ClientSupportsLayerSize(layerSize,
                                                         ClientManager()) &&
-      gfxPrefs::LayersSingleTileEnabled();
+      StaticPrefs::LayersSingleTileEnabled();
 
   if (mContentClient && mHaveSingleTiledContentClient &&
       !wantSingleTiledContentClient) {
     mContentClient = nullptr;
     ClearValidRegion();
   }
 
   if (!mContentClient) {
--- a/gfx/layers/client/MultiTiledContentClient.cpp
+++ b/gfx/layers/client/MultiTiledContentClient.cpp
@@ -17,18 +17,18 @@ namespace layers {
 
 MultiTiledContentClient::MultiTiledContentClient(
     ClientTiledPaintedLayer& aPaintedLayer, ClientLayerManager* aManager)
     : TiledContentClient(aManager, "Multi"),
       mTiledBuffer(aPaintedLayer, *this, aManager, &mSharedFrameMetricsHelper),
       mLowPrecisionTiledBuffer(aPaintedLayer, *this, aManager,
                                &mSharedFrameMetricsHelper) {
   MOZ_COUNT_CTOR(MultiTiledContentClient);
-  mLowPrecisionTiledBuffer.SetResolution(gfxPrefs::LowPrecisionResolution());
-  mHasLowPrecision = gfxPrefs::UseLowPrecisionBuffer();
+  mLowPrecisionTiledBuffer.SetResolution(StaticPrefs::LowPrecisionResolution());
+  mHasLowPrecision = StaticPrefs::UseLowPrecisionBuffer();
 }
 
 void MultiTiledContentClient::ClearCachedResources() {
   CompositableClient::ClearCachedResources();
   mTiledBuffer.DiscardBuffers();
   mLowPrecisionTiledBuffer.DiscardBuffers();
 }
 
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -1342,17 +1342,17 @@ already_AddRefed<gfx::DataSourceSurface>
 void TextureClient::PrintInfo(std::stringstream& aStream, const char* aPrefix) {
   aStream << aPrefix;
   aStream << nsPrintfCString("TextureClient (0x%p)", this).get();
   AppendToString(aStream, GetSize(), " [size=", "]");
   AppendToString(aStream, GetFormat(), " [format=", "]");
   AppendToString(aStream, mFlags, " [flags=", "]");
 
 #ifdef MOZ_DUMP_PAINTING
-  if (gfxPrefs::LayersDumpTexture()) {
+  if (StaticPrefs::LayersDumpTexture()) {
     nsAutoCString pfx(aPrefix);
     pfx += "  ";
 
     aStream << "\n" << pfx.get() << "Surface: ";
     RefPtr<gfx::DataSourceSurface> dSurf = GetAsSurface();
     if (dSurf) {
       aStream << gfxUtils::GetAsLZ4Base64Str(dSurf).get();
     }
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -225,17 +225,17 @@ bool SharedFrameMetricsHelper::AboutToCh
   painted.Inflate(CSSMargin::FromAppUnits(nsMargin(1, 1, 1, 1)));
 
   // Inflate the rect by the danger zone. See the description of the danger zone
   // prefs in AsyncPanZoomController.cpp for an explanation of this.
   CSSRect showing =
       CSSRect(aCompositorMetrics.GetScrollOffset(),
               aCompositorMetrics.CalculateBoundedCompositedSizeInCssPixels());
   showing.Inflate(
-      LayerSize(gfxPrefs::APZDangerZoneX(), gfxPrefs::APZDangerZoneY()) /
+      LayerSize(StaticPrefs::APZDangerZoneX(), StaticPrefs::APZDangerZoneY()) /
       aCompositorMetrics.LayersPixelsPerCSSPixel());
 
   // Clamp both rects to the scrollable rect, because having either of those
   // exceed the scrollable rect doesn't make sense, and could lead to false
   // positives.
   painted = painted.Intersect(aContentMetrics.GetScrollableRect());
   showing = showing.Intersect(aContentMetrics.GetScrollableRect());
 
@@ -595,17 +595,17 @@ Maybe<AcquiredBackBuffer> TileClient::Ac
       (aMode != SurfaceMode::SURFACE_COMPONENT_ALPHA ||
        (mFrontBufferOnWhite && !mFrontBufferOnWhite->IsReadLocked()))) {
     // If we had a backbuffer we no longer need it since we can re-use the
     // front buffer here. It can be worth it to hold on to the back buffer
     // so we don't need to pay the cost of initializing a new back buffer
     // later (copying pixels and texture upload). But this could increase
     // our memory usage and lead to OOM more frequently from spikes in usage,
     // so we have this behavior behind a pref.
-    if (!gfxPrefs::LayersTileRetainBackBuffer()) {
+    if (!StaticPrefs::LayersTileRetainBackBuffer()) {
       DiscardBackBuffer();
     }
     Flip();
   } else {
     if (!mBackBuffer || mBackBuffer->IsReadLocked()) {
       mBackBuffer.Set(this, CreateBackBufferTexture(mBackBuffer, aCompositable,
                                                     mAllocator));
       if (!mBackBuffer) {
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -4,18 +4,18 @@
  * 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/layers/AsyncCompositionManager.h"
 #include <stdint.h>                 // for uint32_t
 #include "LayerManagerComposite.h"  // for LayerManagerComposite, etc
 #include "Layers.h"                 // for Layer, ContainerLayer, etc
 #include "gfxPoint.h"               // for gfxPoint, gfxSize
-#include "gfxPrefs.h"               // for gfxPrefs
 #include "mozilla/ServoBindings.h"  // for Servo_AnimationValue_GetOpacity, etc
+#include "mozilla/StaticPrefs.h"    // for StaticPrefs
 #include "mozilla/WidgetUtils.h"    // for ComputeTransformForRotation
 #include "mozilla/gfx/BaseRect.h"   // for BaseRect
 #include "mozilla/gfx/Point.h"      // for RoundedToInt, PointTyped
 #include "mozilla/gfx/Rect.h"       // for RoundedToInt, RectTyped
 #include "mozilla/gfx/ScaleFactor.h"  // for ScaleFactor
 #include "mozilla/layers/AnimationHelper.h"
 #include "mozilla/layers/APZSampler.h"  // for APZSampler
 #include "mozilla/layers/APZUtils.h"    // for CompleteAsyncTransform
@@ -30,17 +30,16 @@
 #include "nsDisplayList.h"           // for nsDisplayTransform, etc
 #include "nsMathUtils.h"             // for NS_round
 #include "nsPoint.h"                 // for nsPoint
 #include "nsRect.h"                  // for mozilla::gfx::IntRect
 #include "nsRegion.h"                // for nsIntRegion
 #include "nsTArray.h"                // for nsTArray, nsTArray_Impl, etc
 #include "nsTArrayForwardDeclare.h"  // for InfallibleTArray
 #include "UnitTransforms.h"          // for TransformTo
-#include "gfxPrefs.h"
 #if defined(MOZ_WIDGET_ANDROID)
 #  include <android/log.h>
 #  include "mozilla/layers/UiCompositorControllerParent.h"
 #  include "mozilla/widget/AndroidCompositorWidget.h"
 #endif
 #include "GeckoProfiler.h"
 #include "FrameUniformityData.h"
 #include "TreeTraversal.h"  // for ForEachNode, BreadthFirstSearch
@@ -785,17 +784,17 @@ static bool SampleAnimations(Layer* aLay
         break;
     }
   });
 
   return isAnimating;
 }
 
 void AsyncCompositionManager::RecordShadowTransforms(Layer* aLayer) {
-  MOZ_ASSERT(gfxPrefs::CollectScrollTransforms());
+  MOZ_ASSERT(StaticPrefs::CollectScrollTransforms());
   MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
 
   ForEachNodePostOrder<ForwardIterator>(aLayer, [this](Layer* layer) {
     for (uint32_t i = 0; i < layer->GetScrollMetadataCount(); i++) {
       if (!layer->GetFrameMetrics(i).IsScrollable()) {
         continue;
       }
       gfx::Matrix4x4 shadowTransform =
@@ -1468,33 +1467,33 @@ bool AsyncCompositionManager::TransformS
   }
 
   HostLayer* rootComposite = root->AsHostLayer();
 
   gfx::Matrix4x4 trans = rootComposite->GetShadowBaseTransform();
   trans *= gfx::Matrix4x4::From2D(mWorldTransform);
   rootComposite->SetShadowBaseTransform(trans);
 
-  if (gfxPrefs::CollectScrollTransforms()) {
+  if (StaticPrefs::CollectScrollTransforms()) {
     RecordShadowTransforms(root);
   }
 
   return wantNextFrame;
 }
 
 #if defined(MOZ_WIDGET_ANDROID)
 void AsyncCompositionManager::SetFixedLayerMargins(ScreenIntCoord aTop,
                                                    ScreenIntCoord aBottom) {
   mFixedLayerMargins.top = aTop;
   mFixedLayerMargins.bottom = aBottom;
 }
 ScreenMargin AsyncCompositionManager::GetFixedLayerMargins() const {
   ScreenMargin result = mFixedLayerMargins;
-  if (gfxPrefs::APZFixedMarginOverrideEnabled()) {
-    result.top = gfxPrefs::APZFixedMarginOverrideTop();
-    result.bottom = gfxPrefs::APZFixedMarginOverrideBottom();
+  if (StaticPrefs::APZFixedMarginOverrideEnabled()) {
+    result.top = StaticPrefs::APZFixedMarginOverrideTop();
+    result.bottom = StaticPrefs::APZFixedMarginOverrideBottom();
   }
   return result;
 }
 #endif  // defined(MOZ_WIDGET_ANDROID)
 
 }  // namespace layers
 }  // namespace mozilla
--- a/gfx/layers/composite/ContainerLayerComposite.cpp
+++ b/gfx/layers/composite/ContainerLayerComposite.cpp
@@ -427,17 +427,17 @@ void RenderLayers(ContainerT* aContainer
     const Maybe<gfx::Polygon>& childGeometry = preparedData.mGeometry;
 
     Layer* layer = layerToRender->GetLayer();
 
     if (layerToRender->HasStaleCompositor()) {
       continue;
     }
 
-    if (gfxPrefs::LayersDrawFPS()) {
+    if (StaticPrefs::LayersDrawFPS()) {
       for (const auto& metadata : layer->GetAllScrollMetadata()) {
         if (metadata.IsApzForceDisabled()) {
           aManager->DisabledApzWarning();
           break;
         }
       }
     }
 
@@ -472,17 +472,17 @@ void RenderLayers(ContainerT* aContainer
 
       layerToRender->RenderLayer(clipRect, geometry);
     }
 
     if (gfxPrefs::UniformityInfo()) {
       PrintUniformityInfo(layer);
     }
 
-    if (gfxPrefs::DrawLayerInfo()) {
+    if (StaticPrefs::DrawLayerInfo()) {
       DrawLayerInfo(preparedData.mClipRect, aManager, layer);
     }
 
     // Draw a border around scrollable layers.
     // A layer can be scrolled by multiple scroll frames. Draw a border
     // for each.
     // Within the list of scroll frames for a layer, the layer border for a
     // scroll frame lower down is affected by the async transforms on scroll
@@ -504,17 +504,17 @@ void RenderLayers(ContainerT* aContainer
               asyncTransform * aContainer->GetEffectiveTransform());
           asyncTransform =
               sampler->GetCurrentAsyncTransformWithOverscroll(wrapper)
                   .ToUnknownMatrix() *
               asyncTransform;
         }
       }
 
-      if (gfxPrefs::APZMinimap()) {
+      if (StaticPrefs::APZMinimap()) {
         RenderMinimap(aContainer, sampler, aManager, aClipRect, layer);
       }
     }
 
     // invariant: our GL context should be current here, I don't think we can
     // assert it though
   }
 }
@@ -645,17 +645,18 @@ void ContainerRender(ContainerT* aContai
     RenderLayers(aContainer, aManager,
                  RenderTargetIntRect::FromUnknownRect(aClipRect), aGeometry);
   }
 
   // If it is a scrollable container layer with no child layers, and one of the
   // APZCs attached to it has a nonempty async transform, then that transform is
   // not applied to any visible content. Display a warning box (conditioned on
   // the FPS display being enabled).
-  if (gfxPrefs::LayersDrawFPS() && aContainer->IsScrollableWithoutContent()) {
+  if (StaticPrefs::LayersDrawFPS() &&
+      aContainer->IsScrollableWithoutContent()) {
     RefPtr<APZSampler> sampler =
         aManager->GetCompositor()->GetCompositorBridgeParent()->GetAPZSampler();
     // Since aContainer doesn't have any children we can just iterate from the
     // top metrics on it down to the bottom using GetFirstChild and not worry
     // about walking onto another underlying layer.
     for (LayerMetricsWrapper i(aContainer); i; i = i.GetFirstChild()) {
       if (sampler->HasUnusedAsyncTransform(i)) {
         aManager->UnusedApzTransformWarning();
--- a/gfx/layers/composite/Diagnostics.h
+++ b/gfx/layers/composite/Diagnostics.h
@@ -3,18 +3,18 @@
 /* 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/. */
 
 #ifndef mozilla_gfx_layers_composite_Diagnostics_h
 #define mozilla_gfx_layers_composite_Diagnostics_h
 
 #include "FPSCounter.h"
-#include "gfxPrefs.h"
 #include "mozilla/Maybe.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/TimeStamp.h"
 #include <deque>
 #include <string>
 #include <utility>
 
 namespace mozilla {
 namespace layers {
 
@@ -61,17 +61,17 @@ class Diagnostics {
   void RecordCompositeTime(float aValue) { mCompositeMs.Add(aValue); }
   void AddTxnFrame() { mTransactionFps.AddFrame(TimeStamp::Now()); }
 
   std::string GetFrameOverlayString(const GPUStats& aStats);
 
   class Record {
    public:
     explicit Record(TimeStamp aStart = TimeStamp()) {
-      if (gfxPrefs::LayersDrawFPS()) {
+      if (StaticPrefs::LayersDrawFPS()) {
         mStart = aStart.IsNull() ? TimeStamp::Now() : aStart;
       }
     }
     bool Recording() const { return !mStart.IsNull(); }
     float Duration() const {
       return (TimeStamp::Now() - mStart).ToMilliseconds();
     }
 
--- a/gfx/layers/composite/FPSCounter.cpp
+++ b/gfx/layers/composite/FPSCounter.cpp
@@ -2,23 +2,23 @@
 /* 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 <stddef.h>                     // for size_t
 #include "Units.h"                      // for ScreenIntRect
 #include "gfxRect.h"                    // for gfxRect
-#include "gfxPrefs.h"                   // for gfxPrefs
 #include "mozilla/gfx/Point.h"          // for IntSize, Point
 #include "mozilla/gfx/Rect.h"           // for Rect
 #include "mozilla/gfx/Types.h"          // for Color, SurfaceFormat
 #include "mozilla/layers/Compositor.h"  // for Compositor
 #include "mozilla/layers/CompositorTypes.h"
 #include "mozilla/layers/Effects.h"  // for Effect, EffectChain, etc
+#include "mozilla/StaticPrefs.h"     // for StaticPrefs
 #include "mozilla/TimeStamp.h"       // for TimeStamp, TimeDuration
 #include "nsPoint.h"                 // for nsIntPoint
 #include "nsRect.h"                  // for mozilla::gfx::IntRect
 #include "nsIFile.h"                 // for nsIFile
 #include "nsDirectoryServiceDefs.h"  // for NS_OS_TMP_DIR
 #include "mozilla/Sprintf.h"
 #include "FPSCounter.h"
 
@@ -254,17 +254,17 @@ double FPSCounter::GetStdDev(std::map<in
     samples += count;
   }
 
   double stdDev = sumOfDifferences / samples;
   return sqrt(stdDev);
 }
 
 void FPSCounter::PrintFPS() {
-  if (!gfxPrefs::FPSPrintHistogram()) {
+  if (!StaticPrefs::FPSPrintHistogram()) {
     return;
   }
 
   std::map<int, int> histogram;
   int totalFrames = BuildHistogram(histogram);
 
   TimeDuration measurementInterval =
       mFrameTimestamps[GetLatestReadIndex()] - mLastInterval;
@@ -303,17 +303,17 @@ void FPSCounter::PrintHistogram(std::map
   printf_stderr("%s\n", buffer);
   printf_stderr("Mean: %f , std dev %f\n", GetMean(aHistogram),
                 GetStdDev(aHistogram));
 }
 
 // Write FPS timestamp data to a file only if
 // draw-fps.write-to-file is true
 nsresult FPSCounter::WriteFrameTimeStamps() {
-  if (!gfxPrefs::WriteFPSToFile()) {
+  if (!StaticPrefs::WriteFPSToFile()) {
     return NS_OK;
   }
 
   MOZ_ASSERT(mWriteIndex == 0);
 
   nsCOMPtr<nsIFile> resultFile;
   nsresult rv =
       NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(resultFile));
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -617,28 +617,28 @@ LayerComposite* LayerManagerComposite::R
     return nullptr;
   }
 
   return ToLayerComposite(mRoot);
 }
 
 void LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion,
                                                    const IntRect& aBounds) {
-  bool drawFps = gfxPrefs::LayersDrawFPS();
-  bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars();
+  bool drawFps = StaticPrefs::LayersDrawFPS();
+  bool drawFrameColorBars = StaticPrefs::CompositorDrawColorBars();
 
   if (drawFps) {
     aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 650, 400));
   }
   if (drawFrameColorBars) {
     aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 10, aBounds.Height()));
   }
 
 #ifdef USE_SKIA
-  bool drawPaintTimes = gfxPrefs::AlwaysPaint();
+  bool drawPaintTimes = StaticPrefs::AlwaysPaint();
   if (drawPaintTimes) {
     aInvalidRegion.Or(aInvalidRegion, nsIntRect(PaintCounter::GetPaintRect()));
   }
 #endif
 }
 
 #ifdef USE_SKIA
 void LayerManagerComposite::DrawPaintTimes(Compositor* aCompositor) {
@@ -648,18 +648,18 @@ void LayerManagerComposite::DrawPaintTim
 
   TimeDuration compositeTime = TimeStamp::Now() - mRenderStartTime;
   mPaintCounter->Draw(aCompositor, mLastPaintTime, compositeTime);
 }
 #endif
 
 static uint16_t sFrameCount = 0;
 void LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) {
-  bool drawFps = gfxPrefs::LayersDrawFPS();
-  bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars();
+  bool drawFps = StaticPrefs::LayersDrawFPS();
+  bool drawFrameColorBars = StaticPrefs::CompositorDrawColorBars();
 
   // Don't draw diagnostic overlays if we want to snapshot the output.
   if (mTarget) {
     return;
   }
 
   if (drawFps) {
     float alpha = 1;
@@ -759,30 +759,30 @@ void LayerManagerComposite::RenderDebugO
   }
 
   if (drawFrameColorBars) {
     // We intentionally overflow at 2^16.
     sFrameCount++;
   }
 
 #ifdef USE_SKIA
-  bool drawPaintTimes = gfxPrefs::AlwaysPaint();
+  bool drawPaintTimes = StaticPrefs::AlwaysPaint();
   if (drawPaintTimes) {
     DrawPaintTimes(mCompositor);
   }
 #endif
 }
 
 RefPtr<CompositingRenderTarget>
 LayerManagerComposite::PushGroupForLayerEffects() {
   // This is currently true, so just making sure that any new use of this
   // method is flagged for investigation
-  MOZ_ASSERT(gfxPrefs::LayersEffectInvert() ||
-             gfxPrefs::LayersEffectGrayscale() ||
-             gfxPrefs::LayersEffectContrast() != 0.0);
+  MOZ_ASSERT(StaticPrefs::LayersEffectInvert() ||
+             StaticPrefs::LayersEffectGrayscale() ||
+             StaticPrefs::LayersEffectContrast() != 0.0);
 
   RefPtr<CompositingRenderTarget> previousTarget =
       mCompositor->GetCurrentRenderTarget();
   // make our render target the same size as the destination target
   // so that we don't have to change size if the drawing area changes.
   IntRect rect(previousTarget->GetOrigin(), previousTarget->GetSize());
   // XXX: I'm not sure if this is true or not...
   MOZ_ASSERT(rect.IsEqualXY(0, 0));
@@ -900,26 +900,26 @@ void LayerManagerComposite::Render(const
 
   ClearLayerFlags(mRoot);
 
   // At this time, it doesn't really matter if these preferences change
   // during the execution of the function; we should be safe in all
   // permutations. However, may as well just get the values onces and
   // then use them, just in case the consistency becomes important in
   // the future.
-  bool invertVal = gfxPrefs::LayersEffectInvert();
-  bool grayscaleVal = gfxPrefs::LayersEffectGrayscale();
-  float contrastVal = gfxPrefs::LayersEffectContrast();
+  bool invertVal = StaticPrefs::LayersEffectInvert();
+  bool grayscaleVal = StaticPrefs::LayersEffectGrayscale();
+  float contrastVal = StaticPrefs::LayersEffectContrast();
   bool haveLayerEffects = (invertVal || grayscaleVal || contrastVal != 0.0);
 
   // Set LayerScope begin/end frame
   LayerScopeAutoFrame frame(PR_Now());
 
   // Dump to console
-  if (gfxPrefs::LayersDump()) {
+  if (StaticPrefs::LayersDump()) {
     this->Dump(/* aSorted= */ true);
   }
 
   // Dump to LayerScope Viewer
   if (LayerScope::CheckSendable()) {
     // Create a LayersPacket, dump Layers into it and transfer the
     // packet('s ownership) to LayerScope.
     auto packet = MakeUnique<layerscope::Packet>();
@@ -1420,17 +1420,17 @@ void LayerComposite::AddBlendModeEffect(
 }
 
 bool LayerManagerComposite::CanUseCanvasLayerForSize(const IntSize& aSize) {
   return mCompositor->CanUseCanvasLayerForSize(
       gfx::IntSize(aSize.width, aSize.height));
 }
 
 void LayerManagerComposite::NotifyShadowTreeTransaction() {
-  if (gfxPrefs::LayersDrawFPS()) {
+  if (StaticPrefs::LayersDrawFPS()) {
     mDiagnostics->AddTxnFrame();
   }
 }
 
 void LayerComposite::SetLayerManager(HostLayerManager* aManager) {
   HostLayer::SetLayerManager(aManager);
   mCompositeManager = static_cast<LayerManagerComposite*>(aManager);
   mCompositor = mCompositeManager->GetCompositor();
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -424,17 +424,17 @@ void TextureHost::PrintInfo(std::strings
   //       GetSize() and GetFormat() on it.
   if (Lock()) {
     AppendToString(aStream, GetSize(), " [size=", "]");
     AppendToString(aStream, GetFormat(), " [format=", "]");
     Unlock();
   }
   AppendToString(aStream, mFlags, " [flags=", "]");
 #ifdef MOZ_DUMP_PAINTING
-  if (gfxPrefs::LayersDumpTexture()) {
+  if (StaticPrefs::LayersDumpTexture()) {
     nsAutoCString pfx(aPrefix);
     pfx += "  ";
 
     aStream << "\n" << pfx.get() << "Surface: ";
     RefPtr<gfx::DataSourceSurface> dSurf = GetAsSurface();
     if (dSurf) {
       aStream << gfxUtils::GetAsLZ4Base64Str(dSurf).get();
     }
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -1,16 +1,15 @@
 /* -*- 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 "TiledContentHost.h"
-#include "gfxPrefs.h"                   // for gfxPrefs
 #include "PaintedLayerComposite.h"      // for PaintedLayerComposite
 #include "mozilla/gfx/BaseSize.h"       // for BaseSize
 #include "mozilla/gfx/Matrix.h"         // for Matrix4x4
 #include "mozilla/gfx/Point.h"          // for IntSize
 #include "mozilla/layers/Compositor.h"  // for Compositor
 // clang-format off
 //#include "mozilla/layers/CompositorBridgeParent.h"  // for CompositorBridgeParent
 // clang-format on
@@ -20,32 +19,33 @@
 #ifdef XP_DARWIN
 #  include "mozilla/layers/TextureSync.h"  // for TextureSync
 #endif
 #include "nsAString.h"
 #include "nsDebug.h"          // for NS_WARNING
 #include "nsPoint.h"          // for IntPoint
 #include "nsPrintfCString.h"  // for nsPrintfCString
 #include "nsRect.h"           // for IntRect
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/layers/TextureClient.h"
 
 namespace mozilla {
 using namespace gfx;
 namespace layers {
 
 class Layer;
 
 float TileHost::GetFadeInOpacity(float aOpacity) {
   TimeStamp now = TimeStamp::Now();
-  if (!gfxPrefs::LayerTileFadeInEnabled() || mFadeStart.IsNull() ||
+  if (!StaticPrefs::LayerTileFadeInEnabled() || mFadeStart.IsNull() ||
       now < mFadeStart) {
     return aOpacity;
   }
 
-  float duration = gfxPrefs::LayerTileFadeInDuration();
+  float duration = StaticPrefs::LayerTileFadeInDuration();
   float elapsed = (now - mFadeStart).ToMilliseconds();
   if (elapsed > duration) {
     mFadeStart = TimeStamp();
     return aOpacity;
   }
   return aOpacity * (elapsed / duration);
 }
 
@@ -333,18 +333,18 @@ bool TiledLayerBufferComposite::UseTiles
 
     if (aTiles.isProgressive() && texturedDesc.wasPlaceholder()) {
       // This is a progressive paint, and the tile used to be a placeholder.
       // We need to begin fading it in (if enabled via
       // layers.tiles.fade-in.enabled)
       tile.mFadeStart = TimeStamp::Now();
 
       aLayerManager->CompositeUntil(
-          tile.mFadeStart +
-          TimeDuration::FromMilliseconds(gfxPrefs::LayerTileFadeInDuration()));
+          tile.mFadeStart + TimeDuration::FromMilliseconds(
+                                StaticPrefs::LayerTileFadeInDuration()));
     }
   }
 
 #ifdef XP_DARWIN
   if (lockedTextureSerials.Length() > 0) {
     TextureSync::SetTexturesLocked(lockedTexturePid, lockedTextureSerials);
   }
 #endif
@@ -417,31 +417,31 @@ void TiledContentHost::Composite(
   // we also make sure to draw the background color behind the
   // reduced-opacity tile so that content underneath doesn't show
   // through.
   // However, in cases where the background is transparent, or the layer
   // already has some opacity, we want to skip this behaviour. Otherwise
   // we end up changing the expected overall transparency of the content,
   // and it just looks wrong.
   Color backgroundColor;
-  if (aOpacity == 1.0f && gfxPrefs::LowPrecisionOpacity() < 1.0f) {
+  if (aOpacity == 1.0f && StaticPrefs::LowPrecisionOpacity() < 1.0f) {
     // Background colors are only stored on scrollable layers. Grab
     // the one from the nearest scrollable ancestor layer.
     for (LayerMetricsWrapper ancestor(GetLayer(),
                                       LayerMetricsWrapper::StartAt::BOTTOM);
          ancestor; ancestor = ancestor.GetParent()) {
       if (ancestor.Metrics().IsScrollable()) {
         backgroundColor = ancestor.Metadata().GetBackgroundColor();
         break;
       }
     }
   }
   float lowPrecisionOpacityReduction =
       (aOpacity == 1.0f && backgroundColor.a == 1.0f)
-          ? gfxPrefs::LowPrecisionOpacity()
+          ? StaticPrefs::LowPrecisionOpacity()
           : 1.0f;
 
   nsIntRegion tmpRegion;
   const nsIntRegion* renderRegion = aVisibleRegion;
 #ifndef MOZ_IGNORE_PAINT_WILL_RESAMPLE
   if (PaintWillResample()) {
     // If we're resampling, then the texture image will contain exactly the
     // entire visible region's bounds, and we should draw it all in one quad
@@ -626,17 +626,17 @@ void TiledContentHost::RenderLayerBuffer
 }
 
 void TiledContentHost::PrintInfo(std::stringstream& aStream,
                                  const char* aPrefix) {
   aStream << aPrefix;
   aStream << nsPrintfCString("TiledContentHost (0x%p)", this).get();
 
 #if defined(MOZ_DUMP_PAINTING)
-  if (gfxPrefs::LayersDumpTexture()) {
+  if (StaticPrefs::LayersDumpTexture()) {
     nsAutoCString pfx(aPrefix);
     pfx += "  ";
 
     Dump(aStream, pfx.get(), false);
   }
 #endif
 }
 
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -117,17 +117,17 @@ CompositorD3D11::~CompositorD3D11() {}
 template <typename VertexType>
 void CompositorD3D11::SetVertexBuffer(ID3D11Buffer* aBuffer) {
   UINT size = sizeof(VertexType);
   UINT offset = 0;
   mContext->IASetVertexBuffers(0, 1, &aBuffer, &size, &offset);
 }
 
 bool CompositorD3D11::SupportsLayerGeometry() const {
-  return gfxPrefs::D3D11LayerGeometry();
+  return StaticPrefs::D3D11LayerGeometry();
 }
 
 bool CompositorD3D11::UpdateDynamicVertexBuffer(
     const nsTArray<gfx::TexturedTriangle>& aTriangles) {
   HRESULT hr;
 
   // Resize the dynamic vertex buffer if needed.
   if (!mAttachments->EnsureTriangleBuffer(aTriangles.Length())) {
@@ -196,17 +196,17 @@ bool CompositorD3D11::Initialize(nsCStri
     RefPtr<IDXGIFactory> dxgiFactory;
     dxgiAdapter->GetParent(IID_PPV_ARGS(dxgiFactory.StartAssignment()));
 
     RefPtr<IDXGIFactory2> dxgiFactory2;
     hr = dxgiFactory->QueryInterface(
         (IDXGIFactory2**)getter_AddRefs(dxgiFactory2));
 
 #if (_WIN32_WINDOWS_MAXVER >= 0x0A00)
-    if (gfxPrefs::Direct3D11UseDoubleBuffering() && SUCCEEDED(hr) &&
+    if (StaticPrefs::Direct3D11UseDoubleBuffering() && SUCCEEDED(hr) &&
         dxgiFactory2 && IsWindows10OrGreater()) {
       // DXGI_SCALING_NONE is not available on Windows 7 with Platform Update.
       // This looks awful for things like the awesome bar and browser window
       // resizing so we don't use a flip buffer chain here. When using
       // EFFECT_SEQUENTIAL it looks like windows doesn't stretch the surface
       // when resizing. We chose not to run this before Windows 10 because it
       // appears sometimes this breaks our ability to test ASAP compositing.
       RefPtr<IDXGISwapChain1> swapChain;
@@ -285,20 +285,20 @@ bool CompositorD3D11::Initialize(nsCStri
 
   mAllowPartialPresents = CanUsePartialPresents(mDevice);
 
   reporter.SetSuccessful();
   return true;
 }
 
 bool CanUsePartialPresents(ID3D11Device* aDevice) {
-  if (gfxPrefs::PartialPresent() > 0) {
+  if (StaticPrefs::PartialPresent() > 0) {
     return true;
   }
-  if (gfxPrefs::PartialPresent() < 0) {
+  if (StaticPrefs::PartialPresent() < 0) {
     return false;
   }
   if (DeviceManagerDx::Get()->IsWARP()) {
     return true;
   }
 
   DXGI_ADAPTER_DESC desc;
   if (!D3D11Checks::GetDxgiDesc(aDevice, &desc)) {
@@ -1195,17 +1195,17 @@ void CompositorD3D11::BeginFrame(const n
     if (!mAttachments->mSyncObject->Synchronize()) {
       // It's timeout here. Since the timeout is related to the driver-removed,
       // clear the render-bounding size to skip this frame.
       *aRenderBoundsOut = IntRect();
       return;
     }
   }
 
-  if (gfxPrefs::LayersDrawFPS()) {
+  if (StaticPrefs::LayersDrawFPS()) {
     uint32_t pixelsPerFrame = 0;
     for (auto iter = mBackBufferInvalid.RectIter(); !iter.Done(); iter.Next()) {
       pixelsPerFrame += iter.Get().Width() * iter.Get().Height();
     }
 
     mDiagnostics->Start(pixelsPerFrame);
   }
 }
@@ -1240,17 +1240,17 @@ void CompositorD3D11::EndFrame() {
   CD3D11_QUERY_DESC desc(D3D11_QUERY_EVENT);
   mDevice->CreateQuery(&desc, getter_AddRefs(query));
   if (query) {
     mContext->End(query);
   }
 
   if (oldSize == mSize) {
     Present();
-    if (gfxPrefs::CompositorClearState()) {
+    if (StaticPrefs::CompositorClearState()) {
       mContext->ClearState();
     }
   } else {
     mDiagnostics->Cancel();
   }
 
   // Block until the previous frame's work has been completed.
   if (mQuery) {
--- a/gfx/layers/d3d11/MLGDeviceD3D11.cpp
+++ b/gfx/layers/d3d11/MLGDeviceD3D11.cpp
@@ -15,17 +15,17 @@
 #include "mozilla/layers/MemoryReportingMLGPU.h"
 #include "mozilla/layers/ShaderDefinitionsMLGPU.h"
 #include "mozilla/layers/UtilityMLGPU.h"
 #include "mozilla/widget/CompositorWidget.h"
 #include "mozilla/widget/WinCompositorWidget.h"
 #include "MLGShaders.h"
 #include "TextureD3D11.h"
 #include "gfxConfig.h"
-#include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 namespace layers {
 
 using namespace mozilla::gfx;
 using namespace mozilla::widget;
 using namespace mozilla::layers::mlg;
 using namespace std;
@@ -227,17 +227,17 @@ bool MLGSwapChainD3D11::Initialize(Compo
   {
     RefPtr<IDXGIAdapter> adapter;
     dxgiDevice->GetAdapter(getter_AddRefs(adapter));
 
     adapter->GetParent(IID_PPV_ARGS(dxgiFactory.StartAssignment()));
   }
 
   RefPtr<IDXGIFactory2> dxgiFactory2;
-  if (gfxPrefs::Direct3D11UseDoubleBuffering() &&
+  if (StaticPrefs::Direct3D11UseDoubleBuffering() &&
       SUCCEEDED(dxgiFactory->QueryInterface(dxgiFactory2.StartAssignment())) &&
       dxgiFactory2 && IsWin10OrLater() && XRE_IsGPUProcess()) {
     // DXGI_SCALING_NONE is not available on Windows 7 with the Platform Update:
     // This looks awful for things like the awesome bar and browser window
     // resizing, so we don't use a flip buffer chain here. (Note when using
     // EFFECT_SEQUENTIAL Windows doesn't stretch the surface when resizing).
     //
     // We choose not to run this on platforms earlier than Windows 10 because
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -6,17 +6,17 @@
 
 #include "TextureD3D11.h"
 #include "CompositorD3D11.h"
 #include "Effects.h"
 #include "PaintThread.h"
 #include "ReadbackManagerD3D11.h"
 #include "gfx2DGlue.h"
 #include "gfxContext.h"
-#include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "gfxWindowsPlatform.h"
 #include "mozilla/gfx/DataSurfaceHelpers.h"
 #include "mozilla/gfx/DeviceManagerDx.h"
 #include "mozilla/gfx/Logging.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/layers/CompositorBridgeChild.h"
 #include "mozilla/webrender/RenderD3D11TextureHostOGL.h"
 #include "mozilla/webrender/RenderThread.h"
@@ -281,17 +281,17 @@ static void DestroyDrawTarget(RefPtr<Dra
 #ifdef DEBUG
   UnlockD3DTexture(aTexture.get());
 #endif
   aTexture = nullptr;
 }
 
 D3D11TextureData::~D3D11TextureData() {
   if (mDrawTarget) {
-    if (PaintThread::Get() && gfxPrefs::Direct2DDestroyDTOnPaintThread()) {
+    if (PaintThread::Get() && StaticPrefs::Direct2DDestroyDTOnPaintThread()) {
       RefPtr<DrawTarget> dt = mDrawTarget;
       RefPtr<ID3D11Texture2D> tex = mTexture;
       RefPtr<Runnable> task = NS_NewRunnableFunction(
           "PaintThread::RunFunction",
           [dt, tex]() mutable { DestroyDrawTarget(dt, tex); });
       PaintThread::Get()->Dispatch(task);
     }
 #ifdef DEBUG
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -999,17 +999,17 @@ void CompositorBridgeParent::CompositeTo
           mCompositorScheduler->GetLastComposeTime() + (mVsyncRate * 2);
     }
 #endif
   }
 
   RenderTraceLayers(mLayerManager->GetRoot(), "0000");
 
 #ifdef MOZ_DUMP_PAINTING
-  if (gfxPrefs::DumpHostLayers()) {
+  if (StaticPrefs::DumpHostLayers()) {
     printf_stderr("Painting --- compositing layer tree:\n");
     mLayerManager->Dump(/* aSorted = */ true);
   }
 #endif
   mLayerManager->SetDebugOverlayWantsNextFrame(false);
   mLayerManager->EndTransaction(time);
 
   if (!aTarget) {
@@ -1039,17 +1039,17 @@ void CompositorBridgeParent::CompositeTo
   }
   if (executionTime > frameBudget) {
     printf_stderr("Compositor: Composite execution took %4.1f ms\n",
                   executionTime.ToMilliseconds());
   }
 #endif
 
   // 0 -> Full-tilt composite
-  if (gfxPrefs::LayersCompositionFrameRate() == 0 ||
+  if (StaticPrefs::LayersCompositionFrameRate() == 0 ||
       mLayerManager->AlwaysScheduleComposite()) {
     // Special full-tilt composite mode for performance testing
     ScheduleComposition();
   }
 
   // TODO(bug 1328602) Need an equivalent that works with the rende thread.
   mLayerManager->SetCompositionTime(TimeStamp());
 
@@ -1211,17 +1211,17 @@ void CompositorBridgeParent::ScheduleRot
       mCompositionManager->RequiresReorientation(aTargetConfig.orientation())) {
     if (mForceCompositionTask != nullptr) {
       mForceCompositionTask->Cancel();
     }
     RefPtr<CancelableRunnable> task = NewCancelableRunnableMethod(
         "layers::CompositorBridgeParent::ForceComposition", this,
         &CompositorBridgeParent::ForceComposition);
     mForceCompositionTask = task;
-    ScheduleTask(task.forget(), gfxPrefs::OrientationSyncMillis());
+    ScheduleTask(task.forget(), StaticPrefs::OrientationSyncMillis());
   }
 }
 
 void CompositorBridgeParent::ShadowLayersUpdated(
     LayerTransactionParent* aLayerTree, const TransactionInfo& aInfo,
     bool aHitTestUpdate) {
   const TargetConfig& targetConfig = aInfo.targetConfig();
 
@@ -1549,17 +1549,17 @@ RefPtr<Compositor> CompositorBridgeParen
 
 PLayerTransactionParent* CompositorBridgeParent::AllocPLayerTransactionParent(
     const nsTArray<LayersBackend>& aBackendHints, const LayersId& aId) {
   MOZ_ASSERT(!aId.IsValid());
 
 #ifdef XP_WIN
   // This is needed to avoid freezing the window on a device crash on double
   // buffering, see bug 1549674.
-  if (gfxPrefs::Direct3D11UseDoubleBuffering() && IsWin10OrLater() &&
+  if (StaticPrefs::Direct3D11UseDoubleBuffering() && IsWin10OrLater() &&
       XRE_IsGPUProcess()) {
     mWidget->AsWindows()->EnsureCompositorWindow();
   }
 #endif
 
   InitializeLayerManager(aBackendHints);
 
   if (!mLayerManager) {
--- a/gfx/layers/ipc/CompositorVsyncScheduler.cpp
+++ b/gfx/layers/ipc/CompositorVsyncScheduler.cpp
@@ -73,17 +73,17 @@ CompositorVsyncScheduler::CompositorVsyn
       mCurrentCompositeTaskMonitor("CurrentCompositeTaskMonitor"),
       mCurrentCompositeTask(nullptr),
       mCurrentVRTaskMonitor("CurrentVRTaskMonitor"),
       mCurrentVRTask(nullptr) {
   mVsyncObserver = new Observer(this);
 
   // mAsapScheduling is set on the main thread during init,
   // but is only accessed after on the compositor thread.
-  mAsapScheduling = gfxPrefs::LayersCompositionFrameRate() == 0 ||
+  mAsapScheduling = StaticPrefs::LayersCompositionFrameRate() == 0 ||
                     gfxPlatform::IsInLayoutAsapMode() ||
                     recordreplay::IsRecordingOrReplaying();
 }
 
 CompositorVsyncScheduler::~CompositorVsyncScheduler() {
   MOZ_ASSERT(!mIsObservingVsync);
   MOZ_ASSERT(!mVsyncObserver);
   // The CompositorVsyncDispatcher is cleaned up before this in the
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -6,17 +6,16 @@
 
 #include "LayerTransactionParent.h"
 #include <vector>                           // for vector
 #include "CompositableHost.h"               // for CompositableParent, Get, etc
 #include "ImageLayers.h"                    // for ImageLayer
 #include "Layers.h"                         // for Layer, ContainerLayer, etc
 #include "CompositableTransactionParent.h"  // for EditReplyVector
 #include "CompositorBridgeParent.h"
-#include "gfxPrefs.h"
 #include "mozilla/gfx/BasePoint3D.h"         // for BasePoint3D
 #include "mozilla/layers/AnimationHelper.h"  // for GetAnimatedPropValue
 #include "mozilla/layers/CanvasLayerComposite.h"
 #include "mozilla/layers/ColorLayerComposite.h"
 #include "mozilla/layers/Compositor.h"  // for Compositor
 #include "mozilla/layers/ContainerLayerComposite.h"
 #include "mozilla/layers/ImageBridgeParent.h"  // for ImageBridgeParent
 #include "mozilla/layers/ImageLayerComposite.h"
@@ -467,19 +466,19 @@ mozilla::ipc::IPCResult LayerTransaction
       (int)(mozilla::TimeStamp::Now() - updateStart).ToMilliseconds();
   if (compositeTime > 15) {
     printf_stderr("Compositor: Layers update took %i ms (blocking gecko).\n",
                   compositeTime);
   }
 #endif
 
   // Enable visual warning for long transaction when draw FPS option is enabled
-  bool drawFps = gfxPrefs::LayersDrawFPS();
+  bool drawFps = StaticPrefs::LayersDrawFPS();
   if (drawFps) {
-    uint32_t visualWarningTrigger = gfxPrefs::LayerTransactionWarning();
+    uint32_t visualWarningTrigger = StaticPrefs::LayerTransactionWarning();
     // The default theshold is 200ms to trigger, hit red when it take 4 times
     // longer
     TimeDuration latency = TimeStamp::Now() - aInfo.transactionStart();
     if (latency > TimeDuration::FromMilliseconds(visualWarningTrigger)) {
       float severity =
           (latency - TimeDuration::FromMilliseconds(visualWarningTrigger))
               .ToMilliseconds() /
           (4 * visualWarningTrigger);
@@ -746,17 +745,17 @@ mozilla::ipc::IPCResult LayerTransaction
   if (!layer->GetParent() || !layer->GetParent()->GetTransformIsPerspective()) {
     transform.PostTranslate(-scaledOrigin.x, -scaledOrigin.y, -scaledOrigin.z);
   }
 
   // This function is supposed to include the APZ transform, but if root scroll
   // containers are enabled, then the APZ transform might not be on |layer| but
   // instead would be on the parent of |layer|, if that is the root scrollable
   // metrics. So we special-case that behaviour.
-  if (gfxPrefs::LayoutUseContainersForRootFrames() &&
+  if (StaticPrefs::LayoutUseContainersForRootFrames() &&
       !layer->HasScrollableFrameMetrics() && layer->GetParent() &&
       layer->GetParent()->HasRootScrollableFrameMetrics()) {
     transform *= layer->GetParent()->AsHostLayer()->GetShadowBaseTransform();
   }
 
   *aTransform = Some(transform);
 
   return IPC_OK();
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -541,17 +541,17 @@ bool ShadowLayerForwarder::EndTransactio
   TransactionInfo info;
 
   MOZ_ASSERT(IPCOpen(), "no manager to forward to");
   if (!IPCOpen()) {
     return false;
   }
 
   Maybe<TimeStamp> startTime;
-  if (gfxPrefs::LayersDrawFPS()) {
+  if (StaticPrefs::LayersDrawFPS()) {
     startTime = Some(TimeStamp::Now());
   }
 
   GetCompositorBridgeChild()->WillEndTransaction();
 
   MOZ_ASSERT(aId.IsValid());
 
   AUTO_PROFILER_LABEL("ShadowLayerForwarder::EndTransaction", GRAPHICS);
--- a/gfx/layers/mlgpu/ContainerLayerMLGPU.cpp
+++ b/gfx/layers/mlgpu/ContainerLayerMLGPU.cpp
@@ -1,16 +1,16 @@
 /* -*- 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 "ContainerLayerMLGPU.h"
-#include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "LayersLogging.h"
 #include "LayerManagerMLGPU.h"
 #include "MLGDevice.h"
 #include "mozilla/gfx/Rect.h"
 #include "mozilla/gfx/Types.h"
 #include "UnitTransforms.h"
 #include "UtilityMLGPU.h"
 
@@ -58,17 +58,17 @@ bool ContainerLayerMLGPU::OnPrepareToRen
   bool surfaceCopyNeeded = false;
   DefaultComputeSupportsComponentAlphaChildren(&surfaceCopyNeeded);
   if (surfaceCopyNeeded != mSurfaceCopyNeeded || surfaceCopyNeeded) {
     mInvalidateEntireSurface = true;
   }
   mSurfaceCopyNeeded = surfaceCopyNeeded;
 
   gfx::IntRect viewport(gfx::IntPoint(0, 0), mTargetSize);
-  if (!mRenderTarget || !gfxPrefs::AdvancedLayersUseInvalidation() ||
+  if (!mRenderTarget || !StaticPrefs::AdvancedLayersUseInvalidation() ||
       mInvalidateEntireSurface) {
     // Fine-grained invalidation is disabled, invalidate everything.
     mInvalidRect = viewport;
   } else {
     // Clamp the invalid rect to the viewport.
     mInvalidRect -= mTargetOffset;
     mInvalidRect = mInvalidRect.Intersect(viewport);
   }
--- a/gfx/layers/mlgpu/LayerManagerMLGPU.cpp
+++ b/gfx/layers/mlgpu/LayerManagerMLGPU.cpp
@@ -20,16 +20,17 @@
 #include "TextureSourceProviderMLGPU.h"
 #include "TreeTraversal.h"
 #include "FrameBuilder.h"
 #include "LayersLogging.h"
 #include "UtilityMLGPU.h"
 #include "CompositionRecorder.h"
 #include "mozilla/layers/Diagnostics.h"
 #include "mozilla/layers/TextRenderer.h"
+#include "mozilla/StaticPrefs.h"
 
 #ifdef XP_WIN
 #  include "mozilla/widget/WinCompositorWidget.h"
 #  include "mozilla/gfx/DeviceManagerDx.h"
 #endif
 
 using namespace std;
 
@@ -257,18 +258,18 @@ void LayerManagerMLGPU::EndTransaction(c
       gfxCriticalNote << "Could not resize the swapchain ("
                       << hexa(windowSize.width) << ","
                       << hexa(windowSize.height) << ")";
       return;
     }
   }
 
   // Don't draw the diagnostic overlay if we want to snapshot the output.
-  mDrawDiagnostics = gfxPrefs::LayersDrawFPS() && !mTarget;
-  mUsingInvalidation = gfxPrefs::AdvancedLayersUseInvalidation();
+  mDrawDiagnostics = StaticPrefs::LayersDrawFPS() && !mTarget;
+  mUsingInvalidation = StaticPrefs::AdvancedLayersUseInvalidation();
   mDebugFrameNumber++;
 
   AL_LOG("--- Compositing frame %d ---\n", mDebugFrameNumber);
 
   // Compute transforms - and the changed area, if enabled.
   mRoot->ComputeEffectiveTransforms(Matrix4x4());
   ComputeInvalidRegion();
 
@@ -545,17 +546,17 @@ void LayerManagerMLGPU::ClearCachedResou
     if (!layer) {
       return;
     }
     layer->ClearCachedResources();
   });
 }
 
 void LayerManagerMLGPU::NotifyShadowTreeTransaction() {
-  if (gfxPrefs::LayersDrawFPS()) {
+  if (StaticPrefs::LayersDrawFPS()) {
     mDiagnostics->AddTxnFrame();
   }
 }
 
 void LayerManagerMLGPU::UpdateRenderBounds(const gfx::IntRect& aRect) {
   mRenderBounds = aRect;
 }
 
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -16,16 +16,17 @@
 #include "gfxCrashReporterUtils.h"  // for ScopedGfxFeatureReporter
 #include "gfxEnv.h"                 // for gfxEnv
 #include "gfxPlatform.h"            // for gfxPlatform
 #include "gfxPrefs.h"               // for gfxPrefs
 #include "gfxRect.h"                // for gfxRect
 #include "gfxUtils.h"               // for gfxUtils, etc
 #include "mozilla/ArrayUtils.h"     // for ArrayLength
 #include "mozilla/Preferences.h"    // for Preferences
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/gfx/BasePoint.h"  // for BasePoint
 #include "mozilla/gfx/Matrix.h"     // for Matrix4x4, Matrix
 #include "mozilla/gfx/Triangle.h"   // for Triangle
 #include "mozilla/gfx/gfxVars.h"    // for gfxVars
 #include "mozilla/layers/ImageDataSerializer.h"
 #include "mozilla/layers/LayerManagerComposite.h"  // for LayerComposite, etc
 #include "mozilla/layers/CompositingRenderTargetOGL.h"
 #include "mozilla/layers/Effects.h"      // for EffectChain, TexturedEffect, etc
@@ -800,20 +801,20 @@ void CompositorOGL::BeginFrame(const nsI
   mWindowRenderTarget = mCurrentRenderTarget;
 
   if (aClipRectOut && !aClipRectIn) {
     aClipRectOut->SetRect(0, 0, width, height);
   }
 
 #if defined(MOZ_WIDGET_ANDROID)
   if ((mSurfaceOrigin.x > 0) || (mSurfaceOrigin.y > 0)) {
-    mGLContext->fClearColor(gfxPrefs::CompositorOverrideClearColorR(),
-                            gfxPrefs::CompositorOverrideClearColorG(),
-                            gfxPrefs::CompositorOverrideClearColorB(),
-                            gfxPrefs::CompositorOverrideClearColorA());
+    mGLContext->fClearColor(StaticPrefs::CompositorOverrideClearColorR(),
+                            StaticPrefs::CompositorOverrideClearColorG(),
+                            StaticPrefs::CompositorOverrideClearColorB(),
+                            StaticPrefs::CompositorOverrideClearColorA());
   } else {
     mGLContext->fClearColor(mClearColor.r, mClearColor.g, mClearColor.b,
                             mClearColor.a);
   }
 #else
   mGLContext->fClearColor(mClearColor.r, mClearColor.g, mClearColor.b,
                           mClearColor.a);
 #endif  // defined(MOZ_WIDGET_ANDROID)
@@ -1228,17 +1229,17 @@ void CompositorOGL::DrawGeometry(const G
     EffectBlendMode* blendEffect = static_cast<EffectBlendMode*>(
         aEffectChain.mSecondaryEffects[EffectTypes::BLEND_MODE].get());
     blendMode = blendEffect->mBlendMode;
   }
 
   // Only apply DEAA to quads that have been transformed such that aliasing
   // could be visible
   bool bEnableAA =
-      gfxPrefs::LayersDEAAEnabled() && !aTransform.Is2DIntegerTranslation();
+      StaticPrefs::LayersDEAAEnabled() && !aTransform.Is2DIntegerTranslation();
 
   bool colorMatrix = aEffectChain.mSecondaryEffects[EffectTypes::COLOR_MATRIX];
   ShaderConfigOGL config =
       GetShaderConfigFor(aEffectChain.mPrimaryEffect, sourceMask, blendMode,
                          colorMatrix, bEnableAA);
 
   config.SetOpacity(aOpacity != 1.f);
   ApplyPrimitiveConfig(config, aGeometry);
@@ -2021,17 +2022,17 @@ void PerUnitTexturePoolOGL::DestroyTextu
     if (mTextures.Length() > 0) {
       mGL->fDeleteTextures(mTextures.Length(), &mTextures[0]);
     }
   }
   mTextures.SetLength(0);
 }
 
 bool CompositorOGL::SupportsLayerGeometry() const {
-  return gfxPrefs::OGLLayerGeometry();
+  return StaticPrefs::OGLLayerGeometry();
 }
 
 void CompositorOGL::RegisterTextureSource(TextureSource* aTextureSource) {
 #ifdef MOZ_WIDGET_GTK
   if (mDestroyed) {
     return;
   }
   mRegisteredTextureSources.insert(aTextureSource);
--- a/gfx/layers/wr/WebRenderBridgeChild.cpp
+++ b/gfx/layers/wr/WebRenderBridgeChild.cpp
@@ -2,16 +2,17 @@
 /* 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/layers/WebRenderBridgeChild.h"
 
 #include "gfxPlatform.h"
+#include "gfxPrefs.h"
 #include "mozilla/dom/TabGroup.h"
 #include "mozilla/layers/CompositableClient.h"
 #include "mozilla/layers/CompositorBridgeChild.h"
 #include "mozilla/layers/ImageDataSerializer.h"
 #include "mozilla/layers/IpcResourceUpdateQueue.h"
 #include "mozilla/layers/StackingContextHelper.h"
 #include "mozilla/layers/PTextureChild.h"
 #include "mozilla/layers/WebRenderLayerManager.h"
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -2094,17 +2094,17 @@ void WebRenderBridgeParent::NotifyDidSce
   // If the scheduler has a composite more recent than our last composite (which
   // we missed), and we're within the threshold ms of the last vsync, then
   // kick of a late composite.
   TimeStamp lastVsync = mCompositorScheduler->GetLastVsyncTime();
   VsyncId lastVsyncId = mCompositorScheduler->GetLastVsyncId();
   if (lastVsyncId == VsyncId() || !mMostRecentComposite ||
       mMostRecentComposite >= lastVsync ||
       ((TimeStamp::Now() - lastVsync).ToMilliseconds() >
-       gfxPrefs::WebRenderLateSceneBuildThreshold())) {
+       StaticPrefs::WebRenderLateSceneBuildThreshold())) {
     mCompositorScheduler->ScheduleComposition();
     return;
   }
 
   // Look through all the pipelines contained within the built scene
   // and check which vsync they initiated from.
   auto info = aInfo->Raw();
   for (uintptr_t i = 0; i < info.epochs.length; i++) {
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -1611,18 +1611,18 @@ void WebRenderCommandBuilder::BuildWebRe
   // Remove the user data those are not displayed on the screen and
   // also reset the data to unused for next transaction.
   RemoveUnusedAndResetWebRenderUserData();
 }
 
 bool WebRenderCommandBuilder::ShouldDumpDisplayList(
     nsDisplayListBuilder* aBuilder) {
   return aBuilder != nullptr && aBuilder->IsInActiveDocShell() &&
-         ((XRE_IsParentProcess() && gfxPrefs::WebRenderDLDumpParent()) ||
-          (XRE_IsContentProcess() && gfxPrefs::WebRenderDLDumpContent()));
+         ((XRE_IsParentProcess() && StaticPrefs::WebRenderDLDumpParent()) ||
+          (XRE_IsContentProcess() && StaticPrefs::WebRenderDLDumpContent()));
 }
 
 void WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(
     nsDisplayList* aDisplayList, nsDisplayItem* aWrappingItem,
     nsDisplayListBuilder* aDisplayListBuilder, const StackingContextHelper& aSc,
     wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources) {
   AutoRestore<ClipManager*> prevClipManager(mCurrentClipManager);
   mCurrentClipManager = &mClipManagers[aBuilder.GetRenderRoot()];
@@ -2081,19 +2081,19 @@ static bool PaintItemByDrawTarget(nsDisp
 }
 
 already_AddRefed<WebRenderFallbackData>
 WebRenderCommandBuilder::GenerateFallbackData(
     nsDisplayItem* aItem, wr::DisplayListBuilder& aBuilder,
     wr::IpcResourceUpdateQueue& aResources, const StackingContextHelper& aSc,
     nsDisplayListBuilder* aDisplayListBuilder, LayoutDeviceRect& aImageRect) {
   bool useBlobImage =
-      gfxPrefs::WebRenderBlobImages() && !aItem->MustPaintOnContentSide();
+      StaticPrefs::WebRenderBlobImages() && !aItem->MustPaintOnContentSide();
   Maybe<gfx::Color> highlight = Nothing();
-  if (gfxPrefs::WebRenderHighlightPaintedLayers()) {
+  if (StaticPrefs::WebRenderHighlightPaintedLayers()) {
     highlight = Some(useBlobImage ? gfx::Color(1.0, 0.0, 0.0, 0.5)
                                   : gfx::Color(1.0, 1.0, 0.0, 0.5));
   }
 
   RefPtr<WebRenderFallbackData> fallbackData =
       CreateOrRecycleWebRenderUserData<WebRenderFallbackData>(
           aItem, aBuilder.GetRenderRoot());
 
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -166,17 +166,17 @@ bool WebRenderLayerManager::BeginTransac
 
   mTransactionStart = TimeStamp::Now();
   mURL = aURL;
 
   // Increment the paint sequence number even if test logging isn't
   // enabled in this process; it may be enabled in the parent process,
   // and the parent process expects unique sequence numbers.
   ++mPaintSequenceNumber;
-  if (gfxPrefs::APZTestLoggingEnabled()) {
+  if (StaticPrefs::APZTestLoggingEnabled()) {
     mApzTestData.StartNewPaint(mPaintSequenceNumber);
   }
   return true;
 }
 
 bool WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags) {
   if (mWindowOverlayChanged) {
     // If the window overlay changed then we can't do an empty transaction
@@ -687,17 +687,17 @@ void WebRenderLayerManager::FlushRenderi
   // might happen.
   bool resizing = mWidget && mWidget->IsResizingNativeWidget().valueOr(true);
 
   // Limit async FlushRendering to !resizing and Win DComp.
   // XXX relax the limitation
   if (WrBridge()->GetCompositorUseDComp() && !resizing) {
     cBridge->SendFlushRenderingAsync();
   } else if (mWidget->SynchronouslyRepaintOnResize() ||
-             gfxPrefs::LayersForceSynchronousResize()) {
+             StaticPrefs::LayersForceSynchronousResize()) {
     cBridge->SendFlushRendering();
   } else {
     cBridge->SendFlushRenderingAsync();
   }
 }
 
 void WebRenderLayerManager::WaitOnTransactionProcessed() {
   CompositorBridgeChild* bridge = GetCompositorBridgeChild();
@@ -721,17 +721,17 @@ void WebRenderLayerManager::SetRoot(Laye
 
 already_AddRefed<PersistentBufferProvider>
 WebRenderLayerManager::CreatePersistentBufferProvider(
     const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat) {
   // Ensure devices initialization for canvas 2d. The devices are lazily
   // initialized with WebRender to reduce memory usage.
   gfxPlatform::GetPlatform()->EnsureDevicesInitialized();
 
-  if (gfxPrefs::PersistentBufferProviderSharedEnabled()) {
+  if (StaticPrefs::PersistentBufferProviderSharedEnabled()) {
     RefPtr<PersistentBufferProvider> provider =
         PersistentBufferProviderShared::Create(aSize, aFormat,
                                                AsKnowsCompositor());
     if (provider) {
       return provider.forget();
     }
   }
   return LayerManager::CreatePersistentBufferProvider(aSize, aFormat);
--- a/gfx/layers/wr/WebRenderLayerManager.h
+++ b/gfx/layers/wr/WebRenderLayerManager.h
@@ -6,20 +6,20 @@
 
 #ifndef GFX_WEBRENDERLAYERMANAGER_H
 #define GFX_WEBRENDERLAYERMANAGER_H
 
 #include <unordered_set>
 #include <unordered_map>
 #include <vector>
 
-#include "gfxPrefs.h"
 #include "Layers.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/MozPromise.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/layers/APZTestData.h"
 #include "mozilla/layers/FocusTarget.h"
 #include "mozilla/layers/IpcResourceUpdateQueue.h"
 #include "mozilla/layers/RenderRootStateManager.h"
 #include "mozilla/layers/SharedSurfacesChild.h"
 #include "mozilla/layers/StackingContextHelper.h"
 #include "mozilla/layers/TransactionIdAllocator.h"
 #include "mozilla/layers/WebRenderCommandBuilder.h"
@@ -149,23 +149,23 @@ class WebRenderLayerManager final : publ
   void WrReleasedImages(const nsTArray<wr::ExternalImageKeyPair>& aPairs);
 
   WebRenderBridgeChild* WrBridge() const { return mWrChild; }
 
   // See equivalent function in ClientLayerManager
   void LogTestDataForCurrentPaint(ScrollableLayerGuid::ViewID aScrollId,
                                   const std::string& aKey,
                                   const std::string& aValue) {
-    MOZ_ASSERT(gfxPrefs::APZTestLoggingEnabled(), "don't call me");
+    MOZ_ASSERT(StaticPrefs::APZTestLoggingEnabled(), "don't call me");
     mApzTestData.LogTestDataForPaint(mPaintSequenceNumber, aScrollId, aKey,
                                      aValue);
   }
   void LogAdditionalTestData(const std::string& aKey,
                              const std::string& aValue) {
-    MOZ_ASSERT(gfxPrefs::APZTestLoggingEnabled(), "don't call me");
+    MOZ_ASSERT(StaticPrefs::APZTestLoggingEnabled(), "don't call me");
     mApzTestData.RecordAdditionalData(aKey, aValue);
   }
 
   // See equivalent function in ClientLayerManager
   const APZTestData& GetAPZTestData() const { return mApzTestData; }
 
   WebRenderCommandBuilder& CommandBuilder() { return mWebRenderCommandBuilder; }
   WebRenderUserDataRefTable* GetWebRenderUserDataTable() {
--- a/gfx/src/DriverCrashGuard.cpp
+++ b/gfx/src/DriverCrashGuard.cpp
@@ -504,21 +504,21 @@ bool GLContextCrashGuard::UpdateEnvironm
   }
 
   checked = true;
 
   bool changed = false;
 
 #if defined(XP_WIN)
   changed |= CheckAndUpdateBoolPref("gfx.driver-init.webgl-angle-force-d3d11",
-                                    gfxPrefs::WebGLANGLEForceD3D11());
+                                    StaticPrefs::WebGLANGLEForceD3D11());
   changed |= CheckAndUpdateBoolPref("gfx.driver-init.webgl-angle-try-d3d11",
-                                    gfxPrefs::WebGLANGLETryD3D11());
+                                    StaticPrefs::WebGLANGLETryD3D11());
   changed |= CheckAndUpdateBoolPref("gfx.driver-init.webgl-angle-force-warp",
-                                    gfxPrefs::WebGLANGLEForceWARP());
+                                    StaticPrefs::WebGLANGLEForceWARP());
   changed |= CheckAndUpdateBoolPref(
       "gfx.driver-init.webgl-angle",
       FeatureEnabled(nsIGfxInfo::FEATURE_WEBGL_ANGLE, false));
   changed |= CheckAndUpdateBoolPref(
       "gfx.driver-init.direct3d11-angle",
       FeatureEnabled(nsIGfxInfo::FEATURE_DIRECT3D_11_ANGLE, false));
 #endif
 
--- a/gfx/tests/gtest/TestGfxPrefs.cpp
+++ b/gfx/tests/gtest/TestGfxPrefs.cpp
@@ -17,74 +17,52 @@
 // result through this API.
 
 TEST(GfxPrefs, Singleton)
 {
   gfxPrefs::GetSingleton();
   ASSERT_TRUE(gfxPrefs::SingletonExists());
 }
 
-TEST(GfxPrefs, LiveValues)
-{
-  gfxPrefs::GetSingleton();
-  ASSERT_TRUE(gfxPrefs::SingletonExists());
-
-  // Live boolean, default false
-  ASSERT_FALSE(gfxPrefs::LayersDumpTexture());
-
-  // Live int32_t, default 23456
-  ASSERT_TRUE(gfxPrefs::LayerScopePort() == 23456);
-
-  // Live uint32_t, default 2
-  ASSERT_TRUE(gfxPrefs::MSAALevel() == 2);
-}
-
 TEST(GfxPrefs, OnceValues)
 {
   gfxPrefs::GetSingleton();
   ASSERT_TRUE(gfxPrefs::SingletonExists());
 
   // Once boolean, default true
   ASSERT_TRUE(gfxPrefs::WorkAroundDriverBugs());
 
   // Once boolean, default false
-  ASSERT_FALSE(gfxPrefs::LayersDump());
+  ASSERT_FALSE(gfxPrefs::UseApitrace());
 
   // Once uint32_t, default 5
   ASSERT_TRUE(gfxPrefs::APZMaxVelocityQueueSize() == 5);
 
-  // Once float, default -1 (should be OK with ==)
-  ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f);
+  // Once float, default 0 (should be OK with ==)
+  ASSERT_TRUE(gfxPrefs::APZCurveFunctionX1() == 0.0f);
 }
 
 TEST(GfxPrefs, Set)
 {
   gfxPrefs::GetSingleton();
   ASSERT_TRUE(gfxPrefs::SingletonExists());
 
   // Once boolean, default false
-  ASSERT_FALSE(gfxPrefs::LayersDump());
-  gfxPrefs::SetLayersDump(true);
-  ASSERT_TRUE(gfxPrefs::LayersDump());
-  gfxPrefs::SetLayersDump(false);
-  ASSERT_FALSE(gfxPrefs::LayersDump());
+  ASSERT_FALSE(gfxPrefs::UseApitrace());
+  gfxPrefs::SetUseApitrace(true);
+  ASSERT_TRUE(gfxPrefs::UseApitrace());
+  gfxPrefs::SetUseApitrace(false);
+  ASSERT_FALSE(gfxPrefs::UseApitrace());
 
-  // Live boolean, default false
-  ASSERT_FALSE(gfxPrefs::LayersDumpTexture());
-  gfxPrefs::SetLayersDumpTexture(true);
-  ASSERT_TRUE(gfxPrefs::LayersDumpTexture());
-  gfxPrefs::SetLayersDumpTexture(false);
-  ASSERT_FALSE(gfxPrefs::LayersDumpTexture());
-
-  // Once float, default -1
-  ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f);
-  gfxPrefs::SetAPZMaxVelocity(1.75f);
-  ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == 1.75f);
-  gfxPrefs::SetAPZMaxVelocity(-1.0f);
-  ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f);
+  // Once float, default 0
+  ASSERT_TRUE(gfxPrefs::APZCurveFunctionX1() == 0.0f);
+  gfxPrefs::SetAPZCurveFunctionX1(1.75f);
+  ASSERT_TRUE(gfxPrefs::APZCurveFunctionX1() == 1.75f);
+  gfxPrefs::SetAPZCurveFunctionX1(0.0f);
+  ASSERT_TRUE(gfxPrefs::APZCurveFunctionX1() == 0.0f);
 }
 
 // Randomly test the function we use in nsExceptionHandler.cpp here:
 extern bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength);
 TEST(GfxPrefs, StringUtility)
 {
   char testBuffer[64];
   double testVal[] = {
--- a/gfx/thebes/D3D11Checks.cpp
+++ b/gfx/thebes/D3D11Checks.cpp
@@ -5,16 +5,17 @@
 
 #include "D3D11Checks.h"
 #include "DXVA2Manager.h"
 #include "gfxConfig.h"
 #include "GfxDriverInfo.h"
 #include "gfxPrefs.h"
 #include "gfxWindowsPlatform.h"
 #include "mozilla/RefPtr.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/gfx/Logging.h"
 #include "mozilla/layers/TextureD3D11.h"
 #include "nsIGfxInfo.h"
 #include <dxgi.h>
 #include <dxgi1_2.h>
 #include <d3d10_1.h>
 #include <d3d11.h>
@@ -443,26 +444,28 @@ bool D3D11Checks::DoesRemotePresentWork(
     nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
     if (gfxInfo) {
       gfxInfo->GetAdapterDriverVersion(version);
     }
     return DXVA2Manager::IsNV12Supported(desc.VendorId, desc.DeviceId, version);
   };
 
   auto doesP010Work = [&]() {
-    if (gfxVars::DXP010Blocked() && !gfxPrefs::PDMWMFForceAllowP010Format()) {
+    if (gfxVars::DXP010Blocked() &&
+        !StaticPrefs::PDMWMFForceAllowP010Format()) {
       return false;
     }
     UINT formatSupport;
     HRESULT hr = device->CheckFormatSupport(DXGI_FORMAT_P010, &formatSupport);
     return (SUCCEEDED(hr) && (formatSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D));
   };
 
   auto doesP016Work = [&]() {
-    if (gfxVars::DXP016Blocked() && !gfxPrefs::PDMWMFForceAllowP010Format()) {
+    if (gfxVars::DXP016Blocked() &&
+        !StaticPrefs::PDMWMFForceAllowP010Format()) {
       return false;
     }
     UINT formatSupport;
     HRESULT hr = device->CheckFormatSupport(DXGI_FORMAT_P016, &formatSupport);
     return (SUCCEEDED(hr) && (formatSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D));
   };
 
   VideoFormatOptionSet options;
--- a/gfx/thebes/DeviceManagerDx.cpp
+++ b/gfx/thebes/DeviceManagerDx.cpp
@@ -5,16 +5,17 @@
 
 #include "DeviceManagerDx.h"
 #include "D3D11Checks.h"
 #include "gfxConfig.h"
 #include "GfxDriverInfo.h"
 #include "gfxPrefs.h"
 #include "gfxWindowsPlatform.h"
 #include "mozilla/D3DMessageUtils.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/WindowsVersion.h"
 #include "mozilla/gfx/GPUParent.h"
 #include "mozilla/gfx/GraphicsMessages.h"
 #include "mozilla/gfx/Logging.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/layers/CompositorBridgeChild.h"
 #include "mozilla/layers/CompositorThread.h"
@@ -399,17 +400,17 @@ IDXGIAdapter1* DeviceManagerDx::GetDXGIA
   dxgiModule.disown();
   return mAdapter;
 }
 
 bool DeviceManagerDx::CreateCompositorDeviceHelper(
     FeatureState& aD3d11, IDXGIAdapter1* aAdapter, bool aAttemptVideoSupport,
     RefPtr<ID3D11Device>& aOutDevice) {
   // Check if a failure was injected for testing.
-  if (gfxPrefs::DeviceFailForTesting()) {
+  if (StaticPrefs::DeviceFailForTesting()) {
     aD3d11.SetFailed(FeatureStatus::Failed,
                      "Direct3D11 device failure simulated by preference",
                      NS_LITERAL_CSTRING("FEATURE_FAILURE_D3D11_SIM"));
     return false;
   }
 
   // Use D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS
   // to prevent bug 1092260. IE 11 also uses this flag.
@@ -702,23 +703,23 @@ RefPtr<ID3D11Device> DeviceManagerDx::Cr
     MutexAutoLock lock(mDeviceLock);
     if (!mDeviceStatus) {
       return nullptr;
     }
     isAMD = mDeviceStatus->adapter().VendorId == 0x1002;
   }
 
   bool reuseDevice = false;
-  if (gfxPrefs::Direct3D11ReuseDecoderDevice() < 0) {
+  if (StaticPrefs::Direct3D11ReuseDecoderDevice() < 0) {
     // Use the default logic, which is to allow reuse of devices on AMD, but
     // create separate devices everywhere else.
     if (isAMD) {
       reuseDevice = true;
     }
-  } else if (gfxPrefs::Direct3D11ReuseDecoderDevice() > 0) {
+  } else if (StaticPrefs::Direct3D11ReuseDecoderDevice() > 0) {
     reuseDevice = true;
   }
 
   if (reuseDevice) {
     if (mCompositorDevice && mCompositorDeviceSupportsVideo &&
         !mDecoderDevice) {
       mDecoderDevice = mCompositorDevice;
 
@@ -986,18 +987,18 @@ bool DeviceManagerDx::GetAnyDeviceRemove
   mDeviceLock.AssertCurrentThreadOwns();
 
   if (DidDeviceReset(mCompositorDevice, aOutReason) ||
       DidDeviceReset(mContentDevice, aOutReason)) {
     return true;
   }
 
   if (XRE_IsParentProcess() && NS_IsMainThread() &&
-      gfxPrefs::DeviceResetForTesting()) {
-    gfxPrefs::SetDeviceResetForTesting(0);
+      StaticPrefs::DeviceResetForTesting()) {
+    StaticPrefs::SetDeviceResetForTesting(0);
     *aOutReason = DeviceResetReason::FORCED_RESET;
     return true;
   }
 
   return false;
 }
 
 void DeviceManagerDx::ForceDeviceReset(ForcedDeviceResetReason aReason) {
@@ -1086,17 +1087,17 @@ bool DeviceManagerDx::TextureSharingWork
   if (!mDeviceStatus) {
     return false;
   }
   return mDeviceStatus->textureSharingWorks();
 }
 
 bool DeviceManagerDx::CanInitializeKeyedMutexTextures() {
   MutexAutoLock lock(mDeviceLock);
-  return mDeviceStatus && gfxPrefs::Direct3D11AllowKeyedMutex() &&
+  return mDeviceStatus && StaticPrefs::Direct3D11AllowKeyedMutex() &&
          gfxVars::AllowD3D11KeyedMutex();
 }
 
 bool DeviceManagerDx::HasCrashyInitData() {
   MutexAutoLock lock(mDeviceLock);
   if (!mDeviceStatus) {
     return false;
   }
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -15,16 +15,17 @@
 #include "mozilla/webrender/RenderThread.h"
 #include "mozilla/webrender/WebRenderAPI.h"
 #include "mozilla/webrender/webrender_ffi.h"
 #include "mozilla/layers/PaintThread.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/gfx/GPUProcessManager.h"
 #include "mozilla/gfx/GraphicsMessages.h"
 #include "mozilla/ClearOnShutdown.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Unused.h"
 #include "mozilla/IntegerPrintfMacros.h"
 
 #include "mozilla/Logging.h"
 #include "mozilla/Services.h"
 #include "nsAppDirectoryServiceDefs.h"
@@ -893,21 +894,21 @@ void gfxPlatform::Init() {
     // Layers prefs
     forcedPrefs.AppendPrintf(
         "-L%d%d%d%d", gfxPrefs::LayersAMDSwitchableGfxEnabled(),
         gfxPrefs::LayersAccelerationDisabledDoNotUseDirectly(),
         gfxPrefs::LayersAccelerationForceEnabledDoNotUseDirectly(),
         gfxPrefs::LayersD3D11ForceWARP());
     // WebGL prefs
     forcedPrefs.AppendPrintf(
-        "-W%d%d%d%d%d%d%d%d", gfxPrefs::WebGLANGLEForceD3D11(),
-        gfxPrefs::WebGLANGLEForceWARP(), gfxPrefs::WebGLDisabled(),
-        gfxPrefs::WebGLDisableANGLE(), gfxPrefs::WebGLDXGLEnabled(),
-        gfxPrefs::WebGLForceEnabled(), gfxPrefs::WebGLForceLayersReadback(),
-        gfxPrefs::WebGLForceMSAA());
+        "-W%d%d%d%d%d%d%d%d", StaticPrefs::WebGLANGLEForceD3D11(),
+        StaticPrefs::WebGLANGLEForceWARP(), StaticPrefs::WebGLDisabled(),
+        StaticPrefs::WebGLDisableANGLE(), StaticPrefs::WebGLDXGLEnabled(),
+        StaticPrefs::WebGLForceEnabled(), gfxPrefs::WebGLForceLayersReadback(),
+        StaticPrefs::WebGLForceMSAA());
     // Prefs that don't fit into any of the other sections
     forcedPrefs.AppendPrintf("-T%d%d%d) ", gfxPrefs::AndroidRGB16Force(),
                              0,  // SkiaGL canvas no longer supported
                              gfxPrefs::ForceShmemTiles());
     ScopedGfxFeatureReporter::AppNote(forcedPrefs);
   }
 
   InitMoz2DLogging();
@@ -946,17 +947,17 @@ void gfxPlatform::Init() {
 #endif
   gPlatform->PopulateScreenInfo();
   gPlatform->InitAcceleration();
   gPlatform->InitWebRenderConfig();
   // When using WebRender, we defer initialization of the D3D11 devices until
   // the (rare) cases where they're used. Note that the GPU process where
   // WebRender runs doesn't initialize gfxPlatform and performs explicit
   // initialization of the bits it needs.
-  if (!gfxVars::UseWebRender()) {
+  if (!UseWebRender()) {
     gPlatform->EnsureDevicesInitialized();
   }
   gPlatform->InitOMTPConfig();
 
   if (gfxConfig::IsEnabled(Feature::GPU_PROCESS)) {
     GPUProcessManager* gpu = GPUProcessManager::Get();
     gpu->LaunchGPUProcess();
   }
@@ -1040,17 +1041,17 @@ void gfxPlatform::Init() {
 
   // Request the imgITools service, implicitly initializing ImageLib.
   nsCOMPtr<imgITools> imgTools = do_GetService("@mozilla.org/image/tools;1");
   if (!imgTools) {
     MOZ_CRASH("Could not initialize ImageLib");
   }
 
   RegisterStrongMemoryReporter(new GfxMemoryImageReporter());
-  if (XRE_IsParentProcess() && gfxVars::UseWebRender()) {
+  if (XRE_IsParentProcess() && UseWebRender()) {
     RegisterStrongAsyncMemoryReporter(new WebRenderMemoryReporter());
   }
 
 #ifdef USE_SKIA
   RegisterStrongMemoryReporter(new SkMemoryReporter());
 #endif
   mlg::InitializeMemoryReporters();
 
@@ -1145,16 +1146,19 @@ bool gfxPlatform::IsHeadless() {
   static bool headless = false;
   if (!initialized) {
     initialized = true;
     headless = PR_GetEnv("MOZ_HEADLESS");
   }
   return headless;
 }
 
+/* static */
+bool gfxPlatform::UseWebRender() { return gfx::gfxVars::UseWebRender(); }
+
 static bool sLayersIPCIsUp = false;
 
 /* static */
 void gfxPlatform::InitNullMetadata() {
   ScrollMetadata::sNullMetadata = new ScrollMetadata();
   ClearOnShutdown(&ScrollMetadata::sNullMetadata);
 }
 
@@ -1246,18 +1250,17 @@ void gfxPlatform::InitLayersIPC() {
 
   if (XRE_IsContentProcess()) {
     if (gfxVars::UseOMTP() && !recordreplay::IsRecordingOrReplaying()) {
       layers::PaintThread::Start();
     }
   }
 
   if (XRE_IsParentProcess() || recordreplay::IsRecordingOrReplaying()) {
-    if (!gfxConfig::IsEnabled(Feature::GPU_PROCESS) &&
-        gfxVars::UseWebRender()) {
+    if (!gfxConfig::IsEnabled(Feature::GPU_PROCESS) && UseWebRender()) {
       wr::RenderThread::Start();
       image::ImageMemoryReporter::InitForWebRender();
     }
 
     layers::CompositorThreadHolder::Start();
   }
 }
 
@@ -1266,17 +1269,17 @@ void gfxPlatform::ShutdownLayersIPC() {
   if (!sLayersIPCIsUp) {
     return;
   }
   sLayersIPCIsUp = false;
 
   if (XRE_IsContentProcess()) {
     gfx::VRManagerChild::ShutDown();
     // cf bug 1215265.
-    if (gfxPrefs::ChildProcessShutdown()) {
+    if (StaticPrefs::ChildProcessShutdown()) {
       layers::CompositorManagerChild::Shutdown();
       layers::ImageBridgeChild::ShutDown();
     }
 
     if (gfxVars::UseOMTP() && !recordreplay::IsRecordingOrReplaying()) {
       layers::PaintThread::Shutdown();
     }
   } else if (XRE_IsParentProcess()) {
@@ -1284,17 +1287,17 @@ void gfxPlatform::ShutdownLayersIPC() {
     widget::WaylandDisplayShutdown();
 #endif
     gfx::VRManagerChild::ShutDown();
     layers::CompositorManagerChild::Shutdown();
     layers::ImageBridgeChild::ShutDown();
     // This has to happen after shutting down the child protocols.
     layers::CompositorThreadHolder::Shutdown();
     image::ImageMemoryReporter::ShutdownForWebRender();
-    // There is a case that RenderThread exists when gfxVars::UseWebRender() is
+    // There is a case that RenderThread exists when UseWebRender() is
     // false. This could happen when WebRender was fallbacked to compositor.
     if (wr::RenderThread::Get()) {
       wr::RenderThread::ShutDown();
 
       Preferences::UnregisterCallback(WebRenderDebugPrefChangeCallback,
                                       WR_DEBUG_PREF);
     }
 
@@ -1832,26 +1835,26 @@ gfxFontEntry* gfxPlatform::MakePlatformF
                                             uint32_t aLength) {
   return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(
       aFontName, aWeightForEntry, aStretchForEntry, aStyleForEntry, aFontData,
       aLength);
 }
 
 mozilla::layers::DiagnosticTypes gfxPlatform::GetLayerDiagnosticTypes() {
   mozilla::layers::DiagnosticTypes type = DiagnosticTypes::NO_DIAGNOSTIC;
-  if (gfxPrefs::DrawLayerBorders()) {
+  if (StaticPrefs::DrawLayerBorders()) {
     type |= mozilla::layers::DiagnosticTypes::LAYER_BORDERS;
   }
-  if (gfxPrefs::DrawTileBorders()) {
+  if (StaticPrefs::DrawTileBorders()) {
     type |= mozilla::layers::DiagnosticTypes::TILE_BORDERS;
   }
-  if (gfxPrefs::DrawBigImageBorders()) {
+  if (StaticPrefs::DrawBigImageBorders()) {
     type |= mozilla::layers::DiagnosticTypes::BIGIMAGE_BORDERS;
   }
-  if (gfxPrefs::FlashLayerBorders()) {
+  if (StaticPrefs::FlashLayerBorders()) {
     type |= mozilla::layers::DiagnosticTypes::FLASH_BORDERS;
   }
   return type;
 }
 
 BackendPrefsData gfxPlatform::GetBackendPrefs() const {
   BackendPrefsData data;
 
@@ -1955,39 +1958,39 @@ bool gfxPlatform::InSafeMode() {
 }
 
 bool gfxPlatform::OffMainThreadCompositingEnabled() {
   return UsesOffMainThreadCompositing();
 }
 
 eCMSMode gfxPlatform::GetCMSMode() {
   if (!gCMSInitialized) {
-    int32_t mode = gfxPrefs::CMSMode();
+    int32_t mode = StaticPrefs::CMSMode();
     if (mode >= 0 && mode < eCMSMode_AllCount) {
       gCMSMode = static_cast<eCMSMode>(mode);
     }
 
-    bool enableV4 = gfxPrefs::CMSEnableV4();
+    bool enableV4 = StaticPrefs::CMSEnableV4();
     if (enableV4) {
       qcms_enable_iccv4();
     }
     gCMSInitialized = true;
   }
   return gCMSMode;
 }
 
 int gfxPlatform::GetRenderingIntent() {
-  // gfxPrefs.h is using 0 as the default for the rendering
+  // StaticPrefs.h is using 0 as the default for the rendering
   // intent preference, based on that being the value for
   // QCMS_INTENT_DEFAULT.  Assert here to catch if that ever
   // changes and we can then figure out what to do about it.
   MOZ_ASSERT(QCMS_INTENT_DEFAULT == 0);
 
   /* Try to query the pref system for a rendering intent. */
-  int32_t pIntent = gfxPrefs::CMSRenderingIntent();
+  int32_t pIntent = StaticPrefs::CMSRenderingIntent();
   if ((pIntent < QCMS_INTENT_MIN) || (pIntent > QCMS_INTENT_MAX)) {
     /* If the pref is out of range, use embedded profile. */
     pIntent = -1;
   }
   return pIntent;
 }
 
 void gfxPlatform::TransformPixel(const Color& in, Color& out,
@@ -2416,17 +2419,17 @@ void gfxPlatform::InitGPUProcessPrefs() 
                          NS_LITERAL_CSTRING("FEATURE_FAILURE_HEADLESS_MODE"));
     return;
   }
   if (InSafeMode()) {
     gpuProc.ForceDisable(FeatureStatus::Blocked, "Safe-mode is enabled",
                          NS_LITERAL_CSTRING("FEATURE_FAILURE_SAFE_MODE"));
     return;
   }
-  if (gfxPrefs::LayerScopeEnabled()) {
+  if (StaticPrefs::LayerScopeEnabled()) {
     gpuProc.ForceDisable(FeatureStatus::Blocked,
                          "LayerScope does not work in the GPU process",
                          NS_LITERAL_CSTRING("FEATURE_FAILURE_LAYERSCOPE"));
     return;
   }
 }
 
 void gfxPlatform::InitCompositorAccelerationPrefs() {
@@ -2757,17 +2760,17 @@ void gfxPlatform::InitWebRenderConfig() 
     // have their own compositor.
     if (recordreplay::IsRecordingOrReplaying()) {
       gfxVars::SetUseWebRender(false);
     }
 
     // The parent process runs through all the real decision-making code
     // later in this function. For other processes we still want to report
     // the state of the feature for crash reports.
-    if (gfxVars::UseWebRender()) {
+    if (UseWebRender()) {
       reporter.SetSuccessful();
     }
     return;
   }
 
   nsCString failureId;
   FeatureState& featureWebRenderQualified =
       WebRenderHardwareQualificationStatus(GetScreenSize(), HasBattery(),
@@ -2876,18 +2879,17 @@ void gfxPlatform::InitWebRenderConfig() 
     gfxConfig::Disable(Feature::HW_COMPOSITING, FeatureStatus::Blocked,
                        "Acceleration blocked by platform");
   }
 #endif
 
 #ifdef XP_WIN
   if (Preferences::GetBool("gfx.webrender.dcomp-win.enabled", false)) {
     // XXX relax win version to windows 8.
-    if (IsWin10OrLater() && gfxVars::UseWebRender() &&
-        gfxVars::UseWebRenderANGLE()) {
+    if (IsWin10OrLater() && UseWebRender() && gfxVars::UseWebRenderANGLE()) {
       gfxVars::SetUseWebRenderDCompWin(true);
     }
   }
   if (Preferences::GetBool("gfx.webrender.dcomp-win-triple-buffering.enabled",
                            false)) {
     if (gfxVars::UseWebRenderDCompWin()) {
       gfxVars::SetUseWebRenderDCompWinTripleBuffering(true);
     }
@@ -3126,17 +3128,18 @@ void gfxPlatform::GetApzSupportInfo(mozi
   if (SupportsApzTouchInput()) {
     aObj.DefineProperty("ApzTouchInput", 1);
   }
 
   if (SupportsApzDragInput()) {
     aObj.DefineProperty("ApzDragInput", 1);
   }
 
-  if (SupportsApzKeyboardInput() && !gfxPrefs::AccessibilityBrowseWithCaret()) {
+  if (SupportsApzKeyboardInput() &&
+      !StaticPrefs::AccessibilityBrowseWithCaret()) {
     aObj.DefineProperty("ApzKeyboardInput", 1);
   }
 
   if (SupportsApzAutoscrolling()) {
     aObj.DefineProperty("ApzAutoscrollInput", 1);
   }
 }
 
@@ -3230,17 +3233,17 @@ bool gfxPlatform::AsyncPanZoomEnabled() 
     MOZ_ASSERT(NS_IsMainThread());
     gfxPrefs::GetSingleton();
   }
   return gfxPrefs::AsyncPanZoomEnabledDoNotUseDirectly();
 #endif
 }
 
 /*static*/
-bool gfxPlatform::PerfWarnings() { return gfxPrefs::PerfWarnings(); }
+bool gfxPlatform::PerfWarnings() { return StaticPrefs::PerfWarnings(); }
 
 void gfxPlatform::GetAcceleratedCompositorBackends(
     nsTArray<LayersBackend>& aBackends) {
   if (gfxConfig::IsEnabled(Feature::OPENGL_COMPOSITING)) {
     aBackends.AppendElement(LayersBackend::LAYERS_OPENGL);
   } else {
     static int tell_me_once = 0;
     if (!tell_me_once) {
@@ -3342,25 +3345,25 @@ void gfxPlatform::ImportGPUDeviceData(
   gfxConfig::ImportChange(Feature::ADVANCED_LAYERS, aData.advancedLayers());
 }
 
 bool gfxPlatform::SupportsApzTouchInput() const {
   return dom::TouchEvent::PrefEnabled(nullptr);
 }
 
 bool gfxPlatform::SupportsApzDragInput() const {
-  return gfxPrefs::APZDragEnabled();
+  return StaticPrefs::APZDragEnabled();
 }
 
 bool gfxPlatform::SupportsApzKeyboardInput() const {
   return gfxPrefs::APZKeyboardEnabled();
 }
 
 bool gfxPlatform::SupportsApzAutoscrolling() const {
-  return gfxPrefs::APZAutoscrollEnabled();
+  return StaticPrefs::APZAutoscrollEnabled();
 }
 
 void gfxPlatform::InitOpenGLConfig() {
 #ifdef XP_WIN
   // Don't enable by default on Windows, since it could show up in about:support
   // even though it'll never get used. Only attempt if user enables the pref
   if (!Preferences::GetBool("layers.prefer-opengl")) {
     return;
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -198,16 +198,18 @@ class gfxPlatform : public mozilla::laye
   static void InitNullMetadata();
 
   static int32_t MaxTextureSize();
   static int32_t MaxAllocSize();
   static void InitMoz2DLogging();
 
   static bool IsHeadless();
 
+  static bool UseWebRender();
+
   /**
    * Create an offscreen surface of the given dimensions
    * and image format.
    */
   virtual already_AddRefed<gfxASurface> CreateOffscreenSurface(
       const IntSize& aSize, gfxImageFormat aFormat) = 0;
 
   /**
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -284,547 +284,169 @@ class gfxPrefs final {
   };
 
   // clang-format off
 
   // This is where DECL_GFX_PREF for each of the preferences should go.  We
   // will keep these in an alphabetical order to make it easier to see if a
   // method accessing a pref already exists. Just add yours in the list.
 
-  DECL_GFX_PREF(Live, "accessibility.browsewithcaret", AccessibilityBrowseWithCaret, bool, false);
-
   // The apz prefs are explained in AsyncPanZoomController.cpp
-  DECL_GFX_PREF(Live, "apz.allow_double_tap_zooming",          APZAllowDoubleTapZooming, bool, true);
-  DECL_GFX_PREF(Live, "apz.allow_immediate_handoff",           APZAllowImmediateHandoff, bool, true);
-  DECL_GFX_PREF(Live, "apz.allow_zooming",                     APZAllowZooming, bool, false);
-  DECL_GFX_PREF(Live, "apz.android.chrome_fling_physics.enabled", APZUseChromeFlingPhysics, bool, false);
-  DECL_GFX_PREF(Live, "apz.android.chrome_fling_physics.friction", APZChromeFlingPhysicsFriction, float, 0.015f);
-  DECL_GFX_PREF(Live, "apz.android.chrome_fling_physics.inflexion", APZChromeFlingPhysicsInflexion, float, 0.35f);
-  DECL_GFX_PREF(Live, "apz.android.chrome_fling_physics.stop_threshold", APZChromeFlingPhysicsStopThreshold, float, 0.1f);
-  DECL_GFX_PREF(Live, "apz.autoscroll.enabled",                APZAutoscrollEnabled, bool, false);
-  DECL_GFX_PREF(Live, "apz.axis_lock.breakout_angle",          APZAxisBreakoutAngle, float, float(M_PI / 8.0) /* 22.5 degrees */);
-  DECL_GFX_PREF(Live, "apz.axis_lock.breakout_threshold",      APZAxisBreakoutThreshold, float, 1.0f / 32.0f);
-  DECL_GFX_PREF(Live, "apz.axis_lock.direct_pan_angle",        APZAllowedDirectPanAngle, float, float(M_PI / 3.0) /* 60 degrees */);
-  DECL_GFX_PREF(Live, "apz.axis_lock.lock_angle",              APZAxisLockAngle, float, float(M_PI / 6.0) /* 30 degrees */);
-  DECL_GFX_PREF(Live, "apz.axis_lock.mode",                    APZAxisLockMode, int32_t, 0);
-  DECL_GFX_PREF(Live, "apz.content_response_timeout",          APZContentResponseTimeout, int32_t, 400);
-  DECL_GFX_PREF(Live, "apz.danger_zone_x",                     APZDangerZoneX, int32_t, 50);
-  DECL_GFX_PREF(Live, "apz.danger_zone_y",                     APZDangerZoneY, int32_t, 100);
-  DECL_GFX_PREF(Live, "apz.disable_for_scroll_linked_effects", APZDisableForScrollLinkedEffects, bool, false);
-  DECL_GFX_PREF(Live, "apz.displayport_expiry_ms",             APZDisplayPortExpiryTime, uint32_t, 15000);
-  DECL_GFX_PREF(Live, "apz.drag.enabled",                      APZDragEnabled, bool, false);
-  DECL_GFX_PREF(Live, "apz.drag.initial.enabled",              APZDragInitiationEnabled, bool, false);
-  DECL_GFX_PREF(Live, "apz.drag.touch.enabled",                APZTouchDragEnabled, bool, false);
-  DECL_GFX_PREF(Live, "apz.enlarge_displayport_when_clipped",  APZEnlargeDisplayPortWhenClipped, bool, false);
-  DECL_GFX_PREF(Live, "apz.fixed-margin-override.enabled",     APZFixedMarginOverrideEnabled, bool, false);
-  DECL_GFX_PREF(Live, "apz.fixed-margin-override.bottom",      APZFixedMarginOverrideBottom, int32_t, 0);
-  DECL_GFX_PREF(Live, "apz.fixed-margin-override.top",         APZFixedMarginOverrideTop, int32_t, 0);
-  DECL_GFX_PREF(Live, "apz.fling_accel_base_mult",             APZFlingAccelBaseMultiplier, float, 1.0f);
-  DECL_GFX_PREF(Live, "apz.fling_accel_interval_ms",           APZFlingAccelInterval, int32_t, 500);
-  DECL_GFX_PREF(Live, "apz.fling_accel_supplemental_mult",     APZFlingAccelSupplementalMultiplier, float, 1.0f);
-  DECL_GFX_PREF(Live, "apz.fling_accel_min_velocity",          APZFlingAccelMinVelocity, float, 1.5f);
   DECL_GFX_PREF(Once, "apz.fling_curve_function_x1",           APZCurveFunctionX1, float, 0.0f);
   DECL_GFX_PREF(Once, "apz.fling_curve_function_x2",           APZCurveFunctionX2, float, 1.0f);
   DECL_GFX_PREF(Once, "apz.fling_curve_function_y1",           APZCurveFunctionY1, float, 0.0f);
   DECL_GFX_PREF(Once, "apz.fling_curve_function_y2",           APZCurveFunctionY2, float, 1.0f);
-  DECL_GFX_PREF(Live, "apz.fling_curve_threshold_inches_per_ms", APZCurveThreshold, float, -1.0f);
-  DECL_GFX_PREF(Live, "apz.fling_friction",                    APZFlingFriction, float, 0.002f);
-  DECL_GFX_PREF(Live, "apz.fling_min_velocity_threshold",      APZFlingMinVelocityThreshold, float, 0.5f);
-  DECL_GFX_PREF(Live, "apz.fling_stop_on_tap_threshold",       APZFlingStopOnTapThreshold, float, 0.05f);
-  DECL_GFX_PREF(Live, "apz.fling_stopped_threshold",           APZFlingStoppedThreshold, float, 0.01f);
-  DECL_GFX_PREF(Live, "apz.frame_delay.enabled",               APZFrameDelayEnabled, bool, false);
   DECL_GFX_PREF(Once, "apz.keyboard.enabled",                  APZKeyboardEnabled, bool, false);
-  DECL_GFX_PREF(Live, "apz.keyboard.passive-listeners",        APZKeyboardPassiveListeners, bool, false);
-  DECL_GFX_PREF(Live, "apz.max_tap_time",                      APZMaxTapTime, int32_t, 300);
-  DECL_GFX_PREF(Live, "apz.max_velocity_inches_per_ms",        APZMaxVelocity, float, -1.0f);
   DECL_GFX_PREF(Once, "apz.max_velocity_queue_size",           APZMaxVelocityQueueSize, uint32_t, 5);
-  DECL_GFX_PREF(Live, "apz.min_skate_speed",                   APZMinSkateSpeed, float, 1.0f);
-  DECL_GFX_PREF(Live, "apz.minimap.enabled",                   APZMinimap, bool, false);
-  DECL_GFX_PREF(Live, "apz.one_touch_pinch.enabled",           APZOneTouchPinchEnabled, bool, true);
-  DECL_GFX_PREF(Live, "apz.overscroll.enabled",                APZOverscrollEnabled, bool, false);
-  DECL_GFX_PREF(Live, "apz.overscroll.min_pan_distance_ratio", APZMinPanDistanceRatio, float, 1.0f);
-  DECL_GFX_PREF(Live, "apz.overscroll.spring_stiffness",       APZOverscrollSpringStiffness, float, 0.001f);
-  DECL_GFX_PREF(Live, "apz.overscroll.stop_distance_threshold", APZOverscrollStopDistanceThreshold, float, 5.0f);
-  DECL_GFX_PREF(Live, "apz.paint_skipping.enabled",            APZPaintSkipping, bool, true);
-  DECL_GFX_PREF(Live, "apz.peek_messages.enabled",             APZPeekMessages, bool, true);
-  DECL_GFX_PREF(Live, "apz.pinch_lock.mode",                   APZPinchLockMode, int32_t, 1);
-  DECL_GFX_PREF(Live, "apz.pinch_lock.scroll_lock_threshold",  APZPinchLockScrollLockThreshold, float, 1.0f / 32.0f);
-  DECL_GFX_PREF(Live, "apz.pinch_lock.span_breakout_threshold", APZPinchLockSpanBreakoutThreshold, float, 1.0f / 32.0f);
-  DECL_GFX_PREF(Live, "apz.pinch_lock.span_lock_threshold",    APZPinchLockSpanLockThreshold, float, 1.0f / 32.0f);
   DECL_GFX_PREF(Once, "apz.pinch_lock.buffer_max_age",         APZPinchLockBufferMaxAge, int32_t, 50);
-  DECL_GFX_PREF(Live, "apz.popups.enabled",                    APZPopupsEnabled, bool, false);
-  DECL_GFX_PREF(Live, "apz.printtree",                         APZPrintTree, bool, false);
-  DECL_GFX_PREF(Live, "apz.record_checkerboarding",            APZRecordCheckerboarding, bool, false);
-  DECL_GFX_PREF(Live, "apz.second_tap_tolerance",              APZSecondTapTolerance, float, 0.5f);
-  DECL_GFX_PREF(Live, "apz.test.fails_with_native_injection",  APZTestFailsWithNativeInjection, bool, false);
-  DECL_GFX_PREF(Live, "apz.test.logging_enabled",              APZTestLoggingEnabled, bool, false);
-  DECL_GFX_PREF(Live, "apz.touch_move_tolerance",              APZTouchMoveTolerance, float, 0.1f);
-  DECL_GFX_PREF(Live, "apz.touch_start_tolerance",             APZTouchStartTolerance, float, 1.0f/4.5f);
-  DECL_GFX_PREF(Live, "apz.velocity_bias",                     APZVelocityBias, float, 0.0f);
-  DECL_GFX_PREF(Live, "apz.velocity_relevance_time_ms",        APZVelocityRelevanceTime, uint32_t, 150);
-  DECL_GFX_PREF(Live, "apz.x_skate_highmem_adjust",            APZXSkateHighMemAdjust, float, 0.0f);
-  DECL_GFX_PREF(Live, "apz.x_skate_size_multiplier",           APZXSkateSizeMultiplier, float, 1.5f);
-  DECL_GFX_PREF(Live, "apz.x_stationary_size_multiplier",      APZXStationarySizeMultiplier, float, 3.0f);
-  DECL_GFX_PREF(Live, "apz.y_skate_highmem_adjust",            APZYSkateHighMemAdjust, float, 0.0f);
-  DECL_GFX_PREF(Live, "apz.y_skate_size_multiplier",           APZYSkateSizeMultiplier, float, 2.5f);
-  DECL_GFX_PREF(Live, "apz.y_stationary_size_multiplier",      APZYStationarySizeMultiplier, float, 3.5f);
-  DECL_GFX_PREF(Live, "apz.zoom_animation_duration_ms",        APZZoomAnimationDuration, int32_t, 250);
-  DECL_GFX_PREF(Live, "apz.scale_repaint_delay_ms",            APZScaleRepaintDelay, int32_t, 500);
-  DECL_GFX_PREF(Live, "apz.relative-update.enabled",           APZRelativeUpdate, bool, false);
 
-  DECL_GFX_PREF(Live, "browser.ui.scroll-toolbar-threshold",   ToolbarScrollThreshold, int32_t, 10);
-  DECL_GFX_PREF(Live, "browser.ui.zoom.force-user-scalable",   ForceUserScalable, bool, false);
-  DECL_GFX_PREF(Live, "browser.viewport.desktopWidth",         DesktopViewportWidth, int32_t, 980);
-
-  DECL_GFX_PREF(Live, "dom.ipc.plugins.asyncdrawing.enabled",  PluginAsyncDrawingEnabled, bool, false);
-  DECL_GFX_PREF(Live, "dom.meta-viewport.enabled",             MetaViewportEnabled, bool, false);
   DECL_GFX_PREF(Once, "dom.vr.enabled",                        VREnabled, bool, false);
-  DECL_GFX_PREF(Live, "dom.vr.autoactivate.enabled",           VRAutoActivateEnabled, bool, false);
-  DECL_GFX_PREF(Live, "dom.vr.controller_trigger_threshold",   VRControllerTriggerThreshold, float, 0.1f);
   DECL_GFX_PREF(Once, "dom.vr.external.enabled",               VRExternalEnabled, bool, false);
-  DECL_GFX_PREF(Live, "dom.vr.external.notdetected.timeout",   VRExternalNotDetectedTimeout, int32_t, 60000);
-  DECL_GFX_PREF(Live, "dom.vr.external.quit.timeout",          VRExternalQuitTimeout, int32_t, 10000);
-  DECL_GFX_PREF(Live, "dom.vr.navigation.timeout",             VRNavigationTimeout, int32_t, 1000);
   DECL_GFX_PREF(Once, "dom.vr.oculus.enabled",                 VROculusEnabled, bool, true);
-  DECL_GFX_PREF(Live, "dom.vr.oculus.invisible.enabled",       VROculusInvisibleEnabled, bool, true);
-  DECL_GFX_PREF(Live, "dom.vr.oculus.present.timeout",         VROculusPresentTimeout, int32_t, 500);
-  DECL_GFX_PREF(Live, "dom.vr.oculus.quit.timeout",            VROculusQuitTimeout, int32_t, 10000);
   DECL_GFX_PREF(Once, "dom.vr.openvr.enabled",                 VROpenVREnabled, bool, false);
-  DECL_GFX_PREF(Once, "dom.vr.openvr.action_input",             VROpenVRActionInputEnabled, bool, true);
+  DECL_GFX_PREF(Once, "dom.vr.openvr.action_input",            VROpenVRActionInputEnabled, bool, true);
   DECL_GFX_PREF(Once, "dom.vr.osvr.enabled",                   VROSVREnabled, bool, false);
-  DECL_GFX_PREF(Live, "dom.vr.controller.enumerate.interval",  VRControllerEnumerateInterval, int32_t, 1000);
-  DECL_GFX_PREF(Live, "dom.vr.display.enumerate.interval",     VRDisplayEnumerateInterval, int32_t, 5000);
-  DECL_GFX_PREF(Live, "dom.vr.inactive.timeout",               VRInactiveTimeout, int32_t, 5000);
-  DECL_GFX_PREF(Live, "dom.vr.poseprediction.enabled",         VRPosePredictionEnabled, bool, true);
-  DECL_GFX_PREF(Live, "dom.vr.require-gesture",                VRRequireGesture, bool, true);
-  DECL_GFX_PREF(Live, "dom.vr.puppet.enabled",                 VRPuppetEnabled, bool, false);
-  DECL_GFX_PREF(Live, "dom.vr.puppet.submitframe",             VRPuppetSubmitFrame, uint32_t, 0);
-  DECL_GFX_PREF(Live, "dom.vr.display.rafMaxDuration",         VRDisplayRafMaxDuration, uint32_t, 50);
   DECL_GFX_PREF(Once, "dom.vr.process.enabled",                VRProcessEnabled, bool, false);
   DECL_GFX_PREF(Once, "dom.vr.process.startup_timeout_ms",     VRProcessTimeoutMs, int32_t, 5000);
   DECL_GFX_PREF(Once, "dom.vr.service.enabled",                VRServiceEnabled, bool, true);
-  DECL_GFX_PREF(Live, "dom.w3c_pointer_events.enabled",        PointerEventsEnabled, bool, false);
-
-  DECL_GFX_PREF(Live, "general.smoothScroll",                  SmoothScrollEnabled, bool, true);
-  DECL_GFX_PREF(Live, "general.smoothScroll.currentVelocityWeighting",
-                SmoothScrollCurrentVelocityWeighting, float, 0.25);
-  DECL_GFX_PREF(Live, "general.smoothScroll.durationToIntervalRatio",
-                SmoothScrollDurationToIntervalRatio, int32_t, 200);
-  DECL_GFX_PREF(Live, "general.smoothScroll.lines.durationMaxMS",
-                LineSmoothScrollMaxDurationMs, int32_t, 150);
-  DECL_GFX_PREF(Live, "general.smoothScroll.lines.durationMinMS",
-                LineSmoothScrollMinDurationMs, int32_t, 150);
-  DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel",       WheelSmoothScrollEnabled, bool, true);
-  DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel.durationMaxMS",
-                WheelSmoothScrollMaxDurationMs, int32_t, 400);
-  DECL_GFX_PREF(Live, "general.smoothScroll.mouseWheel.durationMinMS",
-                WheelSmoothScrollMinDurationMs, int32_t, 200);
-  DECL_GFX_PREF(Live, "general.smoothScroll.other.durationMaxMS",
-                OtherSmoothScrollMaxDurationMs, int32_t, 150);
-  DECL_GFX_PREF(Live, "general.smoothScroll.other.durationMinMS",
-                OtherSmoothScrollMinDurationMs, int32_t, 150);
-  DECL_GFX_PREF(Live, "general.smoothScroll.pages",            PageSmoothScrollEnabled, bool, true);
-  DECL_GFX_PREF(Live, "general.smoothScroll.pages.durationMaxMS",
-                PageSmoothScrollMaxDurationMs, int32_t, 150);
-  DECL_GFX_PREF(Live, "general.smoothScroll.pages.durationMinMS",
-                PageSmoothScrollMinDurationMs, int32_t, 150);
-  DECL_GFX_PREF(Live, "general.smoothScroll.pixels.durationMaxMS",
-                PixelSmoothScrollMaxDurationMs, int32_t, 150);
-  DECL_GFX_PREF(Live, "general.smoothScroll.pixels.durationMinMS",
-                PixelSmoothScrollMinDurationMs, int32_t, 150);
-  DECL_GFX_PREF(Live, "general.smoothScroll.stopDecelerationWeighting",
-                SmoothScrollStopDecelerationWeighting, float, 0.4f);
-
-  DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.enabled",
-                SmoothScrollMSDPhysicsEnabled, bool, false);
-  DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.continuousMotionMaxDeltaMS",
-                SmoothScrollMSDPhysicsContinuousMotionMaxDeltaMS, int32_t, 120);
-  DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.motionBeginSpringConstant",
-                SmoothScrollMSDPhysicsMotionBeginSpringConstant, int32_t, 1250);
-  DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.slowdownMinDeltaMS",
-                SmoothScrollMSDPhysicsSlowdownMinDeltaMS, int32_t, 12);
-  DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.slowdownMinDeltaRatio",
-                SmoothScrollMSDPhysicsSlowdownMinDeltaRatio, float, 1.3f);
-  DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.slowdownSpringConstant",
-                SmoothScrollMSDPhysicsSlowdownSpringConstant, int32_t, 2000);
-  DECL_GFX_PREF(Live, "general.smoothScroll.msdPhysics.regularSpringConstant",
-                SmoothScrollMSDPhysicsRegularSpringConstant, int32_t, 1000);
 
   DECL_GFX_PREF(Once, "gfx.android.rgb16.force",               AndroidRGB16Force, bool, false);
   DECL_GFX_PREF(Once, "gfx.apitrace.enabled",                  UseApitrace, bool, false);
 #if defined(RELEASE_OR_BETA)
   // "Skip" means this is locked to the default value in beta and release.
   DECL_GFX_PREF(Skip, "gfx.blocklist.all",                     BlocklistAll, int32_t, 0);
 #else
   DECL_GFX_PREF(Once, "gfx.blocklist.all",                     BlocklistAll, int32_t, 0);
 #endif
-#if defined(MOZ_WIDGET_ANDROID)
-  // Overrides the glClear color used when the surface origin is not (0, 0)
-  // Used for drawing a border around the content.
-  DECL_GFX_PREF(Live, "gfx.compositor.override.clear-color.r", CompositorOverrideClearColorR, float, 0.0f);
-  DECL_GFX_PREF(Live, "gfx.compositor.override.clear-color.g", CompositorOverrideClearColorG, float, 0.0f);
-  DECL_GFX_PREF(Live, "gfx.compositor.override.clear-color.b", CompositorOverrideClearColorB, float, 0.0f);
-  DECL_GFX_PREF(Live, "gfx.compositor.override.clear-color.a", CompositorOverrideClearColorA, float, 0.0f);
-#endif // defined(MOZ_WIDGET_ANDROID)
-  DECL_GFX_PREF(Live, "gfx.compositor.clearstate",             CompositorClearState, bool, false);
-  DECL_GFX_PREF(Live, "gfx.compositor.glcontext.opaque",       CompositorGLContextOpaque, bool, false);
-  // 0x7fff is the maximum supported xlib surface size and is more than enough for canvases.
-  DECL_GFX_PREF(Live, "gfx.canvas.max-size",                   MaxCanvasSize, int32_t, 0x7fff);
-
-  DECL_GFX_PREF(Live, "gfx.color_management.enablev4",         CMSEnableV4, bool, false);
-  DECL_GFX_PREF(Live, "gfx.color_management.mode",             CMSMode, int32_t,-1);
-  // The zero default here should match QCMS_INTENT_DEFAULT from qcms.h
-  DECL_GFX_PREF(Live, "gfx.color_management.rendering_intent", CMSRenderingIntent, int32_t, 0);
-  DECL_GFX_PREF(Live, "gfx.content.always-paint",              AlwaysPaint, bool, false);
   // Size in megabytes
   DECL_GFX_PREF(Once, "gfx.content.skia-font-cache-size",      SkiaContentFontCacheSize, int32_t, 5);
-
   DECL_GFX_PREF(Once, "gfx.device-reset.limit",                DeviceResetLimitCount, int32_t, 10);
   DECL_GFX_PREF(Once, "gfx.device-reset.threshold-ms",         DeviceResetThresholdMilliseconds, int32_t, -1);
-
   DECL_GFX_PREF(Once, "gfx.direct2d.disabled",                 Direct2DDisabled, bool, false);
   DECL_GFX_PREF(Once, "gfx.direct2d.force-enabled",            Direct2DForceEnabled, bool, false);
-  DECL_GFX_PREF(Live, "gfx.direct2d.destroy-dt-on-paintthread",Direct2DDestroyDTOnPaintThread, bool, true);
-  DECL_GFX_PREF(Live, "gfx.direct3d11.reuse-decoder-device",   Direct3D11ReuseDecoderDevice, int32_t, -1);
-  DECL_GFX_PREF(Live, "gfx.direct3d11.allow-keyed-mutex",      Direct3D11AllowKeyedMutex, bool, true);
-  DECL_GFX_PREF(Live, "gfx.direct3d11.use-double-buffering",   Direct3D11UseDoubleBuffering, bool, false);
   DECL_GFX_PREF(Once, "gfx.direct3d11.enable-debug-layer",     Direct3D11EnableDebugLayer, bool, false);
   DECL_GFX_PREF(Once, "gfx.direct3d11.break-on-error",         Direct3D11BreakOnError, bool, false);
   DECL_GFX_PREF(Once, "gfx.direct3d11.sleep-on-create-device", Direct3D11SleepOnCreateDevice, int32_t, 0);
-  DECL_GFX_PREF(Live, "gfx.downloadable_fonts.keep_color_bitmaps", KeepColorBitmaps, bool, false);
-  DECL_GFX_PREF(Live, "gfx.downloadable_fonts.validate_variation_tables", ValidateVariationTables, bool, true);
-  DECL_GFX_PREF(Live, "gfx.downloadable_fonts.otl_validation", ValidateOTLTables, bool, true);
-  DECL_GFX_PREF(Live, "gfx.draw-color-bars",                   CompositorDrawColorBars, bool, false);
   DECL_GFX_PREF(Once, "gfx.e10s.hide-plugins-for-scroll",      HidePluginsForScroll, bool, true);
   DECL_GFX_PREF(Once, "gfx.e10s.font-list.shared",             SharedFontList, bool, false);
-  DECL_GFX_PREF(Live, "gfx.layerscope.enabled",                LayerScopeEnabled, bool, false);
-  DECL_GFX_PREF(Live, "gfx.layerscope.port",                   LayerScopePort, int32_t, 23456);
   // Note that        "gfx.logging.level" is defined in Logging.h.
   DECL_GFX_PREF(Live, "gfx.logging.level",                     GfxLoggingLevel, int32_t, mozilla::gfx::LOG_DEFAULT);
   DECL_GFX_PREF(Once, "gfx.logging.crash.length",              GfxLoggingCrashLength, uint32_t, 16);
-  DECL_GFX_PREF(Live, "gfx.logging.painted-pixel-count.enabled",GfxLoggingPaintedPixelCountEnabled, bool, false);
   // The maximums here are quite conservative, we can tighten them if problems show up.
   DECL_GFX_PREF(Once, "gfx.logging.texture-usage.enabled",     GfxLoggingTextureUsageEnabled, bool, false);
   DECL_GFX_PREF(Once, "gfx.logging.peak-texture-usage.enabled",GfxLoggingPeakTextureUsageEnabled, bool, false);
   DECL_GFX_PREF(Once, "gfx.logging.slow-frames.enabled",       LoggingSlowFramesEnabled, bool, false);
   // Use gfxPlatform::MaxAllocSize instead of the pref directly
   DECL_GFX_PREF(Once, "gfx.max-alloc-size",                    MaxAllocSizeDoNotUseDirectly, int32_t, (int32_t)500000000);
   // Use gfxPlatform::MaxTextureSize instead of the pref directly
   DECL_GFX_PREF(Once, "gfx.max-texture-size",                  MaxTextureSizeDoNotUseDirectly, int32_t, (int32_t)32767);
-  DECL_GFX_PREF(Live, "gfx.partialpresent.force",              PartialPresent, int32_t, 0);
-  DECL_GFX_PREF(Live, "gfx.perf-warnings.enabled",             PerfWarnings, bool, false);
-  DECL_GFX_PREF(Live, "gfx.testing.device-reset",              DeviceResetForTesting, int32_t, 0);
-  DECL_GFX_PREF(Live, "gfx.testing.device-fail",               DeviceFailForTesting, bool, false);
   DECL_GFX_PREF(Once, "gfx.text.disable-aa",                   DisableAllTextAA, bool, false);
-  DECL_GFX_PREF(Live, "gfx.ycbcr.accurate-conversion",         YCbCrAccurateConversion, bool, false);
 
   // Disable surface sharing due to issues with compatible FBConfigs on
   // NVIDIA drivers as described in bug 1193015.
-  DECL_GFX_PREF(Live, "gfx.use-glx-texture-from-pixmap",       UseGLXTextureFromPixmap, bool, false);
   DECL_GFX_PREF(Once, "gfx.use-iosurface-textures",            UseIOSurfaceTextures, bool, false);
   DECL_GFX_PREF(Once, "gfx.use-mutex-on-present",              UseMutexOnPresent, bool, false);
   DECL_GFX_PREF(Once, "gfx.use-surfacetexture-textures",       UseSurfaceTextureTextures, bool, false);
   DECL_GFX_PREF(Once, "gfx.allow-texture-direct-mapping",      AllowTextureDirectMapping, bool, true);
-  DECL_GFX_PREF(Live, "gfx.vsync.collect-scroll-transforms",   CollectScrollTransforms, bool, false);
   DECL_GFX_PREF(Once, "gfx.vsync.compositor.unobserve-count",  CompositorUnobserveCount, int32_t, 10);
 
   DECL_GFX_PREF(Once, "gfx.webrender.all",                     WebRenderAll, bool, false);
   DECL_GFX_PREF(Once, "gfx.webrender.all.qualified",           WebRenderAllQualified, bool, true);
   DECL_GFX_PREF(Once,
                 "gfx.webrender.all.qualified.default",
                 WebRenderAllQualifiedDefault,
                 bool,
                 false);
-  DECL_GFX_PREF(Live, "gfx.webrender.blob-images",             WebRenderBlobImages, bool, true);
-  DECL_GFX_PREF(Live, "gfx.webrender.blob.invalidation",       WebRenderBlobInvalidation, bool, false);
-  DECL_GFX_PREF(Live, "gfx.webrender.blob.paint-flashing",     WebRenderBlobPaintFlashing, bool, false);
-  DECL_GFX_PREF(Live, "gfx.webrender.dl.dump-parent",          WebRenderDLDumpParent, bool, false);
-  DECL_GFX_PREF(Live, "gfx.webrender.dl.dump-content",         WebRenderDLDumpContent, bool, false);
   DECL_GFX_PREF(Once, "gfx.webrender.enabled",                 WebRenderEnabledDoNotUseDirectly, bool, false);
   DECL_GFX_PREF(Once, "gfx.webrender.force-disabled",          WebRenderForceDisabled, bool, false);
-  DECL_GFX_PREF(Live, "gfx.webrender.highlight-painted-layers",WebRenderHighlightPaintedLayers, bool, false);
-  DECL_GFX_PREF(Live, "gfx.webrender.late-scenebuild-threshold", WebRenderLateSceneBuildThreshold, int32_t, 4);
-  DECL_GFX_PREF(Live, "gfx.webrender.max-filter-ops-per-chain", WebRenderMaxFilterOpsPerChain, uint32_t, 64);
-  DECL_GFX_PREF(Live, "gfx.webrender.picture-caching",         WebRenderPictureCaching, bool, false);
   DECL_GFX_PREF(Once, "gfx.webrender.split-render-roots",      WebRenderSplitRenderRoots, bool, false);
-  DECL_GFX_PREF(Live, "gfx.webrender.start-debug-server",      WebRenderStartDebugServer, bool, false);
 
   // Use vsync events generated by hardware
   DECL_GFX_PREF(Once, "gfx.work-around-driver-bugs",           WorkAroundDriverBugs, bool, true);
 
-  DECL_GFX_PREF(Live, "gl.allow-high-power",                   GLAllowHighPower, bool, true);
-  DECL_GFX_PREF(Live, "gl.ignore-dx-interop2-blacklist",       IgnoreDXInterop2Blacklist, bool, false);
-  DECL_GFX_PREF(Live, "gl.msaa-level",                         MSAALevel, uint32_t, 2);
-#if defined(XP_MACOSX)
-  DECL_GFX_PREF(Live, "gl.multithreaded",                      GLMultithreaded, bool, false);
-#endif
-  DECL_GFX_PREF(Live, "gl.require-hardware",                   RequireHardwareGL, bool, false);
-  DECL_GFX_PREF(Live, "gl.use-tls-is-current",                 UseTLSIsCurrent, int32_t, 0);
-
-  DECL_GFX_PREF(Live, "image.animated.decode-on-demand.threshold-kb", ImageAnimatedDecodeOnDemandThresholdKB, uint32_t, 20480);
-  DECL_GFX_PREF(Live, "image.animated.decode-on-demand.batch-size", ImageAnimatedDecodeOnDemandBatchSize, uint32_t, 6);
-  DECL_GFX_PREF(Live, "image.animated.decode-on-demand.recycle", ImageAnimatedDecodeOnDemandRecycle, bool, false);
-  DECL_GFX_PREF(Live, "image.animated.resume-from-last-displayed", ImageAnimatedResumeFromLastDisplayed, bool, false);
-  DECL_GFX_PREF(Live, "image.cache.factor2.threshold-surfaces", ImageCacheFactor2ThresholdSurfaces, int32_t, -1);
-  DECL_GFX_PREF(Live, "image.cache.max-rasterized-svg-threshold-kb", ImageCacheMaxRasterizedSVGThresholdKB, int32_t, 90*1024);
   DECL_GFX_PREF(Once, "image.cache.size",                      ImageCacheSize, int32_t, 5*1024*1024);
   DECL_GFX_PREF(Once, "image.cache.timeweight",                ImageCacheTimeWeight, int32_t, 500);
-  DECL_GFX_PREF(Live, "image.decode-immediately.enabled",      ImageDecodeImmediatelyEnabled, bool, false);
-  DECL_GFX_PREF(Live, "image.downscale-during-decode.enabled", ImageDownscaleDuringDecodeEnabled, bool, true);
-  DECL_GFX_PREF(Live, "image.infer-src-animation.threshold-ms", ImageInferSrcAnimationThresholdMS, uint32_t, 2000);
-  DECL_GFX_PREF(Live, "image.layout_network_priority",         ImageLayoutNetworkPriority, bool, true);
   DECL_GFX_PREF(Once, "image.mem.decode_bytes_at_a_time",      ImageMemDecodeBytesAtATime, uint32_t, 200000);
-  DECL_GFX_PREF(Live, "image.mem.discardable",                 ImageMemDiscardable, bool, false);
   DECL_GFX_PREF(Once, "image.mem.animated.discardable",        ImageMemAnimatedDiscardable, bool, false);
-  DECL_GFX_PREF(Live, "image.mem.animated.use_heap",           ImageMemAnimatedUseHeap, bool, false);
-  DECL_GFX_PREF(Live, "image.mem.debug-reporting",             ImageMemDebugReporting, bool, false);
-  DECL_GFX_PREF(Live, "image.mem.shared",                      ImageMemShared, bool, true);
   DECL_GFX_PREF(Once, "image.mem.surfacecache.discard_factor", ImageMemSurfaceCacheDiscardFactor, uint32_t, 1);
   DECL_GFX_PREF(Once, "image.mem.surfacecache.max_size_kb",    ImageMemSurfaceCacheMaxSizeKB, uint32_t, 100 * 1024);
   DECL_GFX_PREF(Once, "image.mem.surfacecache.min_expiration_ms", ImageMemSurfaceCacheMinExpirationMS, uint32_t, 60*1000);
   DECL_GFX_PREF(Once, "image.mem.surfacecache.size_factor",    ImageMemSurfaceCacheSizeFactor, uint32_t, 64);
-  DECL_GFX_PREF(Live, "image.mem.volatile.min_threshold_kb",   ImageMemVolatileMinThresholdKB, int32_t, -1);
   DECL_GFX_PREF(Once, "image.multithreaded_decoding.limit",    ImageMTDecodingLimit, int32_t, -1);
   DECL_GFX_PREF(Once, "image.multithreaded_decoding.idle_timeout", ImageMTDecodingIdleTimeout, int32_t, -1);
-  DECL_GFX_PREF(Live, "image.webp.enabled",                    ImageWebPEnabled, bool, false);
 
   DECL_GFX_PREF(Once, "layers.acceleration.disabled",          LayersAccelerationDisabledDoNotUseDirectly, bool, false);
   // Instead, use gfxConfig::IsEnabled(Feature::HW_COMPOSITING).
 
-  DECL_GFX_PREF(Live, "layers.acceleration.draw-fps",          LayersDrawFPS, bool, false);
-  DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.print-histogram",  FPSPrintHistogram, bool, false);
-  DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.write-to-file", WriteFPSToFile, bool, false);
   DECL_GFX_PREF(Once, "layers.acceleration.force-enabled",     LayersAccelerationForceEnabledDoNotUseDirectly, bool, false);
-  DECL_GFX_PREF(Live, "layers.advanced.basic-layer.enabled",          LayersAdvancedBasicLayerEnabled, bool, false);
   DECL_GFX_PREF(Once, "layers.amd-switchable-gfx.enabled",     LayersAMDSwitchableGfxEnabled, bool, false);
   DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled",         AsyncPanZoomEnabledDoNotUseDirectly, bool, true);
-  DECL_GFX_PREF(Live, "layers.bench.enabled",                  LayersBenchEnabled, bool, false);
   DECL_GFX_PREF(Once, "layers.bufferrotation.enabled",         BufferRotationEnabled, bool, true);
-  DECL_GFX_PREF(Live, "layers.child-process-shutdown",         ChildProcessShutdown, bool, true);
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
   // If MOZ_GFX_OPTIMIZE_MOBILE is defined, we force component alpha off
   // and ignore the preference.
   DECL_GFX_PREF(Skip, "layers.componentalpha.enabled",         ComponentAlphaEnabled, bool, false);
 #else
   // If MOZ_GFX_OPTIMIZE_MOBILE is not defined, we actually take the
   // preference value, defaulting to true.
   DECL_GFX_PREF(Once, "layers.componentalpha.enabled",         ComponentAlphaEnabled, bool, true);
 #endif
   DECL_GFX_PREF(Once, "layers.d3d11.force-warp",               LayersD3D11ForceWARP, bool, false);
-  DECL_GFX_PREF(Live, "layers.deaa.enabled",                   LayersDEAAEnabled, bool, false);
-  DECL_GFX_PREF(Live, "layers.draw-bigimage-borders",          DrawBigImageBorders, bool, false);
-  DECL_GFX_PREF(Live, "layers.draw-borders",                   DrawLayerBorders, bool, false);
-  DECL_GFX_PREF(Live, "layers.draw-tile-borders",              DrawTileBorders, bool, false);
-  DECL_GFX_PREF(Live, "layers.draw-layer-info",                DrawLayerInfo, bool, false);
-  DECL_GFX_PREF(Live, "layers.dump",                           LayersDump, bool, false);
-  DECL_GFX_PREF(Live, "layers.dump-texture",                   LayersDumpTexture, bool, false);
-#ifdef MOZ_DUMP_PAINTING
-  DECL_GFX_PREF(Live, "layers.dump-client-layers",             DumpClientLayers, bool, false);
-  DECL_GFX_PREF(Live, "layers.dump-decision",                  LayersDumpDecision, bool, false);
-  DECL_GFX_PREF(Live, "layers.dump-host-layers",               DumpHostLayers, bool, false);
-#endif
 
   // 0 is "no change" for contrast, positive values increase it, negative values
   // decrease it until we hit mid gray at -1 contrast, after that it gets weird.
-  DECL_GFX_PREF(Live, "layers.effect.contrast",                LayersEffectContrast, float, 0.0f);
-  DECL_GFX_PREF(Live, "layers.effect.grayscale",               LayersEffectGrayscale, bool, false);
-  DECL_GFX_PREF(Live, "layers.effect.invert",                  LayersEffectInvert, bool, false);
   DECL_GFX_PREF(Once, "layers.enable-tiles",                   LayersTilesEnabled, bool, false);
   DECL_GFX_PREF(Once, "layers.enable-tiles-if-skia-pomtp",     LayersTilesEnabledIfSkiaPOMTP, bool, false);
-  DECL_GFX_PREF(Live, "layers.flash-borders",                  FlashLayerBorders, bool, false);
   DECL_GFX_PREF(Once, "layers.force-shmem-tiles",              ForceShmemTiles, bool, false);
   DECL_GFX_PREF(Once, "layers.gpu-process.allow-software",     GPUProcessAllowSoftware, bool, false);
   DECL_GFX_PREF(Once, "layers.gpu-process.enabled",            GPUProcessEnabled, bool, false);
   DECL_GFX_PREF(Once, "layers.gpu-process.force-enabled",      GPUProcessForceEnabled, bool, false);
   DECL_GFX_PREF(Once, "layers.gpu-process.ipc_reply_timeout_ms", GPUProcessIPCReplyTimeoutMs, int32_t, 10000);
-  DECL_GFX_PREF(Live, "layers.gpu-process.max_restarts",       GPUProcessMaxRestarts, int32_t, 1);
   // Note: This pref will only be used if it is less than layers.gpu-process.max_restarts.
-  DECL_GFX_PREF(Live, "layers.gpu-process.max_restarts_with_decoder", GPUProcessMaxRestartsWithDecoder, int32_t, 0);
   DECL_GFX_PREF(Once, "layers.gpu-process.startup_timeout_ms", GPUProcessTimeoutMs, int32_t, 5000);
-  DECL_GFX_PREF(Live, "layers.low-precision-buffer",           UseLowPrecisionBuffer, bool, false);
-  DECL_GFX_PREF(Live, "layers.low-precision-opacity",          LowPrecisionOpacity, float, 1.0f);
-  DECL_GFX_PREF(Live, "layers.low-precision-resolution",       LowPrecisionResolution, float, 0.25f);
-  DECL_GFX_PREF(Live, "layers.max-active",                     MaxActiveLayers, int32_t, -1);
   DECL_GFX_PREF(Once, "layers.mlgpu.enabled",                  AdvancedLayersEnabledDoNotUseDirectly, bool, false);
   DECL_GFX_PREF(Once, "layers.mlgpu.enable-buffer-cache",      AdvancedLayersEnableBufferCache, bool, true);
   DECL_GFX_PREF(Once, "layers.mlgpu.enable-buffer-sharing",    AdvancedLayersEnableBufferSharing, bool, true);
   DECL_GFX_PREF(Once, "layers.mlgpu.enable-clear-view",        AdvancedLayersEnableClearView, bool, true);
   DECL_GFX_PREF(Once, "layers.mlgpu.enable-cpu-occlusion",     AdvancedLayersEnableCPUOcclusion, bool, true);
   DECL_GFX_PREF(Once, "layers.mlgpu.enable-depth-buffer",      AdvancedLayersEnableDepthBuffer, bool, false);
-  DECL_GFX_PREF(Live, "layers.mlgpu.enable-invalidation",      AdvancedLayersUseInvalidation, bool, true);
   DECL_GFX_PREF(Once, "layers.mlgpu.enable-on-windows7",       AdvancedLayersEnableOnWindows7, bool, false);
   DECL_GFX_PREF(Once, "layers.mlgpu.enable-container-resizing", AdvancedLayersEnableContainerResizing, bool, true);
   DECL_GFX_PREF(Once, "layers.offmainthreadcomposition.force-disabled", LayersOffMainThreadCompositionForceDisabled, bool, false);
-  DECL_GFX_PREF(Live, "layers.offmainthreadcomposition.frame-rate", LayersCompositionFrameRate, int32_t,-1);
   DECL_GFX_PREF(Once, "layers.omtp.capture-limit",             LayersOMTPCaptureLimit, uint32_t, 25 * 1024 * 1024);
-  DECL_GFX_PREF(Live, "layers.omtp.dump-capture",              LayersOMTPDumpCapture, bool, false);
   DECL_GFX_PREF(Once, "layers.omtp.paint-workers",             LayersOMTPPaintWorkers, int32_t, 1);
-  DECL_GFX_PREF(Live, "layers.omtp.release-capture-on-main-thread", LayersOMTPReleaseCaptureOnMainThread, bool, false);
-  DECL_GFX_PREF(Live, "layers.orientation.sync.timeout",       OrientationSyncMillis, uint32_t, (uint32_t)0);
   DECL_GFX_PREF(Once, "layers.prefer-opengl",                  LayersPreferOpenGL, bool, false);
-  DECL_GFX_PREF(Live, "layers.progressive-paint",              ProgressivePaint, bool, false);
-  DECL_GFX_PREF(Live, "layers.shared-buffer-provider.enabled", PersistentBufferProviderSharedEnabled, bool, false);
-  DECL_GFX_PREF(Live, "layers.single-tile.enabled",            LayersSingleTileEnabled, bool, true);
-  DECL_GFX_PREF(Live, "layers.force-synchronous-resize",       LayersForceSynchronousResize, bool, true);
   DECL_GFX_PREF(Once, "layers.windowrecording.path",           LayersWindowRecordingPath, std::string, std::string());
 
   // We allow for configurable and rectangular tile size to avoid wasting memory on devices whose
   // screen size does not align nicely to the default tile size. Although layers can be any size,
   // they are often the same size as the screen, especially for width.
   DECL_GFX_PREF(Once, "layers.tile-width",                     LayersTileWidth, int32_t, 256);
   DECL_GFX_PREF(Once, "layers.tile-height",                    LayersTileHeight, int32_t, 256);
   DECL_GFX_PREF(Once, "layers.tile-initial-pool-size",         LayersTileInitialPoolSize, uint32_t, (uint32_t)50);
   DECL_GFX_PREF(Once, "layers.tile-pool-unused-size",          LayersTilePoolUnusedSize, uint32_t, (uint32_t)10);
   DECL_GFX_PREF(Once, "layers.tile-pool-shrink-timeout",       LayersTilePoolShrinkTimeout, uint32_t, (uint32_t)50);
   DECL_GFX_PREF(Once, "layers.tile-pool-clear-timeout",        LayersTilePoolClearTimeout, uint32_t, (uint32_t)5000);
   DECL_GFX_PREF(Once, "layers.tiles.adjust",                   LayersTilesAdjust, bool, true);
-  DECL_GFX_PREF(Live, "layers.tiles.retain-back-buffer",       LayersTileRetainBackBuffer, bool, true);
   DECL_GFX_PREF(Once, "layers.tiles.edge-padding",             TileEdgePaddingEnabled, bool, false);
-  DECL_GFX_PREF(Live, "layers.tiles.fade-in.enabled",          LayerTileFadeInEnabled, bool, false);
-  DECL_GFX_PREF(Live, "layers.tiles.fade-in.duration-ms",      LayerTileFadeInDuration, uint32_t, 250);
-  DECL_GFX_PREF(Live, "layers.transaction.warning-ms",         LayerTransactionWarning, uint32_t, 200);
   DECL_GFX_PREF(Once, "layers.uniformity-info",                UniformityInfo, bool, false);
   DECL_GFX_PREF(Once, "layers.use-image-offscreen-surfaces",   UseImageOffscreenSurfaces, bool, true);
-  DECL_GFX_PREF(Live, "layers.draw-mask-debug",                DrawMaskLayer, bool, false);
-
-  DECL_GFX_PREF(Live, "layers.geometry.opengl.enabled",        OGLLayerGeometry, bool, false);
-  DECL_GFX_PREF(Live, "layers.geometry.basic.enabled",         BasicLayerGeometry, bool, false);
-  DECL_GFX_PREF(Live, "layers.geometry.d3d11.enabled",         D3D11LayerGeometry, bool, false);
-
-  DECL_GFX_PREF(Live, "layout.animation.prerender.partial", PartiallyPrerenderAnimatedContent, bool, false);
-  DECL_GFX_PREF(Live, "layout.animation.prerender.viewport-ratio-limit-x", AnimationPrerenderViewportRatioLimitX, float, 1.125f);
-  DECL_GFX_PREF(Live, "layout.animation.prerender.viewport-ratio-limit-y", AnimationPrerenderViewportRatioLimitY, float, 1.125f);
-  DECL_GFX_PREF(Live, "layout.animation.prerender.absolute-limit-x", AnimationPrerenderAbsoluteLimitX, uint32_t, 4096);
-  DECL_GFX_PREF(Live, "layout.animation.prerender.absolute-limit-y", AnimationPrerenderAbsoluteLimitY, uint32_t, 4096);
-
-  DECL_GFX_PREF(Live, "layout.css.paint-order.enabled",        PaintOrderEnabled, bool, false);
-  DECL_GFX_PREF(Live, "layout.css.scroll-behavior.damping-ratio", ScrollBehaviorDampingRatio, float, 1.0f);
-  DECL_GFX_PREF(Live, "layout.css.scroll-behavior.enabled",    ScrollBehaviorEnabled, bool, true);
-  DECL_GFX_PREF(Live, "layout.css.scroll-behavior.spring-constant", ScrollBehaviorSpringConstant, float, 250.0f);
-  DECL_GFX_PREF(Live, "layout.css.scroll-snap.prediction-max-velocity", ScrollSnapPredictionMaxVelocity, int32_t, 2000);
-  DECL_GFX_PREF(Live, "layout.css.scroll-snap.prediction-sensitivity", ScrollSnapPredictionSensitivity, float, 0.750f);
-  DECL_GFX_PREF(Live, "layout.css.scroll-snap.proximity-threshold", ScrollSnapProximityThreshold, int32_t, 200);
-  DECL_GFX_PREF(Live, "layout.css.touch_action.enabled",       TouchActionEnabled, bool, false);
-
-  DECL_GFX_PREF(Live, "layout.display-list.build-twice",       LayoutDisplayListBuildTwice, bool, false);
-  DECL_GFX_PREF(Live, "layout.display-list.retain",            LayoutRetainDisplayList, bool, true);
-  DECL_GFX_PREF(Live, "layout.display-list.retain.chrome",     LayoutRetainDisplayListChrome, bool, false);
-  DECL_GFX_PREF(Live, "layout.display-list.retain.verify",     LayoutVerifyRetainDisplayList, bool, false);
-  DECL_GFX_PREF(Live, "layout.display-list.retain.verify.order", LayoutVerifyRetainDisplayListOrder, bool, false);
-  DECL_GFX_PREF(Live, "layout.display-list.rebuild-frame-limit", LayoutRebuildFrameLimit, uint32_t, 500);
-  DECL_GFX_PREF(Live, "layout.display-list.dump",              LayoutDumpDisplayList, bool, false);
-  DECL_GFX_PREF(Live, "layout.display-list.dump-content",      LayoutDumpDisplayListContent, bool, false);
-  DECL_GFX_PREF(Live, "layout.display-list.dump-parent",       LayoutDumpDisplayListParent, bool, false);
-  DECL_GFX_PREF(Live, "layout.display-list.show-rebuild-area", LayoutDisplayListShowArea, bool, false);
-  DECL_GFX_PREF(Live, "layout.display-list.flatten-transform", LayoutFlattenTransform, bool, true);
 
   DECL_GFX_PREF(Live, "layout.frame_rate",                     LayoutFrameRate, int32_t, -1);
-  DECL_GFX_PREF(Live, "layout.min-active-layer-size",          LayoutMinActiveLayerSize, int, 64);
   DECL_GFX_PREF(Once, "layout.paint_rects_separately",         LayoutPaintRectsSeparately, bool, true);
 
-  // This and code dependent on it should be removed once containerless scrolling looks stable.
-  DECL_GFX_PREF(Live, "layout.scroll.root-frame-containers",   LayoutUseContainersForRootFrames, bool, false);
-  // This pref is to be set by test code only.
-  DECL_GFX_PREF(Live, "layout.scrollbars.always-layerize-track", AlwaysLayerizeScrollbarTrackTestOnly, bool, false);
-  DECL_GFX_PREF(Live, "layout.smaller-painted-layers",         LayoutSmallerPaintedLayers, bool, false);
-
   DECL_GFX_PREF(Once, "media.hardware-video-decoding.force-enabled",
                                                                HardwareVideoDecodingForceEnabled, bool, false);
 #ifdef XP_WIN
-  DECL_GFX_PREF(Live, "media.wmf.dxva.d3d11.enabled", PDMWMFAllowD3D11, bool, true);
-  DECL_GFX_PREF(Live, "media.wmf.dxva.max-videos", PDMWMFMaxDXVAVideos, uint32_t, 8);
-  DECL_GFX_PREF(Live, "media.wmf.use-nv12-format", PDMWMFUseNV12Format, bool, true);
-  DECL_GFX_PREF(Live, "media.wmf.force.allow-p010-format", PDMWMFForceAllowP010Format, bool, false);
   DECL_GFX_PREF(Once, "media.wmf.use-sync-texture", PDMWMFUseSyncTexture, bool, true);
-  DECL_GFX_PREF(Live, "media.wmf.low-latency.enabled", PDMWMFLowLatencyEnabled, bool, false);
-  DECL_GFX_PREF(Live, "media.wmf.low-latency.force-disabled", PDMWMFLowLatencyForceDisabled, bool, false);
-  DECL_GFX_PREF(Live, "media.wmf.skip-blacklist", PDMWMFSkipBlacklist, bool, false);
-  DECL_GFX_PREF(Live, "media.wmf.deblacklisting-for-telemetry-in-gpu-process", PDMWMFDeblacklistingForTelemetryInGPUProcess, bool, false);
-  DECL_GFX_PREF(Live, "media.wmf.amd.highres.enabled", PDMWMFAMDHighResEnabled, bool, true);
-  DECL_GFX_PREF(Live, "media.wmf.allow-unsupported-resolutions", PDMWMFAllowUnsupportedResolutions, bool, false);
   DECL_GFX_PREF(Once, "media.wmf.vp9.enabled", MediaWmfVp9Enabled, bool, true);
 #endif
 
-  // These affect how line scrolls from wheel events will be accelerated.
-  DECL_GFX_PREF(Live, "mousewheel.acceleration.factor",        MouseWheelAccelerationFactor, int32_t, -1);
-  DECL_GFX_PREF(Live, "mousewheel.acceleration.start",         MouseWheelAccelerationStart, int32_t, -1);
-
-  // This affects whether events will be routed through APZ or not.
-  DECL_GFX_PREF(Live, "mousewheel.system_scroll_override_on_root_content.enabled",
-                                                               MouseWheelHasRootScrollDeltaOverride, bool, false);
-  DECL_GFX_PREF(Live, "mousewheel.system_scroll_override_on_root_content.horizontal.factor",
-                                                               MouseWheelRootScrollHorizontalFactor, int32_t, 0);
-  DECL_GFX_PREF(Live, "mousewheel.system_scroll_override_on_root_content.vertical.factor",
-                                                               MouseWheelRootScrollVerticalFactor, int32_t, 0);
-  DECL_GFX_PREF(Live, "mousewheel.transaction.ignoremovedelay",MouseWheelIgnoreMoveDelayMs, int32_t, (int32_t)100);
-  DECL_GFX_PREF(Live, "mousewheel.transaction.timeout",        MouseWheelTransactionTimeoutMs, int32_t, (int32_t)1500);
-
-  DECL_GFX_PREF(Live, "nglayout.debug.widget_update_flashing", WidgetUpdateFlashing, bool, false);
-
-  DECL_GFX_PREF(Live, "print.font-variations-as-paths",        PrintFontVariationsAsPaths, bool, true);
-
-  DECL_GFX_PREF(Live, "privacy.resistFingerprinting",          ResistFingerprinting, bool, false);
-
   DECL_GFX_PREF(Once, "slider.snapMultiplier",                 SliderSnapMultiplier, int32_t, 0);
-
-  DECL_GFX_PREF(Live, "test.events.async.enabled",             TestEventsAsyncEnabled, bool, false);
-  DECL_GFX_PREF(Live, "test.mousescroll",                      MouseScrollTestingEnabled, bool, false);
-
-  DECL_GFX_PREF(Live, "toolkit.scrollbox.horizontalScrollDistance", ToolkitHorizontalScrollDistance, int32_t, 5);
-  DECL_GFX_PREF(Live, "toolkit.scrollbox.verticalScrollDistance",   ToolkitVerticalScrollDistance, int32_t, 3);
-
-  DECL_GFX_PREF(Live, "ui.click_hold_context_menus.delay",     UiClickHoldContextMenusDelay, int32_t, 500);
-
-  // WebGL (for pref access from Worker threads)
-  DECL_GFX_PREF(Live, "webgl.1.allow-core-profiles",           WebGL1AllowCoreProfile, bool, false);
-
-  DECL_GFX_PREF(Live, "webgl.all-angle-options",               WebGLAllANGLEOptions, bool, false);
-  DECL_GFX_PREF(Live, "webgl.angle.force-d3d11",               WebGLANGLEForceD3D11, bool, false);
-  DECL_GFX_PREF(Live, "webgl.angle.try-d3d11",                 WebGLANGLETryD3D11, bool, false);
-  DECL_GFX_PREF(Live, "webgl.angle.force-warp",                WebGLANGLEForceWARP, bool, false);
-  DECL_GFX_PREF(Live, "webgl.can-lose-context-in-foreground",  WebGLCanLoseContextInForeground, bool, true);
-  DECL_GFX_PREF(Live, "webgl.default-low-power",               WebGLDefaultLowPower, bool, false);
-  DECL_GFX_PREF(Live, "webgl.default-no-alpha",                WebGLDefaultNoAlpha, bool, false);
-  DECL_GFX_PREF(Live, "webgl.disable-angle",                   WebGLDisableANGLE, bool, false);
-  DECL_GFX_PREF(Live, "webgl.disable-wgl",                     WebGLDisableWGL, bool, false);
-  DECL_GFX_PREF(Live, "webgl.disable-extensions",              WebGLDisableExtensions, bool, false);
-  DECL_GFX_PREF(Live, "webgl.dxgl.enabled",                    WebGLDXGLEnabled, bool, false);
-  DECL_GFX_PREF(Live, "webgl.dxgl.needs-finish",               WebGLDXGLNeedsFinish, bool, false);
-
-  DECL_GFX_PREF(Live, "webgl.disable-fail-if-major-performance-caveat",
-                WebGLDisableFailIfMajorPerformanceCaveat, bool, false);
-  DECL_GFX_PREF(Live, "webgl.disable-DOM-blit-uploads",
-                WebGLDisableDOMBlitUploads, bool, false);
-
-  DECL_GFX_PREF(Live, "webgl.disabled",                        WebGLDisabled, bool, false);
-
-  DECL_GFX_PREF(Live, "webgl.enable-draft-extensions",         WebGLDraftExtensionsEnabled, bool, false);
-  DECL_GFX_PREF(Live, "webgl.enable-privileged-extensions",    WebGLPrivilegedExtensionsEnabled, bool, false);
-  DECL_GFX_PREF(Live, "webgl.enable-surface-texture",          WebGLSurfaceTextureEnabled, bool, false);
-  DECL_GFX_PREF(Live, "webgl.enable-webgl2",                   WebGL2Enabled, bool, true);
-  DECL_GFX_PREF(Live, "webgl.force-enabled",                   WebGLForceEnabled, bool, false);
   DECL_GFX_PREF(Once, "webgl.force-layers-readback",           WebGLForceLayersReadback, bool, false);
-  DECL_GFX_PREF(Live, "webgl.force-index-validation",          WebGLForceIndexValidation, int32_t, 0);
-  DECL_GFX_PREF(Live, "webgl.lose-context-on-memory-pressure", WebGLLoseContextOnMemoryPressure, bool, false);
-  DECL_GFX_PREF(Live, "webgl.max-contexts",                    WebGLMaxContexts, uint32_t, 32);
-  DECL_GFX_PREF(Live, "webgl.max-contexts-per-principal",      WebGLMaxContextsPerPrincipal, uint32_t, 16);
-  DECL_GFX_PREF(Live, "webgl.max-warnings-per-context",        WebGLMaxWarningsPerContext, uint32_t, 32);
-  DECL_GFX_PREF(Live, "webgl.min_capability_mode",             WebGLMinCapabilityMode, bool, false);
-  DECL_GFX_PREF(Live, "webgl.msaa-force",                      WebGLForceMSAA, bool, false);
-  DECL_GFX_PREF(Live, "webgl.msaa-samples",                    WebGLMsaaSamples, uint32_t, 4);
-  DECL_GFX_PREF(Live, "webgl.prefer-16bpp",                    WebGLPrefer16bpp, bool, false);
-  DECL_GFX_PREF(Live, "webgl.allow-immediate-queries",         WebGLImmediateQueries, bool, false);
-  DECL_GFX_PREF(Live, "webgl.allow-fb-invalidation",           WebGLFBInvalidation, bool, false);
-
-  DECL_GFX_PREF(Live, "webgl.perf.max-warnings",                    WebGLMaxPerfWarnings, int32_t, 0);
-  DECL_GFX_PREF(Live, "webgl.perf.max-acceptable-fb-status-invals", WebGLMaxAcceptableFBStatusInvals, int32_t, 0);
-  DECL_GFX_PREF(Live, "webgl.perf.spew-frame-allocs",          WebGLSpewFrameAllocs, bool, true);
-
-
-  DECL_GFX_PREF(Live, "widget.window-transforms.disabled",     WindowTransformsDisabled, bool, false);
 
   // WARNING:
   // Please make sure that you've added your new preference to the list above
   // in alphabetical order.
   // Please do not just append it to the end of the list.
 
   // clang-format on
 
--- a/gfx/thebes/gfxUserFontSet.cpp
+++ b/gfx/thebes/gfxUserFontSet.cpp
@@ -2,22 +2,22 @@
  * 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/Logging.h"
 
 #include "gfxUserFontSet.h"
 #include "gfxPlatform.h"
-#include "gfxPrefs.h"
 #include "nsIProtocolHandler.h"
 #include "gfxFontConstants.h"
 #include "mozilla/FontPropertyTypes.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/gfx/2D.h"
 #include "gfxPlatformFontList.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/PostTraversalTask.h"
 
 #include "opentype-sanitiser.h"
 #include "ots-memory-stream.h"
@@ -181,21 +181,21 @@ gfxFont* gfxUserFontEntry::CreateFontIns
   return nullptr;
 }
 
 class MOZ_STACK_CLASS gfxOTSContext : public ots::OTSContext {
  public:
   explicit gfxOTSContext(gfxUserFontEntry* aUserFontEntry)
       : mUserFontEntry(aUserFontEntry) {
     // Whether to apply OTS validation to OpenType Layout tables
-    mCheckOTLTables = gfxPrefs::ValidateOTLTables();
+    mCheckOTLTables = StaticPrefs::ValidateOTLTables();
     // Whether to preserve Variation tables in downloaded fonts
-    mCheckVariationTables = gfxPrefs::ValidateVariationTables();
+    mCheckVariationTables = StaticPrefs::ValidateVariationTables();
     // Whether to preserve color bitmap glyphs
-    mKeepColorBitmaps = gfxPrefs::KeepColorBitmaps();
+    mKeepColorBitmaps = StaticPrefs::KeepColorBitmaps();
   }
 
   virtual ots::TableAction GetTableAction(uint32_t aTag) override {
     // Preserve Graphite, color glyph and SVG tables,
     // and possibly OTL and Variation tables (depending on prefs)
     if ((!mCheckOTLTables && (aTag == TRUETYPE_TAG('G', 'D', 'E', 'F') ||
                               aTag == TRUETYPE_TAG('G', 'P', 'O', 'S') ||
                               aTag == TRUETYPE_TAG('G', 'S', 'U', 'B'))) ||
--- a/gfx/thebes/gfxUtils.cpp
+++ b/gfx/thebes/gfxUtils.cpp
@@ -1456,19 +1456,21 @@ void gfxUtils::RemoveShaderCacheFromDisk
   Preferences::SetCString(GFX_SHADER_CHECK_BUILD_VERSION_PREF, buildID);
   Preferences::SetString(GFX_SHADER_CHECK_DEVICE_ID_PREF, deviceID);
   Preferences::SetString(GFX_SHADER_CHECK_DRIVER_VERSION_PREF, driverVersion);
   return;
 }
 
 /* static */
 bool gfxUtils::DumpDisplayList() {
-  return gfxPrefs::LayoutDumpDisplayList() ||
-         (gfxPrefs::LayoutDumpDisplayListParent() && XRE_IsParentProcess()) ||
-         (gfxPrefs::LayoutDumpDisplayListContent() && XRE_IsContentProcess());
+  return StaticPrefs::LayoutDumpDisplayList() ||
+         (StaticPrefs::LayoutDumpDisplayListParent() &&
+          XRE_IsParentProcess()) ||
+         (StaticPrefs::LayoutDumpDisplayListContent() &&
+          XRE_IsContentProcess());
 }
 
 wr::RenderRoot gfxUtils::GetContentRenderRoot() {
   if (gfx::gfxVars::UseWebRender() && gfxPrefs::WebRenderSplitRenderRoots()) {
     return wr::RenderRoot::Content;
   }
   return wr::RenderRoot::Default;
 }
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -1349,17 +1349,17 @@ void gfxWindowsPlatform::InitializeD3D11
     // update due to the crashes in Bug 1351349.
     if (adaptorId.EqualsLiteral("0x1912") ||
         adaptorId.EqualsLiteral("0x1916") ||
         adaptorId.EqualsLiteral("0x1902")) {
 #ifdef RELEASE_OR_BETA
       d3d11.Disable(FeatureStatus::Blacklisted, "Blacklisted, see bug 1351349",
                     NS_LITERAL_CSTRING("FEATURE_FAILURE_BUG_1351349"));
 #else
-      gfxPrefs::SetCompositorClearState(true);
+      StaticPrefs::SetCompositorClearState(true);
 #endif
     }
   }
 
   nsCString message;
   nsCString failureId;
   if (!gfxPlatform::IsGfxInfoStatusOkay(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS,
                                         &message, failureId)) {
--- a/gfx/vr/VRDisplayClient.cpp
+++ b/gfx/vr/VRDisplayClient.cpp
@@ -91,25 +91,25 @@ void VRDisplayClient::FireEvents() {
   if (bLastEventWasPresenting != isPresenting) {
     bLastEventWasPresenting = isPresenting;
     vm->FireDOMVRDisplayPresentChangeEvent(mDisplayInfo.mDisplayID);
   }
 
   // Check if we need to trigger onvrdisplayactivate event
   if (!bLastEventWasMounted && mDisplayInfo.mDisplayState.isMounted) {
     bLastEventWasMounted = true;
-    if (gfxPrefs::VRAutoActivateEnabled()) {
+    if (StaticPrefs::VRAutoActivateEnabled()) {
       vm->FireDOMVRDisplayMountedEvent(mDisplayInfo.mDisplayID);
     }
   }
 
   // Check if we need to trigger onvrdisplaydeactivate event
   if (bLastEventWasMounted && !mDisplayInfo.mDisplayState.isMounted) {
     bLastEventWasMounted = false;
-    if (gfxPrefs::VRAutoActivateEnabled()) {
+    if (StaticPrefs::VRAutoActivateEnabled()) {
       vm->FireDOMVRDisplayUnmountedEvent(mDisplayInfo.mDisplayID);
     }
   }
 
   if (mLastPresentingGeneration !=
       mDisplayInfo.mDisplayState.presentingGeneration) {
     mLastPresentingGeneration = mDisplayInfo.mDisplayState.presentingGeneration;
     vm->NotifyPresentationGenerationChanged(mDisplayInfo.mDisplayID);
--- a/gfx/vr/VRDisplayHost.cpp
+++ b/gfx/vr/VRDisplayHost.cpp
@@ -1,22 +1,22 @@
 /* -*- 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 "VRDisplayHost.h"
-#include "gfxPrefs.h"
+#include "VRThread.h"
 #include "gfxVR.h"
 #include "ipc/VRLayerParent.h"
+#include "mozilla/StaticPrefs.h"
+#include "mozilla/dom/GamepadBinding.h"       // For GamepadMappingType
 #include "mozilla/layers/CompositorThread.h"  // for CompositorThreadHolder
 #include "mozilla/layers/TextureHost.h"
-#include "mozilla/dom/GamepadBinding.h"  // For GamepadMappingType
-#include "VRThread.h"
 
 #if defined(XP_WIN)
 
 #  include <d3d11.h>
 #  include "gfxWindowsPlatform.h"
 #  include "../layers/d3d11/CompositorD3D11.h"
 #  include "mozilla/gfx/DeviceManagerDx.h"
 #  include "mozilla/layers/TextureD3D11.h"
@@ -263,17 +263,17 @@ void VRDisplayHost::CheckWatchDog() {
   // If content fails to call VRDisplay.submitFrame, we must eventually
   // time-out and trigger a new frame.
   TimeStamp lastFrameStart =
       mLastFrameStart[mDisplayInfo.mFrameId % kVRMaxLatencyFrames];
   if (lastFrameStart.IsNull()) {
     bShouldStartFrame = true;
   } else {
     TimeDuration duration = TimeStamp::Now() - lastFrameStart;
-    if (duration.ToMilliseconds() > gfxPrefs::VRDisplayRafMaxDuration()) {
+    if (duration.ToMilliseconds() > StaticPrefs::VRDisplayRafMaxDuration()) {
       bShouldStartFrame = true;
     }
   }
 
   if (bShouldStartFrame) {
     VRManager* vm = VRManager::Get();
     MOZ_ASSERT(vm);
     vm->NotifyVRVsync(mDisplayInfo.mDisplayID);
--- a/gfx/vr/VRManager.cpp
+++ b/gfx/vr/VRManager.cpp
@@ -382,17 +382,17 @@ void VRManager::CheckForInactiveTimeout(
   if (mVRDisplaysRequested || mVRDisplaysRequestedNonFocus ||
       mVRControllersRequested) {
     // We are using a VR device, keep it alive
     mLastActiveTime = TimeStamp::Now();
   } else if (mLastActiveTime.IsNull()) {
     Shutdown();
   } else {
     TimeDuration duration = TimeStamp::Now() - mLastActiveTime;
-    if (duration.ToMilliseconds() > gfxPrefs::VRInactiveTimeout()) {
+    if (duration.ToMilliseconds() > StaticPrefs::VRInactiveTimeout()) {
       Shutdown();
       // We must not throttle the next enumeration request
       // after an idle timeout, as it may result in the
       // user needing to refresh the browser to detect
       // VR hardware when leaving and returning to a VR
       // site.
       mLastDisplayEnumerationTime = TimeStamp();
     }
@@ -417,17 +417,17 @@ void VRManager::NotifyVRVsync(const uint
 void VRManager::EnumerateVRDisplays() {
   StartTasks();
   /**
    * Throttle the rate of enumeration to the interval set in
    * VRDisplayEnumerateInterval
    */
   if (!mLastDisplayEnumerationTime.IsNull()) {
     TimeDuration duration = TimeStamp::Now() - mLastDisplayEnumerationTime;
-    if (duration.ToMilliseconds() < gfxPrefs::VRDisplayEnumerateInterval()) {
+    if (duration.ToMilliseconds() < StaticPrefs::VRDisplayEnumerateInterval()) {
       return;
     }
   }
 
   /**
    * Any VRSystemManager instance may request that no enumeration
    * should occur, including enumeration from other VRSystemManager
    * instances.
@@ -692,17 +692,18 @@ void VRManager::RefreshVRControllers() {
   }
 }
 
 void VRManager::ScanForControllers() {
   // We don't have to do this every frame, so check if we
   // have enumerated recently
   if (!mLastControllerEnumerationTime.IsNull()) {
     TimeDuration duration = TimeStamp::Now() - mLastControllerEnumerationTime;
-    if (duration.ToMilliseconds() < gfxPrefs::VRControllerEnumerateInterval()) {
+    if (duration.ToMilliseconds() <
+        StaticPrefs::VRControllerEnumerateInterval()) {
       return;
     }
   }
 
   // Only enumerate controllers once we need them
   if (!mVRControllersRequested) {
     return;
   }
--- a/gfx/vr/gfxVRPuppet.cpp
+++ b/gfx/vr/gfxVRPuppet.cpp
@@ -8,16 +8,17 @@
 #  include "CompositorD3D11.h"
 #  include "TextureD3D11.h"
 #  include "mozilla/gfx/DeviceManagerDx.h"
 #elif defined(XP_MACOSX)
 #  include "mozilla/gfx/MacIOSurface.h"
 #endif
 
 #include "mozilla/Base64.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/gfx/DataSurfaceHelpers.h"
 #include "mozilla/layers/CompositorThread.h"  // for CompositorThreadHolder
 #include "gfxPrefs.h"
 #include "gfxUtils.h"
 #include "gfxVRPuppet.h"
 #include "VRManager.h"
 #include "VRThread.h"
 
@@ -284,17 +285,17 @@ bool VRDisplayPuppet::SubmitFrame(ID3D11
   AutoRestoreRenderState restoreState(this);
   if (!restoreState.IsSuccess()) {
     return false;
   }
 
   VRManager* vm = VRManager::Get();
   MOZ_ASSERT(vm);
 
-  switch (gfxPrefs::VRPuppetSubmitFrame()) {
+  switch (StaticPrefs::VRPuppetSubmitFrame()) {
     case 0:
       // The VR frame is not displayed.
       break;
     case 1: {
       // The frames are submitted to VR compositor are decoded
       // into a base64Image and dispatched to the DOM side.
       D3D11_TEXTURE2D_DESC desc;
       aSource->GetDesc(&desc);
@@ -474,17 +475,17 @@ bool VRDisplayPuppet::SubmitFrame(MacIOS
   MOZ_ASSERT(mSubmitThread->GetThread() == NS_GetCurrentThread());
   if (!mIsPresenting || !aMacIOSurface) {
     return false;
   }
 
   VRManager* vm = VRManager::Get();
   MOZ_ASSERT(vm);
 
-  switch (gfxPrefs::VRPuppetSubmitFrame()) {
+  switch (StaticPrefs::VRPuppetSubmitFrame()) {
     case 0:
       // The VR frame is not displayed.
       break;
     case 1: {
       // The frames are submitted to VR compositor are decoded
       // into a base64Image and dispatched to the DOM side.
       RefPtr<SourceSurface> surf = aMacIOSurface->GetAsSurface();
       RefPtr<DataSourceSurface> dataSurf =
@@ -635,17 +636,17 @@ void VRControllerPuppet::SetAxisMove(uin
 
 VRSystemManagerPuppet::VRSystemManagerPuppet()
     : mPuppetDisplayCount(0),
       mPuppetDisplayInfo{},
       mPuppetDisplaySensorState{} {}
 
 /*static*/
 already_AddRefed<VRSystemManagerPuppet> VRSystemManagerPuppet::Create() {
-  if (!gfxPrefs::VREnabled() || !gfxPrefs::VRPuppetEnabled()) {
+  if (!gfxPrefs::VREnabled() || !StaticPrefs::VRPuppetEnabled()) {
     return nullptr;
   }
 
   RefPtr<VRSystemManagerPuppet> manager = new VRSystemManagerPuppet();
   return manager.forget();
 }
 
 void VRSystemManagerPuppet::Destroy() { Shutdown(); }
--- a/gfx/vr/service/OculusSession.cpp
+++ b/gfx/vr/service/OculusSession.cpp
@@ -7,16 +7,17 @@
 #ifndef XP_WIN
 #  error "Oculus support only available for Windows"
 #endif
 
 #include <math.h>
 #include <d3d11.h>
 
 #include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/dom/GamepadEventTypes.h"
 #include "mozilla/dom/GamepadBinding.h"
 #include "mozilla/gfx/DeviceManagerDx.h"
 #include "mozilla/SharedLibrary.h"
 #include "OculusSession.h"
 
 /** XXX The DX11 objects and quad blitting could be encapsulated
  *    into a separate object if either Oculus starts supporting
@@ -252,17 +253,17 @@ void OculusSession::UpdateVisibility() {
   }
   if (mLastPresentationEnd.IsNull()) {
     // There has been no presentation yet
     return;
   }
 
   TimeDuration duration = TimeStamp::Now() - mLastPresentationEnd;
   TimeDuration timeout =
-      TimeDuration::FromMilliseconds(gfxPrefs::VROculusPresentTimeout());
+      TimeDuration::FromMilliseconds(StaticPrefs::VROculusPresentTimeout());
   if (timeout <= TimeDuration(0) || duration >= timeout) {
     if (!ChangeVisibility(false)) {
       gfxWarning() << "OculusSession::ChangeVisibility(false) failed";
     }
   }
 }
 
 void OculusSession::CoverTransitions() {
@@ -288,17 +289,17 @@ void OculusSession::CoverTransitions() {
   layer.Header.Type = ovrLayerType_Disabled;
   ovrLayerHeader* layers = &layer.Header;
   ovr_SubmitFrame(mSession, 0, nullptr, &layers, 1);
 }
 
 bool OculusSession::ChangeVisibility(bool bVisible) {
   ovrInitFlags flags =
       (ovrInitFlags)(ovrInit_RequestVersion | ovrInit_MixedRendering);
-  if (gfxPrefs::VROculusInvisibleEnabled() && !bVisible) {
+  if (StaticPrefs::VROculusInvisibleEnabled() && !bVisible) {
     flags = (ovrInitFlags)(flags | ovrInit_Invisible);
   }
   if (mInitFlags == flags) {
     // The new state is the same, nothing to do
     return true;
   }
 
   // Tear everything down
@@ -1148,17 +1149,17 @@ void OculusSession::UpdateEyeParameters(
   }
 }
 
 void OculusSession::UpdateHeadsetPose(VRSystemState& aState) {
   if (!mSession) {
     return;
   }
   double predictedFrameTime = 0.0f;
-  if (gfxPrefs::VRPosePredictionEnabled()) {
+  if (StaticPrefs::VRPosePredictionEnabled()) {
     // XXX We might need to call ovr_GetPredictedDisplayTime even if we don't
     // use the result. If we don't call it, the Oculus driver will spew out many
     // warnings...
     predictedFrameTime = ovr_GetPredictedDisplayTime(mSession, 0);
   }
   ovrTrackingState trackingState =
       ovr_GetTrackingState(mSession, predictedFrameTime, true);
   ovrPoseStatef& pose(trackingState.HeadPose);
@@ -1319,17 +1320,17 @@ void OculusSession::EnumerateControllers
         memset(&controllerState, 0, sizeof(VRControllerState));
       }
     }
   }
 }
 
 void OculusSession::UpdateControllerInputs(VRSystemState& aState,
                                            const ovrInputState& aInputState) {
-  const float triggerThreshold = gfxPrefs::VRControllerTriggerThreshold();
+  const float triggerThreshold = StaticPrefs::VRControllerTriggerThreshold();
 
   for (uint32_t handIdx = 0; handIdx < 2; handIdx++) {
     // Left Touch Controller will always be at index 0 and
     // and Right Touch Controller will always be at index 1
     VRControllerState& controllerState = aState.controllerState[handIdx];
     if (aInputState.ControllerType & OculusControllerTypes[handIdx]) {
       // Update Button States
       controllerState.buttonPressed = 0;
--- a/gfx/vr/service/OpenVRSession.cpp
+++ b/gfx/vr/service/OpenVRSession.cpp
@@ -1302,17 +1302,17 @@ void OpenVRSession::EnumerateControllers
 
 void OpenVRSession::UpdateControllerButtons(VRSystemState& aState) {
   MOZ_ASSERT(mVRSystem);
 
   // Compared to Edge, we have a wrong implementation for the vertical axis
   // value. In order to not affect the current VR content, we add a workaround
   // for yAxis.
   const float yAxisInvert = (mIsWindowsMR) ? -1.0f : 1.0f;
-  const float triggerThreshold = gfxPrefs::VRControllerTriggerThreshold();
+  const float triggerThreshold = StaticPrefs::VRControllerTriggerThreshold();
 
   for (uint32_t stateIndex = 0; stateIndex < kVRControllerMaxCount;
        ++stateIndex) {
     OpenVRHand trackedDevice = mControllerDeviceIndex[stateIndex];
     if (trackedDevice == OpenVRHand::None) {
       continue;
     }
     VRControllerState& controllerState = aState.controllerState[stateIndex];
@@ -1628,17 +1628,17 @@ void OpenVRSession::UpdateControllerButt
 
 void OpenVRSession::UpdateControllerButtonsObsolete(VRSystemState& aState) {
   MOZ_ASSERT(mVRSystem);
 
   // Compared to Edge, we have a wrong implementation for the vertical axis
   // value. In order to not affect the current VR content, we add a workaround
   // for yAxis.
   const float yAxisInvert = (mIsWindowsMR) ? -1.0f : 1.0f;
-  const float triggerThreshold = gfxPrefs::VRControllerTriggerThreshold();
+  const float triggerThreshold = StaticPrefs::VRControllerTriggerThreshold();
 
   for (uint32_t stateIndex = 0; stateIndex < kVRControllerMaxCount;
        stateIndex++) {
     ::vr::TrackedDeviceIndex_t trackedDevice =
         mControllerDeviceIndexObsolete[stateIndex];
     if (trackedDevice == 0) {
       continue;
     }
--- a/gfx/vr/service/VRService.cpp
+++ b/gfx/vr/service/VRService.cpp
@@ -1,16 +1,16 @@
 /* -*- 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 "VRService.h"
-#include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "../gfxVRMutex.h"
 #include "base/thread.h"  // for Thread
 #include <cstring>        // for memcmp
 
 #if defined(XP_WIN)
 #  include "OculusSession.h"
 #endif
 
@@ -287,34 +287,34 @@ void VRService::ServiceInitialize() {
     // VR hardware was not detected.
     // We must inform the browser of the failure so it may try again
     // later and resolve WebVR promises.  A failure or shutdown is
     // indicated by enumerationCompleted being set to true, with all
     // other fields remaining zeroed out.
     memset(&mSystemState, 0, sizeof(mSystemState));
     mSystemState.enumerationCompleted = true;
     mSystemState.displayState.minRestartInterval =
-        gfxPrefs::VRExternalNotDetectedTimeout();
+        StaticPrefs::VRExternalNotDetectedTimeout();
     mSystemState.displayState.shutdown = true;
     PushState(mSystemState);
   }
 }
 
 void VRService::ServiceShutdown() {
   MOZ_ASSERT(IsInServiceThread());
 
   // Notify the browser that we have shut down.
   // This is indicated by enumerationCompleted being set
   // to true, with all other fields remaining zeroed out.
   memset(&mSystemState, 0, sizeof(mSystemState));
   mSystemState.enumerationCompleted = true;
   mSystemState.displayState.shutdown = true;
   if (mSession && mSession->ShouldQuit()) {
     mSystemState.displayState.minRestartInterval =
-        gfxPrefs::VRExternalQuitTimeout();
+        StaticPrefs::VRExternalQuitTimeout();
   }
   PushState(mSystemState);
   mSession = nullptr;
 }
 
 void VRService::ServiceWaitForImmersive() {
   MOZ_ASSERT(IsInServiceThread());
   MOZ_ASSERT(mSession);
--- a/gfx/webrender_bindings/Moz2DImageRenderer.cpp
+++ b/gfx/webrender_bindings/Moz2DImageRenderer.cpp
@@ -1,15 +1,15 @@
 /* -*- 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 "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "gfxUtils.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/Range.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/RectAbsolute.h"
 #include "mozilla/gfx/Logging.h"
 #include "mozilla/gfx/RecordedEvent.h"
 #include "mozilla/layers/WebRenderDrawEventRecorder.h"
@@ -432,17 +432,17 @@ static bool Moz2DRenderCallback(const Ra
         translator.TranslateRecording((char*)blob.begin().get(), blob.length());
     if (!ret) {
       gfxCriticalNote << "Replay failure: " << translator.GetError();
       MOZ_RELEASE_ASSERT(false);
     }
     offset = extra_end;
   }
 
-  if (gfxPrefs::WebRenderBlobPaintFlashing()) {
+  if (StaticPrefs::WebRenderBlobPaintFlashing()) {
     dt->SetTransform(gfx::Matrix());
     float r = float(rand()) / RAND_MAX;
     float g = float(rand()) / RAND_MAX;
     float b = float(rand()) / RAND_MAX;
     dt->FillRect(gfx::Rect(origin.x, origin.y, aSize.width, aSize.height),
                  gfx::ColorPattern(gfx::Color(r, g, b, 0.5)));
   }
 
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -1,17 +1,17 @@
 /* -*- 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 "WebRenderAPI.h"
 
-#include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "LayersLogging.h"
 #include "mozilla/ipc/ByteBuf.h"
 #include "mozilla/webrender/RendererOGL.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/layers/CompositorThread.h"
 #include "mozilla/webrender/RenderCompositor.h"
 #include "mozilla/widget/CompositorWidget.h"
 #include "mozilla/layers/SynchronousTask.h"
@@ -72,18 +72,18 @@ class NewRenderer : public RendererEvent
 
     bool isMainWindow = true;  // TODO!
     bool supportLowPriorityTransactions = isMainWindow;
     bool supportPictureCaching = isMainWindow;
     wr::Renderer* wrRenderer = nullptr;
     if (!wr_window_new(
             aWindowId, mSize.width, mSize.height,
             supportLowPriorityTransactions,
-            gfxPrefs::WebRenderPictureCaching() && supportPictureCaching,
-            gfxPrefs::WebRenderStartDebugServer(), compositor->gl(),
+            StaticPrefs::WebRenderPictureCaching() && supportPictureCaching,
+            StaticPrefs::WebRenderStartDebugServer(), compositor->gl(),
             aRenderThread.GetProgramCache()
                 ? aRenderThread.GetProgramCache()->Raw()
                 : nullptr,
             aRenderThread.GetShaders()
                 ? aRenderThread.GetShaders()->RawShaders()
                 : nullptr,
             aRenderThread.ThreadPool().Raw(), &WebRenderMallocSizeOf,
             &WebRenderMallocEnclosingSizeOf, (uint32_t)wr::RenderRoot::Default,
--- a/gfx/ycbcr/yuv_convert.cpp
+++ b/gfx/ycbcr/yuv_convert.cpp
@@ -13,17 +13,17 @@
 // YV16 is a full plane of Y and a full height, half width chroma planes
 // YV24 is a full plane of Y and a full height, full width chroma planes
 //
 // ARGB pixel format is output, which on little endian is stored as BGRA.
 // The alpha is set to 255, allowing the application to use RGBA or RGB32.
 
 #include "yuv_convert.h"
 
-#include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "libyuv.h"
 #include "scale_yuv_argb.h"
 // Header for low level row functions.
 #include "yuv_row.h"
 #include "mozilla/SSE.h"
 
 namespace mozilla {
 
@@ -72,17 +72,17 @@ void ConvertYCbCrToRGB32(const uint8* y_
   // Deprecated function's conversion is accurate.
   // libyuv converion is a bit inaccurate to get performance. It dynamically
   // calculates RGB from YUV to use simd. In it, signed byte is used for
   // conversion's coefficient, but it requests 129. libyuv cut 129 to 127. And
   // only 6 bits are used for a decimal part during the dynamic calculation.
   //
   // The function is still fast on some old intel chips.
   // See Bug 1256475.
-  bool use_deprecated = gfxPrefs::YCbCrAccurateConversion() ||
+  bool use_deprecated = StaticPrefs::YCbCrAccurateConversion() ||
                         (supports_mmx() && supports_sse() && !supports_sse3() &&
                          yuv_color_space == YUVColorSpace::BT601);
   // The deprecated function only support BT601.
   // See Bug 1210357.
   if (yuv_color_space != YUVColorSpace::BT601) {
     use_deprecated = false;
   }
   if (use_deprecated) {
@@ -287,17 +287,18 @@ void ScaleYCbCrToRGB32(const uint8* y_bu
                        int height,
                        int y_pitch,
                        int uv_pitch,
                        int rgb_pitch,
                        YUVType yuv_type,
                        YUVColorSpace yuv_color_space,
                        ScaleFilter filter) {
 
-  bool use_deprecated = gfxPrefs::YCbCrAccurateConversion() ||
+  bool use_deprecated =
+      StaticPrefs::YCbCrAccurateConversion() ||
 #if defined(XP_WIN) && defined(_M_X64)
                         // libyuv does not support SIMD scaling on win 64bit. See Bug 1295927.
                         supports_sse3() ||
 #endif
                         (supports_mmx() && supports_sse() && !supports_sse3());
   // The deprecated function only support BT601.
   // See Bug 1210357.
   if (yuv_color_space != YUVColorSpace::BT601) {
--- a/image/AnimationSurfaceProvider.cpp
+++ b/image/AnimationSurfaceProvider.cpp
@@ -30,19 +30,19 @@ AnimationSurfaceProvider::AnimationSurfa
              "Use MetadataDecodingTask for metadata decodes");
   MOZ_ASSERT(!mDecoder->IsFirstFrameDecode(),
              "Use DecodedSurfaceProvider for single-frame image decodes");
 
   // Calculate how many frames we need to decode in this animation before we
   // enter decode-on-demand mode.
   IntSize frameSize = aSurfaceKey.Size();
   size_t threshold =
-      (size_t(gfxPrefs::ImageAnimatedDecodeOnDemandThresholdKB()) * 1024) /
+      (size_t(StaticPrefs::ImageAnimatedDecodeOnDemandThresholdKB()) * 1024) /
       (sizeof(uint32_t) * frameSize.width * frameSize.height);
-  size_t batch = gfxPrefs::ImageAnimatedDecodeOnDemandBatchSize();
+  size_t batch = StaticPrefs::ImageAnimatedDecodeOnDemandBatchSize();
 
   mFrames.reset(
       new AnimationFrameRetainedBuffer(threshold, batch, aCurrentFrame));
 }
 
 AnimationSurfaceProvider::~AnimationSurfaceProvider() {
   DropImageReference();
 
@@ -402,17 +402,17 @@ void AnimationSurfaceProvider::RequestFr
     MOZ_ASSERT_UNREACHABLE("Already replaced frame queue!");
     return;
   }
 
   auto oldFrameQueue =
       static_cast<AnimationFrameRetainedBuffer*>(mFrames.get());
 
   MOZ_ASSERT(!mDecoder->GetFrameRecycler());
-  if (gfxPrefs::ImageAnimatedDecodeOnDemandRecycle()) {
+  if (StaticPrefs::ImageAnimatedDecodeOnDemandRecycle()) {
     mFrames.reset(new AnimationFrameRecyclingQueue(std::move(*oldFrameQueue)));
     mDecoder->SetFrameRecycler(this);
   } else {
     mFrames.reset(new AnimationFrameDiscardingQueue(std::move(*oldFrameQueue)));
   }
 }
 
 void AnimationSurfaceProvider::AnnounceSurfaceAvailable() {
--- a/image/DecoderFactory.cpp
+++ b/image/DecoderFactory.cpp
@@ -69,17 +69,18 @@ DecoderType DecoderFactory::GetDecoderTy
   } else if (!strcmp(aMimeType, IMAGE_ICO_MS)) {
     type = DecoderType::ICO;
 
     // Icon
   } else if (!strcmp(aMimeType, IMAGE_ICON_MS)) {
     type = DecoderType::ICON;
 
     // WebP
-  } else if (!strcmp(aMimeType, IMAGE_WEBP) && gfxPrefs::ImageWebPEnabled()) {
+  } else if (!strcmp(aMimeType, IMAGE_WEBP) &&
+             StaticPrefs::ImageWebPEnabled()) {
     type = DecoderType::WEBP;
   }
 
   return type;
 }
 
 /* static */
 already_AddRefed<Decoder> DecoderFactory::GetDecoder(DecoderType aType,
--- a/image/FrameAnimator.cpp
+++ b/image/FrameAnimator.cpp
@@ -133,17 +133,17 @@ void AnimationState::InitAnimationFrameT
   }
 }
 
 void AnimationState::SetAnimationFrameTime(const TimeStamp& aTime) {
   mCurrentAnimationFrameTime = aTime;
 }
 
 bool AnimationState::MaybeAdvanceAnimationFrameTime(const TimeStamp& aTime) {
-  if (!gfxPrefs::ImageAnimatedResumeFromLastDisplayed() ||
+  if (!StaticPrefs::ImageAnimatedResumeFromLastDisplayed() ||
       mCurrentAnimationFrameTime >= aTime) {
     return false;
   }
 
   // We are configured to stop an animation when it is out of view, and restart
   // it from the same point when it comes back into view. The same applies if it
   // was discarded while out of view.
   mCurrentAnimationFrameTime = aTime;
--- a/image/ImageFactory.cpp
+++ b/image/ImageFactory.cpp
@@ -19,31 +19,31 @@
 #include "MultipartImage.h"
 #include "RasterImage.h"
 #include "VectorImage.h"
 #include "Image.h"
 #include "nsMediaFragmentURIParser.h"
 #include "nsContentUtils.h"
 #include "nsIScriptSecurityManager.h"
 
-#include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 
 namespace mozilla {
 namespace image {
 
 /*static*/
 void ImageFactory::Initialize() {}
 
 static uint32_t ComputeImageFlags(nsIURI* uri, const nsCString& aMimeType,
                                   bool isMultiPart) {
   nsresult rv;
 
   // We default to the static globals.
-  bool isDiscardable = gfxPrefs::ImageMemDiscardable();
-  bool doDecodeImmediately = gfxPrefs::ImageDecodeImmediatelyEnabled();
+  bool isDiscardable = StaticPrefs::ImageMemDiscardable();
+  bool doDecodeImmediately = StaticPrefs::ImageDecodeImmediatelyEnabled();
 
   // We want UI to be as snappy as possible and not to flicker. Disable
   // discarding for chrome URLS.
   bool isChrome = false;
   rv = uri->SchemeIs("chrome", &isChrome);
   if (NS_SUCCEEDED(rv) && isChrome) {
     isDiscardable = false;
   }
--- a/image/ImageMemoryReporter.cpp
+++ b/image/ImageMemoryReporter.cpp
@@ -2,16 +2,17 @@
 /* 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 "ImageMemoryReporter.h"
 #include "Image.h"
 #include "mozilla/layers/SharedSurfacesParent.h"
+#include "mozilla/StaticPrefs.h"
 #include "nsIMemoryReporter.h"
 #include "nsISupportsImpl.h"
 
 namespace mozilla {
 namespace image {
 
 ImageMemoryReporter::WebRenderReporter* ImageMemoryReporter::sWrReporter;
 
@@ -91,17 +92,17 @@ void ImageMemoryReporter::ReportSharedSu
   }
 
   if (aIsForCompositor) {
     path.AppendLiteral("pid=");
     path.AppendInt(uint32_t(aEntry.mCreatorPid));
     path.AppendLiteral("/");
   }
 
-  if (gfxPrefs::ImageMemDebugReporting()) {
+  if (StaticPrefs::ImageMemDebugReporting()) {
     path.AppendInt(aExternalId, 16);
     path.AppendLiteral("/");
   }
 
   path.AppendLiteral("image(");
   path.AppendInt(aEntry.mSize.width);
   path.AppendLiteral("x");
   path.AppendInt(aEntry.mSize.height);
@@ -131,17 +132,17 @@ void ImageMemoryReporter::ReportSharedSu
 /* static */
 void ImageMemoryReporter::AppendSharedSurfacePrefix(
     nsACString& aPathPrefix, const SurfaceMemoryCounter& aCounter,
     layers::SharedSurfacesMemoryReport& aSharedSurfaces) {
   uint64_t extId = aCounter.Values().ExternalId();
   if (extId) {
     auto gpuEntry = aSharedSurfaces.mSurfaces.find(extId);
 
-    if (gfxPrefs::ImageMemDebugReporting()) {
+    if (StaticPrefs::ImageMemDebugReporting()) {
       aPathPrefix.AppendLiteral(", external_id:");
       aPathPrefix.AppendInt(extId, 16);
       if (gpuEntry != aSharedSurfaces.mSurfaces.end()) {
         aPathPrefix.AppendLiteral(", compositor_ref:");
         aPathPrefix.AppendInt(gpuEntry->second.mConsumers);
       } else {
         aPathPrefix.AppendLiteral(", compositor_ref:missing");
       }
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -1308,17 +1308,17 @@ static bool HaveSkia() {
 }
 
 bool RasterImage::CanDownscaleDuringDecode(const IntSize& aSize,
                                            uint32_t aFlags) {
   // Check basic requirements: downscale-during-decode is enabled, Skia is
   // available, this image isn't transient, we have all the source data and know
   // our size, and the flags allow us to do it.
   if (!mHasSize || mTransient || !HaveSkia() ||
-      !gfxPrefs::ImageDownscaleDuringDecodeEnabled() ||
+      !StaticPrefs::ImageDownscaleDuringDecodeEnabled() ||
       !(aFlags & imgIContainer::FLAG_HIGH_QUALITY_SCALING)) {
     return false;
   }
 
   // We don't downscale animated images during decode.
   if (mAnimationState) {
     return false;
   }
--- a/image/SurfaceCache.cpp
+++ b/image/SurfaceCache.cpp
@@ -404,17 +404,18 @@ class ImageSurfaceCache {
     return MakeTuple(bestMatch.forget(), matchType, suggestedSize);
   }
 
   void MaybeSetFactor2Mode() {
     MOZ_ASSERT(!mFactor2Mode);
 
     // Typically an image cache will not have too many size-varying surfaces, so
     // if we exceed the given threshold, we should consider using a subset.
-    int32_t thresholdSurfaces = gfxPrefs::ImageCacheFactor2ThresholdSurfaces();
+    int32_t thresholdSurfaces =
+        StaticPrefs::ImageCacheFactor2ThresholdSurfaces();
     if (thresholdSurfaces < 0 ||
         mSurfaces.Count() <= static_cast<uint32_t>(thresholdSurfaces)) {
       return;
     }
 
     // Determine how many native surfaces this image has. If it is zero, and it
     // is a vector image, then we should impute a single native size. Otherwise,
     // it may be zero because we don't know yet, or the image has an error, or
@@ -1631,17 +1632,17 @@ bool SurfaceCache::IsLegalSize(const Int
   return true;
 }
 
 IntSize SurfaceCache::ClampVectorSize(const IntSize& aSize) {
   // If we exceed the maximum, we need to scale the size downwards to fit.
   // It shouldn't get here if it is significantly larger because
   // VectorImage::UseSurfaceCacheForSize should prevent us from requesting
   // a rasterized version of a surface greater than 4x the maximum.
-  int32_t maxSizeKB = gfxPrefs::ImageCacheMaxRasterizedSVGThresholdKB();
+  int32_t maxSizeKB = StaticPrefs::ImageCacheMaxRasterizedSVGThresholdKB();
   if (maxSizeKB <= 0) {
     return aSize;
   }
 
   int32_t proposedKB = int32_t(int64_t(aSize.width) * aSize.height / 256);
   if (maxSizeKB >= proposedKB) {
     return aSize;
   }
--- a/image/imgFrame.cpp
+++ b/image/imgFrame.cpp
@@ -76,35 +76,35 @@ static bool ShouldUseHeap(const IntSize&
   // On some platforms (i.e. Android), a volatile buffer actually keeps a file
   // handle active. We would like to avoid too many since we could easily
   // exhaust the pool. However, other platforms we do not have the file handle
   // problem, and additionally we may avoid a superfluous memset since the
   // volatile memory starts out as zero-filled. Hence the knobs below.
 
   // For as long as an animated image is retained, its frames will never be
   // released to let the OS purge volatile buffers.
-  if (aIsAnimated && gfxPrefs::ImageMemAnimatedUseHeap()) {
+  if (aIsAnimated && StaticPrefs::ImageMemAnimatedUseHeap()) {
     return true;
   }
 
   // Lets us avoid too many small images consuming all of the handles. The
   // actual allocation checks for overflow.
   int32_t bufferSize = (aStride * aSize.width) / 1024;
-  if (bufferSize < gfxPrefs::ImageMemVolatileMinThresholdKB()) {
+  if (bufferSize < StaticPrefs::ImageMemVolatileMinThresholdKB()) {
     return true;
   }
 
   return false;
 }
 
 static already_AddRefed<DataSourceSurface> AllocateBufferForImage(
     const IntSize& size, SurfaceFormat format, bool aIsAnimated = false) {
   int32_t stride = VolatileSurfaceStride(size, format);
 
-  if (gfxVars::GetUseWebRenderOrDefault() && gfxPrefs::ImageMemShared()) {
+  if (gfxVars::GetUseWebRenderOrDefault() && StaticPrefs::ImageMemShared()) {
     RefPtr<SourceSurfaceSharedData> newSurf = new SourceSurfaceSharedData();
     if (newSurf->Init(size, stride, format)) {
       return newSurf.forget();
     }
   } else if (ShouldUseHeap(size, stride, aIsAnimated)) {
     RefPtr<SourceSurfaceAlignedRawData> newSurf =
         new SourceSurfaceAlignedRawData();
     if (newSurf->Init(size, format, false, 0, stride)) {
--- a/image/imgLoader.cpp
+++ b/image/imgLoader.cpp
@@ -81,17 +81,17 @@ class imgMemoryReporter final : public n
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                             nsISupports* aData, bool aAnonymize) override {
     MOZ_ASSERT(NS_IsMainThread());
 
     layers::CompositorManagerChild* manager =
         CompositorManagerChild::GetInstance();
-    if (!manager || !gfxPrefs::ImageMemDebugReporting()) {
+    if (!manager || !StaticPrefs::ImageMemDebugReporting()) {
       layers::SharedSurfacesMemoryReport sharedSurfaces;
       FinishCollectReports(aHandleReport, aData, aAnonymize, sharedSurfaces);
       return NS_OK;
     }
 
     RefPtr<imgMemoryReporter> self(this);
     nsCOMPtr<nsIHandleReportCallback> handleReport(aHandleReport);
     nsCOMPtr<nsISupports> data(aData);
@@ -258,17 +258,17 @@ class imgMemoryReporter final : public n
           counter.URI().Truncate(max);
           counter.URI().AppendLiteral(" (truncated)");
         }
         counter.URI().ReplaceChar('/', '\\');
       }
 
       summaryTotal += counter;
 
-      if (counter.IsNotable() || gfxPrefs::ImageMemDebugReporting()) {
+      if (counter.IsNotable() || StaticPrefs::ImageMemDebugReporting()) {
         ReportImage(aHandleReport, aData, aPathPrefix, counter,
                     aSharedSurfaces);
       } else {
         ImageMemoryReporter::TrimSharedSurfaces(counter, aSharedSurfaces);
         nonNotableTotal += counter;
       }
     }
 
@@ -339,17 +339,17 @@ class imgMemoryReporter final : public n
       }
 
       ImageMemoryReporter::AppendSharedSurfacePrefix(surfacePathPrefix, counter,
                                                      aSharedSurfaces);
 
       if (counter.Type() == SurfaceMemoryCounterType::NORMAL) {
         PlaybackType playback = counter.Key().Playback();
         if (playback == PlaybackType::eAnimated) {
-          if (gfxPrefs::ImageMemDebugReporting()) {
+          if (StaticPrefs::ImageMemDebugReporting()) {
             surfacePathPrefix.AppendPrintf(
                 " (animation %4u)", uint32_t(counter.Values().FrameIndex()));
           } else {
             surfacePathPrefix.AppendLiteral(" (animation)");
           }
         }
 
         if (counter.Key().Flags() != DefaultSurfaceFlags()) {
--- a/image/imgRequest.cpp
+++ b/image/imgRequest.cpp
@@ -464,17 +464,17 @@ void imgRequest::AdjustPriority(imgReque
 void imgRequest::AdjustPriorityInternal(int32_t aDelta) {
   nsCOMPtr<nsISupportsPriority> p = do_QueryInterface(mChannel);
   if (p) {
     p->AdjustPriority(aDelta);
   }
 }
 
 void imgRequest::BoostPriority(uint32_t aCategory) {
-  if (!gfxPrefs::ImageLayoutNetworkPriority()) {
+  if (!StaticPrefs::ImageLayoutNetworkPriority()) {
     return;
   }
 
   uint32_t newRequestedCategory =
       (mBoostCategoriesRequested & aCategory) ^ aCategory;
   if (!newRequestedCategory) {
     // priority boost for each category can only apply once.
     return;
--- a/image/test/gtest/TestSurfaceCache.cpp
+++ b/image/test/gtest/TestSurfaceCache.cpp
@@ -67,17 +67,17 @@ TEST_F(ImageSurfaceCache, Factor2) {
   // If the data stream is small enough, as we assert above,
   // FLAG_SYNC_DECODE_IF_FAST will allow us to decode sync, but avoid forcing
   // SurfaceCache::Lookup. Instead it will use SurfaceCache::LookupBestMatch.
   const uint32_t bestMatchFlags = imgIContainer::FLAG_HIGH_QUALITY_SCALING |
                                   imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
 
   // We need the default threshold to be enabled (otherwise we should disable
   // this test).
-  int32_t threshold = gfxPrefs::ImageCacheFactor2ThresholdSurfaces();
+  int32_t threshold = StaticPrefs::ImageCacheFactor2ThresholdSurfaces();
   ASSERT_TRUE(threshold >= 0);
 
   // We need to know what the native sizes are, otherwise factor of 2 mode will
   // be disabled.
   size_t nativeSizes = image->GetNativeSizesLength();
   ASSERT_EQ(nativeSizes, 1u);
 
   // Threshold is the native size count and the pref threshold added together.
--- a/layout/base/AccessibleCaretEventHub.cpp
+++ b/layout/base/AccessibleCaretEventHub.cpp
@@ -558,17 +558,17 @@ bool AccessibleCaretEventHub::MoveDistan
          AppUnitsPerCSSPixel() * kMoveStartToleranceInPixel;
 }
 
 void AccessibleCaretEventHub::LaunchLongTapInjector() {
   if (!mLongTapInjectorTimer) {
     return;
   }
 
-  int32_t longTapDelay = gfxPrefs::UiClickHoldContextMenusDelay();
+  int32_t longTapDelay = StaticPrefs::UiClickHoldContextMenusDelay();
   mLongTapInjectorTimer->InitWithNamedFuncCallback(
       FireLongTap, this, longTapDelay, nsITimer::TYPE_ONE_SHOT,
       "AccessibleCaretEventHub::LaunchLongTapInjector");
 }
 
 void AccessibleCaretEventHub::CancelLongTapInjector() {
   if (!mLongTapInjectorTimer) {
     return;
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -34,17 +34,16 @@
 #include "MobileViewportManager.h"
 #include <algorithm>
 
 #ifdef XP_WIN
 #  include "winuser.h"
 #endif
 
 #include "gfxContext.h"
-#include "gfxPrefs.h"
 #include "gfxUserFontSet.h"
 #include "nsContentList.h"
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "mozilla/dom/BrowserBridgeChild.h"
 #include "mozilla/dom/BrowsingContext.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/PointerEventHandler.h"
@@ -3392,17 +3391,17 @@ static void ScrollToShowRect(PresShell* 
   if (needToScroll) {
     ScrollMode scrollMode = ScrollMode::Instant;
     bool autoBehaviorIsSmooth =
         (aFrameAsScrollable->GetScrollStyles().mScrollBehavior ==
          NS_STYLE_SCROLL_BEHAVIOR_SMOOTH);
     bool smoothScroll = (aScrollFlags & ScrollFlags::ScrollSmooth) ||
                         ((aScrollFlags & ScrollFlags::ScrollSmoothAuto) &&
                          autoBehaviorIsSmooth);
-    if (gfxPrefs::ScrollBehaviorEnabled() && smoothScroll) {
+    if (StaticPrefs::ScrollBehaviorEnabled() && smoothScroll) {
       scrollMode = ScrollMode::SmoothMsd;
     }
     nsIFrame* frame = do_QueryFrame(aFrameAsScrollable);
     AutoWeakFrame weakFrame(frame);
     aFrameAsScrollable->ScrollTo(scrollPt, scrollMode, &allowedRange,
                                  aScrollFlags & ScrollFlags::ScrollSnap
                                      ? nsIScrollbarMediator::ENABLE_SNAP
                                      : nsIScrollbarMediator::DISABLE_SNAP);
@@ -5088,17 +5087,17 @@ void PresShell::AddCanvasBackgroundColor
   // With async scrolling, we'd like to have two instances of the background
   // color: one that scrolls with the content (for the reasons stated above),
   // and one underneath which does not scroll with the content, but which can
   // be shown during checkerboarding and overscroll.
   // We can only do that if the color is opaque.
   bool forceUnscrolledItem =
       nsLayoutUtils::UsesAsyncScrolling(aFrame) && NS_GET_A(bgcolor) == 255;
   if ((aFlags & AddCanvasBackgroundColorFlags::AddForSubDocument) &&
-      gfxPrefs::LayoutUseContainersForRootFrames()) {
+      StaticPrefs::LayoutUseContainersForRootFrames()) {
     // If we're using ContainerLayers for a subdoc, then any items we add here
     // will still be scrolled (since we're inside the container at this point),
     // so don't bother and we will do it manually later.
     forceUnscrolledItem = false;
   }
 
   if (!addedScrollingBackgroundColor || forceUnscrolledItem) {
     aList.AppendNewToBottom<nsDisplaySolidColor>(&aBuilder, aFrame, aBounds,
--- a/layout/base/ZoomConstraintsClient.cpp
+++ b/layout/base/ZoomConstraintsClient.cpp
@@ -168,17 +168,17 @@ void ZoomConstraintsClient::ScreenSizeCh
 }
 
 static mozilla::layers::ZoomConstraints ComputeZoomConstraintsFromViewportInfo(
     const nsViewportInfo& aViewportInfo, Document* aDocument) {
   mozilla::layers::ZoomConstraints constraints;
   constraints.mAllowZoom = aViewportInfo.IsZoomAllowed() &&
                            nsLayoutUtils::AllowZoomingForDocument(aDocument);
   constraints.mAllowDoubleTapZoom =
-      constraints.mAllowZoom && gfxPrefs::APZAllowDoubleTapZooming();
+      constraints.mAllowZoom && StaticPrefs::APZAllowDoubleTapZooming();
   if (constraints.mAllowZoom) {
     constraints.mMinZoom.scale = aViewportInfo.GetMinZoom().scale;
     constraints.mMaxZoom.scale = aViewportInfo.GetMaxZoom().scale;
   } else {
     constraints.mMinZoom.scale = aViewportInfo.GetDefaultZoom().scale;
     constraints.mMaxZoom.scale = aViewportInfo.GetDefaultZoom().scale;
   }
   return constraints;
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -58,17 +58,16 @@
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsCSSRendering.h"
 #include "nsTextFragment.h"
 #include "nsStyleConsts.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDocShell.h"
 #include "nsIWidget.h"
 #include "gfxMatrix.h"
-#include "gfxPrefs.h"
 #include "gfxTypes.h"
 #include "nsTArray.h"
 #include "mozilla/dom/HTMLCanvasElement.h"
 #include "nsICanvasRenderingContextInternal.h"
 #include "gfxPlatform.h"
 #include <algorithm>
 #include <limits>
 #include "mozilla/dom/AnonymousContent.h"
@@ -535,24 +534,24 @@ bool nsLayoutUtils::IsAnimationLoggingEn
         &sShouldLog, "layers.offmainthreadcomposition.log-animations");
   }
 
   return sShouldLog;
 }
 
 bool nsLayoutUtils::AreRetainedDisplayListsEnabled() {
 #ifdef MOZ_WIDGET_ANDROID
-  return gfxPrefs::LayoutRetainDisplayList();
+  return StaticPrefs::LayoutRetainDisplayList();
 #else
   if (XRE_IsContentProcess()) {
-    return gfxPrefs::LayoutRetainDisplayList();
+    return StaticPrefs::LayoutRetainDisplayList();
   }
 
   if (XRE_IsE10sParentProcess()) {
-    return gfxPrefs::LayoutRetainDisplayListChrome();
+    return StaticPrefs::LayoutRetainDisplayListChrome();
   }
 
   // Retained display lists require e10s.
   return false;
 #endif
 }
 
 bool nsLayoutUtils::DisplayRootHasRetainedDisplayListBuilder(nsIFrame* aFrame) {
@@ -750,17 +749,17 @@ bool nsLayoutUtils::AsyncPanZoomEnabled(
   return widget->AsyncPanZoomEnabled();
 }
 
 bool nsLayoutUtils::AllowZoomingForDocument(
     const mozilla::dom::Document* aDocument) {
   // True if we allow zooming for all documents on this platform, or if we are
   // in RDM and handling meta viewports, which force zoom under some
   // circumstances.
-  return gfxPrefs::APZAllowZooming() ||
+  return StaticPrefs::APZAllowZooming() ||
          (aDocument && aDocument->InRDMPane() &&
           nsLayoutUtils::ShouldHandleMetaViewport(aDocument));
 }
 
 float nsLayoutUtils::GetCurrentAPZResolutionScale(PresShell* aPresShell) {
   return aPresShell ? aPresShell->GetCumulativeNonRootScaleResolution() : 1.0;
 }
 
@@ -1042,17 +1041,17 @@ bool nsLayoutUtils::ShouldDisableApzForE
         return true;
       }
     }
   }
 
   if (!doc) {
     return false;
   }
-  return gfxPrefs::APZDisableForScrollLinkedEffects() &&
+  return StaticPrefs::APZDisableForScrollLinkedEffects() &&
          doc->HasScrollLinkedEffect();
 }
 
 static bool GetDisplayPortData(
     nsIContent* aContent, DisplayPortPropertyData** aOutRectData,
     DisplayPortMarginsPropertyData** aOutMarginsData) {
   MOZ_ASSERT(aOutRectData && aOutMarginsData);
 
@@ -1167,18 +1166,18 @@ static void TranslateFromScrollPortToScr
   if (scrollableFrame) {
     *aRect += scrollableFrame->GetScrollPortRect().TopLeft();
   }
 }
 
 bool nsLayoutUtils::GetDisplayPort(
     nsIContent* aContent, nsRect* aResult,
     RelativeTo aRelativeTo /* = RelativeTo::ScrollPort */) {
-  float multiplier = gfxPrefs::UseLowPrecisionBuffer()
-                         ? 1.0f / gfxPrefs::LowPrecisionResolution()
+  float multiplier = StaticPrefs::UseLowPrecisionBuffer()
+                         ? 1.0f / StaticPrefs::LowPrecisionResolution()
                          : 1.0f;
   bool usingDisplayPort = GetDisplayPortImpl(aContent, aResult, multiplier);
   if (aResult && usingDisplayPort && aRelativeTo == RelativeTo::ScrollFrame) {
     TranslateFromScrollPortToScrollFrame(aContent, aResult);
   }
   return usingDisplayPort;
 }
 
@@ -1284,17 +1283,17 @@ bool nsLayoutUtils::SetDisplayPortMargin
       new DisplayPortMarginsPropertyData(aMargins, aPriority),
       nsINode::DeleteProperty<DisplayPortMarginsPropertyData>);
 
   nsRect newDisplayPort;
   DebugOnly<bool> hasDisplayPort =
       GetHighResolutionDisplayPort(aContent, &newDisplayPort);
   MOZ_ASSERT(hasDisplayPort);
 
-  if (gfxPrefs::LayoutUseContainersForRootFrames()) {
+  if (StaticPrefs::LayoutUseContainersForRootFrames()) {
     nsIFrame* rootScrollFrame = aPresShell->GetRootScrollFrame();
     if (rootScrollFrame && aContent == rootScrollFrame->GetContent() &&
         nsLayoutUtils::UsesAsyncScrolling(rootScrollFrame)) {
       // We are setting a root displayport for a document.
       // If we have APZ, then set a special flag on the pres shell so
       // that we don't get scrollbars drawn.
       aPresShell->SetIgnoreViewportScrolling(true);
     }
@@ -1360,29 +1359,29 @@ void nsLayoutUtils::SetDisplayPortBaseIf
                                                const nsRect& aBase) {
   if (!aContent->GetProperty(nsGkAtoms::DisplayPortBase)) {
     SetDisplayPortBase(aContent, aBase);
   }
 }
 
 bool nsLayoutUtils::GetCriticalDisplayPort(nsIContent* aContent,
                                            nsRect* aResult) {
-  if (gfxPrefs::UseLowPrecisionBuffer()) {
+  if (StaticPrefs::UseLowPrecisionBuffer()) {
     return GetDisplayPortImpl(aContent, aResult, 1.0f);
   }
   return false;
 }
 
 bool nsLayoutUtils::HasCriticalDisplayPort(nsIContent* aContent) {
   return GetCriticalDisplayPort(aContent, nullptr);
 }
 
 bool nsLayoutUtils::GetHighResolutionDisplayPort(nsIContent* aContent,
                                                  nsRect* aResult) {
-  if (gfxPrefs::UseLowPrecisionBuffer()) {
+  if (StaticPrefs::UseLowPrecisionBuffer()) {
     return GetCriticalDisplayPort(aContent, aResult);
   }
   return GetDisplayPort(aContent, aResult);
 }
 
 void nsLayoutUtils::RemoveDisplayPort(nsIContent* aContent) {
   aContent->DeleteProperty(nsGkAtoms::DisplayPort);
   aContent->DeleteProperty(nsGkAtoms::DisplayPortMargins);
@@ -3808,31 +3807,31 @@ nsresult nsLayoutUtils::PaintFrame(gfxCo
           didBuildAsyncZoomContainer) {
         shouldAttemptPartialUpdate = false;
       }
 
       // Attempt to do a partial build and merge into the existing list.
       // This calls BuildDisplayListForStacking context on a subset of the
       // viewport.
       if (shouldAttemptPartialUpdate) {
-        if (gfxPrefs::LayoutVerifyRetainDisplayList()) {
+        if (StaticPrefs::LayoutVerifyRetainDisplayList()) {
           beforeMergeChecker.Set(&list, "BM");
         }
         updateState = retainedBuilder->AttemptPartialUpdate(
             aBackstop, beforeMergeChecker ? &toBeMergedChecker : nullptr);
         if ((updateState != PartialUpdateResult::Failed) &&
             beforeMergeChecker) {
           afterMergeChecker.Set(&list, "AM");
         }
       }
 
       if ((updateState != PartialUpdateResult::Failed) &&
-          (gfxPrefs::LayoutDisplayListBuildTwice() || afterMergeChecker)) {
+          (StaticPrefs::LayoutDisplayListBuildTwice() || afterMergeChecker)) {
         updateState = PartialUpdateResult::Failed;
-        if (gfxPrefs::LayersDrawFPS()) {
+        if (StaticPrefs::LayersDrawFPS()) {
           if (RefPtr<LayerManager> lm = builder.GetWidgetLayerManager()) {
             if (PaintTiming* pt = ClientLayerManager::MaybeGetPaintTiming(lm)) {
               pt->dl2Ms() = (TimeStamp::Now() - dlStart).ToMilliseconds();
             }
           }
         }
         dlStart = TimeStamp::Now();
       }
@@ -3874,17 +3873,17 @@ nsresult nsLayoutUtils::PaintFrame(gfxCo
           }
         }
       }
     }
 
     builder.SetIsBuilding(false);
     builder.IncrementPresShellPaintCount(presShell);
 
-    if (gfxPrefs::LayersDrawFPS()) {
+    if (StaticPrefs::LayersDrawFPS()) {
       if (RefPtr<LayerManager> lm = builder.GetWidgetLayerManager()) {
         if (PaintTiming* pt = ClientLayerManager::MaybeGetPaintTiming(lm)) {
           pt->dlMs() = (TimeStamp::Now() - dlStart).ToMilliseconds();
         }
       }
     }
   }
 
@@ -3982,17 +3981,17 @@ nsresult nsLayoutUtils::PaintFrame(gfxCo
   TimeStamp paintStart = TimeStamp::Now();
   RefPtr<LayerManager> layerManager =
       list.PaintRoot(&builder, aRenderingContext, flags);
   Telemetry::AccumulateTimeDelta(Telemetry::PAINT_RASTERIZE_TIME, paintStart);
 
   presShell->EndPaint();
   builder.Check();
 
-  if (gfxPrefs::GfxLoggingPaintedPixelCountEnabled()) {
+  if (StaticPrefs::GfxLoggingPaintedPixelCountEnabled()) {
     TimeStamp now = TimeStamp::Now();
     float rasterizeTime = (now - paintStart).ToMilliseconds();
     uint32_t pixelCount = layerManager->GetAndClearPaintedPixelCount();
     static std::vector<std::pair<TimeStamp, uint32_t>> history;
     if (pixelCount) {
       history.push_back(std::make_pair(now, pixelCount));
     }
     uint32_t paintedInLastSecond = 0;
@@ -4038,17 +4037,17 @@ nsresult nsLayoutUtils::PaintFrame(gfxCo
     std::stringstream lsStream;
     nsFrame::PrintDisplayList(&builder, list, lsStream);
     if (layerManager->GetRoot()) {
       layerManager->GetRoot()->SetDisplayListLog(lsStream.str().c_str());
     }
   }
 
 #ifdef MOZ_DUMP_PAINTING
-  if (gfxPrefs::DumpClientLayers()) {
+  if (StaticPrefs::DumpClientLayers()) {
     std::stringstream ss;
     FrameLayerBuilder::DumpRetainedLayerTree(layerManager, ss, false);
     print_stderr(ss);
   }
 #endif
 
   // Update the widget's opaque region information. This sets
   // glass boundaries on Windows. Also set up the window dragging region
@@ -8604,17 +8603,17 @@ void nsLayoutUtils::LogAdditionalTestDat
     clm->LogAdditionalTestData(aKey, aValue);
   } else if (WebRenderLayerManager* wrlm = manager->AsWebRenderLayerManager()) {
     wrlm->LogAdditionalTestData(aKey, aValue);
   }
 }
 
 /* static */
 bool nsLayoutUtils::IsAPZTestLoggingEnabled() {
-  return gfxPrefs::APZTestLoggingEnabled();
+  return StaticPrefs::APZTestLoggingEnabled();
 }
 
 ////////////////////////////////////////
 // SurfaceFromElementResult
 
 nsLayoutUtils::SurfaceFromElementResult::SurfaceFromElementResult()
     // Use safe default values here
     : mIsWriteOnly(true),
@@ -8887,17 +8886,17 @@ ScrollMetadata nsLayoutUtils::ComputeScr
     if (nsLayoutUtils::GetCriticalDisplayPort(aContent, &dp)) {
       metrics.SetCriticalDisplayPort(CSSRect::FromAppUnits(dp));
     }
 
     // Log the high-resolution display port (which is either the displayport
     // or the critical displayport) for test purposes.
     if (IsAPZTestLoggingEnabled()) {
       LogTestDataForPaint(aLayerManager, scrollId, "displayport",
-                          gfxPrefs::UseLowPrecisionBuffer()
+                          StaticPrefs::UseLowPrecisionBuffer()
                               ? metrics.GetCriticalDisplayPort()
                               : metrics.GetDisplayPort());
     }
 
     DisplayPortMarginsPropertyData* marginsData =
         static_cast<DisplayPortMarginsPropertyData*>(
             aContent->GetProperty(nsGkAtoms::DisplayPortMargins));
     if (marginsData) {
@@ -9142,17 +9141,17 @@ ScrollMetadata nsLayoutUtils::ComputeScr
   frameBounds.Deflate(boundMargins);
 
   metrics.SetCompositionBounds(frameBounds);
 
   metrics.SetRootCompositionSize(nsLayoutUtils::CalculateRootCompositionSize(
       aScrollFrame ? aScrollFrame : aForFrame, isRootContentDocRootScrollFrame,
       metrics));
 
-  if (gfxPrefs::APZPrintTree() || gfxPrefs::APZTestLoggingEnabled()) {
+  if (StaticPrefs::APZPrintTree() || StaticPrefs::APZTestLoggingEnabled()) {
     if (nsIContent* content =
             frameForCompositionBoundsCalculation->GetContent()) {
       nsAutoString contentDescription;
       if (content->IsElement()) {
         content->AsElement()->Describe(contentDescription);
       } else {
         contentDescription.AssignLiteral("(not an element)");
       }
@@ -9208,25 +9207,25 @@ Maybe<ScrollMetadata> nsLayoutUtils::Get
   nsPresContext* presContext = frame->PresContext();
   PresShell* presShell = presContext->PresShell();
   Document* document = presShell->GetDocument();
 
   // If we're using containerless scrolling, there is still one case where we
   // want the root container layer to have metrics. If the parent process is
   // using XUL windows, there is no root scrollframe, and without explicitly
   // creating metrics there will be no guaranteed top-level APZC.
-  bool addMetrics = gfxPrefs::LayoutUseContainersForRootFrames() ||
+  bool addMetrics = StaticPrefs::LayoutUseContainersForRootFrames() ||
                     (XRE_IsParentProcess() && !presShell->GetRootScrollFrame());
 
   // Add metrics if there are none in the layer tree with the id (create an id
   // if there isn't one already) of the root scroll frame/root content.
-  bool ensureMetricsForRootId = nsLayoutUtils::AsyncPanZoomEnabled(frame) &&
-                                !gfxPrefs::LayoutUseContainersForRootFrames() &&
-                                aBuilder->IsPaintingToWindow() &&
-                                !presContext->GetParentPresContext();
+  bool ensureMetricsForRootId =
+      nsLayoutUtils::AsyncPanZoomEnabled(frame) &&
+      !StaticPrefs::LayoutUseContainersForRootFrames() &&
+      aBuilder->IsPaintingToWindow() && !presContext->GetParentPresContext();
 
   nsIContent* content = nullptr;
   nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();
   if (rootScrollFrame) {
     content = rootScrollFrame->GetContent();
   } else {
     // If there is no root scroll frame, pick the document element instead.
     // The only case we don't want to do this is in non-APZ fennec, where
@@ -9897,17 +9896,17 @@ bool nsLayoutUtils::ShouldHandleMetaView
       return true;
     case nsIDocShell::META_VIEWPORT_OVERRIDE_DISABLED:
       return false;
     default:
       MOZ_ASSERT(metaViewportOverride ==
                  nsIDocShell::META_VIEWPORT_OVERRIDE_NONE);
       // The META_VIEWPORT_OVERRIDE_NONE case means that there is no override
       // and we rely solely on the gfxPrefs.
-      return gfxPrefs::MetaViewportEnabled();
+      return StaticPrefs::MetaViewportEnabled();
   }
 }
 
 /* static */
 ComputedStyle* nsLayoutUtils::StyleForScrollbar(nsIFrame* aScrollbarPart) {
   // Get the closest content node which is not an anonymous scrollbar
   // part. It should be the originating element of the scrollbar part.
   nsIContent* content = aScrollbarPart->GetContent();
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -1846,17 +1846,17 @@ void nsRefreshDriver::Tick(VsyncId aId, 
   mTickVsyncId = aId;
   mTickVsyncTime = aNowTime;
 
   gfxPlatform::GetPlatform()->SchedulePaintIfDeviceReset();
 
   // We want to process any pending APZ metrics ahead of their positions
   // in the queue. This will prevent us from spending precious time
   // painting a stale displayport.
-  if (gfxPrefs::APZPeekMessages()) {
+  if (StaticPrefs::APZPeekMessages()) {
     nsLayoutUtils::UpdateDisplayPortMarginsFromPendingMessages();
   }
 
   AutoTArray<nsCOMPtr<nsIRunnable>, 16> earlyRunners;
   earlyRunners.SwapElements(mEarlyRunners);
   for (auto& runner : earlyRunners) {
     runner->Run();
   }
@@ -2099,17 +2099,17 @@ void nsRefreshDriver::Tick(VsyncId aId, 
   while (iter.HasMore()) {
     nsAPostRefreshObserver* observer = iter.GetNext();
     observer->DidRefresh();
   }
 
   NS_ASSERTION(mInRefresh, "Still in refresh");
 
   if (mPresContext->IsRoot() && XRE_IsContentProcess() &&
-      gfxPrefs::AlwaysPaint()) {
+      StaticPrefs::AlwaysPaint()) {
     ScheduleViewManagerFlush();
   }
 
   if (dispatchRunnablesAfterTick && sPendingIdleRunnables) {
     AutoTArray<RunnableWithDelay, 8>* runnables = sPendingIdleRunnables;
     sPendingIdleRunnables = nullptr;
     for (RunnableWithDelay& runnableWithDelay : *runnables) {
       NS_DispatchToCurrentThreadQueue(runnableWithDelay.mRunnable.forget(),
--- a/layout/generic/ScrollAnimationBezierPhysics.cpp
+++ b/layout/generic/ScrollAnimationBezierPhysics.cpp
@@ -88,32 +88,32 @@ void ScrollAnimationBezierPhysics::Initi
   mPrevEventTime[1] = mPrevEventTime[0] - maxDelta;
   mPrevEventTime[2] = mPrevEventTime[1] - maxDelta;
 }
 
 void ScrollAnimationBezierPhysics::InitTimingFunction(
     SMILKeySpline& aTimingFunction, nscoord aCurrentPos,
     nscoord aCurrentVelocity, nscoord aDestination) {
   if (aDestination == aCurrentPos ||
-      gfxPrefs::SmoothScrollCurrentVelocityWeighting() == 0) {
+      StaticPrefs::SmoothScrollCurrentVelocityWeighting() == 0) {
     aTimingFunction.Init(
-        0, 0, 1 - gfxPrefs::SmoothScrollStopDecelerationWeighting(), 1);
+        0, 0, 1 - StaticPrefs::SmoothScrollStopDecelerationWeighting(), 1);
     return;
   }
 
   const TimeDuration oneSecond = TimeDuration::FromSeconds(1);
   double slope =
       aCurrentVelocity * (mDuration / oneSecond) / (aDestination - aCurrentPos);
   double normalization = sqrt(1.0 + slope * slope);
   double dt =
-      1.0 / normalization * gfxPrefs::SmoothScrollCurrentVelocityWeighting();
-  double dxy =
-      slope / normalization * gfxPrefs::SmoothScrollCurrentVelocityWeighting();
+      1.0 / normalization * StaticPrefs::SmoothScrollCurrentVelocityWeighting();
+  double dxy = slope / normalization *
+               StaticPrefs::SmoothScrollCurrentVelocityWeighting();
   aTimingFunction.Init(
-      dt, dxy, 1 - gfxPrefs::SmoothScrollStopDecelerationWeighting(), 1);
+      dt, dxy, 1 - StaticPrefs::SmoothScrollStopDecelerationWeighting(), 1);
 }
 
 nsPoint ScrollAnimationBezierPhysics::PositionAt(const TimeStamp& aTime) {
   if (IsFinished(aTime)) {
     return mDestination;
   }
 
   double progressX = mTimingFunctionX.GetSplineValue(ProgressAt(aTime));
--- a/layout/generic/ScrollAnimationMSDPhysics.cpp
+++ b/layout/generic/ScrollAnimationMSDPhysics.cpp
@@ -6,20 +6,20 @@
 
 #include "ScrollAnimationMSDPhysics.h"
 #include "gfxPrefs.h"
 
 using namespace mozilla;
 
 ScrollAnimationMSDPhysics::ScrollAnimationMSDPhysics(const nsPoint& aStartPos)
     : mStartPos(aStartPos),
-      mModelX(0, 0, 0, gfxPrefs::SmoothScrollMSDPhysicsRegularSpringConstant(),
-              1),
-      mModelY(0, 0, 0, gfxPrefs::SmoothScrollMSDPhysicsRegularSpringConstant(),
-              1),
+      mModelX(0, 0, 0,
+              StaticPrefs::SmoothScrollMSDPhysicsRegularSpringConstant(), 1),
+      mModelY(0, 0, 0,
+              StaticPrefs::SmoothScrollMSDPhysicsRegularSpringConstant(), 1),
       mIsFirstIteration(true) {}
 
 void ScrollAnimationMSDPhysics::Update(const TimeStamp& aTime,
                                        const nsPoint& aDestination,
                                        const nsSize& aCurrentVelocity) {
   double springConstant = ComputeSpringConstant(aTime);
 
   // mLastSimulatedTime is the most recent time that this animation has been
@@ -52,42 +52,44 @@ void ScrollAnimationMSDPhysics::ApplyCon
   mDestination += shiftDelta;
 }
 
 double ScrollAnimationMSDPhysics::ComputeSpringConstant(
     const TimeStamp& aTime) {
   if (!mPreviousEventTime) {
     mPreviousEventTime = aTime;
     mPreviousDelta = TimeDuration();
-    return gfxPrefs::SmoothScrollMSDPhysicsMotionBeginSpringConstant();
+    return StaticPrefs::SmoothScrollMSDPhysicsMotionBeginSpringConstant();
   }
 
   TimeDuration delta = aTime - mPreviousEventTime;
   TimeDuration previousDelta = mPreviousDelta;
 
   mPreviousEventTime = aTime;
   mPreviousDelta = delta;
 
   double deltaMS = delta.ToMilliseconds();
-  if (deltaMS >= gfxPrefs::SmoothScrollMSDPhysicsContinuousMotionMaxDeltaMS()) {
-    return gfxPrefs::SmoothScrollMSDPhysicsMotionBeginSpringConstant();
+  if (deltaMS >=
+      StaticPrefs::SmoothScrollMSDPhysicsContinuousMotionMaxDeltaMS()) {
+    return StaticPrefs::SmoothScrollMSDPhysicsMotionBeginSpringConstant();
   }
 
   if (previousDelta &&
-      deltaMS >= gfxPrefs::SmoothScrollMSDPhysicsSlowdownMinDeltaMS() &&
-      deltaMS >= previousDelta.ToMilliseconds() *
-                     gfxPrefs::SmoothScrollMSDPhysicsSlowdownMinDeltaRatio()) {
+      deltaMS >= StaticPrefs::SmoothScrollMSDPhysicsSlowdownMinDeltaMS() &&
+      deltaMS >=
+          previousDelta.ToMilliseconds() *
+              StaticPrefs::SmoothScrollMSDPhysicsSlowdownMinDeltaRatio()) {
     // The rate of events has slowed (the time delta between events has
     // increased) enough that we think that the current scroll motion is coming
     // to a stop. Use a stiffer spring in order to reach the destination more
     // quickly.
-    return gfxPrefs::SmoothScrollMSDPhysicsSlowdownSpringConstant();
+    return StaticPrefs::SmoothScrollMSDPhysicsSlowdownSpringConstant();
   }
 
-  return gfxPrefs::SmoothScrollMSDPhysicsRegularSpringConstant();
+  return StaticPrefs::SmoothScrollMSDPhysicsRegularSpringConstant();
 }
 
 void ScrollAnimationMSDPhysics::SimulateUntil(const TimeStamp& aTime) {
   if (!mLastSimulatedTime || aTime < mLastSimulatedTime) {
     return;
   }
   TimeDuration delta = aTime - mLastSimulatedTime;
   mModelX.Simulate(delta);
--- a/layout/generic/ScrollSnap.cpp
+++ b/layout/generic/ScrollSnap.cpp
@@ -323,17 +323,17 @@ Maybe<nsPoint> ScrollSnapUtils::GetSnapP
     }
 
     ProcessScrollSnapCoordinates(calcSnapPoints,
                                  aSnapInfo.mScrollSnapCoordinates, destPos);
   }
 
   bool snapped = false;
   nsPoint finalPos = calcSnapPoints.GetBestEdge();
-  nscoord proximityThreshold = gfxPrefs::ScrollSnapProximityThreshold();
+  nscoord proximityThreshold = StaticPrefs::ScrollSnapProximityThreshold();
   proximityThreshold = nsPresContext::CSSPixelsToAppUnits(proximityThreshold);
   if (aSnapInfo.mScrollSnapTypeY == StyleScrollSnapStrictness::Proximity &&
       std::abs(aDestination.y - finalPos.y) > proximityThreshold) {
     finalPos.y = aDestination.y;
   } else {
     snapped = true;
   }
   if (aSnapInfo.mScrollSnapTypeX == StyleScrollSnapStrictness::Proximity &&
--- a/layout/generic/ScrollVelocityQueue.cpp
+++ b/layout/generic/ScrollVelocityQueue.cpp
@@ -1,35 +1,35 @@
 /* -*- 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 "ScrollVelocityQueue.h"
 
-#include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "nsPresContext.h"
 #include "nsRefreshDriver.h"
 
 namespace mozilla {
 namespace layout {
 
 void ScrollVelocityQueue::Sample(const nsPoint& aScrollPosition) {
-  float flingSensitivity = gfxPrefs::ScrollSnapPredictionSensitivity();
-  int maxVelocity = gfxPrefs::ScrollSnapPredictionMaxVelocity();
+  float flingSensitivity = StaticPrefs::ScrollSnapPredictionSensitivity();
+  int maxVelocity = StaticPrefs::ScrollSnapPredictionMaxVelocity();
   maxVelocity = nsPresContext::CSSPixelsToAppUnits(maxVelocity);
   int maxOffset = maxVelocity * flingSensitivity;
   TimeStamp currentRefreshTime =
       mPresContext->RefreshDriver()->MostRecentRefresh();
   if (mSampleTime.IsNull()) {
     mAccumulator = nsPoint();
   } else {
     uint32_t durationMs = (currentRefreshTime - mSampleTime).ToMilliseconds();
-    if (durationMs > gfxPrefs::APZVelocityRelevanceTime()) {
+    if (durationMs > StaticPrefs::APZVelocityRelevanceTime()) {
       mAccumulator = nsPoint();
       mQueue.Clear();
     } else if (durationMs == 0) {
       mAccumulator += aScrollPosition - mLastPosition;
     } else {
       nsPoint velocity = mAccumulator * 1000 / durationMs;
       velocity.Clamp(maxVelocity);
       mQueue.AppendElement(std::make_pair(durationMs, velocity));
@@ -49,17 +49,17 @@ void ScrollVelocityQueue::TrimQueue() {
   }
 
   TimeStamp currentRefreshTime =
       mPresContext->RefreshDriver()->MostRecentRefresh();
   nsPoint velocity;
   uint32_t timeDelta = (currentRefreshTime - mSampleTime).ToMilliseconds();
   for (int i = mQueue.Length() - 1; i >= 0; i--) {
     timeDelta += mQueue[i].first;
-    if (timeDelta >= gfxPrefs::APZVelocityRelevanceTime()) {
+    if (timeDelta >= StaticPrefs::APZVelocityRelevanceTime()) {
       // The rest of the samples have expired and should be dropped
       for (; i >= 0; i--) {
         mQueue.RemoveElementAt(0);
       }
     }
   }
 }
 
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -85,17 +85,16 @@
 #include "nsSVGMaskFrame.h"
 #include "nsChangeHint.h"
 #include "nsDeckFrame.h"
 #include "nsSubDocumentFrame.h"
 #include "SVGTextFrame.h"
 #include "RetainedDisplayListBuilder.h"
 
 #include "gfxContext.h"
-#include "gfxPrefs.h"
 #include "nsAbsoluteContainingBlock.h"
 #include "StickyScrollContainer.h"
 #include "nsFontInflationData.h"
 #include "nsRegion.h"
 #include "nsIFrameInlines.h"
 #include "nsStyleChangeList.h"
 #include "nsWindowSizes.h"
 
@@ -1080,17 +1079,17 @@ void nsIFrame::MarkNeedsDisplayItemRebui
   MOZ_ASSERT(rootFrame);
 
   if (rootFrame->IsFrameModified()) {
     return;
   }
 
   RetainedDisplayListData* data = GetOrSetRetainedDisplayListData(rootFrame);
 
-  if (data->ModifiedFramesCount() > gfxPrefs::LayoutRebuildFrameLimit()) {
+  if (data->ModifiedFramesCount() > StaticPrefs::LayoutRebuildFrameLimit()) {
     // If the modified frames count is above the rebuild limit, mark the root
     // frame modified, and stop marking additional frames modified.
     data->AddModifiedFrame(rootFrame);
     rootFrame->SetFrameIsModified(true);
     return;
   }
 
   data->AddModifiedFrame(this);
@@ -3218,17 +3217,17 @@ void nsIFrame::BuildDisplayListForStacki
   if (aBuilder->IsBackgroundOnly()) {
     set.BlockBorderBackgrounds()->DeleteAll(aBuilder);
     set.Floats()->DeleteAll(aBuilder);
     set.Content()->DeleteAll(aBuilder);
     set.PositionedDescendants()->DeleteAll(aBuilder);
     set.Outlines()->DeleteAll(aBuilder);
   }
 
-  if (hasOverrideDirtyRect && gfxPrefs::LayoutDisplayListShowArea()) {
+  if (hasOverrideDirtyRect && StaticPrefs::LayoutDisplayListShowArea()) {
     nsDisplaySolidColor* color = MakeDisplayItem<nsDisplaySolidColor>(
         aBuilder, this,
         dirtyRect + aBuilder->GetCurrentFrameOffsetToReferenceFrame(),
         NS_RGBA(255, 0, 0, 64), false);
     if (color) {
       color->SetOverrideZIndex(INT32_MAX);
       set.PositionedDescendants()->AppendToTop(color);
     }
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -57,16 +57,17 @@
 #include "nsStyleConsts.h"
 #include "nsSVGIntegrationUtils.h"
 #include "nsIScrollPositionListener.h"
 #include "StickyScrollContainer.h"
 #include "nsIFrameInlines.h"
 #include "nsILayoutHistoryState.h"
 #include "gfxPlatform.h"
 #include "gfxPrefs.h"
+#include "mozilla/StaticPrefs.h"
 #include "ScrollAnimationPhysics.h"
 #include "ScrollAnimationBezierPhysics.h"
 #include "ScrollAnimationMSDPhysics.h"
 #include "ScrollSnap.h"
 #include "UnitTransforms.h"
 #include "nsPluginFrame.h"
 #include "nsSliderFrame.h"
 #include "ViewportFrame.h"
@@ -1633,22 +1634,22 @@ class ScrollFrameHelper::AsyncSmoothMSDS
  public:
   AsyncSmoothMSDScroll(const nsPoint& aInitialPosition,
                        const nsPoint& aInitialDestination,
                        const nsSize& aInitialVelocity, const nsRect& aRange,
                        const mozilla::TimeStamp& aStartTime,
                        nsPresContext* aPresContext)
       : mXAxisModel(aInitialPosition.x, aInitialDestination.x,
                     aInitialVelocity.width,
-                    gfxPrefs::ScrollBehaviorSpringConstant(),
-                    gfxPrefs::ScrollBehaviorDampingRatio()),
+                    StaticPrefs::ScrollBehaviorSpringConstant(),
+                    StaticPrefs::ScrollBehaviorDampingRatio()),
         mYAxisModel(aInitialPosition.y, aInitialDestination.y,
                     aInitialVelocity.height,
-                    gfxPrefs::ScrollBehaviorSpringConstant(),
-                    gfxPrefs::ScrollBehaviorDampingRatio()),
+                    StaticPrefs::ScrollBehaviorSpringConstant(),
+                    StaticPrefs::ScrollBehaviorDampingRatio()),
         mRange(aRange),
         mLastRefreshTime(aStartTime),
         mCallee(nullptr),
         mOneDevicePixelInAppUnits(aPresContext->DevPixelsToAppUnits(1)) {
     Telemetry::SetHistogramRecordingEnabled(
         Telemetry::FX_REFRESH_DRIVER_SYNC_SCROLL_FRAME_DELAY_MS, true);
   }
 
@@ -1922,17 +1923,17 @@ void ScrollFrameHelper::AsyncScroll::Ini
   }
   // Likewise we should never get APZ-triggered scrolls here, and if that
   // changes something is likely broken somewhere.
   MOZ_ASSERT(aOrigin != nsGkAtoms::apz);
 
   // Read preferences only on first iteration or for a different event origin.
   if (!mAnimationPhysics || aOrigin != mOrigin) {
     mOrigin = aOrigin;
-    if (gfxPrefs::SmoothScrollMSDPhysicsEnabled()) {
+    if (StaticPrefs::SmoothScrollMSDPhysicsEnabled()) {
       mAnimationPhysics =
           MakeUnique<ScrollAnimationMSDPhysics>(aInitialPosition);
     } else {
       ScrollAnimationBezierPhysicsSettings settings =
           ComputeBezierAnimationSettingsForOrigin(mOrigin);
       mAnimationPhysics =
           MakeUnique<ScrollAnimationBezierPhysics>(aInitialPosition, settings);
     }
@@ -2272,17 +2273,17 @@ void ScrollFrameHelper::ScrollToWithOrig
       presContext->RefreshDriver()->IsTestControllingRefreshesEnabled()
           ? presContext->RefreshDriver()->MostRecentRefresh()
           : TimeStamp::Now();
   bool isSmoothScroll =
       (aMode == ScrollMode::Smooth) && IsSmoothScrollingEnabled();
 
   nsSize currentVelocity(0, 0);
 
-  if (gfxPrefs::ScrollBehaviorEnabled()) {
+  if (StaticPrefs::ScrollBehaviorEnabled()) {
     if (aMode == ScrollMode::SmoothMsd) {
       mIgnoreMomentumScroll = true;
       if (!mAsyncSmoothMSDScroll) {
         nsPoint sv = mVelocityQueue.GetVelocity();
         currentVelocity.width = sv.x;
         currentVelocity.height = sv.y;
         if (mAsyncScroll) {
           if (mAsyncScroll->IsSmoothScroll()) {
@@ -2469,18 +2470,18 @@ void ScrollFrameHelper::MarkRecentlyScro
   // If we just scrolled and there's a displayport expiry timer in place,
   // reset the timer.
   ResetDisplayPortExpiryTimer();
 }
 
 void ScrollFrameHelper::ResetDisplayPortExpiryTimer() {
   if (mDisplayPortExpiryTimer) {
     mDisplayPortExpiryTimer->InitWithNamedFuncCallback(
-        RemoveDisplayPortCallback, this, gfxPrefs::APZDisplayPortExpiryTime(),
-        nsITimer::TYPE_ONE_SHOT,
+        RemoveDisplayPortCallback, this,
+        StaticPrefs::APZDisplayPortExpiryTime(), nsITimer::TYPE_ONE_SHOT,
         "ScrollFrameHelper::ResetDisplayPortExpiryTimer");
   }
 }
 
 bool ScrollFrameHelper::AllowDisplayPortExpiration() {
   if (IsAlwaysActive()) {
     return false;
   }
@@ -2490,17 +2491,17 @@ bool ScrollFrameHelper::AllowDisplayPort
   return true;
 }
 
 void ScrollFrameHelper::TriggerDisplayPortExpiration() {
   if (!AllowDisplayPortExpiration()) {
     return;
   }
 
-  if (!gfxPrefs::APZDisplayPortExpiryTime()) {
+  if (!StaticPrefs::APZDisplayPortExpiryTime()) {
     // a zero time disables the expiry
     return;
   }
 
   if (!mDisplayPortExpiryTimer) {
     mDisplayPortExpiryTimer = NS_NewTimer();
   }
   ResetDisplayPortExpiryTimer();
@@ -2806,17 +2807,17 @@ void ScrollFrameHelper::ScrollToImpl(nsP
   }
 
   ScrollVisual();
   mAnchor.UserScrolled();
 
   bool schedulePaint = true;
   if (nsLayoutUtils::AsyncPanZoomEnabled(mOuter) &&
       !nsLayoutUtils::ShouldDisableApzForElement(content) &&
-      gfxPrefs::APZPaintSkipping()) {
+      StaticPrefs::APZPaintSkipping()) {
     // If APZ is enabled with paint-skipping, there are certain conditions in
     // which we can skip paints:
     // 1) If APZ triggered this scroll, and the tile-aligned displayport is
     //    unchanged.
     // 2) If non-APZ triggered this scroll, but we can handle it by just asking
     //    APZ to update the scroll position. Again we make this conditional on
     //    the tile-aligned displayport being unchanged.
     // We do the displayport check first since it's common to all scenarios,
@@ -2841,17 +2842,17 @@ void ScrollFrameHelper::ScrollToImpl(nsP
         mScrollableByAPZ, HasPluginFrames(), HasPerspective(),
         HasBgAttachmentLocal(), mHasOutOfFlowContentInsideFilter);
     if (usingDisplayPort && displayPort.IsEqualEdges(oldDisplayPort) &&
         !HasPerspective() && !HasBgAttachmentLocal() &&
         !mHasOutOfFlowContentInsideFilter) {
       bool haveScrollLinkedEffects =
           content->GetComposedDoc()->HasScrollLinkedEffect();
       bool apzDisabled = haveScrollLinkedEffects &&
-                         gfxPrefs::APZDisableForScrollLinkedEffects();
+                         StaticPrefs::APZDisableForScrollLinkedEffects();
       if (!apzDisabled && !HasPluginFrames()) {
         if (LastScrollOrigin() == nsGkAtoms::apz) {
           schedulePaint = false;
           PAINT_SKIP_LOG("Skipping due to APZ scroll\n");
         } else if (mScrollableByAPZ) {
           nsIWidget* widget = presContext->GetNearestWidget();
           LayerManager* manager = widget ? widget->GetLayerManager() : nullptr;
           if (manager) {
@@ -3083,17 +3084,17 @@ void ScrollFrameHelper::AppendScrollPart
 
   DisplayListClipState::AutoSaveRestore clipState(aBuilder);
   // Don't let scrollparts extent outside our frame's border-box, if these are
   // viewport scrollbars. They would create layerization problems. This wouldn't
   // normally be an issue but themes can add overflow areas to scrollbar parts.
   if (mIsRoot) {
     nsRect scrollPartsClip =
         mOuter->GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(mOuter);
-    if (!gfxPrefs::LayoutUseContainersForRootFrames() &&
+    if (!StaticPrefs::LayoutUseContainersForRootFrames() &&
         mOuter->PresContext()->IsRootContentDocument()) {
       // With containerless scrolling, the resolution does not apply to the
       // scroll parts. We need to apply it to their clip manually to avoid it
       // cutting off the scrollbars when zoomed in.
       double res = mOuter->PresShell()->GetResolution();
       scrollPartsClip.width = NSToCoordRound(scrollPartsClip.width * res);
       scrollPartsClip.height = NSToCoordRound(scrollPartsClip.height * res);
     }
@@ -3131,18 +3132,19 @@ void ScrollFrameHelper::AppendScrollPart
         mIsRoot && mOuter->PresContext()->IsRootContentDocument()
             ? scrollParts[i]->GetVisualOverflowRectRelativeToParent()
             : aBuilder->GetDirtyRect();
 
     // Always create layers for overlay scrollbars so that we don't create a
     // giant layer covering the whole scrollport if both scrollbars are visible.
     const bool isOverlayScrollbar =
         scrollDirection.isSome() && overlayScrollbars;
-    const bool createLayer = aCreateLayer || isOverlayScrollbar ||
-                             gfxPrefs::AlwaysLayerizeScrollbarTrackTestOnly();
+    const bool createLayer =
+        aCreateLayer || isOverlayScrollbar ||
+        StaticPrefs::AlwaysLayerizeScrollbarTrackTestOnly();
 
     nsDisplayListCollection partList(aBuilder);
     {
       nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
           aBuilder, mOuter, visible, dirty);
 
       nsDisplayListBuilder::AutoCurrentScrollbarInfoSetter infoSetter(
           aBuilder, scrollTargetId, scrollDirection, createLayer);
@@ -3386,17 +3388,17 @@ void ScrollFrameHelper::BuildDisplayList
       // Add classic scrollbars.
       AppendScrollPartsTo(aBuilder, aLists, createLayersForScrollbars, false);
     }
 
     {
       nsDisplayListBuilder::AutoCurrentActiveScrolledRootSetter asrSetter(
           aBuilder);
       if (aBuilder->IsPaintingToWindow() &&
-          gfxPrefs::LayoutUseContainersForRootFrames() && mIsRoot) {
+          StaticPrefs::LayoutUseContainersForRootFrames() && mIsRoot) {
         asrSetter.EnterScrollFrame(sf);
         if (isRcdRsf) {
           aBuilder->SetActiveScrolledRootForRootScrollframe(
               aBuilder->CurrentActiveScrolledRoot());
         }
       }
 
       nsDisplayListBuilder::AutoBuildingDisplayList building(
@@ -3434,17 +3436,17 @@ void ScrollFrameHelper::BuildDisplayList
       couldBuildLayer = true;
     } else {
       couldBuildLayer =
           nsLayoutUtils::AsyncPanZoomEnabled(mOuter) && WantAsyncScroll() &&
           // If we are using containers for root frames, and we are the root
           // scroll frame for the display root, then we don't need a scroll
           // info layer. nsDisplayList::PaintForFrame already calls
           // ComputeFrameMetrics for us.
-          (!(gfxPrefs::LayoutUseContainersForRootFrames() && mIsRoot) ||
+          (!(StaticPrefs::LayoutUseContainersForRootFrames() && mIsRoot) ||
            (aBuilder->RootReferenceFrame()->PresContext() !=
             mOuter->PresContext()));
     }
   }
 
   // Now display the scrollbars and scrollcorner. These parts are drawn
   // in the border-background layer, on top of our own background and
   // borders and underneath borders and backgrounds of later elements
@@ -3524,17 +3526,17 @@ void ScrollFrameHelper::BuildDisplayList
   nsRect scrollPortClip = mScrollPort + aBuilder->ToReferenceFrame(mOuter);
   nsRect clipRect = scrollPortClip;
   // Our override of GetBorderRadii ensures we never have a radius at
   // the corners where we have a scrollbar.
   nscoord radii[8];
   bool haveRadii = mOuter->GetPaddingBoxBorderRadii(radii);
   if (mIsRoot) {
     clipRect.SizeTo(nsLayoutUtils::CalculateCompositionSizeForFrame(mOuter));
-    if ((gfxPrefs::LayoutUseContainersForRootFrames() ||
+    if ((StaticPrefs::LayoutUseContainersForRootFrames() ||
          !aBuilder->IsPaintingToWindow()) &&
         mOuter->PresContext()->IsRootContentDocument()) {
       double res = mOuter->PresShell()->GetResolution();
       clipRect.width = NSToCoordRound(clipRect.width / res);
       clipRect.height = NSToCoordRound(clipRect.height / res);
     }
   }
 
@@ -3636,17 +3638,18 @@ void ScrollFrameHelper::BuildDisplayList
       scrolledRectClipState.ClipContainingBlockDescendants(
           scrolledRectClip + aBuilder->ToReferenceFrame(mOuter));
 
       nsDisplayListBuilder::AutoBuildingDisplayList building(
           aBuilder, mOuter, visibleRect, dirtyRect);
 
       mOuter->BuildDisplayListForChild(aBuilder, mScrolledFrame, set);
 
-      if (dirtyRectHasBeenOverriden && gfxPrefs::LayoutDisplayListShowArea()) {
+      if (dirtyRectHasBeenOverriden &&
+          StaticPrefs::LayoutDisplayListShowArea()) {
         nsDisplaySolidColor* color = MakeDisplayItem<nsDisplaySolidColor>(
             aBuilder, mOuter,
             dirtyRect + aBuilder->GetCurrentFrameOffsetToReferenceFrame(),
             NS_RGBA(0, 0, 255, 64), false);
         if (color) {
           color->SetOverrideZIndex(INT32_MAX);
           set.PositionedDescendants()->AppendToTop(color);
         }
@@ -3661,17 +3664,17 @@ void ScrollFrameHelper::BuildDisplayList
       ClipListsExceptCaret(&set, aBuilder, mScrolledFrame,
                            *extraContentBoxClipForNonCaretContent);
     }
 
     if (aBuilder->IsPaintingToWindow()) {
       mIsScrollParent = idSetter.ShouldForceLayerForScrollParent();
     }
     if (idSetter.ShouldForceLayerForScrollParent() &&
-        !gfxPrefs::LayoutUseContainersForRootFrames()) {
+        !StaticPrefs::LayoutUseContainersForRootFrames()) {
       // Note that forcing layerization of scroll parents follows the scroll
       // handoff chain which is subject to the out-of-flow-frames caveat noted
       // above (where the idSetter variable is created).
       //
       // This is not compatible when using containes for root scrollframes.
       MOZ_ASSERT(couldBuildLayer && mScrolledFrame->GetContent() &&
                  aBuilder->IsPaintingToWindow());
       if (!mWillBuildScrollableLayer) {
@@ -3966,17 +3969,17 @@ bool ScrollFrameHelper::DecideScrollable
 
   // The cached animated geometry root for the display builder is out of
   // date if we just introduced a new animated geometry root.
   if (oldWillBuildScrollableLayer != mWillBuildScrollableLayer) {
     aBuilder->RecomputeCurrentAnimatedGeometryRoot();
   }
 
   mIsScrollableLayerInRootContainer =
-      gfxPrefs::LayoutUseContainersForRootFrames() &&
+      StaticPrefs::LayoutUseContainersForRootFrames() &&
       mWillBuildScrollableLayer && mIsRoot;
   return mWillBuildScrollableLayer;
 }
 
 Maybe<ScrollMetadata> ScrollFrameHelper::ComputeScrollMetadata(
     LayerManager* aLayerManager, const nsIFrame* aContainerReferenceFrame,
     const Maybe<ContainerLayerParameters>& aParameters,
     const DisplayItemClip* aClip) const {
@@ -4013,17 +4016,17 @@ Maybe<ScrollMetadata> ScrollFrameHelper:
 void ScrollFrameHelper::ClipLayerToDisplayPort(
     Layer* aLayer, const DisplayItemClip* aClip,
     const ContainerLayerParameters& aParameters) const {
   // If APZ is not enabled, we still need the displayport to be clipped
   // in the compositor.
   if (!nsLayoutUtils::UsesAsyncScrolling(mOuter)) {
     Maybe<nsRect> parentLayerClip;
     // For containerful frames, the clip is on the container layer.
-    if (aClip && (!gfxPrefs::LayoutUseContainersForRootFrames() ||
+    if (aClip && (!StaticPrefs::LayoutUseContainersForRootFrames() ||
                   mAddClipRectToLayer)) {
       parentLayerClip = Some(aClip->GetClipRect());
     }
 
     if (parentLayerClip) {