Backed out 31 changesets (bug 1552643, bug 1550422) for xpcshell crash on a CLOSED TREE.
authorGurzau Raul <rgurzau@mozilla.com>
Sat, 25 May 2019 09:07:49 +0300
changeset 475564 af54b2de7028db03f42207598f7a0b4ba81e262f
parent 475563 f481cd618aa17316d36b6d12b3b762d1415d7e9e
child 475565 12727cfe24724c93d72995f2d57c1ed7d08ddcda
push id36062
push useraciure@mozilla.com
push dateSat, 25 May 2019 09:39:13 +0000
treeherdermozilla-central@af54b2de7028 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1552643, 1550422
milestone69.0a1
backs oute30c1aa75529e8920aeec4030db6f348397d11fd
caadcd7e02d3a66f7169745414b77891200e1546
aa7086ab09beca98a3b54329ee7825e03b6ee968
0b40296717100fa26c8f7bdea8e365eeb523cfbd
a162952960355c80a50bc502aae46912b90fd7b8
3b70307c0db51a13c491e2bf5ccd24a83f7c6721
69df7818d4a3a3e56566cbd1ae6f254ac72b6626
d98dfc5659273b0984ac10f15c503dc4dc11eea6
6f0997976944901eb6e673aeb913b033ec43d72a
0edd264464c23e34136e708cb872ab7e73b44ec7
9ea6da7a74ec7a923d82cd65a9d2577a6bf24af2
f855f9309c8bb1f35c0d5b79545f8abab47b62e0
1033546224a7414c7a9ebd5af0a9be576298fd12
ade7384c618644d3e76e92c111a560fc9d794307
75b04de7e99cab7bed5cc8b0f2f6d52ddf174bf3
91c3acdb245487d5efd9f27686f62c2694824398
77d2f80257d192d689db0e52061f129169b7fa53
e0cd10d35327b9061a7b825153896fed5e5c151b
0970910824233077ac53ef8f29ad3a6d6f5a88a7
2f328853c1abd0fa84b5f5a7dee4676b31261737
f92f2cc29cb1e91274550f642affab21783ecfd5
6dc82f88333d1c76be3a848afcec72d97e9bf289
c20f66494d6931ef1d8e45c9824a679deabc0bbe
2ba22cddeb6f31b09256c2f3b8e77357ba60f78b
3aa72f89e295166df85898bff848c06858cec22d
ab4c4e8069776746bad6f452793af86418e49282
72e5de040dda081ef661ac04fa3e5543ebfb9e53
7d3c2d48670620bf37673194755164e175f209d3
132e0b8d8468de2a882d9793dfb07e6ebfd7c651
54c85ac75dd041523712691da6da20c417f84994
d7ba4a18dd5483aad960798c5d2ae092089680d6
first release with
nightly linux32
af54b2de7028 / 69.0a1 / 20190525093913 / files
nightly linux64
af54b2de7028 / 69.0a1 / 20190525093913 / files
nightly mac
af54b2de7028 / 69.0a1 / 20190525093913 / files
nightly win32
af54b2de7028 / 69.0a1 / 20190525093913 / files
nightly win64
af54b2de7028 / 69.0a1 / 20190525093913 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 31 changesets (bug 1552643, bug 1550422) for xpcshell crash on a CLOSED TREE. Backed out changeset e30c1aa75529 (bug 1552643) Backed out changeset caadcd7e02d3 (bug 1552643) Backed out changeset aa7086ab09be (bug 1552643) Backed out changeset 0b4029671710 (bug 1550422) Backed out changeset a16295296035 (bug 1550422) Backed out changeset 3b70307c0db5 (bug 1550422) Backed out changeset 69df7818d4a3 (bug 1550422) Backed out changeset d98dfc565927 (bug 1550422) Backed out changeset 6f0997976944 (bug 1550422) Backed out changeset 0edd264464c2 (bug 1550422) Backed out changeset 9ea6da7a74ec (bug 1550422) Backed out changeset f855f9309c8b (bug 1550422) Backed out changeset 1033546224a7 (bug 1550422) Backed out changeset ade7384c6186 (bug 1550422) Backed out changeset 75b04de7e99c (bug 1550422) Backed out changeset 91c3acdb2454 (bug 1550422) Backed out changeset 77d2f80257d1 (bug 1550422) Backed out changeset e0cd10d35327 (bug 1550422) Backed out changeset 097091082423 (bug 1550422) Backed out changeset 2f328853c1ab (bug 1550422) Backed out changeset f92f2cc29cb1 (bug 1550422) Backed out changeset 6dc82f88333d (bug 1550422) Backed out changeset c20f66494d69 (bug 1550422) Backed out changeset 2ba22cddeb6f (bug 1550422) Backed out changeset 3aa72f89e295 (bug 1550422) Backed out changeset ab4c4e806977 (bug 1550422) Backed out changeset 72e5de040dda (bug 1550422) Backed out changeset 7d3c2d486706 (bug 1550422) Backed out changeset 132e0b8d8468 (bug 1550422) Backed out changeset 54c85ac75dd0 (bug 1550422) Backed out changeset d7ba4a18dd54 (bug 1550422)
devtools/server/actors/highlighters/utils/canvas.js
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/WebGL2ContextQueries.cpp
dom/canvas/WebGL2ContextSync.cpp
dom/canvas/WebGLContext.cpp
dom/canvas/WebGLContextExtensions.cpp
dom/canvas/WebGLContextValidate.cpp
dom/canvas/WebGLExtensionDisjointTimerQuery.cpp
dom/canvas/WebGLExtensions.cpp
dom/canvas/WebGLFormats.cpp
dom/canvas/WebGLQuery.cpp
dom/canvas/WebGLShaderValidator.cpp
dom/canvas/WebGLTextureUpload.cpp
dom/html/HTMLCanvasElement.cpp
dom/ipc/BrowserChild.cpp
dom/ipc/BrowserParent.cpp
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/media/AudioStream.cpp
dom/media/Benchmark.cpp
dom/media/ipc/PRDD.ipdl
dom/media/ipc/RDDParent.cpp
dom/media/ipc/RDDParent.h
dom/media/ipc/RDDProcessHost.cpp
dom/media/ipc/RDDProcessManager.cpp
dom/media/ipc/RDDProcessManager.h
dom/media/platforms/PDMFactory.cpp
dom/media/platforms/wmf/DXVA2Manager.cpp
dom/media/platforms/wmf/WMFDecoderModule.cpp
dom/media/platforms/wmf/WMFVideoMFTManager.cpp
dom/media/systemservices/MediaSystemResourceManager.cpp
dom/plugins/ipc/PluginInstanceParent.cpp
dom/vr/VRDisplay.cpp
gfx/2d/DrawTargetCairo.cpp
gfx/2d/Factory.cpp
gfx/2d/HelpersWinFonts.h
gfx/2d/Logging.h
gfx/2d/ScaledFontBase.cpp
gfx/2d/unittest/TestBase.h
gfx/config/gfxConfig.h
gfx/config/gfxVars.h
gfx/gl/GLContext.cpp
gfx/gl/GLContextProviderCGL.mm
gfx/gl/GLContextProviderEAGL.mm
gfx/gl/GLContextProviderGLX.cpp
gfx/gl/GLContextProviderWGL.cpp
gfx/gl/GLLibraryEGL.cpp
gfx/gl/GLScreenBuffer.cpp
gfx/gl/GfxTexturesReporter.cpp
gfx/gl/SharedSurfaceD3D11Interop.cpp
gfx/ipc/GPUChild.cpp
gfx/ipc/GPUParent.cpp
gfx/ipc/GPUParent.h
gfx/ipc/GPUProcessHost.cpp
gfx/ipc/GPUProcessHost.h
gfx/ipc/GPUProcessImpl.cpp
gfx/ipc/GPUProcessManager.cpp
gfx/ipc/GPUProcessManager.h
gfx/ipc/GraphicsMessages.ipdlh
gfx/ipc/PGPU.ipdl
gfx/layers/CompositionRecorder.cpp
gfx/layers/D3D11ShareHandleImage.cpp
gfx/layers/FrameMetrics.cpp
gfx/layers/FrameMetrics.h
gfx/layers/LayerScope.cpp
gfx/layers/Layers.cpp
gfx/layers/PaintThread.cpp
gfx/layers/RotatedBuffer.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/AndroidFlingPhysics.h
gfx/layers/apz/src/AndroidVelocityTracker.cpp
gfx/layers/apz/src/AsyncPanZoomController.cpp
gfx/layers/apz/src/AsyncPanZoomController.h
gfx/layers/apz/src/Axis.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/GestureEventListener.h
gfx/layers/apz/src/HitTestingTreeNode.cpp
gfx/layers/apz/src/InputBlockState.cpp
gfx/layers/apz/src/InputBlockState.h
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/APZCBasicTester.h
gfx/layers/apz/test/gtest/APZCTreeManagerTester.h
gfx/layers/apz/test/gtest/APZTestCommon.h
gfx/layers/apz/test/gtest/InputUtils.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/APZCCallbackHelper.cpp
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/ClientPaintedLayer.cpp
gfx/layers/client/ClientTiledPaintedLayer.cpp
gfx/layers/client/ContentClient.cpp
gfx/layers/client/MultiTiledContentClient.cpp
gfx/layers/client/SingleTiledContentClient.h
gfx/layers/client/TextureClient.cpp
gfx/layers/client/TextureClientPool.cpp
gfx/layers/client/TiledContentClient.cpp
gfx/layers/client/TiledContentClient.h
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/DeviceAttachmentsD3D11.cpp
gfx/layers/d3d11/MLGDeviceD3D11.cpp
gfx/layers/d3d11/TextureD3D11.cpp
gfx/layers/ipc/CompositorBench.cpp
gfx/layers/ipc/CompositorBridgeChild.cpp
gfx/layers/ipc/CompositorBridgeParent.cpp
gfx/layers/ipc/CompositorManagerChild.cpp
gfx/layers/ipc/CompositorVsyncScheduler.cpp
gfx/layers/ipc/ISurfaceAllocator.cpp
gfx/layers/ipc/LayerTransactionParent.cpp
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/mlgpu/ContainerLayerMLGPU.cpp
gfx/layers/mlgpu/LayerManagerMLGPU.cpp
gfx/layers/mlgpu/MLGDevice.cpp
gfx/layers/mlgpu/RenderViewMLGPU.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/TestCompositor.cpp
gfx/tests/gtest/TestGfxPrefs.cpp
gfx/tests/gtest/TestRect.cpp
gfx/tests/gtest/TestTextureCompatibility.cpp
gfx/tests/gtest/TestVsync.cpp
gfx/tests/gtest/moz.build
gfx/tests/marionette/test_pref_rollout_workaround.py
gfx/thebes/D3D11Checks.cpp
gfx/thebes/DeviceManagerDx.cpp
gfx/thebes/gfxAndroidPlatform.cpp
gfx/thebes/gfxContext.cpp
gfx/thebes/gfxMacFont.cpp
gfx/thebes/gfxMacPlatformFontList.mm
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
gfx/thebes/gfxPlatformFontList.cpp
gfx/thebes/gfxPlatformGtk.cpp
gfx/thebes/gfxPrefs.cpp
gfx/thebes/gfxPrefs.h
gfx/thebes/gfxUserFontSet.cpp
gfx/thebes/gfxUtils.cpp
gfx/thebes/gfxWindowsPlatform.cpp
gfx/thebes/moz.build
gfx/vr/VRDisplayClient.cpp
gfx/vr/VRDisplayHost.cpp
gfx/vr/VRDisplayLocal.cpp
gfx/vr/VRManager.cpp
gfx/vr/gfxVRExternal.cpp
gfx/vr/gfxVRPuppet.cpp
gfx/vr/ipc/PVR.ipdl
gfx/vr/ipc/VRChild.cpp
gfx/vr/ipc/VRParent.cpp
gfx/vr/ipc/VRParent.h
gfx/vr/ipc/VRProcessChild.cpp
gfx/vr/ipc/VRProcessManager.cpp
gfx/vr/ipc/VRProcessManager.h
gfx/vr/ipc/VRProcessParent.cpp
gfx/vr/ipc/VRProcessParent.h
gfx/vr/service/OSVRSession.cpp
gfx/vr/service/OculusSession.cpp
gfx/vr/service/OpenVRSession.cpp
gfx/vr/service/VRService.cpp
gfx/vr/service/VRService.h
gfx/vr/service/VRServiceManager.cpp
gfx/webrender_bindings/Moz2DImageRenderer.cpp
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/ycbcr/yuv_convert.cpp
image/AnimationSurfaceProvider.cpp
image/DecodePool.cpp
image/DecodedSurfaceProvider.cpp
image/DecoderFactory.cpp
image/Downscaler.cpp
image/DownscalingFilter.h
image/FrameAnimator.cpp
image/FrameAnimator.h
image/IDecodingTask.cpp
image/Image.cpp
image/ImageFactory.cpp
image/ImageMemoryReporter.cpp
image/RasterImage.cpp
image/SurfaceCache.cpp
image/build/nsImageModule.cpp
image/imgFrame.cpp
image/imgLoader.cpp
image/imgRequest.cpp
image/test/gtest/Common.cpp
image/test/gtest/TestBlendAnimationFilter.cpp
image/test/gtest/TestSurfaceCache.cpp
js/xpconnect/src/XPCShellImpl.cpp
layout/base/AccessibleCaretEventHub.cpp
layout/base/MobileViewportManager.cpp
layout/base/PresShell.cpp
layout/base/TouchManager.cpp
layout/base/ZoomConstraintsClient.cpp
layout/base/gtest/TestAccessibleCaretEventHub.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsPresContext.cpp
layout/base/nsRefreshDriver.cpp
layout/forms/nsButtonFrameRenderer.cpp
layout/generic/ScrollAnimationBezierPhysics.cpp
layout/generic/ScrollAnimationMSDPhysics.cpp
layout/generic/ScrollSnap.cpp
layout/generic/ScrollVelocityQueue.cpp
layout/generic/nsBulletFrame.cpp
layout/generic/nsCanvasFrame.h
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
layout/tables/nsTableFrame.cpp
layout/xul/nsBoxFrame.cpp
layout/xul/nsSliderFrame.cpp
modules/libpref/Preferences.cpp
modules/libpref/Preferences.h
modules/libpref/StaticPrefs.h
modules/libpref/components.conf
modules/libpref/init/StaticPrefList.h
modules/libpref/init/all.js
modules/libpref/test/gtest/CallbackAndVarCacheOrder.cpp
toolkit/content/aboutSupport.js
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsX11ErrorHandler.h
toolkit/xre/nsXREDirProvider.cpp
view/nsViewManager.cpp
widget/GfxInfoBase.cpp
widget/WidgetEventImpl.cpp
widget/cocoa/nsChildView.mm
widget/cocoa/nsCocoaWindow.mm
widget/nsBaseWidget.cpp
widget/nsXPLookAndFeel.cpp
widget/windows/WinCompositorWidget.cpp
widget/windows/nsWindow.cpp
widget/windows/nsWindowBase.cpp
xpcom/threads/PrioritizedEventQueue.cpp
--- a/devtools/server/actors/highlighters/utils/canvas.js
+++ b/devtools/server/actors/highlighters/utils/canvas.js
@@ -22,19 +22,18 @@ const { getComputedStyle } = require("./
 
 // We create a <canvas> element that has always 4096x4096 physical pixels, to displays
 // our grid's overlay.
 // Then, we move the element around when needed, to give the perception that it always
 // covers the screen (See bug 1345434).
 //
 // This canvas size value is the safest we can use because most GPUs can handle it.
 // It's also far from the maximum canvas memory allocation limit (4096x4096x4 is
-// 67.108.864 bytes, where the limit is 500.000.000 bytes, see
-// MaxAllocSizeDoNotUseDirectly in:
-// https://searchfox.org/mozilla-central/source/modules/libpref/init/StaticPrefList.h).
+// 67.108.864 bytes, where the limit is 500.000.000 bytes, see:
+// http://searchfox.org/mozilla-central/source/gfx/thebes/gfxPrefs.h#401).
 //
 // Note:
 // Once bug 1232491 lands, we could try to refactor this code to use the values from
 // the displayport API instead.
 //
 // Using a fixed value should also solve bug 1348293.
 const CANVAS_SIZE = 4096;
 
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -265,16 +265,17 @@
 #include "nsIDocumentEncoder.h"
 #include "nsIDocumentActivity.h"
 #include "nsIStructuredCloneContainer.h"
 #include "nsIMutableArray.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "nsWindowSizes.h"
 #include "mozilla/dom/Location.h"
 #include "mozilla/dom/FontFaceSet.h"
+#include "gfxPrefs.h"
 #include "nsISupportsPrimitives.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/dom/SVGDocument.h"
 #include "mozilla/dom/SVGSVGElement.h"
 #include "mozilla/dom/DocGroup.h"
 #include "mozilla/dom/TabGroup.h"
@@ -7141,17 +7142,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 = StaticPrefs::DesktopViewportWidth() / fullZoom;
+    CSSCoord viewportWidth = gfxPrefs::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);
   }
 
@@ -7235,17 +7236,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 (StaticPrefs::ForceUserScalable()) {
+      if (gfxPrefs::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;
@@ -7348,17 +7349,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 = StaticPrefs::DesktopViewportWidth() / fullZoom;
+            width = gfxPrefs::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
@@ -1,14 +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/dom/Event.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/TextEventDispatcher.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/TextInputProcessor.h"
 #include "mozilla/widget/IMEData.h"
 #include "mozilla/dom/KeyboardEvent.h"
@@ -384,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 = StaticPrefs::TestEventsAsyncEnabled();
+    bool isAPZAware = gfxPrefs::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 "mozilla/StaticPrefs.h"
+#include "gfxPrefs.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"
@@ -7904,17 +7904,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 (StaticPrefs::TestEventsAsyncEnabled()) {
+  if (gfxPrefs::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,17 +41,16 @@
 #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"
@@ -65,16 +64,17 @@
 #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 (StaticPrefs::LayoutUseContainersForRootFrames()) {
+  if (gfxPrefs::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
@@ -34,16 +34,18 @@
 
 #include "nsIFrame.h"
 
 #include "nsContentUtils.h"
 #include "nsLayoutUtils.h"
 #include "nsIContentPolicy.h"
 #include "SVGObserverUtils.h"
 
+#include "gfxPrefs.h"
+
 #include "mozAutoDocUpdate.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/ImageTracker.h"
 #include "mozilla/dom/ScriptSettings.h"
@@ -522,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(
-        StaticPrefs::ImageInferSrcAnimationThresholdMS());
+        gfxPrefs::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,16 +46,17 @@
 
 #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"
@@ -87,17 +88,16 @@
 #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 > StaticPrefs::MaxCanvasSize() ||
-      mHeight > StaticPrefs::MaxCanvasSize() || mWidth < 0 || mHeight < 0) {
+  if (mWidth > gfxPrefs::MaxCanvasSize() ||
+      mHeight > gfxPrefs::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 "mozilla/StaticPrefs.h"
+#include "gfxPrefs.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 StaticPrefs::WebGL2Enabled(); }
+bool WebGL2Context::IsSupported() { return gfxPrefs::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/WebGL2ContextQueries.cpp
+++ b/dom/canvas/WebGL2ContextQueries.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; 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 "GLContext.h"
 #include "WebGLQuery.h"
+#include "gfxPrefs.h"
 #include "nsThreadUtils.h"
 
 namespace mozilla {
 
 /*
  * We fake ANY_SAMPLES_PASSED and ANY_SAMPLES_PASSED_CONSERVATIVE with
  * SAMPLES_PASSED on desktop.
  *
--- 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 || StaticPrefs::WebGLImmediateQueries());
+      (sync.mCanBeAvailable || gfxPrefs::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 || StaticPrefs::WebGLImmediateQueries());
+      (sync.mCanBeAvailable || gfxPrefs::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,16 +8,17 @@
 #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"
@@ -29,17 +30,16 @@
 #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 (StaticPrefs::WebGLDefaultNoAlpha()) alpha = false;
+  if (gfxPrefs::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(StaticPrefs::WebGLMaxPerfWarnings()),
+      mMaxPerfWarnings(gfxPrefs::WebGLMaxPerfWarnings()),
       mNumPerfWarnings(0),
       mMaxAcceptableFBStatusInvals(
-          StaticPrefs::WebGLMaxAcceptableFBStatusInvals()),
+          gfxPrefs::WebGLMaxAcceptableFBStatusInvals()),
       mDataAllocGLCallCount(0),
       mEmptyTFO(0),
       mContextLossHandler(this),
       mNeedsFakeNoAlpha(false),
       mNeedsFakeNoDepth(false),
       mNeedsFakeNoStencil(false),
-      mAllowFBInvalidation(StaticPrefs::WebGLFBInvalidation()),
-      mMsaaSamples((uint8_t)StaticPrefs::WebGLMsaaSamples()) {
+      mAllowFBInvalidation(gfxPrefs::WebGLFBInvalidation()),
+      mMsaaSamples((uint8_t)gfxPrefs::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 = StaticPrefs::WebGLMaxWarningsPerContext();
+  mMaxWarnings = gfxPrefs::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 (!StaticPrefs::MSAALevel()) {
+  if (!gfxPrefs::MSAALevel()) {
     newOpts.antialias = false;
   }
 
-  if (!StaticPrefs::WebGLForceMSAA()) {
+  if (!gfxPrefs::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 (!StaticPrefs::WebGL1AllowCoreProfile()) {
+  } else if (!gfxPrefs::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 (!StaticPrefs::WebGLDefaultLowPower()) {
+      if (!gfxPrefs::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 (StaticPrefs::WebGLDisableWGL()) {
+  if (gfxPrefs::WebGLDisableWGL()) {
     tryNativeGL = false;
   }
 
-  if (StaticPrefs::WebGLDisableANGLE() || PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL") ||
+  if (gfxPrefs::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 = StaticPrefs::WebGLDisabled();
+  bool disabled = gfxPrefs::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 (StaticPrefs::WebGLDisableFailIfMajorPerformanceCaveat()) {
+  if (gfxPrefs::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 = StaticPrefs::WebGLForceEnabled();
+  bool forceEnabled = gfxPrefs::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,19 +961,18 @@ WebGLContext::SetDimensions(int32_t sign
 
   failureId = NS_LITERAL_CSTRING("SUCCESS");
 
   gl->ResetSyncCallCount("WebGLContext Initialization");
   return NS_OK;
 }
 
 void WebGLContext::LoseOldestWebGLContextIfLimitExceeded() {
-  const auto maxWebGLContexts = StaticPrefs::WebGLMaxContexts();
-  auto maxWebGLContextsPerPrincipal =
-      StaticPrefs::WebGLMaxContextsPerPrincipal();
+  const auto maxWebGLContexts = gfxPrefs::WebGLMaxContexts();
+  auto maxWebGLContextsPerPrincipal = gfxPrefs::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.
@@ -1325,17 +1324,17 @@ ScopedPrepForResourceClear::~ScopedPrepF
   gl->fClearStencil(webgl.mStencilClearValue);
 }
 
 }  // namespace webgl
 
 // -
 
 void WebGLContext::OnEndOfFrame() const {
-  if (StaticPrefs::WebGLSpewFrameAllocs()) {
+  if (gfxPrefs::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
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; 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 "WebGLContext.h"
 #include "WebGLContextUtils.h"
 #include "WebGLExtensions.h"
+#include "gfxPrefs.h"
 #include "GLContext.h"
 
 #include "nsString.h"
 #include "nsContentUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "AccessCheck.h"
 
@@ -76,17 +77,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 (StaticPrefs::WebGLPrivilegedExtensionsEnabled()) {
+  if (gfxPrefs::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,20 +283,19 @@ 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 = StaticPrefs::WebGLDisableExtensions();
-  mLoseContextOnMemoryPressure =
-      StaticPrefs::WebGLLoseContextOnMemoryPressure();
-  mCanLoseContextInForeground = StaticPrefs::WebGLCanLoseContextInForeground();
+  mDisableExtensions = gfxPrefs::WebGLDisableExtensions();
+  mLoseContextOnMemoryPressure = gfxPrefs::WebGLLoseContextOnMemoryPressure();
+  mCanLoseContextInForeground = gfxPrefs::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;
@@ -483,17 +482,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 (StaticPrefs::WebGLMinCapabilityMode()) {
+  if (gfxPrefs::WebGLMinCapabilityMode()) {
     bool ok = true;
 
     ok &= RestrictCap(&mGLMaxVertexTextureImageUnits,
                       kMinMaxVertexTextureImageUnits);
     ok &= RestrictCap(&mGLMaxFragmentTextureImageUnits,
                       kMinMaxFragmentTextureImageUnits);
     ok &= RestrictCap(&mGLMaxCombinedTextureImageUnits,
                       kMinMaxCombinedTextureImageUnits);
@@ -660,25 +659,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 (StaticPrefs::WebGLForceIndexValidation()) {
+  switch (gfxPrefs::WebGLForceIndexValidation()) {
     case -1:
       mNeedsIndexValidation = false;
       break;
     case 1:
       mNeedsIndexValidation = true;
       break;
     default:
-      MOZ_ASSERT(StaticPrefs::WebGLForceIndexValidation() == 0);
+      MOZ_ASSERT(gfxPrefs::WebGLForceIndexValidation() == 0);
       break;
   }
 
   return true;
 }
 
 bool WebGLContext::ValidateFramebufferTarget(GLenum target) const {
   bool isValid = true;
--- a/dom/canvas/WebGLExtensionDisjointTimerQuery.cpp
+++ b/dom/canvas/WebGLExtensionDisjointTimerQuery.cpp
@@ -1,16 +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 "WebGLExtensions.h"
 
+#include "gfxPrefs.h"
 #include "GLContext.h"
 #include "mozilla/dom/ToJSValue.h"
 #include "mozilla/dom/WebGLRenderingContextBinding.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "WebGLContext.h"
 #include "WebGLQuery.h"
 
 namespace mozilla {
--- 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 (!StaticPrefs::WebGLDraftExtensionsEnabled()) return false;
+  if (!gfxPrefs::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)
@@ -78,17 +78,17 @@ WebGLExtensionMultiview::WebGLExtensionM
     : WebGLExtensionBase(webgl) {
   MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
 }
 
 WebGLExtensionMultiview::~WebGLExtensionMultiview() = default;
 
 bool WebGLExtensionMultiview::IsSupported(const WebGLContext* const webgl) {
   if (!webgl->IsWebGL2()) return false;
-  if (!StaticPrefs::WebGLDraftExtensionsEnabled()) return false;
+  if (!gfxPrefs::WebGLDraftExtensionsEnabled()) return false;
 
   const auto& gl = webgl->gl;
   return gl->IsSupported(gl::GLFeature::multiview);
 }
 
 void WebGLExtensionMultiview::FramebufferTextureMultiviewOVR(
     const GLenum target, const GLenum attachment, WebGLTexture* const texture,
     const GLint level, const GLint baseViewIndex,
--- a/dom/canvas/WebGLFormats.cpp
+++ b/dom/canvas/WebGLFormats.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; 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 "WebGLFormats.h"
 
+#include "gfxPrefs.h"
 #include "GLContext.h"
 #include "GLDefs.h"
 #include "mozilla/gfx/Logging.h"
 #include "mozilla/StaticMutex.h"
 
 namespace mozilla {
 namespace webgl {
 
--- a/dom/canvas/WebGLQuery.cpp
+++ b/dom/canvas/WebGLQuery.cpp
@@ -1,15 +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 "WebGLQuery.h"
 
+#include "gfxPrefs.h"
 #include "GLContext.h"
 #include "mozilla/dom/WebGL2RenderingContextBinding.h"
 #include "nsContentUtils.h"
 #include "WebGLContext.h"
 
 namespace mozilla {
 
 ////
@@ -111,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 || StaticPrefs::WebGLImmediateQueries());
+      (mCanBeAvailable || gfxPrefs::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 (StaticPrefs::WebGLAllANGLEOptions()) {
+  if (gfxPrefs::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 (!StaticPrefs::WebGLDisableDOMBlitUploads() && sfer.mLayersImage) {
+  if (!gfxPrefs::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/html/HTMLCanvasElement.cpp
+++ b/dom/html/HTMLCanvasElement.cpp
@@ -1,16 +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 "mozilla/dom/HTMLCanvasElement.h"
 
+#include "gfxPrefs.h"
 #include "ImageEncoder.h"
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "Layers.h"
 #include "MediaSegment.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Base64.h"
 #include "mozilla/CheckedInt.h"
--- a/dom/ipc/BrowserChild.cpp
+++ b/dom/ipc/BrowserChild.cpp
@@ -3,16 +3,17 @@
 /* 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 "base/basictypes.h"
 
 #include "BrowserChild.h"
 
+#include "gfxPrefs.h"
 #ifdef ACCESSIBILITY
 #  include "mozilla/a11y/DocAccessibleChild.h"
 #endif
 #include "Layers.h"
 #include "ContentChild.h"
 #include "BrowserParent.h"
 #include "js/JSON.h"
 #include "mozilla/Preferences.h"
@@ -1805,17 +1806,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 (StaticPrefs::TouchActionEnabled()) {
+    if (gfxPrefs::TouchActionEnabled()) {
       APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(
           mPuppetWidget, document, localEvent, aInputBlockId,
           mSetAllowedTouchBehaviorCallback);
     }
     UniquePtr<DisplayportSetListener> postLayerization =
         APZCCallbackHelper::SendSetTargetAPZCNotification(
             mPuppetWidget, document, localEvent, aGuid.mLayersId,
             aInputBlockId);
--- a/dom/ipc/BrowserParent.cpp
+++ b/dom/ipc/BrowserParent.cpp
@@ -90,16 +90,17 @@
 #include "FilePickerParent.h"
 #include "BrowserChild.h"
 #include "LoadContext.h"
 #include "nsNetCID.h"
 #include "nsIAuthInformation.h"
 #include "nsIAuthPromptCallback.h"
 #include "nsAuthInformationHolder.h"
 #include "nsICancelable.h"
+#include "gfxPrefs.h"
 #include "gfxUtils.h"
 #include "nsILoginManagerPrompter.h"
 #include "nsPIWindowRoot.h"
 #include "nsIAuthPrompt2.h"
 #include "gfxDrawable.h"
 #include "ImageOps.h"
 #include "UnitTransforms.h"
 #include <algorithm>
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -201,16 +201,17 @@
 #include "URIUtils.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsIDocShell.h"
 #include "nsDocShell.h"
 #include "nsOpenURIInFrameParams.h"
 #include "mozilla/net/NeckoMessageUtils.h"
 #include "gfxPlatform.h"
 #include "gfxPlatformFontList.h"
+#include "gfxPrefs.h"
 #include "prio.h"
 #include "private/pprio.h"
 #include "ContentProcessManager.h"
 #include "mozilla/dom/BlobURLProtocolHandler.h"
 #include "mozilla/dom/ipc/StructuredCloneData.h"
 #include "mozilla/PerformanceMetricsCollector.h"
 #include "mozilla/psm/PSMContentListener.h"
 #include "nsPluginHost.h"
@@ -2951,18 +2952,40 @@ ContentParent::Observe(nsISupports* aSub
   }
 
   if (IsDead() || !mSubprocess) {
     return NS_OK;
   }
 
   if (!strcmp(aTopic, "nsPref:changed")) {
     // A pref changed. If it's not on the blacklist, inform child processes.
-    if (!ShouldSyncPreference(aData)) {
-      return NS_OK;
+#define BLACKLIST_ENTRY(s) \
+  { s, (sizeof(s) / sizeof(char16_t)) - 1 }
+    struct BlacklistEntry {
+      const char16_t* mPrefBranch;
+      size_t mLen;
+    };
+    // These prefs are not useful in child processes.
+    static const BlacklistEntry sContentPrefBranchBlacklist[] = {
+        BLACKLIST_ENTRY(u"app.update.lastUpdateTime."),
+        BLACKLIST_ENTRY(u"datareporting.policy."),
+        BLACKLIST_ENTRY(u"browser.safebrowsing.provider."),
+        BLACKLIST_ENTRY(u"browser.shell."),
+        BLACKLIST_ENTRY(u"browser.slowstartup."),
+        BLACKLIST_ENTRY(u"extensions.getAddons.cache."),
+        BLACKLIST_ENTRY(u"media.gmp-manager."),
+        BLACKLIST_ENTRY(u"media.gmp-gmpopenh264."),
+        BLACKLIST_ENTRY(u"privacy.sanitize."),
+    };
+#undef BLACKLIST_ENTRY
+
+    for (const auto& entry : sContentPrefBranchBlacklist) {
+      if (NS_strncmp(entry.mPrefBranch, aData, entry.mLen) == 0) {
+        return NS_OK;
+      }
     }
 
     // We know prefs are ASCII here.
     NS_LossyConvertUTF16toASCII strData(aData);
 
     Pref pref(strData, /* isLocked */ false, Nothing(), Nothing());
     Preferences::GetPreference(&pref);
     if (IsAlive()) {
@@ -3100,47 +3123,16 @@ ContentParent::Observe(nsISupports* aSub
     }
   } else if (!strcmp(aTopic, NS_NETWORK_LINK_TYPE_TOPIC)) {
     UpdateNetworkLinkType();
   }
 
   return NS_OK;
 }
 
-/* static */
-bool ContentParent::ShouldSyncPreference(const char16_t* aData) {
-#define BLACKLIST_ENTRY(s) \
-  { s, (sizeof(s) / sizeof(char16_t)) - 1 }
-  struct BlacklistEntry {
-    const char16_t* mPrefBranch;
-    size_t mLen;
-  };
-  // These prefs are not useful in child processes.
-  static const BlacklistEntry sContentPrefBranchBlacklist[] = {
-      BLACKLIST_ENTRY(u"app.update.lastUpdateTime."),
-      BLACKLIST_ENTRY(u"datareporting.policy."),
-      BLACKLIST_ENTRY(u"browser.safebrowsing.provider."),
-      BLACKLIST_ENTRY(u"browser.shell."),
-      BLACKLIST_ENTRY(u"browser.slowStartup."),
-      BLACKLIST_ENTRY(u"browser.startup."),
-      BLACKLIST_ENTRY(u"extensions.getAddons.cache."),
-      BLACKLIST_ENTRY(u"media.gmp-manager."),
-      BLACKLIST_ENTRY(u"media.gmp-gmpopenh264."),
-      BLACKLIST_ENTRY(u"privacy.sanitize."),
-  };
-#undef BLACKLIST_ENTRY
-
-  for (const auto& entry : sContentPrefBranchBlacklist) {
-    if (NS_strncmp(entry.mPrefBranch, aData, entry.mLen) == 0) {
-      return false;
-    }
-  }
-  return true;
-}
-
 void ContentParent::UpdateNetworkLinkType() {
   nsresult rv;
   nsCOMPtr<nsINetworkLinkService> nls =
       do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID, &rv);
   if (NS_FAILED(rv)) {
     return;
   }
 
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -1211,18 +1211,16 @@ class ContentParent final : public PCont
     return mRecordReplayState != eNotRecordingOrReplaying;
   }
 
   void OnBrowsingContextGroupSubscribe(BrowsingContextGroup* aGroup);
   void OnBrowsingContextGroupUnsubscribe(BrowsingContextGroup* aGroup);
 
   void UpdateNetworkLinkType();
 
-  static bool ShouldSyncPreference(const char16_t* aData);
-
  private:
   // Released in ActorDestroy; deliberately not exposed to the CC.
   RefPtr<ContentParent> mSelfRef;
 
   // If you add strong pointers to cycle collected objects here, be sure to
   // release these objects in ShutDownProcess.  See the comment there for more
   // details.
 
--- a/dom/media/AudioStream.cpp
+++ b/dom/media/AudioStream.cpp
@@ -13,16 +13,17 @@
 #include "mozilla/Monitor.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/Sprintf.h"
 #include "mozilla/Unused.h"
 #include <algorithm>
 #include "mozilla/Telemetry.h"
 #include "CubebUtils.h"
 #include "nsPrintfCString.h"
+#include "gfxPrefs.h"
 #include "AudioConverter.h"
 #if defined(XP_WIN)
 #  include "nsXULAppAPI.h"
 #endif
 
 namespace mozilla {
 
 #undef LOG
--- a/dom/media/Benchmark.cpp
+++ b/dom/media/Benchmark.cpp
@@ -6,16 +6,17 @@
 
 #include "Benchmark.h"
 
 #include "BufferMediaResource.h"
 #include "MediaData.h"
 #include "PDMFactory.h"
 #include "VideoUtils.h"
 #include "WebMDemuxer.h"
+#include "gfxPrefs.h"
 #include "mozilla/AbstractThread.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/StaticMutex.h"
 #include "mozilla/StaticPrefs.h"
 #include "mozilla/SystemGroup.h"
 #include "mozilla/TaskQueue.h"
 #include "mozilla/Telemetry.h"
@@ -162,16 +163,17 @@ void Benchmark::Dispose() {
   MOZ_ASSERT(OnThread());
 
   mKeepAliveUntilComplete = nullptr;
 }
 
 void Benchmark::Init() {
   MOZ_ASSERT(NS_IsMainThread());
   gfxVars::Initialize();
+  gfxPrefs::GetSingleton();
 }
 
 BenchmarkPlayback::BenchmarkPlayback(Benchmark* aGlobalState,
                                      MediaDataDemuxer* aDemuxer)
     : QueueObject(new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
                                 "BenchmarkPlayback::QueueObject")),
       mGlobalState(aGlobalState),
       mDecoderTaskQueue(
--- a/dom/media/ipc/PRDD.ipdl
+++ b/dom/media/ipc/PRDD.ipdl
@@ -1,15 +1,14 @@
 /* -*- Mode: C++; tab-width: 8; 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 MemoryReportTypes;
-include PrefsTypes;
 
 include protocol PProfiler;
 include protocol PRemoteDecoderManager;
 
 using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
 
 namespace mozilla {
 
@@ -28,18 +27,16 @@ parent:
   async NewContentRemoteDecoderManager(
             Endpoint<PRemoteDecoderManagerParent> endpoint);
 
   async RequestMemoryReport(uint32_t generation,
                             bool anonymize,
                             bool minimizeMemoryUsage,
                             FileDescriptor? DMDFile);
 
-  async PreferenceUpdate(Pref pref);
-
 child:
   // args TBD, sent when init complete. Occurs once, after Init().
   async InitComplete();
 
   async InitCrashReporter(Shmem shmem, NativeThreadId threadId);
 
   async AddMemoryReport(MemoryReport aReport);
   async FinishMemoryReport(uint32_t aGeneration);
--- a/dom/media/ipc/RDDParent.cpp
+++ b/dom/media/ipc/RDDParent.cpp
@@ -170,21 +170,16 @@ mozilla::ipc::IPCResult RDDParent::RecvR
         Unused << GetSingleton()->SendAddMemoryReport(aReport);
       },
       [&](const uint32_t& aGeneration) {
         return GetSingleton()->SendFinishMemoryReport(aGeneration);
       });
   return IPC_OK();
 }
 
-mozilla::ipc::IPCResult RDDParent::RecvPreferenceUpdate(const Pref& aPref) {
-  Preferences::SetPreference(aPref);
-  return IPC_OK();
-}
-
 void RDDParent::ActorDestroy(ActorDestroyReason aWhy) {
   if (AbnormalShutdown == aWhy) {
     NS_WARNING("Shutting down RDD process early due to a crash!");
     ProcessChild::QuickExit();
   }
 
 #ifndef NS_FREE_PERMANENT_DATA
   // No point in going through XPCOM shutdown because we don't keep persistent
--- a/dom/media/ipc/RDDParent.h
+++ b/dom/media/ipc/RDDParent.h
@@ -30,17 +30,16 @@ class RDDParent final : public PRDDParen
       Endpoint<PProfilerChild>&& aEndpoint);
 
   mozilla::ipc::IPCResult RecvNewContentRemoteDecoderManager(
       Endpoint<PRemoteDecoderManagerParent>&& aEndpoint);
   mozilla::ipc::IPCResult RecvRequestMemoryReport(
       const uint32_t& generation, const bool& anonymize,
       const bool& minimizeMemoryUsage,
       const Maybe<ipc::FileDescriptor>& DMDFile);
-  mozilla::ipc::IPCResult RecvPreferenceUpdate(const Pref& pref);
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
 
  private:
   const TimeStamp mLaunchTime;
 #ifdef MOZ_GECKO_PROFILER
   RefPtr<ChildProfilerController> mProfilerController;
 #endif
--- a/dom/media/ipc/RDDProcessHost.cpp
+++ b/dom/media/ipc/RDDProcessHost.cpp
@@ -62,17 +62,16 @@ bool RDDProcessHost::Launch(StringVector
   mSandboxLevel = Preferences::GetInt("security.sandbox.rdd.level");
 #endif
 
   mLaunchPhase = LaunchPhase::Waiting;
   mLaunchTime = TimeStamp::Now();
 
   if (!GeckoChildProcessHost::AsyncLaunch(aExtraOpts)) {
     mLaunchPhase = LaunchPhase::Complete;
-    mPrefSerializer = nullptr;
     return false;
   }
   return true;
 }
 
 bool RDDProcessHost::WaitForLaunch() {
   if (mLaunchPhase == LaunchPhase::Complete) {
     return !!mRDDChild;
--- a/dom/media/ipc/RDDProcessManager.cpp
+++ b/dom/media/ipc/RDDProcessManager.cpp
@@ -3,19 +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/. */
 #include "RDDProcessManager.h"
 
 #include "mozilla/MemoryReportingProcess.h"
 #include "mozilla/RemoteDecoderManagerChild.h"
 #include "mozilla/RemoteDecoderManagerParent.h"
-#include "mozilla/Preferences.h"
 #include "mozilla/StaticPrefs.h"
-#include "mozilla/dom/ContentParent.h"
+
 #include "nsAppRunner.h"
 #include "nsContentUtils.h"
 #include "RDDChild.h"
 #include "RDDProcessHost.h"
 
 namespace mozilla {
 
 using namespace mozilla::layers;
@@ -36,17 +35,16 @@ RDDProcessManager::RDDProcessManager()
       mNumProcessAttempts(0),
       mProcess(nullptr),
       mProcessToken(0),
       mRDDChild(nullptr) {
   MOZ_COUNT_CTOR(RDDProcessManager);
 
   mObserver = new Observer(this);
   nsContentUtils::RegisterShutdownObserver(mObserver);
-  Preferences::AddStrongObserver(mObserver, "");
 }
 
 RDDProcessManager::~RDDProcessManager() {
   MOZ_COUNT_DTOR(RDDProcessManager);
 
   // The RDD process should have already been shut down.
   MOZ_ASSERT(!mProcess && !mRDDChild);
 
@@ -59,51 +57,29 @@ NS_IMPL_ISUPPORTS(RDDProcessManager::Obs
 RDDProcessManager::Observer::Observer(RDDProcessManager* aManager)
     : mManager(aManager) {}
 
 NS_IMETHODIMP
 RDDProcessManager::Observer::Observe(nsISupports* aSubject, const char* aTopic,
                                      const char16_t* aData) {
   if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
     mManager->OnXPCOMShutdown();
-  } else if (!strcmp(aTopic, "nsPref:changed")) {
-    mManager->OnPreferenceChange(aData);
   }
   return NS_OK;
 }
 
 void RDDProcessManager::OnXPCOMShutdown() {
   if (mObserver) {
     nsContentUtils::UnregisterShutdownObserver(mObserver);
-    Preferences::RemoveObserver(mObserver, "");
     mObserver = nullptr;
   }
 
   CleanShutdown();
 }
 
-void RDDProcessManager::OnPreferenceChange(const char16_t* aData) {
-  // A pref changed. If it's not on the blacklist, inform child processes.
-  if (!dom::ContentParent::ShouldSyncPreference(aData)) {
-    return;
-  }
-
-  // We know prefs are ASCII here.
-  NS_LossyConvertUTF16toASCII strData(aData);
-
-  mozilla::dom::Pref pref(strData, /* isLocked */ false, Nothing(), Nothing());
-  Preferences::GetPreference(&pref);
-  if (!!mRDDChild) {
-    MOZ_ASSERT(mQueuedPrefs.IsEmpty());
-    mRDDChild->SendPreferenceUpdate(pref);
-  } else {
-    mQueuedPrefs.AppendElement(pref);
-  }
-}
-
 void RDDProcessManager::LaunchRDDProcess() {
   if (mProcess) {
     return;
   }
 
   mNumProcessAttempts++;
 
   std::vector<std::string> extraArgs;
@@ -148,23 +124,16 @@ void RDDProcessManager::OnProcessLaunchC
   if (!mProcess->IsConnected()) {
     DestroyProcess();
     return;
   }
 
   mRDDChild = mProcess->GetActor();
   mProcessToken = mProcess->GetProcessToken();
 
-  // Flush any pref updates that happened during launch and weren't
-  // included in the blobs set up in LaunchRDDProcess.
-  for (const mozilla::dom::Pref& pref : mQueuedPrefs) {
-    Unused << NS_WARN_IF(!mRDDChild->SendPreferenceUpdate(pref));
-  }
-  mQueuedPrefs.Clear();
-
   CrashReporter::AnnotateCrashReport(
       CrashReporter::Annotation::RDDProcessStatus,
       NS_LITERAL_CSTRING("Running"));
 }
 
 void RDDProcessManager::OnProcessUnexpectedShutdown(RDDProcessHost* aHost) {
   MOZ_ASSERT(mProcess && mProcess == aHost);
 
--- a/dom/media/ipc/RDDProcessManager.h
+++ b/dom/media/ipc/RDDProcessManager.h
@@ -59,17 +59,16 @@ class RDDProcessManager final : public R
   RDDChild* GetRDDChild() { return mRDDChild; }
 
   // Returns whether or not a RDD process was ever launched.
   bool AttemptedRDDProcess() const { return mNumProcessAttempts > 0; }
 
  private:
   // Called from our xpcom-shutdown observer.
   void OnXPCOMShutdown();
-  void OnPreferenceChange(const char16_t* aData);
 
   RDDProcessManager();
 
   // Shutdown the RDD process.
   void CleanShutdown();
   void DestroyProcess();
 
   DISALLOW_COPY_AND_ASSIGN(RDDProcessManager);
@@ -91,17 +90,13 @@ class RDDProcessManager final : public R
   RefPtr<Observer> mObserver;
   mozilla::ipc::TaskFactory<RDDProcessManager> mTaskFactory;
   uint32_t mNumProcessAttempts;
 
   // Fields that are associated with the current RDD process.
   RDDProcessHost* mProcess;
   uint64_t mProcessToken;
   RDDChild* mRDDChild;
-  // Collects any pref changes that occur during process launch (after
-  // the initial map is passed in command-line arguments) to be sent
-  // when the process can receive IPC messages.
-  nsTArray<mozilla::dom::Pref> mQueuedPrefs;
 };
 
 }  // namespace mozilla
 
 #endif  // _include_dom_media_ipc_RDDProcessManager_h_
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -10,17 +10,18 @@
 #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 "nsIXULRuntime.h"  // for BrowserTabsRemoteAutostart
+#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"
 #include "mozilla/SyncRunnable.h"
@@ -168,16 +169,17 @@ 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
@@ -10,19 +10,19 @@
 #include "DriverCrashGuard.h"
 #include "GfxDriverInfo.h"
 #include "ImageContainer.h"
 #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 +411,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) &&
-      !StaticPrefs::PDMWMFSkipBlacklist()) {
+      !gfxPrefs::PDMWMFSkipBlacklist()) {
     for (const auto& model : sAMDPreUVD4) {
       if (adapter.DeviceId == model) {
         mIsAMDPreUVD4 = true;
         break;
       }
     }
   }
 
@@ -501,17 +501,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 = StaticPrefs::PDMWMFMaxDXVAVideos();
+  uint32_t dxvaLimit = gfxPrefs::PDMWMFMaxDXVAVideos();
 
   if (sDXVAVideosCount == dxvaLimit) {
     aFailureReason.AssignLiteral("Too many DXVA videos playing");
     return nullptr;
   }
 
   nsAutoPtr<D3D9DXVA2Manager> d3d9Manager(new D3D9DXVA2Manager());
   hr = d3d9Manager->Init(aKnowsCompositor, aFailureReason);
@@ -674,33 +674,32 @@ D3D11DXVA2Manager::Init(layers::KnowsCom
 
   if (layers::ImageBridgeChild::GetSingleton() || !aKnowsCompositor) {
     // There's no proper KnowsCompositor for ImageBridge currently (and it
     // implements the interface), so just use that if it's available.
     mTextureClientAllocator = new D3D11RecycleAllocator(
         layers::ImageBridgeChild::GetSingleton().get(), mDevice,
         gfx::SurfaceFormat::NV12);
 
-    if (ImageBridgeChild::GetSingleton() &&
-        StaticPrefs::PDMWMFUseSyncTexture() &&
+    if (ImageBridgeChild::GetSingleton() && gfxPrefs::PDMWMFUseSyncTexture() &&
         mDevice != DeviceManagerDx::Get()->GetCompositorDevice()) {
       // We use a syncobject to avoid the cost of the mutex lock when
       // compositing, and because it allows color conversion ocurring directly
       // from this texture DXVA does not seem to accept IDXGIKeyedMutex textures
       // as input.
       mSyncObject = layers::SyncObjectClient::CreateSyncObjectClient(
           layers::ImageBridgeChild::GetSingleton()
               ->GetTextureFactoryIdentifier()
               .mSyncHandle,
           mDevice);
     }
   } else {
     mTextureClientAllocator = new D3D11RecycleAllocator(
         aKnowsCompositor, mDevice, gfx::SurfaceFormat::NV12);
-    if (StaticPrefs::PDMWMFUseSyncTexture()) {
+    if (gfxPrefs::PDMWMFUseSyncTexture()) {
       // We use a syncobject to avoid the cost of the mutex lock when
       // compositing, and because it allows color conversion ocurring directly
       // from this texture DXVA does not seem to accept IDXGIKeyedMutex textures
       // as input.
       mSyncObject = layers::SyncObjectClient::CreateSyncObjectClient(
           aKnowsCompositor->GetTextureFactoryIdentifier().mSyncHandle, mDevice);
     }
   }
@@ -844,17 +843,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) &&
-      !StaticPrefs::PDMWMFSkipBlacklist()) {
+      !gfxPrefs::PDMWMFSkipBlacklist()) {
     for (const auto& model : sAMDPreUVD4) {
       if (adapterDesc.DeviceId == model) {
         mIsAMDPreUVD4 = true;
         break;
       }
     }
   }
 
@@ -1214,17 +1213,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 = StaticPrefs::PDMWMFMaxDXVAVideos();
+  uint32_t dxvaLimit = gfxPrefs::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);
@@ -1246,17 +1245,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 !StaticPrefs::PDMWMFAMDHighResEnabled() && mIsAMDPreUVD4 &&
+  return !gfxPrefs::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/WMFDecoderModule.cpp
+++ b/dom/media/platforms/wmf/WMFDecoderModule.cpp
@@ -12,16 +12,17 @@
 #include "MFTDecoder.h"
 #include "MP4Decoder.h"
 #include "MediaInfo.h"
 #include "VPXDecoder.h"
 #include "WMF.h"
 #include "WMFAudioMFTManager.h"
 #include "WMFMediaDataDecoder.h"
 #include "WMFVideoMFTManager.h"
+#include "gfxPrefs.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/StaticMutex.h"
 #include "mozilla/StaticPrefs.h"
 #include "mozilla/WindowsVersion.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/mscom/EnsureMTA.h"
 #include "nsAutoPtr.h"
@@ -84,17 +85,17 @@ void WMFDecoderModule::Init() {
     testForVPx = sDXVAEnabled = true;
   } else {
     // Only allow DXVA in the UI process if we aren't in e10s Firefox
     testForVPx = sDXVAEnabled = !mozilla::BrowserTabsRemoteAutostart();
   }
 
   sDXVAEnabled = sDXVAEnabled && gfx::gfxVars::CanUseHardwareVideoDecoding();
   testForVPx = testForVPx && gfx::gfxVars::CanUseHardwareVideoDecoding();
-  if (testForVPx && StaticPrefs::MediaWmfVp9Enabled()) {
+  if (testForVPx && gfxPrefs::MediaWmfVp9Enabled()) {
     gfx::WMFVPXVideoCrashGuard guard;
     if (!guard.Crashed()) {
       sUsableVPXMFT = CanCreateMFTDecoder(CLSID_WebmMfVpxDec);
     }
   }
 }
 
 /* static */
--- 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() &&
-        StaticPrefs::PDMWMFDeblacklistingForTelemetryInGPUProcess();
+        gfxPrefs::PDMWMFDeblacklistingForTelemetryInGPUProcess();
     nsACString* failureReason = &mFailureReason;
     nsCString secondFailureReason;
     if (mBackend == LayersBackend::LAYERS_D3D11 &&
-        StaticPrefs::PDMWMFAllowD3D11() && IsWin8OrLater()) {
+        gfxPrefs::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 || StaticPrefs::PDMWMFAllowUnsupportedResolutions()) {
+  if (mStreamType != H264 || gfxPrefs::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 =
-        (StaticPrefs::PDMWMFLowLatencyEnabled() || IsWin10OrLater()) &&
-        !StaticPrefs::PDMWMFLowLatencyForceDisabled();
+        (gfxPrefs::PDMWMFLowLatencyEnabled() || IsWin10OrLater()) &&
+        !gfxPrefs::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 ? StaticPrefs::PDMWMFUseNV12Format() &&
+                         hw ? gfxPrefs::PDMWMFUseNV12Format() &&
                                       gfx::DeviceManagerDx::Get()->CanUseNV12()
                                   ? "nv12"
                                   : "rgba32"
                             : "yuv420");
 }
 
 }  // namespace mozilla
--- a/dom/media/systemservices/MediaSystemResourceManager.cpp
+++ b/dom/media/systemservices/MediaSystemResourceManager.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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/TaskQueue.h"
 
+#include "gfxPrefs.h"
 #include "MediaSystemResourceManagerChild.h"
 #include "mozilla/layers/ImageBridgeChild.h"
 
 #include "MediaSystemResourceManager.h"
 
 namespace mozilla {
 
 using namespace mozilla::ipc;
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -30,16 +30,17 @@
 #  include "gfxXlibSurface.h"
 #endif
 #include "gfxUtils.h"
 #include "mozilla/gfx/2D.h"
 #include "Layers.h"
 #include "ImageContainer.h"
 #include "GLContext.h"
 #include "GLContextProvider.h"
+#include "gfxPrefs.h"
 #include "LayersLogging.h"
 #include "mozilla/layers/TextureWrapperImage.h"
 #include "mozilla/layers/TextureClientRecycleAllocator.h"
 #include "mozilla/layers/ImageBridgeChild.h"
 #if defined(XP_WIN)
 #  include "mozilla/layers/D3D11ShareHandleImage.h"
 #  include "mozilla/gfx/DeviceManagerDx.h"
 #  include "mozilla/layers/TextureD3D11.h"
@@ -308,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 (!StaticPrefs::PluginAsyncDrawingEnabled()) {
+  if (!gfxPrefs::PluginAsyncDrawingEnabled()) {
     return false;
   }
   return gfxPlatform::GetPlatform()->SupportsPluginDirectBitmapDrawing();
 }
 
 static inline bool AllowDirectDXGISurfaceDrawing() {
-  if (!StaticPrefs::PluginAsyncDrawingEnabled()) {
+  if (!gfxPrefs::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(StaticPrefs::VRNavigationTimeout());
+      TimeDuration::FromMilliseconds(gfxPrefs::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(StaticPrefs::VRNavigationTimeout());
+      TimeDuration::FromMilliseconds(gfxPrefs::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() && StaticPrefs::VRRequireGesture() &&
+      !IsHandlingVRNavigationEvent() && gfxPrefs::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 "mozilla/StaticPrefs.h"
+#include "gfxPrefs.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() &&
-      StaticPrefs::PrintFontVariationsAsPaths()) {
+      gfxPrefs::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/2d/Factory.cpp
+++ b/gfx/2d/Factory.cpp
@@ -62,18 +62,16 @@
 
 #include "mozilla/CheckedInt.h"
 
 #ifdef MOZ_ENABLE_FREETYPE
 #  include "ft2build.h"
 #  include FT_FREETYPE_H
 #endif
 #include "MainThreadUtils.h"
-#include "mozilla/Preferences.h"
-#include "mozilla/StaticPrefs.h"
 
 #if defined(MOZ_LOGGING)
 GFX2D_API mozilla::LogModule* GetGFX2DLog() {
   static mozilla::LazyLogModule sLog("gfx2d");
   return sLog;
 }
 #endif
 
@@ -185,19 +183,18 @@ void mozilla_UnlockFTLibrary(FT_Library 
   mozilla::gfx::Factory::UnlockFTLibrary(aFTLibrary);
 }
 }
 #endif
 
 namespace mozilla {
 namespace gfx {
 
-// In Gecko, this value is managed by gfx.logging.level and gets updated when
-// the pref change.
-Atomic<int32_t> LoggingPrefs::sGfxLogLevel(LOG_DEFAULT);
+// In Gecko, this value is managed by gfx.logging.level in gfxPrefs.
+int32_t LoggingPrefs::sGfxLogLevel = LOG_DEFAULT;
 
 #ifdef MOZ_ENABLE_FREETYPE
 FT_Library Factory::mFTLibrary = nullptr;
 StaticMutex Factory::mFTLock;
 #endif
 
 #ifdef WIN32
 // Note: mDeviceLock must be held when mutating these values.
@@ -212,28 +209,19 @@ StaticRefPtr<IDWriteFontCollection> Fact
 StaticMutex Factory::mDeviceLock;
 StaticMutex Factory::mDTDependencyLock;
 #endif
 
 DrawEventRecorder* Factory::mRecorder;
 
 mozilla::gfx::Config* Factory::sConfig = nullptr;
 
-static void PrefChanged(const char* aPref, void*) {
-  mozilla::gfx::LoggingPrefs::sGfxLogLevel =
-      Preferences::GetInt(StaticPrefs::GetGfxLoggingLevelPrefName(),
-                          StaticPrefs::GetGfxLoggingLevelPrefDefault());
-}
-
 void Factory::Init(const Config& aConfig) {
   MOZ_ASSERT(!sConfig);
   sConfig = new Config(aConfig);
-  Preferences::RegisterCallback(
-      PrefChanged,
-      nsDependentCString(StaticPrefs::GetGfxLoggingLevelPrefName()));
 }
 
 void Factory::ShutDown() {
   if (sConfig) {
     delete sConfig->mLogForwarder;
     delete sConfig;
     sConfig = nullptr;
   }
--- a/gfx/2d/HelpersWinFonts.h
+++ b/gfx/2d/HelpersWinFonts.h
@@ -1,26 +1,26 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "mozilla/StaticPrefs.h"
+#include "gfxPrefs.h"
 
 namespace mozilla {
 namespace gfx {
 
 extern BYTE sSystemTextQuality;
 
 static BYTE GetSystemTextQuality() { return sSystemTextQuality; }
 
 static AntialiasMode GetSystemDefaultAAMode() {
   AntialiasMode defaultMode = AntialiasMode::SUBPIXEL;
-  if (StaticPrefs::DisableAllTextAA()) {
+  if (gfxPrefs::DisableAllTextAA()) {
     return AntialiasMode::NONE;
   }
 
   switch (GetSystemTextQuality()) {
     case CLEARTYPE_QUALITY:
       defaultMode = AntialiasMode::SUBPIXEL;
       break;
     case ANTIALIASED_QUALITY:
--- a/gfx/2d/Logging.h
+++ b/gfx/2d/Logging.h
@@ -16,17 +16,16 @@
 #  include "mozilla/Logging.h"
 #endif
 #include "mozilla/Tuple.h"
 
 #if defined(MOZ_WIDGET_ANDROID)
 #  include "nsDebug.h"
 #endif
 #include "2D.h"
-#include "mozilla/Atomics.h"
 #include "Point.h"
 #include "BaseRect.h"
 #include "Matrix.h"
 #include "LoggingConstants.h"
 
 #if defined(MOZ_LOGGING)
 extern GFX2D_API mozilla::LogModule* GetGFX2DLog();
 #endif
@@ -54,17 +53,17 @@ inline mozilla::LogLevel PRLogLevelForLe
 
 class LoggingPrefs {
  public:
   // Used to choose the level of logging we get.  The higher the number,
   // the more logging we get.  Value of zero will give you no logging,
   // 1 just errors, 2 adds warnings and 3 or 4 add debug logging.
   // In addition to setting the value to 4, you will need to set the
   // environment variable MOZ_LOG to gfx:4. See mozilla/Logging.h for details.
-  static Atomic<int32_t> sGfxLogLevel;
+  static int32_t sGfxLogLevel;
 };
 
 /// Graphics logging is available in both debug and release builds and is
 /// controlled with a gfx.logging.level preference. If not set, the default
 /// for the preference is 5 in the debug builds, 1 in the release builds.
 ///
 /// gfxDebug only works in the debug builds, and is used for information
 /// level messages, helping with debugging.  In addition to only working
--- a/gfx/2d/ScaledFontBase.cpp
+++ b/gfx/2d/ScaledFontBase.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 "ScaledFontBase.h"
 
-#include "mozilla/StaticPrefs.h"
+#include "gfxPrefs.h"
 
 #ifdef USE_SKIA
 #  include "PathSkia.h"
 #  include "skia/include/core/SkFont.h"
 #endif
 
 #ifdef USE_CAIRO
 #  include "PathCairo.h"
@@ -31,17 +31,17 @@ Atomic<uint32_t> UnscaledFont::sDeletion
 
 UnscaledFont::~UnscaledFont() { sDeletionCounter++; }
 
 Atomic<uint32_t> ScaledFont::sDeletionCounter(0);
 
 ScaledFont::~ScaledFont() { sDeletionCounter++; }
 
 AntialiasMode ScaledFont::GetDefaultAAMode() {
-  if (StaticPrefs::DisableAllTextAA()) {
+  if (gfxPrefs::DisableAllTextAA()) {
     return AntialiasMode::NONE;
   }
 
   return AntialiasMode::DEFAULT;
 }
 
 ScaledFontBase::~ScaledFontBase() {
 #ifdef USE_SKIA
--- a/gfx/2d/unittest/TestBase.h
+++ b/gfx/2d/unittest/TestBase.h
@@ -4,19 +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/. */
 
 #pragma once
 
 #include <string>
 #include <vector>
 
-#if defined(_MSC_VER) && !defined(__clang__)
+#ifdef _MSC_VER
 // On MSVC otherwise our generic member pointer trick doesn't work.
-// JYA: Do we still need this?
 #  pragma pointers_to_members(full_generality, single_inheritance)
 #endif
 
 #define VERIFY(arg)                          \
   if (!(arg)) {                              \
     LogMessage("VERIFY FAILED: " #arg "\n"); \
     mTestFailed = true;                      \
   }
--- a/gfx/config/gfxConfig.h
+++ b/gfx/config/gfxConfig.h
@@ -15,17 +15,17 @@
 namespace mozilla {
 namespace gfx {
 
 // Defined in GraphicsMessages.ipdlh.
 class FeatureFailure;
 
 // Manages the history and state of a graphics feature. The flow of a feature
 // is:
-//   - A default value, set by all.js, or gfxPlatform.
+//   - A default value, set by all.js, gfxPrefs, or gfxPlatform.
 //   - A user value, set by an external value or user pref.
 //   - An environment value, determined by system/hardware factors or
 //   nsIGfxInfo.
 //   - A runtime value, determined by any failures encountered after enabling
 //     the feature.
 //
 // Each state change for a feature is recorded in this class.
 class gfxConfig {
--- a/gfx/config/gfxVars.h
+++ b/gfx/config/gfxVars.h
@@ -44,24 +44,23 @@ class gfxVarReceiver;
   _(UseWebRenderDCompWinTripleBuffering, bool, false)              \
   _(UseWebRenderProgramBinaryDisk, bool, false)                    \
   _(WebRenderDebugFlags, int32_t, 0)                               \
   _(ScreenDepth, int32_t, 0)                                       \
   _(GREDirectory, nsString, nsString())                            \
   _(ProfDirectory, nsString, nsString())                           \
   _(UseOMTP, bool, false)                                          \
   _(AllowD3D11KeyedMutex, bool, false)                             \
-  _(SystemTextQuality, int32_t, 5 /* CLEARTYPE_QUALITY */)         \
-  _(LayersWindowRecordingPath, nsCString, nsCString())
+  _(SystemTextQuality, int32_t, 5 /* CLEARTYPE_QUALITY */)
 
 /* Add new entries above this line. */
 
 // Some graphics settings are computed on the UI process and must be
 // communicated to content and GPU processes. gfxVars helps facilitate
-// this. Its function is similar to StaticPrefs, except rather than hold
+// this. Its function is similar to gfxPrefs, except rather than hold
 // user preferences, it holds dynamically computed values.
 //
 // Each variable in GFX_VARS_LIST exposes the following static methods:
 //
 //    const DataType& CxxName();
 //    void SetCxxName(const DataType& aValue);
 //
 // Note that the setter may only be called in the UI process; a gfxVar must be
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -29,17 +29,17 @@
 #include "nsPrintfCString.h"
 #include "nsThreadUtils.h"
 #include "prenv.h"
 #include "prlink.h"
 #include "ScopedGLHelpers.h"
 #include "SharedSurfaceGL.h"
 #include "GfxTexturesReporter.h"
 #include "gfx2DGlue.h"
-#include "mozilla/StaticPrefs.h"
+#include "gfxPrefs.h"
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/gfx/Logging.h"
 
 #include "OGLShaderProgram.h"  // for ShaderProgramType
 
 #include "mozilla/DebugOnly.h"
 
 #ifdef XP_MACOSX
@@ -204,19 +204,19 @@ static const char* const sExtensionNames
     "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",
     "GL_OVR_multiview2"};
 
 static bool ShouldUseTLSIsCurrent(bool useTLSIsCurrent) {
-  if (StaticPrefs::UseTLSIsCurrent() == 0) return useTLSIsCurrent;
-
-  return StaticPrefs::UseTLSIsCurrent() > 0;
+  if (gfxPrefs::UseTLSIsCurrent() == 0) return useTLSIsCurrent;
+
+  return gfxPrefs::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;
 
@@ -271,17 +271,17 @@ uint8_t GLContext::ChooseDebugFlags(cons
 GLContext::GLContext(CreateContextFlags flags, const SurfaceCaps& caps,
                      GLContext* sharedContext, bool isOffscreen,
                      bool useTLSIsCurrent)
     : mUseTLSIsCurrent(ShouldUseTLSIsCurrent(useTLSIsCurrent)),
       mIsOffscreen(isOffscreen),
       mDebugFlags(ChooseDebugFlags(flags)),
       mSharedContext(sharedContext),
       mCaps(caps),
-      mWorkAroundDriverBugs(StaticPrefs::WorkAroundDriverBugs()) {
+      mWorkAroundDriverBugs(gfxPrefs::WorkAroundDriverBugs()) {
   mOwningThreadId = PlatformThread::CurrentId();
   MOZ_ALWAYS_TRUE(sCurrentContext.init());
   sCurrentContext.set(0);
 }
 
 GLContext::~GLContext() {
   NS_ASSERTION(
       IsDestroyed(),
@@ -1754,17 +1754,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 = StaticPrefs::MSAALevel();
+  uint32_t msaaLevel = gfxPrefs::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
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "GLContextProvider.h"
 #include "GLContextCGL.h"
 #include "nsDebug.h"
 #include "nsIWidget.h"
 #include <OpenGL/gl.h>
 #include "gfxFailure.h"
-#include "mozilla/StaticPrefs.h"
+#include "gfxPrefs.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>
 
@@ -93,17 +93,17 @@ bool GLContextCGL::MakeCurrentImpl() con
     [mContext makeCurrentContext];
     MOZ_ASSERT(IsCurrentImpl());
     // Use non-blocking swap in "ASAP mode".
     // ASAP mode means that rendering is iterated as fast as possible.
     // ASAP mode is entered when layout.frame_rate=0 (requires restart).
     // If swapInt is 1, then glSwapBuffers will block and wait for a vblank signal.
     // When we're iterating as fast as possible, however, we want a non-blocking
     // glSwapBuffers, which will happen when swapInt==0.
-    GLint swapInt = StaticPrefs::LayoutFrameRate() == 0 ? 0 : 1;
+    GLint swapInt = gfxPrefs::LayoutFrameRate() == 0 ? 0 : 1;
     [mContext setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
   }
   return true;
 }
 
 bool GLContextCGL::IsCurrentImpl() const { return [NSOpenGLContext currentContext] == mContext; }
 
 GLenum GLContextCGL::GetPreferredARGB32Format() const { return LOCAL_GL_BGRA; }
@@ -197,17 +197,17 @@ already_AddRefed<GLContext> GLContextPro
   } else {
     attribs = aForceAccelerated ? kAttribs_singleBuffered_accel : kAttribs_singleBuffered;
   }
   NSOpenGLContext* context = CreateWithFormat(attribs);
   if (!context) {
     return nullptr;
   }
 
-  GLint opaque = StaticPrefs::CompositorGLContextOpaque();
+  GLint opaque = gfxPrefs::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 +221,27 @@ static already_AddRefed<GLContextCGL> Cr
   if (!sCGLLibrary.EnsureInitialized()) {
     return nullptr;
   }
 
   NSOpenGLContext* context = nullptr;
 
   std::vector<NSOpenGLPixelFormatAttribute> attribs;
 
-  if (!StaticPrefs::GLAllowHighPower()) {
+  if (!gfxPrefs::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 (StaticPrefs::RequireHardwareGL()) {
+  if (gfxPrefs::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 +255,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 (StaticPrefs::GLMultithreaded()) {
+  if (gfxPrefs::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/GLContextProviderEAGL.mm
+++ b/gfx/gl/GLContextProviderEAGL.mm
@@ -2,16 +2,17 @@
  * 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 "GLContextProvider.h"
 #include "GLContextEAGL.h"
 #include "nsDebug.h"
 #include "nsIWidget.h"
+#include "gfxPrefs.h"
 #include "gfxFailure.h"
 #include "prenv.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/layers/CompositorOptions.h"
 #include "mozilla/widget/CompositorWidget.h"
 #include "GeckoProfiler.h"
 
 #import <UIKit/UIKit.h>
--- a/gfx/gl/GLContextProviderGLX.cpp
+++ b/gfx/gl/GLContextProviderGLX.cpp
@@ -14,17 +14,16 @@
 #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"
@@ -33,16 +32,17 @@
 #include "gfxXlibSurface.h"
 #include "gfxContext.h"
 #include "gfxEnv.h"
 #include "gfxPlatform.h"
 #include "GLContextGLX.h"
 #include "gfxUtils.h"
 #include "gfx2DGlue.h"
 #include "GLScreenBuffer.h"
+#include "gfxPrefs.h"
 
 #include "gfxCrashReporterUtils.h"
 
 #ifdef MOZ_WIDGET_GTK
 #  include "gfxPlatformGtk.h"
 #endif
 
 namespace mozilla {
@@ -180,17 +180,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 = StaticPrefs::UseGLXTextureFromPixmap();
+    mUseTextureFromPixmap = gfxPrefs::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)) {
@@ -592,17 +592,17 @@ bool GLContextGLX::MakeCurrentImpl() con
 
   const bool succeeded = mGLX->fMakeCurrent(mDisplay, mDrawable, mContext);
   NS_ASSERTION(succeeded, "Failed to make GL context current!");
 
   if (!IsOffscreen() && mGLX->SupportsSwapControl()) {
     // Many GLX implementations default to blocking until the next
     // VBlank when calling glXSwapBuffers. We want to run unthrottled
     // in ASAP mode. See bug 1280744.
-    const bool isASAP = (StaticPrefs::LayoutFrameRate() == 0);
+    const bool isASAP = (gfxPrefs::LayoutFrameRate() == 0);
     mGLX->fSwapInterval(mDisplay, mDrawable, isASAP ? 0 : 1);
   }
   return succeeded;
 }
 
 bool GLContextGLX::IsCurrentImpl() const {
   return mGLX->fGetCurrentContext() == mContext;
 }
--- a/gfx/gl/GLContextProviderWGL.cpp
+++ b/gfx/gl/GLContextProviderWGL.cpp
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "GLContextProvider.h"
 #include "GLContextWGL.h"
 #include "GLLibraryLoader.h"
 #include "nsDebug.h"
 #include "nsIWidget.h"
 #include "gfxPlatform.h"
+#include "gfxPrefs.h"
 #include "gfxWindowsSurface.h"
 
 #include "gfxCrashReporterUtils.h"
 
 #include "prenv.h"
 
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/Preferences.h"
@@ -209,18 +210,17 @@ 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() &&
-      !StaticPrefs::IgnoreDXInterop2Blacklist()) {
+  if (gfxVars::DXInterop2Blocked() && !gfxPrefs::IgnoreDXInterop2Blacklist()) {
     hasDXInterop2 = false;
   }
 
   if (hasDXInterop2) {
     const SymLoadStruct dxInteropSymbols[] = {
         SYMBOL(DXSetResourceShareHandleNV),
         SYMBOL(DXOpenDeviceNV),
         SYMBOL(DXCloseDeviceNV),
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -7,17 +7,16 @@
 #include "gfxConfig.h"
 #include "gfxCrashReporterUtils.h"
 #include "gfxUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Tokenizer.h"
 #include "mozilla/ScopeExit.h"
-#include "mozilla/StaticPrefs.h"
 #include "mozilla/Unused.h"
 #include "mozilla/webrender/RenderThread.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsIGfxInfo.h"
 #include "nsPrintfCString.h"
 #ifdef XP_WIN
 #  include "mozilla/gfx/DeviceManagerDx.h"
@@ -25,16 +24,17 @@
 
 #  include <d3d11.h>
 #endif
 #include "OGLShaderProgram.h"
 #include "prenv.h"
 #include "prsystem.h"
 #include "GLContext.h"
 #include "GLContextProvider.h"
+#include "gfxPrefs.h"
 #include "ScopedGLHelpers.h"
 #ifdef MOZ_WIDGET_GTK
 #  include <gdk/gdk.h>
 #  ifdef MOZ_WAYLAND
 #    include <gdk/gdkwayland.h>
 #    include <dlfcn.h>
 #  endif  // MOZ_WIDGET_GTK
 #endif    // MOZ_WAYLAND
@@ -80,17 +80,18 @@ PRLibrary* LoadApitraceLibrary() {
   // on android as we can use LD_PRELOAD or other tricks
   // on other platforms. We look for it in /data/local
   // as that's writeable by all users.
   path = "/data/local/tmp/egltrace.so";
 #endif
   if (!path) return nullptr;
 
   // Initialization of gfx prefs here is only needed during the unit tests...
-  if (!StaticPrefs::UseApitrace()) {
+  gfxPrefs::GetSingleton();
+  if (!gfxPrefs::UseApitrace()) {
     return nullptr;
   }
 
   static PRLibrary* sApitraceLibrary = nullptr;
   if (sApitraceLibrary) return sApitraceLibrary;
 
   nsAutoCString logFile;
   Preferences::GetCString("gfx.apitrace.logfile", logFile);
@@ -284,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 (!StaticPrefs::WebGLANGLETryD3D11())
+  if (!gfxPrefs::WebGLANGLETryD3D11())
     d3d11ANGLE.UserDisable("User disabled D3D11 ANGLE by pref",
                            NS_LITERAL_CSTRING("FAILURE_ID_ANGLE_PREF"));
 
-  if (StaticPrefs::WebGLANGLEForceD3D11())
+  if (gfxPrefs::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
@@ -736,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 (StaticPrefs::WebGLANGLEForceWARP()) {
+    if (gfxPrefs::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
@@ -2,17 +2,17 @@
 /* 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 "GLScreenBuffer.h"
 
 #include <cstring>
 #include "CompositorTypes.h"
-#include "mozilla/StaticPrefs.h"
+#include "gfxPrefs.h"
 #include "GLContext.h"
 #include "GLBlitHelper.h"
 #include "GLReadTexImageHelper.h"
 #include "SharedSurfaceEGL.h"
 #include "SharedSurfaceGL.h"
 #include "ScopedGLHelpers.h"
 #include "gfx2DGlue.h"
 #include "../layers/ipc/ShadowLayers.h"
@@ -64,36 +64,36 @@ UniquePtr<SurfaceFactory> GLScreenBuffer
     GLContext* gl, const SurfaceCaps& caps,
     KnowsCompositor* compositorConnection, const layers::TextureFlags& flags) {
   LayersIPCChannel* ipcChannel = compositorConnection->GetTextureForwarder();
   const layers::LayersBackend backend =
       compositorConnection->GetCompositorBackendType();
   const bool useANGLE = compositorConnection->GetCompositorUseANGLE();
 
   const bool useGl =
-      !StaticPrefs::WebGLForceLayersReadback() &&
+      !gfxPrefs::WebGLForceLayersReadback() &&
       (backend == layers::LayersBackend::LAYERS_OPENGL ||
        (backend == layers::LayersBackend::LAYERS_WR && !useANGLE));
   const bool useD3D =
-      !StaticPrefs::WebGLForceLayersReadback() &&
+      !gfxPrefs::WebGLForceLayersReadback() &&
       (backend == layers::LayersBackend::LAYERS_D3D11 ||
        (backend == layers::LayersBackend::LAYERS_WR && useANGLE));
 
   UniquePtr<SurfaceFactory> factory = nullptr;
   if (useGl) {
 #if defined(XP_MACOSX)
     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() && !StaticPrefs::WebGLSurfaceTextureEnabled()) {
+    if (XRE_IsParentProcess() && !gfxPrefs::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 && StaticPrefs::WebGLDXGLEnabled()) {
+    if (!factory && gfxPrefs::WebGLDXGLEnabled()) {
       factory =
           SurfaceFactory_D3D11Interop::Create(gl, caps, ipcChannel, flags);
     }
 #endif
   }
 
 #ifdef MOZ_X11
   if (!factory && sGLXLibrary.UseTextureFromPixmap()) {
--- a/gfx/gl/GfxTexturesReporter.cpp
+++ b/gfx/gl/GfxTexturesReporter.cpp
@@ -3,17 +3,17 @@
 /* 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 <string>
 #include <sstream>
 #include "nsExceptionHandler.h"
 #include "GfxTexturesReporter.h"
-#include "mozilla/StaticPrefs.h"
+#include "gfxPrefs.h"
 
 using namespace mozilla;
 using namespace mozilla::gl;
 
 NS_IMPL_ISUPPORTS(GfxTexturesReporter, nsIMemoryReporter)
 
 Atomic<size_t> GfxTexturesReporter::sAmount(0);
 Atomic<size_t> GfxTexturesReporter::sPeakAmount(0);
@@ -54,25 +54,25 @@ std::string FormatBytes(size_t amount) {
 /* static */
 void GfxTexturesReporter::UpdateAmount(MemoryUse action, size_t amount) {
   if (action == MemoryFreed) {
     MOZ_RELEASE_ASSERT(
         amount <= sAmount,
         "GFX: Current texture usage greater than update amount.");
     sAmount -= amount;
 
-    if (StaticPrefs::GfxLoggingTextureUsageEnabled()) {
+    if (gfxPrefs::GfxLoggingTextureUsageEnabled()) {
       printf_stderr("Current texture usage: %s\n",
                     FormatBytes(sAmount).c_str());
     }
   } else {
     sAmount += amount;
     if (sAmount > sPeakAmount) {
       sPeakAmount.exchange(sAmount);
-      if (StaticPrefs::GfxLoggingPeakTextureUsageEnabled()) {
+      if (gfxPrefs::GfxLoggingPeakTextureUsageEnabled()) {
         printf_stderr("Peak texture usage: %s\n",
                       FormatBytes(sPeakAmount).c_str());
       }
     }
   }
 
   CrashReporter::AnnotateTexturesSize(sAmount);
 }
--- a/gfx/gl/SharedSurfaceD3D11Interop.cpp
+++ b/gfx/gl/SharedSurfaceD3D11Interop.cpp
@@ -2,16 +2,17 @@
 /* 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 "SharedSurfaceD3D11Interop.h"
 
 #include <d3d11.h>
 #include <d3d11_1.h>
+#include "gfxPrefs.h"
 #include "GLContext.h"
 #include "WGLLibrary.h"
 #include "nsPrintfCString.h"
 #include "mozilla/gfx/DeviceManagerDx.h"
 
 namespace mozilla {
 namespace gl {
 
@@ -409,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(StaticPrefs::WebGLDXGLNeedsFinish()),
+      mNeedsFinish(gfxPrefs::WebGLDXGLNeedsFinish()),
       mLockedForGL(false) {
   MOZ_ASSERT(bool(mProdTex) == bool(mInteropFB));
 }
 
 SharedSurface_D3D11Interop::~SharedSurface_D3D11Interop() {
   MOZ_ASSERT(!IsProducerAcquired());
 
   if (!mGL || !mGL->MakeCurrent()) return;
--- a/gfx/ipc/GPUChild.cpp
+++ b/gfx/ipc/GPUChild.cpp
@@ -1,19 +1,19 @@
 /* -*- 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 "GPUChild.h"
 #include "gfxConfig.h"
+#include "gfxPrefs.h"
 #include "GPUProcessHost.h"
 #include "GPUProcessManager.h"
 #include "VRProcessManager.h"
-#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TelemetryIPC.h"
 #include "mozilla/dom/CheckerboardReportService.h"
 #include "mozilla/dom/MemoryReportRequest.h"
 #include "mozilla/gfx/gfxVars.h"
 #if defined(XP_WIN)
 #  include "mozilla/gfx/DeviceManagerDx.h"
 #endif
@@ -35,16 +35,32 @@ using namespace layers;
 
 GPUChild::GPUChild(GPUProcessHost* aHost) : mHost(aHost), mGPUReady(false) {
   MOZ_COUNT_CTOR(GPUChild);
 }
 
 GPUChild::~GPUChild() { MOZ_COUNT_DTOR(GPUChild); }
 
 void GPUChild::Init() {
+  // Build a list of prefs the GPU process will need. Note that because we
+  // limit the GPU process to prefs contained in gfxPrefs, we can simplify
+  // the message in two ways: one, we only need to send its index in gfxPrefs
+  // rather than its name, and two, we only need to send prefs that don't
+  // have their default value.
+  nsTArray<GfxPrefSetting> prefs;
+  for (auto pref : gfxPrefs::all()) {
+    if (pref->HasDefaultValue()) {
+      continue;
+    }
+
+    GfxPrefValue value;
+    pref->GetCachedValue(&value);
+    prefs.AppendElement(GfxPrefSetting(pref->Index(), value));
+  }
+
   nsTArray<GfxVarUpdate> updates = gfxVars::FetchNonDefaultVars();
 
   DevicePrefs devicePrefs;
   devicePrefs.hwCompositing() = gfxConfig::GetValue(Feature::HW_COMPOSITING);
   devicePrefs.d3d11Compositing() =
       gfxConfig::GetValue(Feature::D3D11_COMPOSITING);
   devicePrefs.oglCompositing() =
       gfxConfig::GetValue(Feature::OPENGL_COMPOSITING);
@@ -52,17 +68,17 @@ void GPUChild::Init() {
   devicePrefs.useD2D1() = gfxConfig::GetValue(Feature::DIRECT2D);
 
   nsTArray<LayerTreeIdMapping> mappings;
   LayerTreeOwnerTracker::Get()->Iterate(
       [&](LayersId aLayersId, base::ProcessId aProcessId) {
         mappings.AppendElement(LayerTreeIdMapping(aLayersId, aProcessId));
       });
 
-  SendInit(updates, devicePrefs, mappings);
+  SendInit(prefs, updates, devicePrefs, mappings);
 
   gfxVars::AddReceiver(this);
 
 #ifdef MOZ_GECKO_PROFILER
   Unused << SendInitProfiler(ProfilerParent::CreateForProcess(OtherPid()));
 #endif
 }
 
@@ -137,33 +153,33 @@ mozilla::ipc::IPCResult GPUChild::RecvIn
                                                       aShmem, aThreadId);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult GPUChild::RecvCreateVRProcess() {
   // Make sure create VR process at the main process
   MOZ_ASSERT(XRE_IsParentProcess());
-  if (StaticPrefs::VRProcessEnabled()) {
+  if (gfxPrefs::VRProcessEnabled()) {
     VRProcessManager::Initialize();
     VRProcessManager* vr = VRProcessManager::Get();
     MOZ_ASSERT(vr, "VRProcessManager must be initialized first.");
 
     if (vr) {
       vr->LaunchVRProcess();
     }
   }
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult GPUChild::RecvShutdownVRProcess() {
   // Make sure stopping VR process at the main process
   MOZ_ASSERT(XRE_IsParentProcess());
-  if (StaticPrefs::VRProcessEnabled()) {
+  if (gfxPrefs::VRProcessEnabled()) {
     VRProcessManager::Shutdown();
   }
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult GPUChild::RecvNotifyUiObservers(
     const nsCString& aTopic) {
--- a/gfx/ipc/GPUParent.cpp
+++ b/gfx/ipc/GPUParent.cpp
@@ -5,21 +5,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifdef XP_WIN
 #  include "WMF.h"
 #endif
 #include "GPUParent.h"
 #include "gfxConfig.h"
 #include "gfxCrashReporterUtils.h"
 #include "gfxPlatform.h"
+#include "gfxPrefs.h"
 #include "GLContextProvider.h"
 #include "GPUProcessHost.h"
 #include "GPUProcessManager.h"
 #include "mozilla/Assertions.h"
-#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/VideoDecoderManagerChild.h"
 #include "mozilla/VideoDecoderManagerParent.h"
 #include "mozilla/dom/MemoryReportRequest.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/image/ImageMemoryReporter.h"
@@ -104,16 +104,18 @@ bool GPUParent::Init(base::ProcessId aPa
     // We need to quit this process if the buildID doesn't match the parent's.
     // This can occur when an update occurred in the background.
     ProcessChild::QuickExit();
   }
 
   // Init crash reporter support.
   CrashReporterClient::InitSingleton(this);
 
+  // Ensure gfxPrefs are initialized.
+  gfxPrefs::GetSingleton();
   gfxConfig::Init();
   gfxVars::Initialize();
   gfxPlatform::InitNullMetadata();
   // Ensure our Factory is initialised, mainly for gfx logging to work.
   gfxPlatform::InitMoz2DLogging();
   mlg::InitializeMemoryReporters();
 #if defined(XP_WIN)
   DeviceManagerDx::Init();
@@ -167,18 +169,23 @@ PAPZInputBridgeParent* GPUParent::AllocP
 
 bool GPUParent::DeallocPAPZInputBridgeParent(PAPZInputBridgeParent* aActor) {
   APZInputBridgeParent* parent = static_cast<APZInputBridgeParent*>(aActor);
   parent->Release();
   return true;
 }
 
 mozilla::ipc::IPCResult GPUParent::RecvInit(
-    nsTArray<GfxVarUpdate>&& vars, const DevicePrefs& devicePrefs,
-    nsTArray<LayerTreeIdMapping>&& aMappings) {
+    nsTArray<GfxPrefSetting>&& prefs, nsTArray<GfxVarUpdate>&& vars,
+    const DevicePrefs& devicePrefs, nsTArray<LayerTreeIdMapping>&& aMappings) {
+  const nsTArray<gfxPrefs::Pref*>& globalPrefs = gfxPrefs::all();
+  for (auto& setting : prefs) {
+    gfxPrefs::Pref* pref = globalPrefs[setting.index()];
+    pref->SetCachedValue(setting.value());
+  }
   for (const auto& var : vars) {
     gfxVars::ApplyUpdate(var);
   }
 
   // Inherit device preferences.
   gfxConfig::Inherit(Feature::HW_COMPOSITING, devicePrefs.hwCompositing());
   gfxConfig::Inherit(Feature::D3D11_COMPOSITING,
                      devicePrefs.d3d11Compositing());
@@ -254,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 (StaticPrefs::Direct3D11UseDoubleBuffering() && IsWin10OrLater()) {
+    if (gfxPrefs::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();
@@ -318,23 +325,25 @@ mozilla::ipc::IPCResult GPUParent::RecvI
 mozilla::ipc::IPCResult GPUParent::RecvInitProfiler(
     Endpoint<PProfilerChild>&& aEndpoint) {
 #ifdef MOZ_GECKO_PROFILER
   mProfilerController = ChildProfilerController::Create(std::move(aEndpoint));
 #endif
   return IPC_OK();
 }
 
-mozilla::ipc::IPCResult GPUParent::RecvUpdateVar(const GfxVarUpdate& aUpdate) {
-  gfxVars::ApplyUpdate(aUpdate);
+mozilla::ipc::IPCResult GPUParent::RecvUpdatePref(
+    const GfxPrefSetting& setting) {
+  gfxPrefs::Pref* pref = gfxPrefs::all()[setting.index()];
+  pref->SetCachedValue(setting.value());
   return IPC_OK();
 }
 
-mozilla::ipc::IPCResult GPUParent::RecvPreferenceUpdate(const Pref& aPref) {
-  Preferences::SetPreference(aPref);
+mozilla::ipc::IPCResult GPUParent::RecvUpdateVar(const GfxVarUpdate& aUpdate) {
+  gfxVars::ApplyUpdate(aUpdate);
   return IPC_OK();
 }
 
 static void CopyFeatureChange(Feature aFeature, Maybe<FeatureFailure>* aOut) {
   FeatureState& feature = gfxConfig::GetFeature(aFeature);
   if (feature.DisabledByDefault() || feature.IsEnabled()) {
     // No change:
     //   - Disabled-by-default means the parent process told us not to use this
@@ -468,17 +477,17 @@ mozilla::ipc::IPCResult GPUParent::RecvR
       },
       [&](const uint32_t& aGeneration) {
         return GetSingleton()->SendFinishMemoryReport(aGeneration);
       });
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult GPUParent::RecvShutdownVR() {
-  if (StaticPrefs::VRProcessEnabled()) {
+  if (gfxPrefs::VRProcessEnabled()) {
     VRGPUChild::Shutdown();
   }
   return IPC_OK();
 }
 
 void GPUParent::ActorDestroy(ActorDestroyReason aWhy) {
   if (AbnormalShutdown == aWhy) {
     NS_WARNING("Shutting down GPU process early due to a crash!");
@@ -509,17 +518,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 (StaticPrefs::Direct3D11UseDoubleBuffering() && IsWin10OrLater()) {
+  else if (gfxPrefs::Direct3D11UseDoubleBuffering() && IsWin10OrLater()) {
     widget::WinCompositorWindowThread::ShutDown();
   }
 #endif
 
   image::ImageMemoryReporter::ShutdownForWebRender();
 
   // Shut down the default GL context provider.
   gl::GLContextProvider::Shutdown();
@@ -544,14 +553,15 @@ void GPUParent::ActorDestroy(ActorDestro
 #endif
 
 #if defined(XP_WIN)
   DeviceManagerDx::Shutdown();
 #endif
   LayerTreeOwnerTracker::Shutdown();
   gfxVars::Shutdown();
   gfxConfig::Shutdown();
+  gfxPrefs::DestroySingleton();
   CrashReporterClient::DestroySingleton();
   XRE_ShutdownChildProcess();
 }
 
 }  // namespace gfx
 }  // namespace mozilla
--- a/gfx/ipc/GPUParent.h
+++ b/gfx/ipc/GPUParent.h
@@ -32,35 +32,36 @@ class GPUParent final : public PGPUParen
 
   bool Init(base::ProcessId aParentPid, const char* aParentBuildID,
             MessageLoop* aIOLoop, IPC::Channel* aChannel);
   void NotifyDeviceReset();
 
   PAPZInputBridgeParent* AllocPAPZInputBridgeParent(const LayersId& aLayersId);
   bool DeallocPAPZInputBridgeParent(PAPZInputBridgeParent* aActor);
 
-  mozilla::ipc::IPCResult RecvInit(nsTArray<GfxVarUpdate>&& vars,
+  mozilla::ipc::IPCResult RecvInit(nsTArray<GfxPrefSetting>&& prefs,
+                                   nsTArray<GfxVarUpdate>&& vars,
                                    const DevicePrefs& devicePrefs,
                                    nsTArray<LayerTreeIdMapping>&& mappings);
   mozilla::ipc::IPCResult RecvInitCompositorManager(
       Endpoint<PCompositorManagerParent>&& aEndpoint);
   mozilla::ipc::IPCResult RecvInitVsyncBridge(
       Endpoint<PVsyncBridgeParent>&& aVsyncEndpoint);
   mozilla::ipc::IPCResult RecvInitImageBridge(
       Endpoint<PImageBridgeParent>&& aEndpoint);
   mozilla::ipc::IPCResult RecvInitVRManager(
       Endpoint<PVRManagerParent>&& aEndpoint);
   mozilla::ipc::IPCResult RecvInitVR(Endpoint<PVRGPUChild>&& aVRGPUChild);
   mozilla::ipc::IPCResult RecvInitUiCompositorController(
       const LayersId& aRootLayerTreeId,
       Endpoint<PUiCompositorControllerParent>&& aEndpoint);
   mozilla::ipc::IPCResult RecvInitProfiler(
       Endpoint<PProfilerChild>&& aEndpoint);
+  mozilla::ipc::IPCResult RecvUpdatePref(const GfxPrefSetting& pref);
   mozilla::ipc::IPCResult RecvUpdateVar(const GfxVarUpdate& pref);
-  mozilla::ipc::IPCResult RecvPreferenceUpdate(const Pref& pref);
   mozilla::ipc::IPCResult RecvNewContentCompositorManager(
       Endpoint<PCompositorManagerParent>&& aEndpoint);
   mozilla::ipc::IPCResult RecvNewContentImageBridge(
       Endpoint<PImageBridgeParent>&& aEndpoint);
   mozilla::ipc::IPCResult RecvNewContentVRManager(
       Endpoint<PVRManagerParent>&& aEndpoint);
   mozilla::ipc::IPCResult RecvNewContentVideoDecoderManager(
       Endpoint<PVideoDecoderManagerParent>&& aEndpoint);
--- a/gfx/ipc/GPUProcessHost.cpp
+++ b/gfx/ipc/GPUProcessHost.cpp
@@ -1,22 +1,21 @@
 /* -*- 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 "GPUProcessHost.h"
 #include "chrome/common/process_watcher.h"
+#include "gfxPrefs.h"
 #include "mozilla/gfx/Logging.h"
 #include "nsITimer.h"
 #include "mozilla/Preferences.h"
-#include "mozilla/StaticPrefs.h"
 #include "VRGPUChild.h"
-#include "ProcessUtils.h"
 
 namespace mozilla {
 namespace gfx {
 
 using namespace ipc;
 
 GPUProcessHost::GPUProcessHost(Listener* aListener)
     : GeckoChildProcessHost(GeckoProcessType_GPU),
@@ -31,43 +30,36 @@ GPUProcessHost::GPUProcessHost(Listener*
 
 GPUProcessHost::~GPUProcessHost() { MOZ_COUNT_DTOR(GPUProcessHost); }
 
 bool GPUProcessHost::Launch(StringVector aExtraOpts) {
   MOZ_ASSERT(mLaunchPhase == LaunchPhase::Unlaunched);
   MOZ_ASSERT(!mGPUChild);
   MOZ_ASSERT(!gfxPlatform::IsHeadless());
 
-  mPrefSerializer = MakeUnique<ipc::SharedPreferenceSerializer>();
-  if (!mPrefSerializer->SerializeToSharedMemory()) {
-    return false;
-  }
-  mPrefSerializer->AddSharedPrefCmdLineArgs(*this, aExtraOpts);
-
 #if defined(XP_WIN) && defined(MOZ_SANDBOX)
   mSandboxLevel = Preferences::GetInt("security.sandbox.gpu.level");
 #endif
 
   mLaunchPhase = LaunchPhase::Waiting;
   mLaunchTime = TimeStamp::Now();
 
   if (!GeckoChildProcessHost::AsyncLaunch(aExtraOpts)) {
     mLaunchPhase = LaunchPhase::Complete;
-    mPrefSerializer = nullptr;
     return false;
   }
   return true;
 }
 
 bool GPUProcessHost::WaitForLaunch() {
   if (mLaunchPhase == LaunchPhase::Complete) {
     return !!mGPUChild;
   }
 
-  int32_t timeoutMs = StaticPrefs::GPUProcessTimeoutMs();
+  int32_t timeoutMs = gfxPrefs::GPUProcessTimeoutMs();
 
   // If one of the following environment variables are set we can effectively
   // ignore the timeout - as we can guarantee the compositor process will be
   // terminated
   if (PR_GetEnv("MOZ_DEBUG_CHILD_PROCESS") ||
       PR_GetEnv("MOZ_DEBUG_CHILD_PAUSE")) {
     timeoutMs = 0;
   }
@@ -126,17 +118,16 @@ void GPUProcessHost::OnChannelErrorTask(
 
 static uint64_t sProcessTokenCounter = 0;
 
 void GPUProcessHost::InitAfterConnect(bool aSucceeded) {
   MOZ_ASSERT(mLaunchPhase == LaunchPhase::Waiting);
   MOZ_ASSERT(!mGPUChild);
 
   mLaunchPhase = LaunchPhase::Complete;
-  mPrefSerializer = nullptr;
 
   if (aSucceeded) {
     mProcessToken = ++sProcessTokenCounter;
     mGPUChild = MakeUnique<GPUChild>(this);
     DebugOnly<bool> rv =
         mGPUChild->Open(GetChannel(), base::GetProcId(GetChildProcessHandle()));
     MOZ_ASSERT(rv);
 
--- a/gfx/ipc/GPUProcessHost.h
+++ b/gfx/ipc/GPUProcessHost.h
@@ -8,21 +8,16 @@
 #define _include_mozilla_gfx_ipc_GPUProcessHost_h_
 
 #include "mozilla/Maybe.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/ipc/GeckoChildProcessHost.h"
 #include "mozilla/ipc/ProtocolUtils.h"
 #include "mozilla/ipc/TaskFactory.h"
 
-namespace mozilla {
-namespace ipc {
-class SharedPreferenceSerializer;
-}
-}  // namespace mozilla
 class nsITimer;
 
 namespace mozilla {
 namespace gfx {
 
 class GPUChild;
 
 // GPUProcessHost is the "parent process" container for a subprocess handle and
@@ -122,18 +117,16 @@ class GPUProcessHost final : public mozi
   mozilla::ipc::TaskFactory<GPUProcessHost> mTaskFactory;
 
   enum class LaunchPhase { Unlaunched, Waiting, Complete };
   LaunchPhase mLaunchPhase;
 
   UniquePtr<GPUChild> mGPUChild;
   uint64_t mProcessToken;
 
-  UniquePtr<mozilla::ipc::SharedPreferenceSerializer> mPrefSerializer;
-
   bool mShutdownRequested;
   bool mChannelClosed;
 
   TimeStamp mLaunchTime;
 };
 
 }  // namespace gfx
 }  // namespace mozilla
--- a/gfx/ipc/GPUProcessImpl.cpp
+++ b/gfx/ipc/GPUProcessImpl.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 "GPUProcessImpl.h"
 #include "mozilla/ipc/IOThreadChild.h"
 #include "nsXPCOM.h"
-#include "ProcessUtils.h"
 
 #if defined(OS_WIN) && defined(MOZ_SANDBOX)
 #  include "mozilla/sandboxTarget.h"
 #endif
 
 namespace mozilla {
 namespace gfx {
 
@@ -22,58 +21,25 @@ GPUProcessImpl::GPUProcessImpl(ProcessId
 
 GPUProcessImpl::~GPUProcessImpl() {}
 
 bool GPUProcessImpl::Init(int aArgc, char* aArgv[]) {
 #if defined(MOZ_SANDBOX) && defined(OS_WIN)
   mozilla::SandboxTarget::Instance()->StartSandbox();
 #endif
   char* parentBuildID = nullptr;
-  char* prefsHandle = nullptr;
-  char* prefMapHandle = nullptr;
-  char* prefsLen = nullptr;
-  char* prefMapSize = nullptr;
   for (int i = 1; i < aArgc; i++) {
     if (!aArgv[i]) {
       continue;
     }
     if (strcmp(aArgv[i], "-parentBuildID") == 0) {
       parentBuildID = aArgv[i + 1];
-
-#ifdef XP_WIN
-    } else if (strcmp(aArgv[i], "-prefsHandle") == 0) {
-      if (++i == aArgc) {
-        return false;
-      }
-      prefsHandle = aArgv[i];
-    } else if (strcmp(aArgv[i], "-prefMapHandle") == 0) {
-      if (++i == aArgc) {
-        return false;
-      }
-      prefMapHandle = aArgv[i];
-#endif
-    } else if (strcmp(aArgv[i], "-prefsLen") == 0) {
-      if (++i == aArgc) {
-        return false;
-      }
-      prefsLen = aArgv[i];
-    } else if (strcmp(aArgv[i], "-prefMapSize") == 0) {
-      if (++i == aArgc) {
-        return false;
-      }
-      prefMapSize = aArgv[i];
     }
   }
 
-  SharedPreferenceDeserializer deserializer;
-  if (!deserializer.DeserializeFromSharedMemory(prefsHandle, prefMapHandle,
-                                                prefsLen, prefMapSize)) {
-    return false;
-  }
-
   return mGPU.Init(ParentPid(), parentBuildID, IOThreadChild::message_loop(),
                    IOThreadChild::channel());
 }
 
 void GPUProcessImpl::CleanUp() { NS_ShutdownXPCOM(nullptr); }
 
 }  // namespace gfx
 }  // namespace mozilla
--- a/gfx/ipc/GPUProcessManager.cpp
+++ b/gfx/ipc/GPUProcessManager.cpp
@@ -1,20 +1,20 @@
 /* -*- 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 "GPUProcessManager.h"
 
+#include "gfxPrefs.h"
 #include "GPUProcessHost.h"
 #include "GPUProcessListener.h"
 #include "mozilla/MemoryReportingProcess.h"
-#include "mozilla/Preferences.h"
 #include "mozilla/Sprintf.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/StaticPrefs.h"
 #include "mozilla/VideoDecoderManagerChild.h"
 #include "mozilla/VideoDecoderManagerParent.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/layers/APZCTreeManagerChild.h"
@@ -79,17 +79,16 @@ GPUProcessManager::GPUProcessManager()
       mProcess(nullptr),
       mProcessToken(0),
       mGPUChild(nullptr) {
   MOZ_COUNT_CTOR(GPUProcessManager);
 
   mIdNamespace = AllocateNamespace();
   mObserver = new Observer(this);
   nsContentUtils::RegisterShutdownObserver(mObserver);
-  Preferences::AddStrongObserver(mObserver, "");
 
   mDeviceResetLastTime = TimeStamp::Now();
 
   LayerTreeOwnerTracker::Initialize();
 }
 
 GPUProcessManager::~GPUProcessManager() {
   MOZ_COUNT_DTOR(GPUProcessManager);
@@ -108,51 +107,29 @@ NS_IMPL_ISUPPORTS(GPUProcessManager::Obs
 GPUProcessManager::Observer::Observer(GPUProcessManager* aManager)
     : mManager(aManager) {}
 
 NS_IMETHODIMP
 GPUProcessManager::Observer::Observe(nsISupports* aSubject, const char* aTopic,
                                      const char16_t* aData) {
   if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
     mManager->OnXPCOMShutdown();
-  } else if (!strcmp(aTopic, "nsPref:changed")) {
-    mManager->OnPreferenceChange(aData);
   }
   return NS_OK;
 }
 
 void GPUProcessManager::OnXPCOMShutdown() {
   if (mObserver) {
     nsContentUtils::UnregisterShutdownObserver(mObserver);
-    Preferences::RemoveObserver(mObserver, "");
     mObserver = nullptr;
   }
 
   CleanShutdown();
 }
 
-void GPUProcessManager::OnPreferenceChange(const char16_t* aData) {
-  // A pref changed. If it's not on the blacklist, inform child processes.
-  if (!dom::ContentParent::ShouldSyncPreference(aData)) {
-    return;
-  }
-
-  // We know prefs are ASCII here.
-  NS_LossyConvertUTF16toASCII strData(aData);
-
-  mozilla::dom::Pref pref(strData, /* isLocked */ false, Nothing(), Nothing());
-  Preferences::GetPreference(&pref);
-  if (!!mGPUChild) {
-    MOZ_ASSERT(mQueuedPrefs.IsEmpty());
-    mGPUChild->SendPreferenceUpdate(pref);
-  } else {
-    mQueuedPrefs.AppendElement(pref);
-  }
-}
-
 void GPUProcessManager::LaunchGPUProcess() {
   if (mProcess) {
     return;
   }
 
   // Start the Vsync I/O thread so can use it as soon as the process launches.
   EnsureVsyncIOThread();
 
@@ -360,37 +337,30 @@ void GPUProcessManager::OnProcessLaunchC
     DisableGPUProcess("Failed to create PVsyncBridge endpoints");
     return;
   }
 
   mVsyncBridge = VsyncBridgeChild::Create(mVsyncIOThread, mProcessToken,
                                           std::move(vsyncChild));
   mGPUChild->SendInitVsyncBridge(std::move(vsyncParent));
 
-  // Flush any pref updates that happened during launch and weren't
-  // included in the blobs set up in LaunchGPUProcess.
-  for (const mozilla::dom::Pref& pref : mQueuedPrefs) {
-    Unused << NS_WARN_IF(!mGPUChild->SendPreferenceUpdate(pref));
-  }
-  mQueuedPrefs.Clear();
-
   CrashReporter::AnnotateCrashReport(
       CrashReporter::Annotation::GPUProcessStatus,
       NS_LITERAL_CSTRING("Running"));
 
   CrashReporter::AnnotateCrashReport(
       CrashReporter::Annotation::GPUProcessLaunchCount,
       static_cast<int>(mNumProcessAttempts));
 }
 
 static bool ShouldLimitDeviceResets(uint32_t count, int32_t deltaMilliseconds) {
   // We decide to limit by comparing the amount of resets that have happened
   // and time since the last reset to two prefs.
-  int32_t timeLimit = StaticPrefs::DeviceResetThresholdMilliseconds();
-  int32_t countLimit = StaticPrefs::DeviceResetLimitCount();
+  int32_t timeLimit = gfxPrefs::DeviceResetThresholdMilliseconds();
+  int32_t countLimit = gfxPrefs::DeviceResetLimitCount();
 
   bool hasTimeLimit = timeLimit >= 0;
   bool hasCountLimit = countLimit >= 0;
 
   bool triggeredTime = deltaMilliseconds < timeLimit;
   bool triggeredCount = count > (uint32_t)countLimit;
 
   // If we have both prefs set then it needs to trigger both limits,
@@ -506,23 +476,23 @@ void GPUProcessManager::NotifyListenersO
 }
 
 void GPUProcessManager::OnProcessUnexpectedShutdown(GPUProcessHost* aHost) {
   MOZ_ASSERT(mProcess && mProcess == aHost);
 
   CompositorManagerChild::OnGPUProcessLost(aHost->GetProcessToken());
   DestroyProcess();
 
-  if (mNumProcessAttempts > uint32_t(StaticPrefs::GPUProcessMaxRestarts())) {
+  if (mNumProcessAttempts > uint32_t(gfxPrefs::GPUProcessMaxRestarts())) {
     char disableMessage[64];
     SprintfLiteral(disableMessage, "GPU process disabled after %d attempts",
                    mNumProcessAttempts);
     DisableGPUProcess(disableMessage);
   } else if (mNumProcessAttempts >
-                 uint32_t(StaticPrefs::GPUProcessMaxRestartsWithDecoder()) &&
+                 uint32_t(gfxPrefs::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/ipc/GPUProcessManager.h
+++ b/gfx/ipc/GPUProcessManager.h
@@ -174,17 +174,16 @@ class GPUProcessManager final : public G
   GPUChild* GetGPUChild() { return mGPUChild; }
 
   // Returns whether or not a GPU process was ever launched.
   bool AttemptedGPUProcess() const { return mNumProcessAttempts > 0; }
 
  private:
   // Called from our xpcom-shutdown observer.
   void OnXPCOMShutdown();
-  void OnPreferenceChange(const char16_t* aData);
 
   bool CreateContentCompositorManager(
       base::ProcessId aOtherProcess,
       mozilla::ipc::Endpoint<PCompositorManagerChild>* aOutEndpoint);
   bool CreateContentImageBridge(
       base::ProcessId aOtherProcess,
       mozilla::ipc::Endpoint<PImageBridgeChild>* aOutEndpoint);
   bool CreateContentVRManager(
@@ -273,18 +272,14 @@ class GPUProcessManager final : public G
   uint32_t mDeviceResetCount;
   TimeStamp mDeviceResetLastTime;
 
   // Fields that are associated with the current GPU process.
   GPUProcessHost* mProcess;
   uint64_t mProcessToken;
   GPUChild* mGPUChild;
   RefPtr<VsyncBridgeChild> mVsyncBridge;
-  // Collects any pref changes that occur during process launch (after
-  // the initial map is passed in command-line arguments) to be sent
-  // when the process can receive IPC messages.
-  nsTArray<mozilla::dom::Pref> mQueuedPrefs;
 };
 
 }  // namespace gfx
 }  // namespace mozilla
 
 #endif  // _include_mozilla_gfx_ipc_GPUProcessManager_h_
--- a/gfx/ipc/GraphicsMessages.ipdlh
+++ b/gfx/ipc/GraphicsMessages.ipdlh
@@ -12,16 +12,29 @@ using mozilla::gfx::BackendType from "mo
 using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
 using gfxImageFormat from "mozilla/gfx/Types.h";
 using mozilla::gfx::D3D11Checks::VideoFormatOption from "mozilla/gfx/D3D11Checks.h";
 using mozilla::gfx::D3D11Checks::VideoFormatOptionSet from "mozilla/gfx/D3D11Checks.h";
 
 namespace mozilla {
 namespace gfx {
 
+union GfxPrefValue {
+  bool;
+  int32_t;
+  uint32_t;
+  float;
+  nsCString;
+};
+
+struct GfxPrefSetting {
+  int32_t index;
+  GfxPrefValue value;
+};
+
 struct D3D11DeviceStatus
 {
   bool isWARP;
   bool textureSharingWorks;
   uint32_t featureLevel;
   DxgiAdapterDesc adapter;
   int32_t sequenceNumber;
   VideoFormatOptionSet formatOptions;
--- a/gfx/ipc/PGPU.ipdl
+++ b/gfx/ipc/PGPU.ipdl
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; 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 GraphicsMessages;
 include MemoryReportTypes;
 include HangTypes;
-include PrefsTypes;
 include protocol PAPZInputBridge;
 include protocol PCompositorManager;
 include protocol PImageBridge;
 include protocol PProfiler;
 include protocol PVRGPU;
 include protocol PVRManager;
 include protocol PVsyncBridge;
 include protocol PUiCompositorController;
@@ -45,33 +44,33 @@ sync protocol PGPU
   manages PAPZInputBridge;
 
 parent:
   // Sent from the UI process to initialize a new APZ input bridge when a new
   // top-level compositor is created.
   async PAPZInputBridge(LayersId aLayersId);
 
   // Sent by the UI process to initiate core settings.
-  async Init(GfxVarUpdate[] vars,
+  async Init(GfxPrefSetting[] prefs,
+             GfxVarUpdate[] vars,
              DevicePrefs devicePrefs,
              LayerTreeIdMapping[] mapping);
 
   async InitCompositorManager(Endpoint<PCompositorManagerParent> endpoint);
   async InitVsyncBridge(Endpoint<PVsyncBridgeParent> endpoint);
   async InitImageBridge(Endpoint<PImageBridgeParent> endpoint);
   async InitVRManager(Endpoint<PVRManagerParent> endpoint);
   async InitUiCompositorController(LayersId rootLayerTreeId, Endpoint<PUiCompositorControllerParent> endpoint);
   async InitProfiler(Endpoint<PProfilerChild> endpoint);
   // Forward GPU process its endpoints to the VR process.
   async InitVR(Endpoint<PVRGPUChild> endpoint);
-  // Called to update a gfx variable.
+  // Called to update a gfx preference or variable.
+  async UpdatePref(GfxPrefSetting pref);
   async UpdateVar(GfxVarUpdate var);
 
-  async PreferenceUpdate(Pref pref);
-
   // Create a new content-process compositor bridge.
   async NewContentCompositorManager(Endpoint<PCompositorManagerParent> endpoint);
   async NewContentImageBridge(Endpoint<PImageBridgeParent> endpoint);
   async NewContentVRManager(Endpoint<PVRManagerParent> endpoint);
   async NewContentVideoDecoderManager(Endpoint<PVideoDecoderManagerParent> endpoint);
 
   // Called to notify the GPU process of who owns a layersId.
   sync AddLayerTreeIdMapping(LayerTreeIdMapping mapping);
--- a/gfx/layers/CompositionRecorder.cpp
+++ b/gfx/layers/CompositionRecorder.cpp
@@ -2,17 +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 "CompositionRecorder.h"
 #include "gfxUtils.h"
 #include "mozilla/gfx/2D.h"
-#include "mozilla/gfx/gfxVars.h"
+#include "gfxPrefs.h"
 
 #include <ctime>
 #include <iomanip>
 #include "stdio.h"
 #ifdef XP_WIN
 #  include "direct.h"
 #else
 #  include <sys/types.h>
@@ -32,17 +32,17 @@ CompositionRecorder::~CompositionRecorde
 void CompositionRecorder::RecordFrame(RecordedFrame* aFrame) {
   mCollectedFrames.AppendElement(aFrame);
 }
 
 void CompositionRecorder::WriteCollectedFrames() {
   std::time_t t = std::time(nullptr);
   std::tm tm = *std::localtime(&t);
   std::stringstream str;
-  str << gfxVars::LayersWindowRecordingPath() << "windowrecording-"
+  str << gfxPrefs::LayersWindowRecordingPath() << "windowrecording-"
       << std::put_time(&tm, "%Y%m%d%H%M%S");
 
 #ifdef XP_WIN
   _mkdir(str.str().c_str());
 #else
   mkdir(str.str().c_str(), 0777);
 #endif
 
--- a/gfx/layers/D3D11ShareHandleImage.cpp
+++ b/gfx/layers/D3D11ShareHandleImage.cpp
@@ -5,18 +5,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "D3D11ShareHandleImage.h"
 #include <memory>
 #include "DXVA2Manager.h"
 #include "WMF.h"
 #include "d3d11.h"
 #include "gfxImageSurface.h"
+#include "gfxPrefs.h"
 #include "gfxWindowsPlatform.h"
-#include "mozilla/StaticPrefs.h"
 #include "mozilla/gfx/DeviceManagerDx.h"
 #include "mozilla/layers/CompositableClient.h"
 #include "mozilla/layers/CompositableForwarder.h"
 #include "mozilla/layers/TextureClient.h"
 #include "mozilla/layers/TextureD3D11.h"
 
 namespace mozilla {
 namespace layers {
@@ -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(StaticPrefs::PDMWMFUseNV12Format() &&
+      mCanUseNV12(gfxPrefs::PDMWMFUseNV12Format() &&
                   gfx::DeviceManagerDx::Get()->CanUseNV12()),
-      mCanUseP010(StaticPrefs::PDMWMFUseNV12Format() &&
+      mCanUseP010(gfxPrefs::PDMWMFUseNV12Format() &&
                   gfx::DeviceManagerDx::Get()->CanUseP010()),
-      mCanUseP016(StaticPrefs::PDMWMFUseNV12Format() &&
+      mCanUseP016(gfxPrefs::PDMWMFUseNV12Format() &&
                   gfx::DeviceManagerDx::Get()->CanUseP016()) {
   SetPreferredSurfaceFormat(aPreferredFormat);
 }
 
 void D3D11RecycleAllocator::SetPreferredSurfaceFormat(
     gfx::SurfaceFormat aPreferredFormat) {
   if ((aPreferredFormat == gfx::SurfaceFormat::NV12 && mCanUseNV12) ||
       (aPreferredFormat == gfx::SurfaceFormat::P010 && mCanUseP010) ||
@@ -251,17 +251,17 @@ already_AddRefed<TextureClient> D3D11Rec
   // we could not reuse old D3D11Textures. It could cause video flickering.
   RefPtr<ID3D11Device> device = gfx::DeviceManagerDx::Get()->GetImageDevice();
   if (!!mImageDevice && mImageDevice != device) {
     ShrinkToMinimumSize();
   }
   mImageDevice = device;
 
   TextureAllocationFlags allocFlags = TextureAllocationFlags::ALLOC_DEFAULT;
-  if (StaticPrefs::PDMWMFUseSyncTexture() ||
+  if (gfxPrefs::PDMWMFUseSyncTexture() ||
       mDevice == DeviceManagerDx::Get()->GetCompositorDevice()) {
     // If our device is the compositor device, we don't need any synchronization
     // in practice.
     allocFlags = TextureAllocationFlags::ALLOC_MANUAL_SYNCHRONIZATION;
   }
 
   D3D11TextureClientAllocationHelper helper(mUsableSurfaceFormat, aColorSpace,
                                             aSize, allocFlags, mDevice,
--- a/gfx/layers/FrameMetrics.cpp
+++ b/gfx/layers/FrameMetrics.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 "FrameMetrics.h"
-
+#include "gfxPrefs.h"
 #include "nsStyleConsts.h"
 #include "nsStyleStruct.h"
 #include "mozilla/WritingModes.h"
 
 namespace mozilla {
 namespace layers {
 
 const ScrollableLayerGuid::ViewID ScrollableLayerGuid::NULL_SCROLL_ID = 0;
--- a/gfx/layers/FrameMetrics.h
+++ b/gfx/layers/FrameMetrics.h
@@ -982,17 +982,17 @@ struct ScrollMetadata {
   }
   bool GetHasScrollgrab() const { return mHasScrollgrab; }
   void SetIsLayersIdRoot(bool aValue) { mIsLayersIdRoot = aValue; }
   bool IsLayersIdRoot() const { return mIsLayersIdRoot; }
   void SetIsAutoDirRootContentRTL(bool aValue) {
     mIsAutoDirRootContentRTL = aValue;
   }
   bool IsAutoDirRootContentRTL() const { return mIsAutoDirRootContentRTL; }
-  // Implemented out of line because the implementation needs StaticPrefs.h
+  // Implemented out of line because the implementation needs gfxPrefs.h
   // and we don't want to include that from FrameMetrics.h.
   void SetUsesContainerScrolling(bool aValue);
   bool UsesContainerScrolling() const { return mUsesContainerScrolling; }
   void SetForceDisableApz(bool aForceDisable) {
     mForceDisableApz = aForceDisable;
   }
   bool IsApzForceDisabled() const { return mForceDisableApz; }
   void SetResolutionUpdated(bool aUpdated) { mResolutionUpdated = aUpdated; }
--- a/gfx/layers/LayerScope.cpp
+++ b/gfx/layers/LayerScope.cpp
@@ -16,17 +16,17 @@
 
 #include "mozilla/layers/CompositorOGL.h"
 #include "mozilla/layers/CompositorThread.h"
 #include "mozilla/layers/LayerManagerComposite.h"
 #include "mozilla/layers/TextureHostOGL.h"
 
 #include "gfxContext.h"
 #include "gfxUtils.h"
-
+#include "gfxPrefs.h"
 #include "nsIWidget.h"
 
 #include "GLContext.h"
 #include "GLContextProvider.h"
 #include "GLReadTexImageHelper.h"
 
 #include "nsIServiceManager.h"
 #include "nsIConsoleService.h"
@@ -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 = StaticPrefs::LayerScopePort();
+  int port = gfxPrefs::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 (!StaticPrefs::LayerScopeEnabled() || XRE_IsGPUProcess()) {
+  if (!gfxPrefs::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 (!StaticPrefs::LayerScopeEnabled()) {
+  if (!gfxPrefs::LayerScopeEnabled()) {
     return false;
   }
   if (!gLayerScopeManager.GetSocketManager()) {
     Init();
     return false;
   }
   if (!gLayerScopeManager.GetSocketManager()->IsConnected()) {
     return false;
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -12,21 +12,21 @@
 #include "ImageLayers.h"       // for ImageLayer
 #include "LayerSorter.h"       // for SortLayersBy3DZOrder
 #include "LayersLogging.h"     // for AppendToString
 #include "LayerUserData.h"
 #include "ReadbackLayer.h"   // for ReadbackLayer
 #include "UnitTransforms.h"  // for ViewAs
 #include "gfxEnv.h"
 #include "gfxPlatform.h"  // for gfxPlatform
+#include "gfxPrefs.h"
 #include "gfxUtils.h"  // for gfxUtils, etc
 #include "gfx2DGlue.h"
 #include "mozilla/DebugOnly.h"  // for DebugOnly
 #include "mozilla/IntegerPrintfMacros.h"
-#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"  // for Accumulate
 #include "mozilla/ToString.h"
 #include "mozilla/gfx/2D.h"        // for DrawTarget
 #include "mozilla/gfx/BaseSize.h"  // for BaseSize
 #include "mozilla/gfx/Matrix.h"    // for Matrix4x4
 #include "mozilla/gfx/Polygon.h"   // for Polygon
 #include "mozilla/layers/AsyncCanvasRenderer.h"
 #include "mozilla/layers/BSPTree.h"             // for BSPTree
@@ -134,17 +134,17 @@ LayerManager::CreatePersistentBufferProv
 
 already_AddRefed<ImageContainer> LayerManager::CreateImageContainer(
     ImageContainer::Mode flag) {
   RefPtr<ImageContainer> container = new ImageContainer(flag);
   return container.forget();
 }
 
 bool LayerManager::AreComponentAlphaLayersEnabled() {
-  return StaticPrefs::ComponentAlphaEnabled();
+  return gfxPrefs::ComponentAlphaEnabled();
 }
 
 /*static*/
 void LayerManager::LayerUserDataDestroy(void* data) {
   delete static_cast<LayerUserData*>(data);
 }
 
 UniquePtr<LayerUserData> LayerManager::RemoveUserData(void* aKey) {
--- a/gfx/layers/PaintThread.cpp
+++ b/gfx/layers/PaintThread.cpp
@@ -5,23 +5,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "PaintThread.h"
 
 #include <algorithm>
 
 #include "base/task.h"
 #include "gfxPlatform.h"
+#include "gfxPrefs.h"
 #include "GeckoProfiler.h"
 #include "mozilla/layers/CompositorBridgeChild.h"
 #include "mozilla/layers/ShadowLayers.h"
 #include "mozilla/layers/SyncObject.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/Preferences.h"
-#include "mozilla/StaticPrefs.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/SyncRunnable.h"
 #include "nsIPropertyBag2.h"
 #include "nsServiceManagerUtils.h"
 #include "prsystem.h"
 
 // Uncomment the following line to dispatch sync runnables when
 // painting so that rasterization happens synchronously from
@@ -43,17 +43,17 @@ PaintThread::PaintThread() {}
 
 void PaintThread::Release() {}
 
 void PaintThread::AddRef() {}
 
 /* static */
 int32_t PaintThread::CalculatePaintWorkerCount() {
   int32_t cpuCores = PR_GetNumberOfProcessors();
-  int32_t workerCount = StaticPrefs::LayersOMTPPaintWorkers();
+  int32_t workerCount = gfxPrefs::LayersOMTPPaintWorkers();
 
   // If not manually specified, default to (cpuCores * 3) / 4, and clamp
   // between 1 and 4. If a user wants more, they can manually specify it
   if (workerCount < 1) {
     workerCount = std::min(std::max((cpuCores * 3) / 4, 1), 4);
   }
 
   return workerCount;
@@ -157,17 +157,17 @@ void PaintThread::UpdateRenderMode() {
     }
   }
 }
 
 void PaintThread::QueuePaintTask(UniquePtr<PaintTask>&& aTask) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aTask);
 
-  if (StaticPrefs::LayersOMTPDumpCapture() && aTask->mCapture) {
+  if (gfxPrefs::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 (StaticPrefs::LayersOMTPReleaseCaptureOnMainThread()) {
+  if (gfxPrefs::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/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -7,29 +7,29 @@
 #include "RotatedBuffer.h"
 #include <sys/types.h>              // for int32_t
 #include <algorithm>                // for max
 #include "BasicImplData.h"          // for BasicImplData
 #include "BasicLayersImpl.h"        // for ToData
 #include "GeckoProfiler.h"          // for AUTO_PROFILER_LABEL
 #include "Layers.h"                 // for PaintedLayer, Layer, etc
 #include "gfxPlatform.h"            // for gfxPlatform
+#include "gfxPrefs.h"               // for gfxPrefs
 #include "gfxUtils.h"               // for gfxUtils
 #include "mozilla/ArrayUtils.h"     // for ArrayLength
 #include "mozilla/gfx/BasePoint.h"  // for BasePoint
 #include "mozilla/gfx/BaseRect.h"   // for BaseRect
 #include "mozilla/gfx/BaseSize.h"   // for BaseSize
 #include "mozilla/gfx/Matrix.h"     // for Matrix
 #include "mozilla/gfx/Point.h"      // for Point, IntPoint
 #include "mozilla/gfx/Rect.h"       // for Rect, IntRect
 #include "mozilla/gfx/Types.h"      // for ExtendMode::ExtendMode::CLAMP, etc
 #include "mozilla/layers/ShadowLayers.h"   // for ShadowableLayer
 #include "mozilla/layers/TextureClient.h"  // for TextureClient
 #include "mozilla/Move.h"                  // for Move
-#include "mozilla/StaticPrefs.h"           // for StaticPrefs
 #include "mozilla/gfx/Point.h"             // for IntSize
 #include "gfx2DGlue.h"
 #include "nsLayoutUtils.h"  // for invalidation debugging
 #include "PaintThread.h"
 
 namespace mozilla {
 
 using namespace gfx;
@@ -71,17 +71,17 @@ Rect RotatedBuffer::GetSourceRectangle(X
 }
 
 void RotatedBuffer::BeginCapture() {
   RefPtr<gfx::DrawTarget> target = GetBufferTarget();
 
   MOZ_ASSERT(!mCapture);
   MOZ_ASSERT(target);
   mCapture = Factory::CreateCaptureDrawTargetForTarget(
-      target, StaticPrefs::LayersOMTPCaptureLimit());
+      target, gfxPrefs::LayersOMTPCaptureLimit());
 }
 
 RefPtr<gfx::DrawTargetCapture> RotatedBuffer::EndCapture() {
   MOZ_ASSERT(mCapture);
   return std::move(mCapture);
 }
 
 /**
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -5,16 +5,17 @@
  * 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
@@ -31,19 +32,18 @@
 #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/TouchEvents.h"
 #include "mozilla/Preferences.h"        // for Preferences
-#include "mozilla/StaticPrefs.h"        // for StaticPrefs
-#include "mozilla/TouchEvents.h"
 #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(StaticPrefs::APZPrintTree);
+  mApzcTreeLog.ConditionOnPrefFunction(gfxPrefs::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 (StaticPrefs::APZTestLoggingEnabled()) {
+  if (gfxPrefs::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);
   }
 
@@ -599,17 +599,17 @@ APZCTreeManager::UpdateHitTestingTreeImp
   CollectTransformsForChromeMainThread(aRootLayerTreeId);
 }
 
 void APZCTreeManager::UpdateFocusState(LayersId aRootLayerTreeId,
                                        LayersId aOriginatingLayersId,
                                        const FocusTarget& aFocusTarget) {
   AssertOnUpdaterThread();
 
-  if (!StaticPrefs::APZKeyboardEnabled()) {
+  if (!gfxPrefs::APZKeyboardEnabled()) {
     return;
   }
 
   mFocusState.Update(aRootLayerTreeId, aOriginatingLayersId, aFocusTarget);
 }
 
 void APZCTreeManager::UpdateHitTestingTree(LayersId aRootLayerTreeId,
                                            Layer* aRoot, bool aIsFirstPaint,
@@ -1301,29 +1301,29 @@ nsEventStatus APZCTreeManager::ReceiveIn
       {  // scope lock
         RecursiveMutexAutoLock lock(mTreeLock);
         if (!apzc && mRootNode) {
           apzc = mRootNode->GetApzc();
         }
       }
 
       if (apzc) {
-        if (StaticPrefs::APZTestLoggingEnabled() &&
+        if (gfxPrefs::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 = StaticPrefs::APZDragEnabled();
+        bool apzDragEnabled = gfxPrefs::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);
@@ -1538,18 +1538,18 @@ nsEventStatus APZCTreeManager::ReceiveIn
         apzc->GetGuid(aOutTargetGuid);
         tapInput.mPoint = *untransformedPoint;
       }
       break;
     }
     case KEYBOARD_INPUT: {
       // Disable async keyboard scrolling when accessibility.browsewithcaret is
       // enabled
-      if (!StaticPrefs::APZKeyboardEnabled() ||
-          StaticPrefs::AccessibilityBrowseWithCaret()) {
+      if (!gfxPrefs::APZKeyboardEnabled() ||
+          gfxPrefs::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);
@@ -1735,17 +1735,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 =
-        StaticPrefs::APZDragEnabled() && StaticPrefs::APZTouchDragEnabled() &&
+        gfxPrefs::APZDragEnabled() && gfxPrefs::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) {
@@ -1918,17 +1918,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 (StaticPrefs::APZDragInitiationEnabled() &&
+  if (gfxPrefs::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());
@@ -2382,17 +2382,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 && !StaticPrefs::APZAllowImmediateHandoff() &&
+  if (aHandoffState.mIsHandoff && !gfxPrefs::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();
@@ -3289,18 +3289,17 @@ 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() &&
-      StaticPrefs::LayoutUseContainersForRootFrames();
+      aMetrics.IsRootContent() && gfxPrefs::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
@@ -1,33 +1,34 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/layers/APZInputBridge.h"
 
+#include "gfxPrefs.h"                       // for gfxPrefs
 #include "InputData.h"                      // for MouseInput, etc
 #include "mozilla/dom/WheelEventBinding.h"  // for WheelEvent constants
 #include "mozilla/EventStateManager.h"      // for EventStateManager
 #include "mozilla/layers/APZThreadUtils.h"  // for AssertOnControllerThread, etc
 #include "mozilla/MouseEvents.h"            // for WidgetMouseEvent
 #include "mozilla/TextEvents.h"             // for WidgetKeyboardEvent
 #include "mozilla/TouchEvents.h"            // for WidgetTouchEvent
 #include "mozilla/WheelHandlingHelper.h"    // for WheelDeltaHorizontalizer,
                                             //     WheelDeltaAdjustmentStrategy
 
 namespace mozilla {
 namespace layers {
 
 static bool WillHandleMouseEvent(const WidgetMouseEventBase& aEvent) {
   return aEvent.mMessage == eMouseMove || aEvent.mMessage == eMouseDown ||
          aEvent.mMessage == eMouseUp || aEvent.mMessage == eDragEnd ||
-         (StaticPrefs::TestEventsAsyncEnabled() &&
+         (gfxPrefs::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 ||
@@ -60,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 (StaticPrefs::APZAllowZooming()) {
+      if (gfxPrefs::APZAllowZooming()) {
         mouseEvent.mIgnoreRootScrollFrame = true;
       }
 
       if (WillHandleMouseEvent(mouseEvent)) {
         MouseInput input(mouseEvent);
         input.mOrigin =
             ScreenPoint(mouseEvent.mRefPoint.x, mouseEvent.mRefPoint.y);
 
@@ -110,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 (StaticPrefs::SmoothScrollEnabled() &&
+        if (gfxPrefs::SmoothScrollEnabled() &&
             ((wheelEvent.mDeltaMode ==
                   dom::WheelEvent_Binding::DOM_DELTA_LINE &&
-              StaticPrefs::WheelSmoothScrollEnabled()) ||
+              gfxPrefs::WheelSmoothScrollEnabled()) ||
              (wheelEvent.mDeltaMode ==
                   dom::WheelEvent_Binding::DOM_DELTA_PAGE &&
-              StaticPrefs::PageSmoothScrollEnabled()))) {
+              gfxPrefs::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
@@ -6,20 +6,20 @@
 
 #include "AndroidAPZ.h"
 
 #include "AndroidFlingPhysics.h"
 #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 +50,38 @@ AndroidSpecificState::AndroidSpecificSta
     return;
   }
   mOverScroller = scroller;
 }
 
 AsyncPanZoomAnimation* AndroidSpecificState::CreateFlingAnimation(
     AsyncPanZoomController& aApzc, const FlingHandoffState& aHandoffState,
     float aPLPPI) {
-  if (StaticPrefs::APZUseChromeFlingPhysics()) {
+  if (gfxPrefs::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 (StaticPrefs::APZUseChromeFlingPhysics()) {
+  if (gfxPrefs::APZUseChromeFlingPhysics()) {
     return MakeUnique<AndroidVelocityTracker>();
   }
   return MakeUnique<SimpleVelocityTracker>(aAxis);
 }
 
 /* static */
 void AndroidSpecificState::InitializeGlobalState() {
-  // Not conditioned on StaticPrefs::APZUseChromeFlingPhysics() because
+  // Not conditioned on gfxPrefs::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 +162,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() < StaticPrefs::APZFlingAccelInterval() &&
-        velocity.Length() >= StaticPrefs::APZFlingAccelMinVelocity()) {
+    if (flingDuration.ToMilliseconds() < gfxPrefs::APZFlingAccelInterval() &&
+        velocity.Length() >= gfxPrefs::APZFlingAccelMinVelocity()) {
       bool unused = false;
       mOverScroller->ComputeScrollOffset(flingDuration.ToMilliseconds(),
                                          &unused);
     } else {
       mOverScroller->ForceFinished(true);
     }
   }
   mOverScroller->Fling(
@@ -237,19 +237,18 @@ bool StackScrollerFlingAnimation::DoSamp
     shouldContinueFling = false;
   } else if (hitBoundX && hitBoundY) {
     // We can't scroll any farther along either axis.
     shouldContinueFling = false;
   }
 
   float speed = velocity.Length();
 
-  // StaticPrefs::APZFlingStoppedThreshold is only used in tests.
-  if (!shouldContinueFling ||
-      (speed < StaticPrefs::APZFlingStoppedThreshold())) {
+  // gfxPrefs::APZFlingStoppedThreshold is only used in tests.
+  if (!shouldContinueFling || (speed < gfxPrefs::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: StaticPrefs::ToolbarScrollThreshold() returns a percentage as
-        // an int32_t. So multiply it by 0.01f to convert.
+        // NOTE: gfxPrefs::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 * StaticPrefs::ToolbarScrollThreshold() *
+            Abs(std::lround(0.01f * gfxPrefs::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,17 +4,16 @@
  * 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
@@ -28,38 +27,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 StaticPrefs::APZChromeFlingPhysicsFriction();
+  return gfxPrefs::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 = StaticPrefs::APZChromeFlingPhysicsInflexion();
+  const float inflexion = gfxPrefs::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 StaticPrefs::APZChromeFlingPhysicsStopThreshold();
+  return gfxPrefs::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/AndroidFlingPhysics.h
+++ b/gfx/layers/apz/src/AndroidFlingPhysics.h
@@ -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/. */
 
 #ifndef mozilla_layers_AndroidFlingPhysics_h_
 #define mozilla_layers_AndroidFlingPhysics_h_
 
 #include "AsyncPanZoomController.h"
 #include "Units.h"
+#include "gfxPrefs.h"
 #include "mozilla/Assertions.h"
 
 namespace mozilla {
 namespace layers {
 
 class AndroidFlingPhysics {
  public:
   void Init(const ParentLayerPoint& aVelocity, float aPLPPI);
--- 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 "mozilla/StaticPrefs.h"
+#include "gfxPrefs.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 = StaticPrefs::APZVelocityRelevanceTime();
+  const uint32_t horizon = gfxPrefs::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,30 +28,29 @@
 #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 "mozilla/StaticPrefs.h"        // for StaticPrefs
+#include "gfxPrefs.h"                   // for gfxPrefs
 #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
 #include "mozilla/MouseEvents.h"             // for WidgetWheelEvent
 #include "mozilla/Preferences.h"             // for Preferences
 #include "mozilla/RecursiveMutex.h"          // for RecursiveMutexAutoLock, etc
 #include "mozilla/RefPtr.h"                  // for RefPtr
-#include "mozilla/StaticPrefs.h"             // for StaticPrefs
 #include "mozilla/StaticPtr.h"               // for StaticAutoPtr
 #include "mozilla/Telemetry.h"               // for Telemetry
 #include "mozilla/TimeStamp.h"               // for TimeDuration, TimeStamp
 #include "mozilla/dom/CheckerboardReportService.h"  // for CheckerboardEventStorage
 // note: CheckerboardReportService.h actually lives in gfx/layers/apz/util/
 #include "mozilla/dom/Touch.h"              // for Touch
 #include "mozilla/gfx/BasePoint.h"          // for BasePoint
 #include "mozilla/gfx/BaseRect.h"           // for BaseRect
@@ -127,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 StaticPrefs.h.
+ * The default values are provided in gfxPrefs.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.
@@ -610,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(
-            StaticPrefs::APZZoomAnimationDuration())),
+            gfxPrefs::APZZoomAnimationDuration())),
         mStartOffset(aStartOffset),
         mStartZoom(aStartZoom),
         mEndOffset(aEndOffset),
         mEndZoom(aEndZoom) {}
 
   virtual bool DoSample(FrameMetrics& aFrameMetrics,
                         const TimeDuration& aDelta) override {
     mDuration += aDelta;
@@ -811,18 +810,18 @@ void AsyncPanZoomController::InitializeG
   sInitialized = true;
 
   MOZ_ASSERT(NS_IsMainThread());
 
   gZoomAnimationFunction =
       new ComputedTimingFunction(nsTimingFunction(StyleTimingKeyword::Ease));
   ClearOnShutdown(&gZoomAnimationFunction);
   gVelocityCurveFunction = new ComputedTimingFunction(nsTimingFunction(
-      StaticPrefs::APZCurveFunctionX1(), StaticPrefs::APZCurveFunctionY1(),
-      StaticPrefs::APZCurveFunctionX2(), StaticPrefs::APZCurveFunctionY2()));
+      gfxPrefs::APZCurveFunctionX1(), gfxPrefs::APZCurveFunctionY1(),
+      gfxPrefs::APZCurveFunctionX2(), gfxPrefs::APZCurveFunctionY2()));
   ClearOnShutdown(&gVelocityCurveFunction);
 
   uint64_t sysmem = PR_GetPhysicalMemorySize();
   uint64_t threshold = 1LL << 32;  // 4 GB in bytes
   gIsHighMemSystem = sysmem >= threshold;
 
   PlatformSpecificState::InitializeGlobalState();
 }
@@ -839,18 +838,18 @@ AsyncPanZoomController::AsyncPanZoomCont
       // mTreeManager must be initialized before GetFrameTime() is called
       mTreeManager(aTreeManager),
       mRecursiveMutex("AsyncPanZoomController"),
       mLastContentPaintMetrics(mLastContentPaintMetadata.GetMetrics()),
       mX(this),
       mY(this),
       mPanDirRestricted(false),
       mPinchLocked(false),
-      mPinchEventBuffer(TimeDuration::FromMilliseconds(
-          StaticPrefs::APZPinchLockBufferMaxAge())),
+      mPinchEventBuffer(
+          TimeDuration::FromMilliseconds(gfxPrefs::APZPinchLockBufferMaxAge())),
       mZoomConstraints(false, false,
                        mScrollMetadata.GetMetrics().GetDevPixelsPerCSSPixel() *
                            kViewportMinScale / ParentLayerToScreenScale(1),
                        mScrollMetadata.GetMetrics().GetDevPixelsPerCSSPixel() *
                            kViewportMaxScale / ParentLayerToScreenScale(1)),
       mLastSampleTime(GetFrameTime()),
       mLastCheckerboardReport(GetFrameTime()),
       mOverscrollEffect(MakeUnique<OverscrollEffect>(*this)),
@@ -933,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 (StaticPrefs::APZTouchStartTolerance() * GetDPI());
+  return (gfxPrefs::APZTouchStartTolerance() * GetDPI());
 }
 
 ScreenCoord AsyncPanZoomController::GetTouchMoveTolerance() const {
-  return (StaticPrefs::APZTouchMoveTolerance() * GetDPI());
+  return (gfxPrefs::APZTouchMoveTolerance() * GetDPI());
 }
 
 ScreenCoord AsyncPanZoomController::GetSecondTapTolerance() const {
-  return (StaticPrefs::APZSecondTapTolerance() * GetDPI());
+  return (gfxPrefs::APZSecondTapTolerance() * GetDPI());
 }
 
 /* static */ AsyncPanZoomController::AxisLockMode
 AsyncPanZoomController::GetAxisLockMode() {
-  return static_cast<AxisLockMode>(StaticPrefs::APZAxisLockMode());
+  return static_cast<AxisLockMode>(gfxPrefs::APZAxisLockMode());
 }
 
 /* static */ AsyncPanZoomController::PinchLockMode
 AsyncPanZoomController::GetPinchLockMode() {
-  return static_cast<PinchLockMode>(StaticPrefs::APZPinchLockMode());
+  return static_cast<PinchLockMode>(gfxPrefs::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;
@@ -1007,17 +1006,17 @@ bool AsyncPanZoomController::ArePointerE
   zoomable &= (aBlock->TouchActionAllowsPinchZoom());
 
   return pannable || zoomable;
 }
 
 nsEventStatus AsyncPanZoomController::HandleDragEvent(
     const MouseInput& aEvent, const AsyncDragMetrics& aDragMetrics,
     CSSCoord aInitialThumbPos) {
-  if (!StaticPrefs::APZDragEnabled()) {
+  if (!gfxPrefs::APZDragEnabled()) {
     return nsEventStatus_eIgnore;
   }
 
   if (!GetApzcTreeManager()) {
     return nsEventStatus_eConsumeNoDefault;
   }
 
   if (aEvent.mType == MouseInput::MouseType::MOUSE_UP) {
@@ -1047,17 +1046,17 @@ nsEventStatus AsyncPanZoomController::Ha
 
   const ScrollbarData& scrollbarData = node->GetScrollbarData();
   MOZ_ASSERT(scrollbarData.mScrollbarLayerType ==
              layers::ScrollbarLayerType::Thumb);
   MOZ_ASSERT(scrollbarData.mDirection.isSome());
   ScrollDirection direction = *scrollbarData.mDirection;
 
   bool isMouseAwayFromThumb = false;
-  if (int snapMultiplier = StaticPrefs::SliderSnapMultiplier()) {
+  if (int snapMultiplier = gfxPrefs::SliderSnapMultiplier()) {
     // It's fine to ignore the async component of the thumb's transform,
     // because any async transform of the thumb will be in the direction of
     // scrolling, but here we're interested in the other direction.
     ParentLayerRect thumbRect =
         (node->GetTransform() * AsyncTransformMatrix())
             .TransformBounds(LayerRect(node->GetVisibleRegion().GetBounds()));
     ScrollDirection otherDirection = GetPerpendicularDirection(direction);
     ParentLayerCoord distance =
@@ -1400,17 +1399,17 @@ nsEventStatus AsyncPanZoomController::On
       if (panThreshold > 0.0f) {
         UpdateWithTouchAtDevicePoint(aEvent);
         if (PanVector(extPoint).Length() < panThreshold) {
           return nsEventStatus_eIgnore;
         }
       }
 
       MOZ_ASSERT(GetCurrentTouchBlock());
-      if (StaticPrefs::TouchActionEnabled() &&
+      if (gfxPrefs::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);
@@ -1561,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 (!StaticPrefs::APZAllowZooming()) {
+  if (!gfxPrefs::APZAllowZooming()) {
     if (RefPtr<GeckoContentController> controller =
             GetGeckoContentController()) {
       controller->NotifyPinchGesture(aEvent.mType, GetGuid(), 0,
                                      aEvent.modifiers);
     }
   }
 
   SetState(PINCHING);
@@ -1608,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 (!StaticPrefs::APZAllowZooming()) {
+  if (!gfxPrefs::APZAllowZooming()) {
     if (RefPtr<GeckoContentController> controller =
             GetGeckoContentController()) {
       controller->NotifyPinchGesture(
           aEvent.mType, GetGuid(),
           ViewAs<LayoutDevicePixel>(
               aEvent.mCurrentSpan - aEvent.mPreviousSpan,
               PixelCastJustification::LayoutDeviceIsParentLayerForRCDRSF),
           aEvent.modifiers);
@@ -1698,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 = StaticPrefs::APZScaleRepaintDelay();
+        const int delay = gfxPrefs::APZScaleRepaintDelay();
         if (delay >= 0) {
           if (RefPtr<GeckoContentController> controller =
                   GetGeckoContentController()) {
             mPinchPaintTimerSet = true;
             controller->PostDelayedTask(
                 NewRunnableMethod(
                     "layers::AsyncPanZoomController::"
                     "DoDelayedRequestContentRepaint",
@@ -1742,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 (!StaticPrefs::APZAllowZooming()) {
+  if (!gfxPrefs::APZAllowZooming()) {
     if (RefPtr<GeckoContentController> controller =
             GetGeckoContentController()) {
       controller->NotifyPinchGesture(aEvent.mType, GetGuid(), 0,
                                      aEvent.modifiers);
     }
   }
 
   {
@@ -1835,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,
-           StaticPrefs::APZFlingMinVelocityThreshold());
-
-  if (flingVelocity.Length() < StaticPrefs::APZFlingMinVelocityThreshold()) {
+           gfxPrefs::APZFlingMinVelocityThreshold());
+
+  if (flingVelocity.Length() < gfxPrefs::APZFlingMinVelocityThreshold()) {
     // Relieve overscroll now if needed, since we will not transition to a fling
     // animation and then an overscroll animation, and relieve it then.
     GetCurrentInputBlock()
         ->GetOverscrollHandoffChain()
         ->SnapBackOverscrolledApzc(this);
     return nsEventStatus_eConsumeNoDefault;
   }
 
@@ -1956,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 (StaticPrefs::MouseWheelHasRootScrollDeltaOverride() &&
+  if (gfxPrefs::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 = StaticPrefs::MouseWheelAccelerationStart();
+    int32_t start = gfxPrefs::MouseWheelAccelerationStart();
     if (start >= 0 && aEvent.mScrollSeriesNumber >= uint32_t(start)) {
-      int32_t factor = StaticPrefs::MouseWheelAccelerationFactor();
+      int32_t factor = gfxPrefs::MouseWheelAccelerationFactor();
       if (factor > 0) {
         delta.x = ComputeAcceleratedWheelDelta(
             delta.x, aEvent.mScrollSeriesNumber, factor);
         delta.y = ComputeAcceleratedWheelDelta(
             delta.y, aEvent.mScrollSeriesNumber, factor);
       }
     }
   }
@@ -2004,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 (!StaticPrefs::SmoothScrollEnabled()) {
+  if (!gfxPrefs::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;
@@ -2104,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 = StaticPrefs::ToolkitHorizontalScrollDistance();
+      int32_t scrollDistance = gfxPrefs::ToolkitHorizontalScrollDistance();
 
       if (aAction.mForward) {
         scrollDestination.x += scrollDistance * lineScrollSize.width;
       } else {
         scrollDestination.x -= scrollDistance * lineScrollSize.width;
       }
       break;
     }
     case KeyboardScrollAction::eScrollLine: {
-      int32_t scrollDistance = StaticPrefs::ToolkitVerticalScrollDistance();
+      int32_t scrollDistance = gfxPrefs::ToolkitVerticalScrollDistance();
 
       if (aAction.mForward) {
         scrollDestination.y += scrollDistance * lineScrollSize.height;
       } else {
         scrollDestination.y -= scrollDistance * lineScrollSize.height;
       }
       break;
     }
@@ -2249,17 +2248,17 @@ bool AsyncPanZoomController::IsContentOf
     return mScrollMetadata.IsAutoDirRootContentRTL();
   }
   RecursiveMutexAutoLock lock(mRecursiveMutex);
   return Metrics().IsHorizontalContentRightToLeft();
 }
 
 bool AsyncPanZoomController::AllowScrollHandoffInCurrentBlock() const {
   bool result = mInputQueue->AllowScrollHandoff();
-  if (!StaticPrefs::APZAllowImmediateHandoff()) {
+  if (!gfxPrefs::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);
       }
     }
   }
@@ -2334,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() &&
-        StaticPrefs::MouseScrollTestingEnabled()) {
+        gfxPrefs::MouseScrollTestingEnabled()) {
       if (RefPtr<GeckoContentController> controller =
               GetGeckoContentController()) {
         controller->NotifyMozMouseScrollEvent(
             GetScrollId(), NS_LITERAL_STRING("MozMouseScrollFailed"));
       }
     }
     return nsEventStatus_eConsumeNoDefault;
   }
@@ -2925,47 +2924,45 @@ 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, StaticPrefs::APZAxisLockAngle())) {
+      if (apz::IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
         mY.SetAxisLocked(true);
         SetState(PANNING_LOCKED_X);
-      } else if (apz::IsCloseToVertical(aAngle,
-                                        StaticPrefs::APZAxisLockAngle())) {
+      } else if (apz::IsCloseToVertical(aAngle, gfxPrefs::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,
-                                 StaticPrefs::APZAllowedDirectPanAngle())) {
+                                 gfxPrefs::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,
-                               StaticPrefs::APZAllowedDirectPanAngle())) {
+    if (apz::IsCloseToVertical(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
       mX.SetAxisLocked(true);
       SetState(PANNING_LOCKED_Y);
       mPanDirRestricted = true;
     } else {
       SetState(NOTHING);
     }
   } else {
     SetState(NOTHING);
@@ -2988,23 +2985,22 @@ 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,
-                                      StaticPrefs::APZAxisLockAngle())) {
+  } else if (apz::IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
     mY.SetAxisLocked(true);
     if (canScrollHorizontal) {
       SetState(PANNING_LOCKED_X);
     }
-  } else if (apz::IsCloseToVertical(aAngle, StaticPrefs::APZAxisLockAngle())) {
+  } else if (apz::IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
     mX.SetAxisLocked(true);
     if (canScrollVertical) {
       SetState(PANNING_LOCKED_Y);
     }
   } else {
     SetState(PANNING);
   }
 }
@@ -3014,29 +3010,28 @@ 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 = StaticPrefs::APZAxisBreakoutThreshold() * GetDPI();
+    float breakThreshold = gfxPrefs::APZAxisBreakoutThreshold() * GetDPI();
 
     if (fabs(aPanDistance.x) > breakThreshold ||
         fabs(aPanDistance.y) > breakThreshold) {
       if (mState == PANNING_LOCKED_X) {
         if (!apz::IsCloseToHorizontal(angle,
-                                      StaticPrefs::APZAxisBreakoutAngle())) {
+                                      gfxPrefs::APZAxisBreakoutAngle())) {
           mY.SetAxisLocked(false);
           SetState(PANNING);
         }
       } else if (mState == PANNING_LOCKED_Y) {
-        if (!apz::IsCloseToVertical(angle,
-                                    StaticPrefs::APZAxisBreakoutAngle())) {
+        if (!apz::IsCloseToVertical(angle, gfxPrefs::APZAxisBreakoutAngle())) {
           mX.SetAxisLocked(false);
           SetState(PANNING);
         }
       }
     }
   }
 }
 
@@ -3070,25 +3065,25 @@ void AsyncPanZoomController::HandlePinch
       ToScreenCoordinates(ParentLayerPoint(0, bufferedSpanDistance), focusPoint)
           .Length();
   ScreenPoint focusChange =
       ToScreenCoordinates(bufferedFocusChange, focusPoint);
 
   if (mPinchLocked) {
     if (GetPinchLockMode() == PINCH_STICKY) {
       ScreenCoord spanBreakoutThreshold =
-          StaticPrefs::APZPinchLockSpanBreakoutThreshold() * GetDPI();
+          gfxPrefs::APZPinchLockSpanBreakoutThreshold() * GetDPI();
       mPinchLocked = !(spanDistance > spanBreakoutThreshold);
     }
   } else {
     if (GetPinchLockMode() != PINCH_FREE) {
       ScreenCoord spanLockThreshold =
-          StaticPrefs::APZPinchLockSpanLockThreshold() * GetDPI();
+          gfxPrefs::APZPinchLockSpanLockThreshold() * GetDPI();
       ScreenCoord scrollLockThreshold =
-          StaticPrefs::APZPinchLockScrollLockThreshold() * GetDPI();
+          gfxPrefs::APZPinchLockScrollLockThreshold() * GetDPI();
 
       if (spanDistance < spanLockThreshold &&
           focusChange.Length() > scrollLockThreshold) {
         mPinchLocked = true;
       }
     }
   }
 }
@@ -3096,17 +3091,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 (StaticPrefs::TouchActionEnabled()) {
+  if (gfxPrefs::TouchActionEnabled()) {
     HandlePanningWithTouchAction(angle);
   } else {
     if (GetAxisLockMode() == FREE) {
       SetState(PANNING);
     } else {
       HandlePanning(angle);
     }
   }
@@ -3251,31 +3246,29 @@ 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 <
-        StaticPrefs::APZMinPanDistanceRatio() * aPanDistance.y) {
+    if (aPanDistance.x < gfxPrefs::APZMinPanDistanceRatio() * aPanDistance.y) {
       aOverscroll.x = 0;
     }
-    if (aPanDistance.y <
-        StaticPrefs::APZMinPanDistanceRatio() * aPanDistance.x) {
+    if (aPanDistance.y < gfxPrefs::APZMinPanDistanceRatio() * aPanDistance.x) {
       aOverscroll.y = 0;
     }
   }
 
   OverscrollBy(aOverscroll);
 }
 
 void AsyncPanZoomController::OverscrollBy(ParentLayerPoint& aOverscroll) {
-  if (!StaticPrefs::APZOverscrollEnabled()) {
+  if (!gfxPrefs::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();
@@ -3332,17 +3325,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() < StaticPrefs::APZFlingMinVelocityThreshold()) {
+      velocity.Length() < gfxPrefs::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
@@ -3403,17 +3396,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() &&
-        StaticPrefs::APZOverscrollEnabled()) {
+        gfxPrefs::APZOverscrollEnabled()) {
       // Obey overscroll-behavior.
       RecursiveMutexAutoLock lock(mRecursiveMutex);
       if (!mX.OverscrollBehaviorAllowsOverscrollEffect()) {
         residualVelocity.x = 0;
       }
       if (!mY.OverscrollBehaviorAllowsOverscrollEffect()) {
         residualVelocity.y = 0;
       }
@@ -3448,18 +3441,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,
-        StaticPrefs::ScrollBehaviorSpringConstant(),
-        StaticPrefs::ScrollBehaviorDampingRatio()));
+        gfxPrefs::ScrollBehaviorSpringConstant(),
+        gfxPrefs::ScrollBehaviorDampingRatio()));
   }
 }
 
 void AsyncPanZoomController::StartOverscrollAnimation(
     const ParentLayerPoint& aVelocity) {
   SetState(OVERSCROLL_ANIMATION);
   StartAnimation(new OverscrollAnimation(*this, aVelocity));
 }
@@ -3660,52 +3653,50 @@ 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) < StaticPrefs::APZMinSkateSpeed();
-  bool yIsStationarySpeed =
-      fabsf(aVelocity.y) < StaticPrefs::APZMinSkateSpeed();
+  bool xIsStationarySpeed = fabsf(aVelocity.x) < gfxPrefs::APZMinSkateSpeed();
+  bool yIsStationarySpeed = fabsf(aVelocity.y) < gfxPrefs::APZMinSkateSpeed();
   float xMultiplier = xIsStationarySpeed
-                          ? StaticPrefs::APZXStationarySizeMultiplier()
-                          : StaticPrefs::APZXSkateSizeMultiplier();
+                          ? gfxPrefs::APZXStationarySizeMultiplier()
+                          : gfxPrefs::APZXSkateSizeMultiplier();
   float yMultiplier = yIsStationarySpeed
-                          ? StaticPrefs::APZYStationarySizeMultiplier()
-                          : StaticPrefs::APZYSkateSizeMultiplier();
+                          ? gfxPrefs::APZYStationarySizeMultiplier()
+                          : gfxPrefs::APZYSkateSizeMultiplier();
 
   if (IsHighMemSystem() && !xIsStationarySpeed) {
-    xMultiplier += StaticPrefs::APZXSkateHighMemAdjust();
+    xMultiplier += gfxPrefs::APZXSkateHighMemAdjust();
   }
 
   if (IsHighMemSystem() && !yIsStationarySpeed) {
-    yMultiplier += StaticPrefs::APZYSkateHighMemAdjust();
+    yMultiplier += gfxPrefs::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(StaticPrefs::APZDangerZoneX(),
-                           StaticPrefs::APZDangerZoneY()) /
-                 aFrameMetrics.LayersPixelsPerCSSPixel();
+    dangerZone =
+        LayerSize(gfxPrefs::APZDangerZoneX(), gfxPrefs::APZDangerZoneY()) /
+        aFrameMetrics.LayersPixelsPerCSSPixel();
   }
   const CSSSize compositionSize =
       aFrameMetrics.CalculateBoundedCompositedSizeInCssPixels();
 
   const float xSize = std::max(aDisplayPortSize.width,
                                compositionSize.width + (2 * dangerZone.width));
 
   const float ySize =
@@ -3754,17 +3745,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 (StaticPrefs::APZEnlargeDisplayPortWhenClipped()) {
+  if (gfxPrefs::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
@@ -3773,17 +3764,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 * StaticPrefs::APZVelocityBias());
+  displayPort.MoveBy(velocity * paintFactor * gfxPrefs::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();
@@ -3837,18 +3828,18 @@ bool AsyncPanZoomController::SnapBackIfO
   if (mState != FLING) {
     ScrollSnap();
   }
   return false;
 }
 
 bool AsyncPanZoomController::IsFlingingFast() const {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
-  if (mState == FLING && GetVelocityVector().Length() >
-                             StaticPrefs::APZFlingStopOnTapThreshold()) {
+  if (mState == FLING &&
+      GetVelocityVector().Length() > gfxPrefs::APZFlingStopOnTapThreshold()) {
     APZC_LOG("%p is moving fast\n", this);
     return true;
   }
   return false;
 }
 
 bool AsyncPanZoomController::IsPannable() const {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
@@ -4192,17 +4183,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 (StaticPrefs::APZAllowZooming() && Metrics().IsRootContent() &&
+  return (gfxPrefs::APZAllowZooming() && Metrics().IsRootContent() &&
           Metrics().GetVisualViewport().Size() <=
               Metrics().GetLayoutViewport().Size())
              ? GetCurrentAsyncViewportTransform(aMode)
              : GetCurrentAsyncTransform(aMode);
 }
 
 AsyncTransformComponentMatrix
 AsyncPanZoomController::GetCurrentAsyncTransformWithOverscroll(
@@ -4220,33 +4211,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 (StaticPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
+  if (gfxPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
     return mCompositedLayoutViewport;
   }
   return Metrics().GetLayoutViewport();
 }
 
 CSSPoint AsyncPanZoomController::GetEffectiveScrollOffset(
     AsyncTransformConsumer aMode) const {
-  if (StaticPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
+  if (gfxPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
     return mCompositedScrollOffset;
   }
   return Metrics().GetScrollOffset();
 }
 
 CSSToParentLayerScale2D AsyncPanZoomController::GetEffectiveZoom(
     AsyncTransformConsumer aMode) const {
-  if (StaticPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
+  if (gfxPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
     return mCompositedZoom;
   }
   return Metrics().GetZoom();
 }
 
 bool AsyncPanZoomController::SampleCompositedAsyncTransform() {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
   if (!mCompositedLayoutViewport.IsEqualEdges(Metrics().GetLayoutViewport()) ||
@@ -4332,17 +4323,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 = StaticPrefs::APZRecordCheckerboarding();
+  bool recordTrace = gfxPrefs::APZRecordCheckerboarding();
   bool forTelemetry = Telemetry::CanRecordExtended();
   uint32_t magnitude = GetCheckerboardMagnitude();
 
   MutexAutoLock lock(mCheckerboardEventLock);
   if (!mCheckerboardEvent && (recordTrace || forTelemetry)) {
     mCheckerboardEvent = MakeUnique<CheckerboardEvent>(recordTrace);
   }
   mPotentialCheckerboardTracker.InTransform(IsTransformingState(mState));
@@ -4361,17 +4352,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 (StaticPrefs::APZRecordCheckerboarding()) {
+    if (gfxPrefs::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;
@@ -4666,17 +4657,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 (StaticPrefs::APZRelativeUpdate() && aLayerMetrics.IsRelative()) {
+      if (gfxPrefs::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.
@@ -4741,17 +4732,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 (StaticPrefs::APZRelativeUpdate() && aLayerMetrics.IsRelative()) {
+    if (gfxPrefs::APZRelativeUpdate() && aLayerMetrics.IsRelative()) {
       Metrics().ApplyRelativeSmoothScrollUpdateFrom(aLayerMetrics);
     } else {
       Metrics().ApplySmoothScrollUpdateFrom(aLayerMetrics);
     }
     needContentRepaint = true;
     mExpectedGeckoMetrics = aLayerMetrics;
 
     SmoothScrollTo(Metrics().GetSmoothScrollOffset());
@@ -5062,17 +5053,17 @@ void AsyncPanZoomController::DispatchSta
 
   if (RefPtr<GeckoContentController> controller = GetGeckoContentController()) {
     if (!IsTransformingState(aOldState) && IsTransformingState(aNewState)) {
       controller->NotifyAPZStateChange(GetGuid(),
                                        APZStateChange::eTransformBegin);
 #if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
       // Let the compositor know about scroll state changes so it can manage
       // windowed plugins.
-      if (StaticPrefs::HidePluginsForScroll() && mCompositorController) {
+      if (gfxPrefs::HidePluginsForScroll() && mCompositorController) {
         mCompositorController->ScheduleHideAllPluginWindows();
       }
 #endif
     } else if (IsTransformingState(aOldState) &&
                !IsTransformingState(aNewState)) {
 #if defined(MOZ_WIDGET_ANDROID)
       // The Android UI thread only shows overlay UI elements when the content
       // is not being panned or zoomed and it is in a steady state. So the
@@ -5084,17 +5075,17 @@ void AsyncPanZoomController::DispatchSta
           animator->UpdateRootFrameMetrics(Metrics());
         }
       }
 #endif
 
       controller->NotifyAPZStateChange(GetGuid(),
                                        APZStateChange::eTransformEnd);
 #if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
-      if (StaticPrefs::HidePluginsForScroll() && mCompositorController) {
+      if (gfxPrefs::HidePluginsForScroll() && mCompositorController) {
         mCompositorController->ScheduleShowAllPluginWindows();
       }
 #endif
     }
   }
 }
 
 bool AsyncPanZoomController::IsTransformingState(PanZoomState aState) {
@@ -5176,31 +5167,31 @@ ScrollableLayerGuid AsyncPanZoomControll
 void AsyncPanZoomController::UpdateSharedCompositorFrameMetrics() {
   mRecursiveMutex.AssertCurrentThreadIn();
 
   FrameMetrics* frame =
       mSharedFrameMetricsBuffer
           ? static_cast<FrameMetrics*>(mSharedFrameMetricsBuffer->memory())
           : nullptr;
 
-  if (frame && mSharedLock && StaticPrefs::ProgressivePaint()) {
+  if (frame && mSharedLock && gfxPrefs::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 &&
-      StaticPrefs::ProgressivePaint()) {
+      gfxPrefs::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());
 
@@ -5278,17 +5269,17 @@ void AsyncPanZoomController::ScrollSnapN
 void AsyncPanZoomController::ScrollSnap() {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
   ScrollSnapNear(Metrics().GetScrollOffset());
 }
 
 void AsyncPanZoomController::ScrollSnapToDestination() {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
 
-  float friction = StaticPrefs::APZFlingFriction();
+  float friction = gfxPrefs::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/AsyncPanZoomController.h
+++ b/gfx/layers/apz/src/AsyncPanZoomController.h
@@ -1157,17 +1157,17 @@ class AsyncPanZoomController {
   /**
    * Samples the composited async transform, making the result of
    * |GetCurrentAsyncTransform(eForCompositing)| and similar functions reflect
    * the async scroll offset and zoom stored in |Metrics()|.
    *
    * Returns true if the newly sampled value is different from the previously
    * sampled value.
    *
-   * (This is only relevant when |StaticPrefs::APZFrameDelayEnabled() == true|.
+   * (This is only relevant when |gfxPrefs::APZFrameDelayEnabled() == true|.
    * Otherwise, GetCurrentAsyncTransform() always reflects what's stored in
    * |Metrics()| immediately, without any delay.)
    */
   bool SampleCompositedAsyncTransform();
 
   /**
    * Returns the incremental transformation corresponding to the async
    * panning/zooming of the layout viewport (unlike GetCurrentAsyncTransform,
--- a/gfx/layers/apz/src/Axis.cpp
+++ b/gfx/layers/apz/src/Axis.cpp
@@ -18,16 +18,17 @@
 #include "mozilla/gfx/Rect.h"               // for RoundedIn
 #include "mozilla/layers/APZThreadUtils.h"  // for AssertOnControllerThread
 #include "mozilla/mozalloc.h"               // for operator new
 #include "mozilla/FloatingPoint.h"          // for FuzzyEqualsAdditive
 #include "nsMathUtils.h"                    // for NS_lround
 #include "nsPrintfCString.h"                // for nsPrintfCString
 #include "nsThreadUtils.h"                  // for NS_DispatchToMainThread, etc
 #include "nscore.h"                         // for NS_IMETHOD
+#include "gfxPrefs.h"                       // for the preferences
 
 #define AXIS_LOG(...)
 // #define AXIS_LOG(...) printf_stderr("AXIS: " __VA_ARGS__)
 
 namespace mozilla {
 namespace layers {
 
 bool FuzzyEqualsCoordinate(float aValue1, float aValue2) {
--- a/gfx/layers/apz/src/DesktopFlingPhysics.h
+++ b/gfx/layers/apz/src/DesktopFlingPhysics.h
@@ -4,34 +4,35 @@
  * 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_DesktopFlingPhysics_h_
 #define mozilla_layers_DesktopFlingPhysics_h_
 
 #include "AsyncPanZoomController.h"
 #include "Units.h"
+#include "gfxPrefs.h"
 #include "mozilla/Assertions.h"
 
 #define FLING_PHYS_LOG(...)
 // #define FLING_PHYS_LOG(...) printf_stderr("FLING: " __VA_ARGS__)
 
 namespace mozilla {
 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 = StaticPrefs::APZFlingFriction();
-    float threshold = StaticPrefs::APZFlingStoppedThreshold();
+    float friction = gfxPrefs::APZFlingFriction();
+    float threshold = gfxPrefs::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 (StaticPrefs::APZKeyboardPassiveListeners()) {
+  if (gfxPrefs::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
@@ -10,16 +10,17 @@
 #include "APZUtils.h"
 #include "AsyncPanZoomAnimation.h"
 #include "AsyncPanZoomController.h"
 #include "FrameMetrics.h"
 #include "Layers.h"
 #include "LayersLogging.h"
 #include "Units.h"
 #include "OverscrollHandoffState.h"
+#include "gfxPrefs.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/TimeStamp.h"
 #include "nsThreadUtils.h"
 
 #define FLING_LOG(...)
 // #define FLING_LOG(...) printf_stderr("FLING: " __VA_ARGS__)
@@ -89,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() <
-            StaticPrefs::APZFlingAccelInterval() &&
-        velocity.Length() >= StaticPrefs::APZFlingAccelMinVelocity()) {
+            gfxPrefs::APZFlingAccelInterval() &&
+        velocity.Length() >= gfxPrefs::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);
       }
@@ -215,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 * StaticPrefs::APZFlingAccelBaseMultiplier()) +
-           (aSupplemental * StaticPrefs::APZFlingAccelSupplementalMultiplier());
+    return (aBase * gfxPrefs::APZFlingAccelBaseMultiplier()) +
+           (aSupplemental * gfxPrefs::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
@@ -3,29 +3,30 @@
 /* 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 "GenericScrollAnimation.h"
 
 #include "AsyncPanZoomController.h"
 #include "FrameMetrics.h"
+#include "gfxPrefs.h"
 #include "nsPoint.h"
 #include "ScrollAnimationPhysics.h"
 #include "ScrollAnimationBezierPhysics.h"
 #include "ScrollAnimationMSDPhysics.h"
 
 namespace mozilla {
 namespace layers {
 
 GenericScrollAnimation::GenericScrollAnimation(
     AsyncPanZoomController& aApzc, const nsPoint& aInitialPosition,
     const ScrollAnimationBezierPhysicsSettings& aSettings)
     : mApzc(aApzc), mFinalDestination(aInitialPosition) {
-  if (StaticPrefs::SmoothScrollMSDPhysicsEnabled()) {
+  if (gfxPrefs::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
@@ -5,18 +5,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "GestureEventListener.h"
 #include <math.h>                    // for fabsf
 #include <stddef.h>                  // for size_t
 #include "AsyncPanZoomController.h"  // for AsyncPanZoomController
 #include "InputBlockState.h"         // for TouchBlockState
 #include "base/task.h"               // for CancelableTask, etc
+#include "gfxPrefs.h"                // for gfxPrefs
 #include "InputBlockState.h"         // for TouchBlockState
-#include "mozilla/StaticPrefs.h"     // for StaticPrefs
 #include "nsDebug.h"                 // for NS_WARNING
 #include "nsMathUtils.h"             // for NS_hypot
 
 #define GEL_LOG(...)
 // #define GEL_LOG(...) printf_stderr("GEL: " __VA_ARGS__)
 
 namespace mozilla {
 namespace layers {
@@ -286,23 +286,23 @@ nsEventStatus GestureEventListener::Hand
         mSingleTapSent = Nothing();
         SetState(GESTURE_NONE);
       }
       break;
     }
 
     // The user has performed a double tap, but not lifted her finger.
     case GESTURE_SECOND_SINGLE_TOUCH_DOWN: {
-      // If touch has moved noticeably (within StaticPrefs::APZMaxTapTime()),
+      // If touch has moved noticeably (within gfxPrefs::APZMaxTapTime()),
       // change state.
       if (MoveDistanceIsLarge()) {
         CancelLongTapTimeoutTask();
         CancelMaxTapTimeoutTask();
         mSingleTapSent = Nothing();
-        if (!StaticPrefs::APZOneTouchPinchEnabled()) {
+        if (!gfxPrefs::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(), StaticPrefs::UiClickHoldContextMenusDelay());
+      task.forget(), gfxPrefs::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(),
-                                           StaticPrefs::APZMaxTapTime());
+                                           gfxPrefs::APZMaxTapTime());
 }
 
 }  // namespace layers
 }  // namespace mozilla
--- a/gfx/layers/apz/src/GestureEventListener.h
+++ b/gfx/layers/apz/src/GestureEventListener.h
@@ -79,27 +79,27 @@ class GestureEventListener final {
     // In this state there's no gesture going on, and we don't think we're
     // about to enter one.
     // Allowed next states: GESTURE_FIRST_SINGLE_TOUCH_DOWN,
     // GESTURE_MULTI_TOUCH_DOWN.
     GESTURE_NONE,
 
     // A touch start with a single touch point has just happened.
     // After having gotten into this state we start timers for MAX_TAP_TIME and
-    // StaticPrefs::UiClickHoldContextMenusDelay().
+    // gfxPrefs::UiClickHoldContextMenusDelay().
     // Allowed next states: GESTURE_MULTI_TOUCH_DOWN, GESTURE_NONE,
     //                      GESTURE_FIRST_SINGLE_TOUCH_UP,
     //                      GESTURE_LONG_TOUCH_DOWN,
     //                      GESTURE_FIRST_SINGLE_TOUCH_MAX_TAP_DOWN.
     GESTURE_FIRST_SINGLE_TOUCH_DOWN,
 
     // While in GESTURE_FIRST_SINGLE_TOUCH_DOWN state a MAX_TAP_TIME timer got
     // triggered. Now we'll trigger either a single tap if a user lifts her
-    // finger or a long tap if StaticPrefs::UiClickHoldContextMenusDelay()
-    // happens first.
+    // finger or a long tap if gfxPrefs::UiClickHoldContextMenusDelay() happens
+    // first.
     // Allowed next states: GESTURE_MULTI_TOUCH_DOWN, GESTURE_NONE,
     //                      GESTURE_LONG_TOUCH_DOWN.
     GESTURE_FIRST_SINGLE_TOUCH_MAX_TAP_DOWN,
 
     // A user put her finger down and lifted it up quickly enough.
     // After having gotten into this state we clear the timer for MAX_TAP_TIME.
     // Allowed next states: GESTURE_SECOND_SINGLE_TOUCH_DOWN, GESTURE_NONE,
     //                      GESTURE_MULTI_TOUCH_DOWN.
--- a/gfx/layers/apz/src/HitTestingTreeNode.cpp
+++ b/gfx/layers/apz/src/HitTestingTreeNode.cpp
@@ -1,15 +1,16 @@
 /* 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 "HitTestingTreeNode.h"
 
 #include "AsyncPanZoomController.h"  // for AsyncPanZoomController
+#include "gfxPrefs.h"
 #include "LayersLogging.h"            // for Stringify
 #include "mozilla/gfx/Point.h"        // for Point4D
 #include "mozilla/layers/APZUtils.h"  // for CompleteAsyncTransform
 #include "mozilla/layers/AsyncCompositionManager.h"  // for ViewTransform::operator Matrix4x4()
 #include "mozilla/layers/AsyncDragMetrics.h"  // for AsyncDragMetrics
 #include "nsPrintfCString.h"                  // for nsPrintfCString
 #include "UnitTransforms.h"                   // for ViewAs
 
@@ -267,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 (StaticPrefs::TouchActionEnabled()) {
+  } else if (gfxPrefs::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
@@ -4,17 +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 "InputBlockState.h"
 
 #include "APZUtils.h"
 #include "AsyncPanZoomController.h"  // for AsyncPanZoomController
 #include "ScrollAnimationPhysics.h"  // for kScrollSeriesTimeoutMs
-
+#include "gfxPrefs.h"                // for gfxPrefs
 #include "mozilla/MouseEvents.h"
 #include "mozilla/Telemetry.h"                // for Telemetry
 #include "mozilla/layers/IAPZCTreeManager.h"  // for AllowedTouchBehavior
 #include "OverscrollHandoffState.h"
 #include "QueuedInput.h"
 
 #define TBS_LOG(...)
 // #define TBS_LOG(...) printf_stderr("TBS: " __VA_ARGS__)
@@ -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 || (StaticPrefs::APZAllowImmediateHandoff()
+  MOZ_ASSERT(!mScrolledApzc || (gfxPrefs::APZAllowImmediateHandoff()
                                     ? IsDownchainOf(mScrolledApzc, aApzc)
                                     : mScrolledApzc == aApzc));
 
   mScrolledApzc = aApzc;
 }
 
 AsyncPanZoomController* InputBlockState::GetScrolledApzc() const {
   return mScrolledApzc;
@@ -399,41 +399,39 @@ 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() >=
-        StaticPrefs::MouseWheelIgnoreMoveDelayMs()) {
+    if (duration.ToMilliseconds() >= gfxPrefs::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() <
-      StaticPrefs::MouseWheelTransactionTimeoutMs()) {
+  if (duration.ToMilliseconds() < gfxPrefs::MouseWheelTransactionTimeoutMs()) {
     return false;
   }
 
   TBS_LOG("%p wheel transaction timed out\n", this);
 
-  if (StaticPrefs::MouseScrollTestingEnabled()) {
+  if (gfxPrefs::MouseScrollTestingEnabled()) {
     RefPtr<AsyncPanZoomController> apzc = GetTargetApzc();
     apzc->NotifyMozMouseScrollEvent(
         NS_LITERAL_STRING("MozMouseScrollTransactionTimeout"));
   }
 
   EndTransaction();
   return true;
 }
@@ -447,18 +445,17 @@ 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() >=
-        StaticPrefs::MouseWheelIgnoreMoveDelayMs()) {
+    if (duration.ToMilliseconds() >= gfxPrefs::MouseWheelIgnoreMoveDelayMs()) {
       mLastMouseMove = now;
     }
   }
 }
 
 void WheelBlockState::UpdateTargetApzc(
     const RefPtr<AsyncPanZoomController>& aTargetApzc) {
   InputBlockState::UpdateTargetApzc(aTargetApzc);
@@ -579,17 +576,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 (!StaticPrefs::TouchActionEnabled()) {
+  if (!gfxPrefs::TouchActionEnabled()) {
     mAllowedTouchBehaviorSet = true;
   }
 }
 
 bool TouchBlockState::SetAllowedTouchBehaviors(
     const nsTArray<TouchBehaviorFlags>& aBehaviors) {
   if (mAllowedTouchBehaviorSet) {
     return false;
@@ -611,36 +608,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 (StaticPrefs::TouchActionEnabled()) {
+  if (gfxPrefs::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()
-         && (!StaticPrefs::TouchActionEnabled() || mAllowedTouchBehaviorSet);
+         && (!gfxPrefs::TouchActionEnabled() || mAllowedTouchBehaviorSet);
 }
 
 bool TouchBlockState::IsReadyForHandling() const {
   if (!CancelableBlockState::IsReadyForHandling()) {
     return false;
   }
 
-  if (!StaticPrefs::TouchActionEnabled()) {
+  if (!gfxPrefs::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;
   }
@@ -668,66 +665,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 (!StaticPrefs::TouchActionEnabled()) {
+  if (!gfxPrefs::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 (!StaticPrefs::TouchActionEnabled()) {
+  if (!gfxPrefs::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 (!StaticPrefs::TouchActionEnabled()) {
+  if (!gfxPrefs::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 (!StaticPrefs::TouchActionEnabled()) {
+  if (!gfxPrefs::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 (!StaticPrefs::TouchActionEnabled()) {
+  if (!gfxPrefs::TouchActionEnabled()) {
     return true;
   }
   if (mAllowedTouchBehaviors.IsEmpty()) {
     // Default to allowed
     return true;
   }
   TouchBehaviorFlags flags = mAllowedTouchBehaviors[0];
   return (flags & AllowedTouchBehavior::HORIZONTAL_PAN) &&
@@ -775,18 +772,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()
-                              ? StaticPrefs::APZAxisLockAngle()
-                              : StaticPrefs::APZAllowedDirectPanAngle();
+                              ? gfxPrefs::APZAxisLockAngle()
+                              : gfxPrefs::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/InputBlockState.h
+++ b/gfx/layers/apz/src/InputBlockState.h
@@ -102,19 +102,19 @@ class InputBlockState : public RefCounte
  private:
   RefPtr<AsyncPanZoomController> mTargetApzc;
   TargetConfirmationState mTargetConfirmed;
   bool mRequiresTargetConfirmation;
   const uint64_t mBlockId;
 
   // The APZC that was actually scrolled by events in this input block.
   // This is used in configurations where a single input block is only
-  // allowed to scroll a single APZC (configurations where
-  // StaticPrefs::APZAllowImmediateHandoff() is false). Set the first time an
-  // input event in this block scrolls an APZC.
+  // allowed to scroll a single APZC (configurations where gfxPrefs::
+  // APZAllowImmediateHandoff() is false).
+  // Set the first time an input event in this block scrolls an APZC.
   RefPtr<AsyncPanZoomController> mScrolledApzc;
 
  protected:
   RefPtr<const OverscrollHandoffChain> mOverscrollHandoffChain;
 
   // Used to transform events from global screen space to |mTargetApzc|'s
   // screen space. It's cached at the beginning of the input block so that
   // all events in the block are in the same coordinate space.
--- a/gfx/layers/apz/src/InputQueue.cpp
+++ b/gfx/layers/apz/src/InputQueue.cpp
@@ -2,17 +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 "InputQueue.h"
 
 #include "AsyncPanZoomController.h"
-
+#include "gfxPrefs.h"
 #include "InputBlockState.h"
 #include "LayersLogging.h"
 #include "mozilla/layers/APZThreadUtils.h"
 #include "OverscrollHandoffState.h"
 #include "QueuedInput.h"
 
 #define INPQ_LOG(...)
 // #define INPQ_LOG(...) printf_stderr("INPQ: " __VA_ARGS__)
@@ -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 (!StaticPrefs::TouchActionEnabled()) {
+    if (!gfxPrefs::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 (StaticPrefs::TouchActionEnabled()) {
+      if (gfxPrefs::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 StaticPrefs::APZKeyboardPassiveListeners()
+  return gfxPrefs::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 = StaticPrefs::APZContentResponseTimeout();
+  int32_t timeout = gfxPrefs::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
@@ -2,46 +2,48 @@
 /* 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 "KeyboardScrollAnimation.h"
 #include "ScrollAnimationBezierPhysics.h"
 
+#include "gfxPrefs.h"
+
 namespace mozilla {
 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(StaticPrefs::LineSmoothScrollMaxDurationMs(), 0, 10000);
-      minMS = clamped(StaticPrefs::LineSmoothScrollMinDurationMs(), 0, maxMS);
+      maxMS = clamped(gfxPrefs::LineSmoothScrollMaxDurationMs(), 0, 10000);
+      minMS = clamped(gfxPrefs::LineSmoothScrollMinDurationMs(), 0, maxMS);
       break;
     }
     case KeyboardScrollAction::eScrollPage: {
-      maxMS = clamped(StaticPrefs::PageSmoothScrollMaxDurationMs(), 0, 10000);
-      minMS = clamped(StaticPrefs::PageSmoothScrollMinDurationMs(), 0, maxMS);
+      maxMS = clamped(gfxPrefs::PageSmoothScrollMaxDurationMs(), 0, 10000);
+      minMS = clamped(gfxPrefs::PageSmoothScrollMinDurationMs(), 0, maxMS);
       break;
     }
     case KeyboardScrollAction::eScrollComplete: {
-      maxMS = clamped(StaticPrefs::OtherSmoothScrollMaxDurationMs(), 0, 10000);
-      minMS = clamped(StaticPrefs::OtherSmoothScrollMinDurationMs(), 0, maxMS);
+      maxMS = clamped(gfxPrefs::OtherSmoothScrollMaxDurationMs(), 0, 10000);
+      minMS = clamped(gfxPrefs::OtherSmoothScrollMinDurationMs(), 0, maxMS);
       break;
     }
   }
 
   // The pref is 100-based int percentage, while mIntervalRatio is 1-based ratio
   double intervalRatio =
-      ((double)StaticPrefs::SmoothScrollDurationToIntervalRatio()) / 100.0;
+      ((double)gfxPrefs::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,51 +81,51 @@ 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 < StaticPrefs::APZVelocityRelevanceTime()) {
+    if (timeDelta < gfxPrefs::APZVelocityRelevanceTime()) {
       count++;
       velocity += e.second;
     }
   }
   mVelocityQueue.Clear();
   if (count > 1) {
     velocity /= count;
   }
   return Some(velocity);
 }
 
 void SimpleVelocityTracker::Clear() { mVelocityQueue.Clear(); }
 
 void SimpleVelocityTracker::AddVelocityToQueue(uint32_t aTimestampMs,
                                                float aVelocity) {
   mVelocityQueue.AppendElement(std::make_pair(aTimestampMs, aVelocity));
-  if (mVelocityQueue.Length() > StaticPrefs::APZMaxVelocityQueueSize()) {
+  if (mVelocityQueue.Length() > gfxPrefs::APZMaxVelocityQueueSize()) {
     mVelocityQueue.RemoveElementAt(0);
   }
 }
 
 float SimpleVelocityTracker::ApplyFlingCurveToVelocity(float aVelocity) const {
   float newVelocity = aVelocity;
-  if (StaticPrefs::APZMaxVelocity() > 0.0f) {
+  if (gfxPrefs::APZMaxVelocity() > 0.0f) {
     bool velocityIsNegative = (newVelocity < 0);
     newVelocity = fabs(newVelocity);
 
-    float maxVelocity = mAxis->ToLocalVelocity(StaticPrefs::APZMaxVelocity());
+    float maxVelocity = mAxis->ToLocalVelocity(gfxPrefs::APZMaxVelocity());
     newVelocity = std::min(newVelocity, maxVelocity);
 
-    if (StaticPrefs::APZCurveThreshold() > 0.0f &&
-        StaticPrefs::APZCurveThreshold() < StaticPrefs::APZMaxVelocity()) {
+    if (gfxPrefs::APZCurveThreshold() > 0.0f &&
+        gfxPrefs::APZCurveThreshold() < gfxPrefs::APZMaxVelocity()) {
       float curveThreshold =
-          mAxis->ToLocalVelocity(StaticPrefs::APZCurveThreshold());
+          mAxis->ToLocalVelocity(gfxPrefs::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 "mozilla/StaticPrefs.h"
+#include "gfxPrefs.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(StaticPrefs::PageSmoothScrollMaxDurationMs(), 0, 10000);
-      minMS = clamped(StaticPrefs::PageSmoothScrollMinDurationMs(), 0, maxMS);
+      maxMS = clamped(gfxPrefs::PageSmoothScrollMaxDurationMs(), 0, 10000);
+      minMS = clamped(gfxPrefs::PageSmoothScrollMinDurationMs(), 0, maxMS);
       break;
     case ScrollWheelInput::SCROLLDELTA_PIXEL:
-      maxMS = clamped(StaticPrefs::PixelSmoothScrollMaxDurationMs(), 0, 10000);
-      minMS = clamped(StaticPrefs::PixelSmoothScrollMinDurationMs(), 0, maxMS);
+      maxMS = clamped(gfxPrefs::PixelSmoothScrollMaxDurationMs(), 0, 10000);
+      minMS = clamped(gfxPrefs::PixelSmoothScrollMinDurationMs(), 0, maxMS);
       break;
     case ScrollWheelInput::SCROLLDELTA_LINE:
-      maxMS = clamped(StaticPrefs::WheelSmoothScrollMaxDurationMs(), 0, 10000);
-      minMS = clamped(StaticPrefs::WheelSmoothScrollMinDurationMs(), 0, maxMS);
+      maxMS = clamped(gfxPrefs::WheelSmoothScrollMaxDurationMs(), 0, 10000);
+      minMS = clamped(gfxPrefs::WheelSmoothScrollMinDurationMs(), 0, maxMS);
       break;
   }
 
   // The pref is 100-based int percentage, while mIntervalRatio is 1-based ratio
   double intervalRatio =
-      ((double)StaticPrefs::SmoothScrollDurationToIntervalRatio()) / 100.0;
+      ((double)gfxPrefs::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/APZCBasicTester.h
+++ b/gfx/layers/apz/test/gtest/APZCBasicTester.h
@@ -7,29 +7,30 @@
 #ifndef mozilla_layers_APZCBasicTester_h
 #define mozilla_layers_APZCBasicTester_h
 
 /**
  * Defines a test fixture used for testing a single APZC.
  */
 
 #include "APZTestCommon.h"
-
+#include "gfxPrefs.h"
 #include "mozilla/layers/APZSampler.h"
 #include "mozilla/layers/APZUpdater.h"
 
 class APZCBasicTester : public APZCTesterBase {
  public:
   explicit APZCBasicTester(
       AsyncPanZoomController::GestureBehavior aGestureBehavior =
           AsyncPanZoomController::DEFAULT_GESTURES)
       : mGestureBehavior(aGestureBehavior) {}
 
  protected:
   virtual void SetUp() {
+    gfxPrefs::GetSingleton();
     APZThreadUtils::SetThreadAssertionsEnabled(false);
     APZThreadUtils::SetControllerThread(MessageLoop::current());
 
     tm = new TestAPZCTreeManager(mcc);
     updater = new APZUpdater(tm, false);
     sampler = new APZSampler(tm, false);
     apzc = new TestAsyncPanZoomController(
         LayersId{0}, mcc, tm, wr::RenderRoot::Default, mGestureBehavior);
--- a/gfx/layers/apz/test/gtest/APZCTreeManagerTester.h
+++ b/gfx/layers/apz/test/gtest/APZCTreeManagerTester.h
@@ -9,23 +9,24 @@
 
 /**
  * Defines a test fixture used for testing multiple APZCs interacting in
  * an APZCTreeManager.
  */
 
 #include "APZTestCommon.h"
 #include "gfxPlatform.h"
-
+#include "gfxPrefs.h"
 #include "mozilla/layers/APZSampler.h"
 #include "mozilla/layers/APZUpdater.h"
 
 class APZCTreeManagerTester : public APZCTesterBase {
  protected:
   virtual void SetUp() {
+    gfxPrefs::GetSingleton();
     gfxPlatform::GetPlatform();
     APZThreadUtils::SetThreadAssertionsEnabled(false);
     APZThreadUtils::SetControllerThread(MessageLoop::current());
 
     manager = new TestAPZCTreeManager(mcc);
     updater = new APZUpdater(manager, false);
     sampler = new APZSampler(manager, false);
   }
--- 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( \
-      &(StaticPrefs::prefBase), &(StaticPrefs::Set##prefBase), prefValue)
+      &(gfxPrefs::prefBase), &(gfxPrefs::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;
@@ -515,17 +515,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 (StaticPrefs::TouchActionEnabled() &&
+  if (gfxPrefs::TouchActionEnabled() &&
       status != nsEventStatus_eConsumeNoDefault) {
     SetDefaultAllowedTouchBehavior(aTarget, *aOutInputBlockId);
   }
 
   status = TouchUp(aTarget, aPoint, mcc->Time());
   if (aOutEventStatuses) {
     (*aOutEventStatuses)[1] = status;
   }
@@ -547,18 +547,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.
-  StaticPrefs::SetAPZTouchStartTolerance(1.0f / 1000.0f);
-  StaticPrefs::SetAPZTouchMoveTolerance(0.0f);
+  gfxPrefs::SetAPZTouchStartTolerance(1.0f / 1000.0f);
+  gfxPrefs::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;
@@ -591,17 +591,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 (StaticPrefs::TouchActionEnabled()) {
+    } else if (gfxPrefs::TouchActionEnabled()) {
       SetDefaultAllowedTouchBehavior(aTarget, *aOutInputBlockId);
     }
   }
 
   status = TouchMove(aTarget, aTouchStart, mcc->Time());
   if (aOutEventStatuses) {
     (*aOutEventStatuses)[1] = status;
   }
@@ -676,17 +676,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 (StaticPrefs::TouchActionEnabled() &&
+  if (gfxPrefs::TouchActionEnabled() &&
       status != nsEventStatus_eConsumeNoDefault) {
     SetDefaultAllowedTouchBehavior(aTarget, blockId);
   }
 
   status = TouchUp(aTarget, aPoint, mcc->Time());
   if (aOutEventStatuses) {
     (*aOutEventStatuses)[1] = status;
   }
@@ -695,17 +695,17 @@ void APZCTesterBase::DoubleTap(const Ref
   if (aOutEventStatuses) {
     (*aOutEventStatuses)[2] = status;
   }
   if (aOutInputBlockIds) {
     (*aOutInputBlockIds)[1] = blockId;
   }
   mcc->AdvanceByMillis(10);
 
-  if (StaticPrefs::TouchActionEnabled() &&
+  if (gfxPrefs::TouchActionEnabled() &&
       status != nsEventStatus_eConsumeNoDefault) {
     SetDefaultAllowedTouchBehavior(aTarget, blockId);
   }
 
   status = TouchUp(aTarget, aPoint, mcc->Time());
   if (aOutEventStatuses) {
     (*aOutEventStatuses)[3] = status;
   }
@@ -768,17 +768,17 @@ void APZCTesterBase::PinchWithTouchInput
   }
 
   mcc->AdvanceBy(TIME_BETWEEN_TOUCH_EVENT);
 
   if (aAllowedTouchBehaviors) {
     EXPECT_EQ(2UL, aAllowedTouchBehaviors->Length());
     aTarget->SetAllowedTouchBehavior(*aOutInputBlockId,
                                      *aAllowedTouchBehaviors);
-  } else if (StaticPrefs::TouchActionEnabled()) {
+  } else if (gfxPrefs::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/InputUtils.h
+++ b/gfx/layers/apz/test/gtest/InputUtils.h
@@ -8,16 +8,17 @@
 #define mozilla_layers_InputUtils_h
 
 /**
  * Defines a set of utility functions for generating input events
  * to an APZC/APZCTM during APZ gtests.
  */
 
 #include "APZTestCommon.h"
+#include "gfxPrefs.h"
 
 /* The InputReceiver template parameter used in the helper functions below needs
  * to be a class that implements functions with the signatures:
  * nsEventStatus ReceiveInputEvent(const InputData& aEvent,
  *                                 ScrollableLayerGuid* aGuid,
  *                                 uint64_t* aOutInputBlockId);
  * void SetAllowedTouchBehavior(uint64_t aInputBlockId,
  *                              const nsTArray<uint32_t>& aBehaviours);
--- a/gfx/layers/apz/test/gtest/TestBasic.cpp
+++ b/gfx/layers/apz/test/gtest/TestBasic.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 "APZCBasicTester.h"
 #include "APZTestCommon.h"
-
+#include "gfxPrefs.h"
 #include "InputUtils.h"
 
 TEST_F(APZCBasicTester, Overzoom) {
   // the visible area of the document in CSS pixels is x=10 y=0 w=100 h=100
   FrameMetrics fm;
   fm.SetCompositionBounds(ParentLayerRect(0, 0, 100, 100));
   fm.SetScrollableRect(CSSRect(0, 0, 125, 150));
   fm.SetScrollOffset(CSSPoint(10, 0));
@@ -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 (StaticPrefs::TouchActionEnabled() &&
+  if (gfxPrefs::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,16 +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 "APZCBasicTester.h"
 #include "APZTestCommon.h"
+#include "gfxPrefs.h"
 
 class APZCGestureDetectorTester : public APZCBasicTester {
  public:
   APZCGestureDetectorTester()
       : APZCBasicTester(AsyncPanZoomController::USE_GESTURE_DETECTOR) {}
 
  protected:
   FrameMetrics GetPinchableFrameMetrics() {
@@ -387,17 +388,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 (StaticPrefs::TouchActionEnabled() &&
+    if (gfxPrefs::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);
@@ -453,17 +454,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 (StaticPrefs::TouchActionEnabled() &&
+    if (gfxPrefs::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);
@@ -701,17 +702,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 (StaticPrefs::TouchActionEnabled() &&
+  if (gfxPrefs::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
@@ -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 "APZCTreeManagerTester.h"
 #include "APZTestCommon.h"
-
+#include "gfxPrefs.h"
 #include "InputUtils.h"
 
 class APZHitTestingTester : public APZCTreeManagerTester {
  protected:
   ScreenToParentLayerMatrix4x4 transformToApzc;
   ParentLayerToScreenMatrix4x4 transformToGecko;
 
   already_AddRefed<AsyncPanZoomController> GetTargetAPZC(
@@ -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 (StaticPrefs::TouchActionEnabled()) {
+  if (gfxPrefs::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 =
-        StaticPrefs::APZPinchLockScrollLockThreshold() * 1.2 * tm->GetDPI();
+        gfxPrefs::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 =
-        StaticPrefs::APZPinchLockSpanBreakoutThreshold() * 1.2 * tm->GetDPI();
+        gfxPrefs::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 =
-        StaticPrefs::APZPinchLockSpanBreakoutThreshold() * 0.8 * tm->GetDPI();
+        gfxPrefs::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
@@ -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 "APZCTreeManagerTester.h"
 #include "APZTestCommon.h"
-
+#include "gfxPrefs.h"
 #include "InputUtils.h"
 #include "mozilla/StaticPrefs.h"
 
 class APZCSnappingTester : public APZCTreeManagerTester {};
 
 TEST_F(APZCSnappingTester, Bug1265510) {
   SCOPED_GFX_VAR(UseWebRender, bool, false);
 
@@ -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(
-                StaticPrefs::MouseWheelTransactionTimeoutMs() + 100);
+                gfxPrefs::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 || StaticPrefs::APZTestLoggingEnabled(),
+    MOZ_ASSERT(!aTestData || gfxPrefs::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/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -3,17 +3,17 @@
 /* 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 "APZCCallbackHelper.h"
 
 #include "TouchActionHelper.h"
 #include "gfxPlatform.h"  // For gfxPlatform::UseTiling
-
+#include "gfxPrefs.h"
 #include "LayersLogging.h"  // For Stringify
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/MouseEventBinding.h"
 #include "mozilla/dom/BrowserParent.h"
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/layers/LayerTransactionChild.h"
 #include "mozilla/layers/ShadowLayers.h"
 #include "mozilla/layers/WebRenderLayerManager.h"
--- a/gfx/layers/apz/util/APZEventState.cpp
+++ b/gfx/layers/apz/util/APZEventState.cpp
@@ -3,17 +3,17 @@
 /* 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 "APZEventState.h"
 
 #include "ActiveElementManager.h"
 #include "APZCCallbackHelper.h"
-
+#include "gfxPrefs.h"
 #include "LayersLogging.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/dom/MouseEventBinding.h"
 #include "mozilla/dom/BrowserChild.h"
 #include "mozilla/dom/TabGroup.h"
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/Move.h"
 #include "mozilla/Preferences.h"
@@ -391,17 +391,17 @@ void APZEventState::ProcessTouchEvent(co
 
   mTouchCounter.Update(aEvent);
   if (mTouchCounter.GetActiveTouchCount() == 0) {
     mFirstTouchCancelled = false;
   }
 
   if (sentContentResponse && !isTouchPrevented &&
       aApzResponse == nsEventStatus_eConsumeDoDefault &&
-      StaticPrefs::PointerEventsEnabled()) {
+      gfxPrefs::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
@@ -1,16 +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 "CheckerboardReportService.h"
 
+#include "gfxPrefs.h"                 // for gfxPrefs
 #include "jsapi.h"                    // for JS_Now
 #include "MainThreadUtils.h"          // for NS_IsMainThread
 #include "mozilla/Assertions.h"       // for MOZ_ASSERT
 #include "mozilla/ClearOnShutdown.h"  // for ClearOnShutdown
 #include "mozilla/Unused.h"
 #include "mozilla/dom/CheckerboardReportServiceBinding.h"  // for dom::CheckerboardReports
 #include "mozilla/gfx/GPUParent.h"
 #include "mozilla/gfx/GPUProcessManager.h"
@@ -186,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 StaticPrefs::APZRecordCheckerboarding();
+  return gfxPrefs::APZRecordCheckerboarding();
 }
 
 void CheckerboardReportService::SetRecordingEnabled(bool aEnabled) {
-  StaticPrefs::SetAPZRecordCheckerboarding(aEnabled);
+  gfxPrefs::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
@@ -19,16 +19,17 @@
 #include "mozilla/gfx/ssse3-scaler.h"
 #include "mozilla/layers/ImageDataSerializer.h"
 #include "mozilla/SSE.h"
 #include "gfxPlatform.h"
 #include "gfxUtils.h"
 #include "YCbCrUtils.h"
 #include <algorithm>
 #include "ImageContainer.h"
+#include "gfxPrefs.h"
 
 namespace mozilla {
 using namespace mozilla::gfx;
 
 namespace layers {
 
 class DataTextureSourceBasic : public DataTextureSource,
                                public TextureSourceBasic {
@@ -362,17 +363,17 @@ BasicCompositor::CreateDataTextureSource
 }
 
 bool BasicCompositor::SupportsEffect(EffectTypes aEffect) {
   return aEffect != EffectTypes::YCBCR &&
          aEffect != EffectTypes::COMPONENT_ALPHA;
 }
 
 bool BasicCompositor::SupportsLayerGeometry() const {
-  return StaticPrefs::BasicLayerGeometry();
+  return gfxPrefs::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();
@@ -1018,17 +1019,17 @@ void BasicCompositor::BeginFrame(
 }
 
 void BasicCompositor::EndFrame() {
   Compositor::EndFrame();
 
   // Pop aClipRectIn/bounds rect
   mRenderTarget->mDrawTarget->PopClip();
 
-  if (StaticPrefs::WidgetUpdateFlashing()) {
+  if (gfxPrefs::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
@@ -18,17 +18,17 @@
 #include "RenderTrace.h"            // for RenderTraceLayers, etc
 #include "basic/BasicImplData.h"    // for BasicImplData
 #include "basic/BasicLayers.h"      // for BasicLayerManager, etc
 #include "gfxASurface.h"            // for gfxASurface, etc
 #include "gfxContext.h"             // for gfxContext, etc
 #include "gfxImageSurface.h"        // for gfxImageSurface
 #include "gfxMatrix.h"              // for gfxMatrix
 #include "gfxPlatform.h"            // for gfxPlatform
-
+#include "gfxPrefs.h"               // for gfxPrefs
 #include "gfxPoint.h"               // for IntSize, gfxPoint
 #include "gfxRect.h"                // for gfxRect
 #include "gfxUtils.h"               // for gfxUtils
 #include "gfx2DGlue.h"              // for thebes --> moz2d transition
 #include "mozilla/Assertions.h"     // for MOZ_ASSERT, etc
 #include "mozilla/WidgetUtils.h"    // for ScreenRotation
 #include "mozilla/gfx/2D.h"         // for DrawTarget
 #include "mozilla/gfx/BasePoint.h"  // for BasePoint
@@ -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 (StaticPrefs::WidgetUpdateFlashing()) {
+  if (gfxPrefs::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
@@ -2,19 +2,19 @@
 /* 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 "ClientLayerManager.h"
 #include "GeckoProfiler.h"       // for AUTO_PROFILER_LABEL
 #include "gfxEnv.h"              // for gfxEnv
+#include "gfxPrefs.h"            // for gfxPrefs::LayersTile...
 #include "mozilla/Assertions.h"  // for MOZ_ASSERT, etc
 #include "mozilla/Hal.h"
-#include "mozilla/StaticPrefs.h"
 #include "mozilla/dom/BrowserChild.h"  // for BrowserChild
 #include "mozilla/dom/TabGroup.h"      // for TabGroup
 #include "mozilla/hal_sandbox/PHal.h"  // for ScreenConfiguration
 #include "mozilla/layers/CompositableClient.h"
 #include "mozilla/layers/CompositorBridgeChild.h"  // for CompositorBridgeChild
 #include "mozilla/layers/FrameUniformityData.h"
 #include "mozilla/layers/ISurfaceAllocator.h"
 #include "mozilla/layers/LayersMessages.h"  // for EditReply, etc
@@ -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 (StaticPrefs::APZTestLoggingEnabled()) {
+    if (gfxPrefs::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 (StaticPrefs::LayersDrawFPS()) {
+  if (gfxPrefs::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 (StaticPrefs::AlwaysPaint() && XRE_IsContentProcess()) {
+    if (gfxPrefs::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 (StaticPrefs::APZTestLoggingEnabled()) {
+  if (gfxPrefs::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() ||
-          StaticPrefs::LayersForceSynchronousResize()) {
+          gfxPrefs::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 (StaticPrefs::AlwaysPaint() && XRE_IsContentProcess()) {
+  if (gfxPrefs::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() &&
-      StaticPrefs::PersistentBufferProviderSharedEnabled()) {
+      gfxPrefs::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
@@ -5,19 +5,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_CLIENTLAYERMANAGER_H
 #define GFX_CLIENTLAYERMANAGER_H
 
 #include <stdint.h>  // for int32_t
 #include "Layers.h"
 #include "gfxContext.h"  // for gfxContext
+#include "gfxPrefs.h"
 #include "mozilla/Attributes.h"   // for override
-#include "mozilla/LinkedList.h"   // for LinkedList
-#include "mozilla/StaticPrefs.h"  // for StaticPrefs
+#include "mozilla/LinkedList.h"   // For LinkedList
 #include "mozilla/WidgetUtils.h"  // for ScreenRotation
 #include "mozilla/gfx/Rect.h"     // for Rect
 #include "mozilla/layers/CompositorTypes.h"
 #include "mozilla/layers/FocusTarget.h"   // for FocusTarget
 #include "mozilla/layers/LayersTypes.h"   // for BufferMode, LayersBackend, etc
 #include "mozilla/layers/PaintThread.h"   // For PaintThread
 #include "mozilla/layers/ShadowLayers.h"  // for ShadowLayerForwarder, etc
 #include "mozilla/layers/APZTestData.h"   // for APZTestData
@@ -197,41 +197,41 @@ 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(StaticPrefs::APZTestLoggingEnabled(), "don't call me");
+    MOZ_ASSERT(gfxPrefs::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.
   void StartNewRepaintRequest(SequenceNumber aSequenceNumber);
 
   // TODO(botond): When we start using this and write a wrapper similar to
   // nsLayoutUtils::LogTestDataForPaint(), make sure that wrapper checks
-  // StaticPrefs::APZTestLoggingEnabled().
+  // gfxPrefs::APZTestLoggingEnabled().
   void LogTestDataForRepaintRequest(SequenceNumber aSequenceNumber,
                                     ScrollableLayerGuid::ViewID aScrollId,
                                     const std::string& aKey,
                                     const std::string& aValue) {
-    MOZ_ASSERT(StaticPrefs::APZTestLoggingEnabled(), "don't call me");
+    MOZ_ASSERT(gfxPrefs::APZTestLoggingEnabled(), "don't call me");
     mApzTestData.LogTestDataForRepaintRequest(aSequenceNumber, aScrollId, aKey,
                                               aValue);
   }
   void LogAdditionalTestData(const std::string& aKey,
                              const std::string& aValue) {
-    MOZ_ASSERT(StaticPrefs::APZTestLoggingEnabled(), "don't call me");
+    MOZ_ASSERT(gfxPrefs::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/ClientPaintedLayer.cpp
+++ b/gfx/layers/client/ClientPaintedLayer.cpp
@@ -8,17 +8,17 @@
 #include "ClientTiledPaintedLayer.h"    // for ClientTiledPaintedLayer
 #include <stdint.h>                     // for uint32_t
 #include "GeckoProfiler.h"              // for AUTO_PROFILER_LABEL
 #include "client/ClientLayerManager.h"  // for ClientLayerManager, etc
 #include "gfxContext.h"                 // for gfxContext
 #include "gfx2DGlue.h"
 #include "gfxEnv.h"              // for gfxEnv
 #include "gfxRect.h"             // for gfxRect
-
+#include "gfxPrefs.h"            // for gfxPrefs
 #include "mozilla/Assertions.h"  // for MOZ_ASSERT, etc
 #include "mozilla/gfx/2D.h"      // for DrawTarget
 #include "mozilla/gfx/DrawEventRecorder.h"
 #include "mozilla/gfx/Matrix.h"  // for Matrix
 #include "mozilla/gfx/Rect.h"    // for Rect, IntRect
 #include "mozilla/gfx/Types.h"   // for Float, etc
 #include "mozilla/layers/LayersTypes.h"
 #include "mozilla/Preferences.h"
--- a/gfx/layers/client/ClientTiledPaintedLayer.cpp
+++ b/gfx/layers/client/ClientTiledPaintedLayer.cpp
@@ -5,19 +5,19 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ClientTiledPaintedLayer.h"
 #include "FrameMetrics.h"          // for FrameMetrics
 #include "Units.h"                 // for ScreenIntRect, CSSPoint, etc
 #include "UnitTransforms.h"        // for TransformTo
 #include "ClientLayerManager.h"    // for ClientLayerManager, etc
 #include "gfxPlatform.h"           // for gfxPlatform
+#include "gfxPrefs.h"              // for gfxPrefs
 #include "gfxRect.h"               // for gfxRect
 #include "mozilla/Assertions.h"    // for MOZ_ASSERT, etc
-#include "mozilla/StaticPrefs.h"   // for StaticPrefs
 #include "mozilla/gfx/BaseSize.h"  // for BaseSize
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/gfx/Rect.h"  // for Rect, RectTyped
 #include "mozilla/layers/CompositorBridgeChild.h"
 #include "mozilla/layers/LayerMetricsWrapper.h"  // for LayerMetricsWrapper
 #include "mozilla/layers/LayersMessages.h"
 #include "mozilla/layers/PaintThread.h"
 #include "mozilla/mozalloc.h"  // for operator delete, etc
@@ -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 (StaticPrefs::LayoutUseContainersForRootFrames()) {
+    if (gfxPrefs::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 (!StaticPrefs::ProgressivePaint()) {
+  if (!gfxPrefs::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()) &&
-      StaticPrefs::LayersSingleTileEnabled();
+      gfxPrefs::LayersSingleTileEnabled();
 
   if (mContentClient && mHaveSingleTiledContentClient &&
       !wantSingleTiledContentClient) {
     mContentClient = nullptr;
     ClearValidRegion();
   }
 
   if (!mContentClient) {
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -4,17 +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 "mozilla/layers/ContentClient.h"
 #include "BasicLayers.h"            // for BasicLayerManager
 #include "gfxContext.h"             // for gfxContext, etc
 #include "gfxPlatform.h"            // for gfxPlatform
 #include "gfxEnv.h"                 // for gfxEnv
-
+#include "gfxPrefs.h"               // for gfxPrefs
 #include "gfxPoint.h"               // for IntSize, gfxPoint
 #include "gfxUtils.h"               // for gfxUtils
 #include "ipc/ShadowLayers.h"       // for ShadowLayerForwarder
 #include "mozilla/ArrayUtils.h"     // for ArrayLength
 #include "mozilla/gfx/2D.h"         // for DrawTarget, Factory
 #include "mozilla/gfx/BasePoint.h"  // for BasePoint
 #include "mozilla/gfx/BaseSize.h"   // for BaseSize
 #include "mozilla/gfx/Rect.h"       // for Rect
--- a/gfx/layers/client/MultiTiledContentClient.cpp
+++ b/gfx/layers/client/MultiTiledContentClient.cpp
@@ -2,34 +2,33 @@
 /* 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/MultiTiledContentClient.h"
 
 #include "ClientTiledPaintedLayer.h"
-#include "mozilla/StaticPrefs.h"
 #include "mozilla/layers/LayerMetricsWrapper.h"
 
 namespace mozilla {
 
 using namespace gfx;
 
 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(StaticPrefs::LowPrecisionResolution());
-  mHasLowPrecision = StaticPrefs::UseLowPrecisionBuffer();
+  mLowPrecisionTiledBuffer.SetResolution(gfxPrefs::LowPrecisionResolution());
+  mHasLowPrecision = gfxPrefs::UseLowPrecisionBuffer();
 }
 
 void MultiTiledContentClient::ClearCachedResources() {
   CompositableClient::ClearCachedResources();
   mTiledBuffer.DiscardBuffers();
   mLowPrecisionTiledBuffer.DiscardBuffers();
 }
 
@@ -260,17 +259,17 @@ void ClientMultiTiledLayerBuffer::Update
                          .PreScale(mResolution, mResolution)
                          .PreTranslate(-mTilingOrigin));
 
       mCallback(&mPaintedLayer, ctx, paintRegion, dirtyRegion,
                 DrawRegionClip::DRAW, nsIntRegion(), mCallbackData);
       ctx = nullptr;
 
       // Edge padding allows us to avoid resampling artifacts
-      if (StaticPrefs::TileEdgePaddingEnabled() && mResolution == 1) {
+      if (gfxPrefs::TileEdgePaddingEnabled() && mResolution == 1) {
         drawTarget->PadEdges(newValidRegion.MovedBy(-mTilingOrigin));
       }
 
       // Reset
       mPaintTiles.Clear();
       mTilingOrigin = IntPoint(std::numeric_limits<int32_t>::max(),
                                std::numeric_limits<int32_t>::max());
     }
--- a/gfx/layers/client/SingleTiledContentClient.h
+++ b/gfx/layers/client/SingleTiledContentClient.h
@@ -15,17 +15,17 @@ namespace layers {
 class ClientTiledPaintedLayer;
 class ClientLayerManager;
 
 /**
  * Provide an instance of TiledLayerBuffer backed by drawable TextureClients.
  * This buffer provides an implementation of ValidateTile using a
  * thebes callback and can support painting using a single paint buffer.
  * Whether a single paint buffer is used is controlled by
- * StaticPrefs::PerTileDrawing().
+ * gfxPrefs::PerTileDrawing().
  */
 class ClientSingleTiledLayerBuffer : public ClientTiledLayerBuffer,
                                      public TextureClientAllocator {
   virtual ~ClientSingleTiledLayerBuffer() = default;
 
  public:
   ClientSingleTiledLayerBuffer(ClientTiledPaintedLayer& aPaintedLayer,
                                CompositableClient& aCompositableClient,
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/layers/TextureClient.h"
 #include <stdint.h>  // for uint8_t, uint32_t, etc
 #include "Layers.h"  // for Layer, etc
 #include "gfx2DGlue.h"
 #include "gfxPlatform.h"  // for gfxPlatform
 #include "mozilla/Atomics.h"
-#include "mozilla/StaticPrefs.h"
 #include "mozilla/SystemGroup.h"
 #include "mozilla/ipc/SharedMemory.h"  // for SharedMemory, etc
 #include "mozilla/layers/CompositableForwarder.h"
 #include "mozilla/layers/ISurfaceAllocator.h"
 #include "mozilla/layers/ImageBridgeChild.h"
 #include "mozilla/layers/ImageDataSerializer.h"
 #include "mozilla/layers/PaintThread.h"
 #include "mozilla/layers/TextureClientRecycleAllocator.h"
@@ -28,16 +27,17 @@
 #include "mozilla/layers/TextureClientOGL.h"
 #include "mozilla/layers/PTextureChild.h"
 #include "mozilla/gfx/DataSurfaceHelpers.h"  // for CreateDataSourceSurfaceByCloning
 #include "nsPrintfCString.h"                 // for nsPrintfCString
 #include "LayersLogging.h"                   // for AppendToString
 #include "gfxUtils.h"                        // for gfxUtils::GetAsLZ4Base64Str
 #include "IPDLActor.h"
 #include "BufferTexture.h"
+#include "gfxPrefs.h"
 #include "mozilla/layers/ShadowLayers.h"
 #include "mozilla/ipc/CrossProcessSemaphore.h"
 
 #ifdef XP_WIN
 #  include "mozilla/gfx/DeviceManagerDx.h"
 #  include "mozilla/layers/TextureD3D11.h"
 #  include "mozilla/layers/TextureDIB.h"
 #  include "gfxWindowsPlatform.h"
@@ -1075,23 +1075,23 @@ already_AddRefed<TextureClient> TextureC
   if (!data && aLayersBackend == LayersBackend::LAYERS_OPENGL &&
       type == gfxSurfaceType::Xlib && aFormat != SurfaceFormat::A8 &&
       gl::sGLXLibrary.UseTextureFromPixmap()) {
     data = X11TextureData::Create(aSize, aFormat, aTextureFlags, aAllocator);
   }
 #endif
 
 #ifdef XP_MACOSX
-  if (!data && StaticPrefs::UseIOSurfaceTextures()) {
+  if (!data && gfxPrefs::UseIOSurfaceTextures()) {
     data = MacIOSurfaceTextureData::Create(aSize, aFormat, moz2DBackend);
   }
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
-  if (!data && StaticPrefs::UseSurfaceTextureTextures()) {
+  if (!data && gfxPrefs::UseSurfaceTextureTextures()) {
     data = AndroidNativeWindowTextureData::Create(aSize, aFormat);
   }
 #endif
 
   if (data) {
     return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator);
   }
 
@@ -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 (StaticPrefs::LayersDumpTexture()) {
+  if (gfxPrefs::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/TextureClientPool.cpp
+++ b/gfx/layers/client/TextureClientPool.cpp
@@ -4,17 +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 "TextureClientPool.h"
 #include "CompositableClient.h"
 #include "mozilla/layers/CompositableForwarder.h"
 #include "mozilla/layers/TextureForwarder.h"
 #include "mozilla/layers/TiledContentClient.h"
-#include "mozilla/StaticPrefs.h"
+
+#include "gfxPrefs.h"
 
 #include "nsComponentManagerUtils.h"
 
 #define TCP_LOG(...)
 //#define TCP_LOG(...) printf_stderr(__VA_ARGS__);
 
 namespace mozilla {
 namespace layers {
@@ -136,17 +137,17 @@ void TextureClientPool::AllocateTextureC
 
   if (mSupportsTextureDirectMapping &&
       std::max(mSize.width, mSize.height) <= mMaxTextureSize) {
     allocFlags =
         TextureAllocationFlags(allocFlags | ALLOC_ALLOW_DIRECT_MAPPING);
   }
 
   RefPtr<TextureClient> newClient;
-  if (StaticPrefs::ForceShmemTiles()) {
+  if (gfxPrefs::ForceShmemTiles()) {
     // gfx::BackendType::NONE means use the content backend
     newClient = TextureClient::CreateForRawBufferAccess(
         mSurfaceAllocator, mFormat, mSize, gfx::BackendType::NONE, mBackend,
         mFlags, allocFlags);
   } else {
     newClient = TextureClient::CreateForDrawing(
         mSurfaceAllocator, mFormat, mSize, mBackend, mMaxTextureSize,
         BackendSelector::Content, mFlags, allocFlags);
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -7,33 +7,33 @@
 #include "mozilla/layers/TiledContentClient.h"
 #include <math.h>  // for ceil, ceilf, floor
 #include <algorithm>
 #include "ClientTiledPaintedLayer.h"  // for ClientTiledPaintedLayer
 #include "GeckoProfiler.h"            // for AUTO_PROFILER_LABEL
 #include "ClientLayerManager.h"       // for ClientLayerManager
 #include "gfxContext.h"               // for gfxContext, etc
 #include "gfxPlatform.h"              // for gfxPlatform
+#include "gfxPrefs.h"                 // for gfxPrefs
 #include "gfxRect.h"                  // for gfxRect
 #include "mozilla/MathAlgorithms.h"   // for Abs
 #include "mozilla/gfx/Point.h"        // for IntSize
 #include "mozilla/gfx/Rect.h"         // for Rect
 #include "mozilla/gfx/Tools.h"        // for BytesPerPixel
 #include "mozilla/layers/CompositableForwarder.h"
 #include "mozilla/layers/CompositorBridgeChild.h"  // for CompositorBridgeChild
 #include "mozilla/layers/LayerMetricsWrapper.h"
 #include "mozilla/layers/ShadowLayers.h"  // for ShadowLayerForwarder
 #include "mozilla/layers/PaintThread.h"   // for PaintThread
 #include "TextureClientPool.h"
 #include "nsISupportsImpl.h"      // for gfxContext::AddRef, etc
 #include "nsExpirationTracker.h"  // for nsExpirationTracker
 #include "nsMathUtils.h"          // for NS_lroundf
 #include "LayersLogging.h"
 #include "UnitTransforms.h"  // for TransformTo
-#include "mozilla/StaticPrefs.h"
 #include "mozilla/UniquePtr.h"
 
 #ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
 #  include "cairo.h"
 #  include <sstream>
 using mozilla::layers::Layer;
 static void DrawDebugOverlay(mozilla::gfx::DrawTarget* dt, int x, int y,
                              int width, int height) {
@@ -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(StaticPrefs::APZDangerZoneX(), StaticPrefs::APZDangerZoneY()) /
+      LayerSize(gfxPrefs::APZDangerZoneX(), gfxPrefs::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 (!StaticPrefs::LayersTileRetainBackBuffer()) {
+    if (!gfxPrefs::LayersTileRetainBackBuffer()) {
       DiscardBackBuffer();
     }
     Flip();
   } else {
     if (!mBackBuffer || mBackBuffer->IsReadLocked()) {
       mBackBuffer.Set(this, CreateBackBufferTexture(mBackBuffer, aCompositable,
                                                     mAllocator));
       if (!mBackBuffer) {
@@ -673,17 +673,17 @@ Maybe<AcquiredBackBuffer> TileClient::Ac
   } else {
     target = backBuffer;
   }
 
   // Construct a capture draw target if necessary
   RefPtr<DrawTargetCapture> capture;
   if (aFlags & TilePaintFlags::Async) {
     capture = Factory::CreateCaptureDrawTargetForTarget(
-        target, StaticPrefs::LayersOMTPCaptureLimit());
+        target, gfxPrefs::LayersOMTPCaptureLimit());
     target = capture;
   }
 
   // Gather texture clients
   AutoTArray<RefPtr<TextureClient>, 4> clients;
   clients.AppendElement(RefPtr<TextureClient>(mBackBuffer));
   if (mBackBufferOnWhite) {
     clients.AppendElement(mBackBufferOnWhite);
--- a/gfx/layers/client/TiledContentClient.h
+++ b/gfx/layers/client/TiledContentClient.h
@@ -310,17 +310,17 @@ class SharedFrameMetricsHelper {
   bool mProgressiveUpdateWasInDanger;
 };
 
 /**
  * Provide an instance of TiledLayerBuffer backed by drawable TextureClients.
  * This buffer provides an implementation of ValidateTile using a
  * thebes callback and can support painting using a single paint buffer.
  * Whether a single paint buffer is used is controlled by
- * StaticPrefs::PerTileDrawing().
+ * gfxPrefs::PerTileDrawing().
  */
 class ClientTiledLayerBuffer {
  public:
   ClientTiledLayerBuffer(ClientTiledPaintedLayer& aPaintedLayer,
                          CompositableClient& aCompositableClient)
       : mPaintedLayer(aPaintedLayer),
         mCompositableClient(aCompositableClient),
         mLastPaintContentType(gfxContentType::COLOR),
--- 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,16 +30,17 @@
 #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
@@ -784,17 +785,17 @@ static bool SampleAnimations(Layer* aLay
         break;
     }
   });
 
   return isAnimating;
 }
 
 void AsyncCompositionManager::RecordShadowTransforms(Layer* aLayer) {
-  MOZ_ASSERT(StaticPrefs::CollectScrollTransforms());
+  MOZ_ASSERT(gfxPrefs::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 =
@@ -1467,33 +1468,33 @@ bool AsyncCompositionManager::TransformS
   }
 
   HostLayer* rootComposite = root->AsHostLayer();
 
   gfx::Matrix4x4 trans = rootComposite->GetShadowBaseTransform();
   trans *= gfx::Matrix4x4::From2D(mWorldTransform);
   rootComposite->SetShadowBaseTransform(trans);
 
-  if (StaticPrefs::CollectScrollTransforms()) {
+  if (gfxPrefs::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 (StaticPrefs::APZFixedMarginOverrideEnabled()) {
-    result.top = StaticPrefs::APZFixedMarginOverrideTop();
-    result.bottom = StaticPrefs::APZFixedMarginOverrideBottom();
+  if (gfxPrefs::APZFixedMarginOverrideEnabled()) {
+    result.top = gfxPrefs::APZFixedMarginOverrideTop();
+    result.bottom = gfxPrefs::APZFixedMarginOverrideBottom();
   }
   return result;
 }
 #endif  // defined(MOZ_WIDGET_ANDROID)
 
 }  // namespace layers
 }  // namespace mozilla
--- a/gfx/layers/composite/ContainerLayerComposite.cpp
+++ b/gfx/layers/composite/ContainerLayerComposite.cpp
@@ -5,19 +5,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ContainerLayerComposite.h"
 #include <algorithm>                         // for min
 #include "FrameMetrics.h"                    // for FrameMetrics
 #include "Units.h"                           // for LayerRect, LayerPixel, etc
 #include "CompositableHost.h"                // for CompositableHost
 #include "gfxEnv.h"                          // for gfxEnv
+#include "gfxPrefs.h"                        // for gfxPrefs
 #include "mozilla/Assertions.h"              // for MOZ_ASSERT, etc
 #include "mozilla/RefPtr.h"                  // for RefPtr
-#include "mozilla/StaticPrefs.h"             // for StaticPrefs
 #include "mozilla/UniquePtr.h"               // for UniquePtr
 #include "mozilla/gfx/BaseRect.h"            // for BaseRect
 #include "mozilla/gfx/Matrix.h"              // for Matrix4x4
 #include "mozilla/gfx/Point.h"               // for Point, IntPoint
 #include "mozilla/gfx/Rect.h"                // for IntRect, Rect
 #include "mozilla/layers/APZSampler.h"       // for APZSampler
 #include "mozilla/layers/Compositor.h"       // for Compositor, etc
 #include "mozilla/layers/CompositorTypes.h"  // for DiagnosticFlags::CONTAINER
@@ -427,17 +427,17 @@ void RenderLayers(ContainerT* aContainer
     const Maybe<gfx::Polygon>& childGeometry = preparedData.mGeometry;
 
     Layer* layer = layerToRender->GetLayer();
 
     if (layerToRender->HasStaleCompositor()) {
       continue;
     }
 
-    if (StaticPrefs::LayersDrawFPS()) {
+    if (gfxPrefs::LayersDrawFPS()) {
       for (const auto& metadata : layer->GetAllScrollMetadata()) {
         if (metadata.IsApzForceDisabled()) {
           aManager->DisabledApzWarning();
           break;
         }
       }
     }
 
@@ -468,21 +468,21 @@ void RenderLayers(ContainerT* aContainer
 
       if (geometry && isLeafLayer) {
         TransformLayerGeometry(layer, geometry);
       }
 
       layerToRender->RenderLayer(clipRect, geometry);
     }
 
-    if (StaticPrefs::UniformityInfo()) {
+    if (gfxPrefs::UniformityInfo()) {
       PrintUniformityInfo(layer);
     }
 
-    if (StaticPrefs::DrawLayerInfo()) {
+    if (gfxPrefs::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 (StaticPrefs::APZMinimap()) {
+      if (gfxPrefs::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,18 +645,17 @@ 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 (StaticPrefs::LayersDrawFPS() &&
-      aContainer->IsScrollableWithoutContent()) {
+  if (gfxPrefs::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 (StaticPrefs::LayersDrawFPS()) {
+      if (gfxPrefs::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 (!StaticPrefs::FPSPrintHistogram()) {
+  if (!gfxPrefs::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 (!StaticPrefs::WriteFPSToFile()) {
+  if (!gfxPrefs::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
@@ -20,17 +20,17 @@
 #include "LayerScope.h"                    // for LayerScope Tool
 #include "protobuf/LayerScopePacket.pb.h"  // for protobuf (LayerScope)
 #include "PaintedLayerComposite.h"         // for PaintedLayerComposite
 #include "TiledContentHost.h"
 #include "Units.h"                           // for ScreenIntRect
 #include "UnitTransforms.h"                  // for ViewAs
 #include "apz/src/AsyncPanZoomController.h"  // for AsyncPanZoomController
 #include "gfxEnv.h"                          // for gfxEnv
-
+#include "gfxPrefs.h"                        // for gfxPrefs
 #ifdef XP_MACOSX
 #  include "gfxPlatformMac.h"
 #endif
 #include "gfxRect.h"                    // for gfxRect
 #include "gfxUtils.h"                   // for frame color util
 #include "mozilla