Merge mozilla-central to autoland.
authorCosmin Sabou <csabou@mozilla.com>
Wed, 26 Jun 2019 07:00:06 +0300
changeset 542959 741653aeeb8eefc14d670bddb939199694a3001c
parent 542958 95654f223f59b98cfecfea1744f2e0c255366b51 (current diff)
parent 542956 07314de37ce5ffe85657614b2d48e55a02eb5d4d (diff)
child 542960 31e100717641c1b782eba27758c7aa5c95d9e899
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-central to autoland.
testing/web-platform/meta/css/cssom-view/scroll-behavior-subframe-root.html.ini
--- a/devtools/client/inspector/markup/markup-context-menu.js
+++ b/devtools/client/inspector/markup/markup-context-menu.js
@@ -581,16 +581,41 @@ class MarkupContextMenu {
         INSPECTOR_L10N.getStr("inspectorHTMLPasteLastChild.accesskey"),
       disabled: disableFirstLastPaste,
       click: () => this._pasteAdjacentHTML("beforeEnd"),
     }));
 
     return pasteSubmenu;
   }
 
+  _getPseudoClassSubmenu(isSelectionElement) {
+    const menu = new Menu();
+
+    // Set the pseudo classes
+    for (const name of PSEUDO_CLASSES) {
+      const menuitem = new MenuItem({
+        id: "node-menu-pseudo-" + name.substr(1),
+        label: name.substr(1),
+        type: "checkbox",
+        click: () => this.inspector.togglePseudoClass(name),
+      });
+
+      if (isSelectionElement) {
+        const checked = this.selection.nodeFront.hasPseudoClassLock(name);
+        menuitem.checked = checked;
+      } else {
+        menuitem.disabled = true;
+      }
+
+      menu.append(menuitem);
+    }
+
+    return menu;
+  }
+
   _openMenu({ target, screenX = 0, screenY = 0 } = {}) {
     if (this.selection.isSlotted()) {
       // Slotted elements should not show any context menu.
       return null;
     }
 
     const markupContainer = this.markup.getContainer(this.selection.nodeFront);
 
@@ -643,34 +668,62 @@ class MarkupContextMenu {
         INSPECTOR_L10N.getStr("inspectorAttributesSubmenu.accesskey"),
       submenu: this._getAttributesSubmenu(isEditableElement),
     }));
 
     menu.append(new MenuItem({
       type: "separator",
     }));
 
-    // Set the pseudo classes
-    for (const name of PSEUDO_CLASSES) {
-      const menuitem = new MenuItem({
-        id: "node-menu-pseudo-" + name.substr(1),
-        label: name.substr(1),
-        type: "checkbox",
-        click: () => this.inspector.togglePseudoClass(name),
-      });
+    menu.append(new MenuItem({
+      id: "node-menu-useinconsole",
+      label: INSPECTOR_L10N.getStr("inspectorUseInConsole.label"),
+      click: () => this._useInConsole(),
+    }));
+
+    menu.append(new MenuItem({
+      id: "node-menu-showdomproperties",
+      label: INSPECTOR_L10N.getStr("inspectorShowDOMProperties.label"),
+      click: () => this._showDOMProperties(),
+    }));
+
+    this._buildA11YMenuItem(menu);
+
+    if (this.selection.nodeFront.customElementLocation) {
+      menu.append(new MenuItem({
+        id: "node-menu-jumptodefinition",
+        label: INSPECTOR_L10N.getStr("inspectorCustomElementDefinition.label"),
+        click: () => this._jumpToCustomElementDefinition(),
+      }));
+    }
 
-      if (isSelectionElement) {
-        const checked = this.selection.nodeFront.hasPseudoClassLock(name);
-        menuitem.checked = checked;
-      } else {
-        menuitem.disabled = true;
-      }
+    menu.append(new MenuItem({
+      type: "separator",
+    }));
+
+    menu.append(new MenuItem({
+      label: INSPECTOR_L10N.getStr("inspectorPseudoClassSubmenu.label"),
+      submenu: this._getPseudoClassSubmenu(isSelectionElement),
+    }));
 
-      menu.append(menuitem);
-    }
+    menu.append(new MenuItem({
+      id: "node-menu-screenshotnode",
+      label: INSPECTOR_L10N.getStr("inspectorScreenshotNode.label"),
+      disabled: !isScreenshotable,
+      click: () => this.inspector.screenshotNode().catch(console.error),
+    }));
+
+    menu.append(new MenuItem({
+      id: "node-menu-scrollnodeintoview",
+      label: INSPECTOR_L10N.getStr("inspectorScrollNodeIntoView.label"),
+      accesskey:
+        INSPECTOR_L10N.getStr("inspectorScrollNodeIntoView.accesskey"),
+      disabled: !isSelectionElement,
+      click: () => this.markup.scrollNodeIntoView(),
+    }));
 
     menu.append(new MenuItem({
       type: "separator",
     }));
 
     menu.append(new MenuItem({
       label: INSPECTOR_L10N.getStr("inspectorCopyHTMLSubmenu.label"),
       submenu: this._getCopySubmenu(markupContainer, isSelectionElement),
@@ -695,59 +748,16 @@ class MarkupContextMenu {
     }));
     menu.append(new MenuItem({
       id: "node-menu-collapse",
       label: INSPECTOR_L10N.getStr("inspectorCollapseAll.label"),
       disabled: !isNodeWithChildren || !markupContainer.expanded,
       click: () => this.markup.collapseAll(this.selection.nodeFront),
     }));
 
-    menu.append(new MenuItem({
-      type: "separator",
-    }));
-
-    menu.append(new MenuItem({
-      id: "node-menu-scrollnodeintoview",
-      label: INSPECTOR_L10N.getStr("inspectorScrollNodeIntoView.label"),
-      accesskey:
-        INSPECTOR_L10N.getStr("inspectorScrollNodeIntoView.accesskey"),
-      disabled: !isSelectionElement,
-      click: () => this.markup.scrollNodeIntoView(),
-    }));
-    menu.append(new MenuItem({
-      id: "node-menu-screenshotnode",
-      label: INSPECTOR_L10N.getStr("inspectorScreenshotNode.label"),
-      disabled: !isScreenshotable,
-      click: () => this.inspector.screenshotNode().catch(console.error),
-    }));
-    menu.append(new MenuItem({
-      id: "node-menu-useinconsole",
-      label: INSPECTOR_L10N.getStr("inspectorUseInConsole.label"),
-      click: () => this._useInConsole(),
-    }));
-    menu.append(new MenuItem({
-      id: "node-menu-showdomproperties",
-      label: INSPECTOR_L10N.getStr("inspectorShowDOMProperties.label"),
-      click: () => this._showDOMProperties(),
-    }));
-
-    if (this.selection.nodeFront.customElementLocation) {
-      menu.append(new MenuItem({
-        type: "separator",
-      }));
-
-      menu.append(new MenuItem({
-        id: "node-menu-jumptodefinition",
-        label: INSPECTOR_L10N.getStr("inspectorCustomElementDefinition.label"),
-        click: () => this._jumpToCustomElementDefinition(),
-      }));
-    }
-
-    this._buildA11YMenuItem(menu);
-
     const nodeLinkMenuItems = this._getNodeLinkMenuItems();
     if (nodeLinkMenuItems.filter(item => item.visible).length > 0) {
       menu.append(new MenuItem({
         id: "node-menu-link-separator",
         type: "separator",
       }));
     }
 
--- a/devtools/client/locales/en-US/inspector.properties
+++ b/devtools/client/locales/en-US/inspector.properties
@@ -285,16 +285,20 @@ inspectorAttributesSubmenu.label=Attribu
 inspectorAttributesSubmenu.accesskey=A
 
 # LOCALIZATION NOTE (inspectorAddAttribute.label): This is the label shown in
 # the inspector contextual-menu for the item that lets users add attribute
 # to current node
 inspectorAddAttribute.label=Add Attribute
 inspectorAddAttribute.accesskey=A
 
+# LOCALIZATION NOTE (inspectorPseudoClassSubmenu.label): This is the label
+# shown in the inspector contextual-menu for the sub-menu of the pseudo-classes.
+inspectorPseudoClassSubmenu.label=Change Pseudo-class
+
 # LOCALIZATION NOTE (inspectorSearchHTML.label3): This is the label that is
 # shown as the placeholder for the markup view search in the inspector.
 inspectorSearchHTML.label3=Search HTML
 
 # LOCALIZATION NOTE (inspectorImageDataUri.label): This is the label
 # shown in the inspector contextual-menu for the item that lets users copy
 # the URL embedding the image data encoded in Base 64 (what we name
 # here Image Data URL). For more information:
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -134,16 +134,17 @@ static_assert(MAX_WORKERS_PER_DOMAIN >= 
 #define PREF_WORKERS_MAX_HARDWARE_CONCURRENCY "dom.maxHardwareConcurrency"
 
 #define PREF_MAX_SCRIPT_RUN_TIME_CONTENT "dom.max_script_run_time"
 #define PREF_MAX_SCRIPT_RUN_TIME_CHROME "dom.max_chrome_script_run_time"
 
 #define GC_REQUEST_OBSERVER_TOPIC "child-gc-request"
 #define CC_REQUEST_OBSERVER_TOPIC "child-cc-request"
 #define MEMORY_PRESSURE_OBSERVER_TOPIC "memory-pressure"
+#define MEMORY_PRESSURE_ONGOING_DATA "low-memory-ongoing"
 
 #define BROADCAST_ALL_WORKERS(_func, ...)                         \
   PR_BEGIN_MACRO                                                  \
   AssertIsOnMainThread();                                         \
                                                                   \
   AutoTArray<WorkerPrivate*, 100> workers;                        \
   {                                                               \
     MutexAutoLock lock(mMutex);                                   \
@@ -2194,19 +2195,23 @@ RuntimeService::Observe(nsISupports* aSu
     GarbageCollectAllWorkers(/* shrinking = */ false);
     return NS_OK;
   }
   if (!strcmp(aTopic, CC_REQUEST_OBSERVER_TOPIC)) {
     CycleCollectAllWorkers();
     return NS_OK;
   }
   if (!strcmp(aTopic, MEMORY_PRESSURE_OBSERVER_TOPIC)) {
-    GarbageCollectAllWorkers(/* shrinking = */ true);
-    CycleCollectAllWorkers();
-    MemoryPressureAllWorkers();
+    // Don't continue to GC/CC if we are in an ongoing low-memory state since
+    // its very slow and it likely won't help us anyway.
+    if (!nsDependentString(aData).EqualsLiteral(MEMORY_PRESSURE_ONGOING_DATA)) {
+      GarbageCollectAllWorkers(/* shrinking = */ true);
+      CycleCollectAllWorkers();
+      MemoryPressureAllWorkers();
+    }
     return NS_OK;
   }
   if (!strcmp(aTopic, NS_IOSERVICE_OFFLINE_STATUS_TOPIC)) {
     SendOfflineStatusChangeEventToAllWorkers(NS_IsOffline());
     return NS_OK;
   }
 
   MOZ_ASSERT_UNREACHABLE("Unknown observer topic!");
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -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(StaticPrefs::apz_printtree);
 #if defined(MOZ_WIDGET_ANDROID)
   if (jni::IsFennec()) {
     mToolbarAnimator = new AndroidDynamicToolbarAnimator(this);
   }
 #endif  // (MOZ_WIDGET_ANDROID)
 }
 
 APZCTreeManager::~APZCTreeManager() = default;
@@ -601,17 +601,17 @@ APZCTreeManager::UpdateHitTestingTreeImp
   SendSubtreeTransformsToChromeMainThread(nullptr);
 }
 
 void APZCTreeManager::UpdateFocusState(LayersId aRootLayerTreeId,
                                        LayersId aOriginatingLayersId,
                                        const FocusTarget& aFocusTarget) {
   AssertOnUpdaterThread();
 
-  if (!StaticPrefs::APZKeyboardEnabled()) {
+  if (!StaticPrefs::apz_keyboard_enabled()) {
     return;
   }
 
   mFocusState.Update(aRootLayerTreeId, aOriginatingLayersId, aFocusTarget);
 }
 
 void APZCTreeManager::UpdateHitTestingTree(Layer* aRoot, bool aIsFirstPaint,
                                            LayersId aOriginatingLayersId,
@@ -1314,17 +1314,17 @@ nsEventStatus APZCTreeManager::ReceiveIn
           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 = StaticPrefs::apz_drag_enabled();
         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);
@@ -1539,18 +1539,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 (!StaticPrefs::apz_keyboard_enabled() ||
+          StaticPrefs::accessibility_browsewithcaret()) {
         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);
@@ -1736,18 +1736,19 @@ 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() &&
-        hitScrollbarNode && hitScrollbarNode->IsScrollThumbNode() &&
+        StaticPrefs::apz_drag_enabled() &&
+        StaticPrefs::apz_touch_drag_enabled() && 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) {
         // If there's any unknown items in the list, throw it out and we'll
@@ -1919,17 +1920,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 (StaticPrefs::apz_drag_initial_enabled() &&
       // 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());
@@ -2383,17 +2384,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 && !StaticPrefs::apz_allow_immediate_handoff() &&
       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();
--- a/gfx/layers/apz/src/APZInputBridge.cpp
+++ b/gfx/layers/apz/src/APZInputBridge.cpp
@@ -60,17 +60,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 (StaticPrefs::apz_allow_zooming()) {
         mouseEvent.mIgnoreRootScrollFrame = true;
       }
 
       if (WillHandleMouseEvent(mouseEvent)) {
         MouseInput input(mouseEvent);
         input.mOrigin =
             ScreenPoint(mouseEvent.mRefPoint.x, mouseEvent.mRefPoint.y);
 
--- a/gfx/layers/apz/src/AndroidAPZ.cpp
+++ b/gfx/layers/apz/src/AndroidAPZ.cpp
@@ -50,39 +50,40 @@ AndroidSpecificState::AndroidSpecificSta
     return;
   }
   mOverScroller = scroller;
 }
 
 AsyncPanZoomAnimation* AndroidSpecificState::CreateFlingAnimation(
     AsyncPanZoomController& aApzc, const FlingHandoffState& aHandoffState,
     float aPLPPI) {
-  if (StaticPrefs::APZUseChromeFlingPhysics()) {
+  if (StaticPrefs::apz_android_chrome_fling_physics_enabled()) {
     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 (StaticPrefs::apz_android_chrome_fling_physics_enabled()) {
     return MakeUnique<AndroidVelocityTracker>();
   }
   return MakeUnique<SimpleVelocityTracker>(aAxis);
 }
 
 /* static */
 void AndroidSpecificState::InitializeGlobalState() {
-  // Not conditioned on StaticPrefs::APZUseChromeFlingPhysics() because
-  // the pref is live.
+  // Not conditioned on
+  // StaticPrefs::apz_android_chrome_fling_physics_enabled() 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.
 // The Android OverScroller class (unfortunately) operates in integers instead
@@ -162,18 +163,19 @@ 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() <
+            StaticPrefs::apz_fling_accel_interval_ms() &&
+        velocity.Length() >= StaticPrefs::apz_fling_accel_interval_ms()) {
       bool unused = false;
       mOverScroller->ComputeScrollOffset(flingDuration.ToMilliseconds(),
                                          &unused);
     } else {
       mOverScroller->ForceFinished(true);
     }
   }
   mOverScroller->Fling(
@@ -237,19 +239,19 @@ bool StackScrollerFlingAnimation::DoSamp
     shouldContinueFling = false;
   } else if (hitBoundX && hitBoundY) {
     // We can't scroll any farther along either axis.
     shouldContinueFling = false;
   }
 
   float speed = velocity.Length();
 
-  // StaticPrefs::APZFlingStoppedThreshold is only used in tests.
+  // StaticPrefs::apz_fling_stopped_threshold is only used in tests.
   if (!shouldContinueFling ||
-      (speed < StaticPrefs::APZFlingStoppedThreshold())) {
+      (speed < StaticPrefs::apz_fling_stopped_threshold())) {
     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/AndroidFlingPhysics.cpp
+++ b/gfx/layers/apz/src/AndroidFlingPhysics.cpp
@@ -28,38 +28,39 @@ 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 StaticPrefs::apz_android_chrome_fling_physics_friction();
 }
 
 // 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 =
+      StaticPrefs::apz_android_chrome_fling_physics_inflexion();
   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 StaticPrefs::apz_android_chrome_fling_physics_stop_threshold();
 }
 
 static double ComputeSplineDeceleration(ParentLayerCoord aVelocity,
                                         double aTuningCoeff) {
   float velocityPerSec = aVelocity * 1000.0f;
   return std::log(GetInflexion() * velocityPerSec /
                   (GetFlingFriction() * aTuningCoeff));
 }
--- a/gfx/layers/apz/src/AndroidVelocityTracker.cpp
+++ b/gfx/layers/apz/src/AndroidVelocityTracker.cpp
@@ -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 = StaticPrefs::apz_velocity_relevance_time_ms();
   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
@@ -610,17 +610,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())),
+            StaticPrefs::apz_zoom_animation_duration_ms())),
         mStartOffset(aStartOffset),
         mStartZoom(aStartZoom),
         mEndOffset(aEndOffset),
         mEndZoom(aEndZoom) {}
 
   virtual bool DoSample(FrameMetrics& aFrameMetrics,
                         const TimeDuration& aDelta) override {
     mDuration += aDelta;
@@ -810,19 +810,21 @@ void AsyncPanZoomController::InitializeG
   if (sInitialized) return;
   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()));
+  gVelocityCurveFunction = new ComputedTimingFunction(
+      nsTimingFunction(StaticPrefs::apz_fling_curve_function_x1(),
+                       StaticPrefs::apz_fling_curve_function_y1(),
+                       StaticPrefs::apz_fling_curve_function_x2(),
+                       StaticPrefs::apz_fling_curve_function_y2()));
   ClearOnShutdown(&gVelocityCurveFunction);
 
   uint64_t sysmem = PR_GetPhysicalMemorySize();
   uint64_t threshold = 1LL << 32;  // 4 GB in bytes
   gIsHighMemSystem = sysmem >= threshold;
 
   PlatformSpecificState::InitializeGlobalState();
 }
@@ -840,17 +842,17 @@ AsyncPanZoomController::AsyncPanZoomCont
       mTreeManager(aTreeManager),
       mRecursiveMutex("AsyncPanZoomController"),
       mLastContentPaintMetrics(mLastContentPaintMetadata.GetMetrics()),
       mX(this),
       mY(this),
       mPanDirRestricted(false),
       mPinchLocked(false),
       mPinchEventBuffer(TimeDuration::FromMilliseconds(
-          StaticPrefs::APZPinchLockBufferMaxAge())),
+          StaticPrefs::apz_pinch_lock_buffer_max_age())),
       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 +935,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 (StaticPrefs::apz_touch_start_tolerance() * GetDPI());
 }
 
 ScreenCoord AsyncPanZoomController::GetTouchMoveTolerance() const {
-  return (StaticPrefs::APZTouchMoveTolerance() * GetDPI());
+  return (StaticPrefs::apz_touch_move_tolerance() * GetDPI());
 }
 
 ScreenCoord AsyncPanZoomController::GetSecondTapTolerance() const {
-  return (StaticPrefs::APZSecondTapTolerance() * GetDPI());
+  return (StaticPrefs::apz_second_tap_tolerance() * GetDPI());
 }
 
 /* static */ AsyncPanZoomController::AxisLockMode
 AsyncPanZoomController::GetAxisLockMode() {
-  return static_cast<AxisLockMode>(StaticPrefs::APZAxisLockMode());
+  return static_cast<AxisLockMode>(StaticPrefs::apz_axis_lock_mode());
 }
 
 /* static */ AsyncPanZoomController::PinchLockMode
 AsyncPanZoomController::GetPinchLockMode() {
-  return static_cast<PinchLockMode>(StaticPrefs::APZPinchLockMode());
+  return static_cast<PinchLockMode>(StaticPrefs::apz_pinch_lock_mode());
 }
 
 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 +1009,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 (!StaticPrefs::apz_drag_enabled()) {
     return nsEventStatus_eIgnore;
   }
 
   if (!GetApzcTreeManager()) {
     return nsEventStatus_eConsumeNoDefault;
   }
 
   if (aEvent.mType == MouseInput::MouseType::MOUSE_UP) {
@@ -1561,17 +1563,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 (!StaticPrefs::apz_allow_zooming()) {
     if (RefPtr<GeckoContentController> controller =
             GetGeckoContentController()) {
       controller->NotifyPinchGesture(aEvent.mType, GetGuid(), 0,
                                      aEvent.modifiers);
     }
   }
 
   SetState(PINCHING);
@@ -1608,17 +1610,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 (!StaticPrefs::apz_allow_zooming()) {
     if (RefPtr<GeckoContentController> controller =
             GetGeckoContentController()) {
       controller->NotifyPinchGesture(
           aEvent.mType, GetGuid(),
           ViewAs<LayoutDevicePixel>(
               aEvent.mCurrentSpan - aEvent.mPreviousSpan,
               PixelCastJustification::LayoutDeviceIsParentLayerForRCDRSF),
           aEvent.modifiers);
@@ -1698,17 +1700,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 = StaticPrefs::apz_scale_repaint_delay_ms();
         if (delay >= 0) {
           if (RefPtr<GeckoContentController> controller =
                   GetGeckoContentController()) {
             mPinchPaintTimerSet = true;
             controller->PostDelayedTask(
                 NewRunnableMethod(
                     "layers::AsyncPanZoomController::"
                     "DoDelayedRequestContentRepaint",
@@ -1742,17 +1744,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 (!StaticPrefs::apz_allow_zooming()) {
     if (RefPtr<GeckoContentController> controller =
             GetGeckoContentController()) {
       controller->NotifyPinchGesture(aEvent.mType, GetGuid(), 0,
                                      aEvent.modifiers);
     }
   }
 
   {
@@ -1835,19 +1837,20 @@ 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()) {
+           StaticPrefs::apz_fling_min_velocity_threshold());
+
+  if (flingVelocity.Length() <
+      StaticPrefs::apz_fling_min_velocity_threshold()) {
     // 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;
   }
 
@@ -2249,17 +2252,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 (!StaticPrefs::apz_allow_immediate_handoff()) {
     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);
       }
     }
   }
@@ -2925,47 +2928,48 @@ 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,
+                                   StaticPrefs::apz_axis_lock_lock_angle())) {
         mY.SetAxisLocked(true);
         SetState(PANNING_LOCKED_X);
-      } else if (apz::IsCloseToVertical(aAngle,
-                                        StaticPrefs::APZAxisLockAngle())) {
+      } else if (apz::IsCloseToVertical(
+                     aAngle, StaticPrefs::apz_axis_lock_lock_angle())) {
         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())) {
+    if (apz::IsCloseToHorizontal(
+            aAngle, StaticPrefs::apz_axis_lock_direct_pan_angle())) {
       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())) {
+                               StaticPrefs::apz_axis_lock_direct_pan_angle())) {
       mX.SetAxisLocked(true);
       SetState(PANNING_LOCKED_Y);
       mPanDirRestricted = true;
     } else {
       SetState(NOTHING);
     }
   } else {
     SetState(NOTHING);
@@ -2988,23 +2992,24 @@ 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, StaticPrefs::apz_axis_lock_lock_angle())) {
     mY.SetAxisLocked(true);
     if (canScrollHorizontal) {
       SetState(PANNING_LOCKED_X);
     }
-  } else if (apz::IsCloseToVertical(aAngle, StaticPrefs::APZAxisLockAngle())) {
+  } else if (apz::IsCloseToVertical(aAngle,
+                                    StaticPrefs::apz_axis_lock_lock_angle())) {
     mX.SetAxisLocked(true);
     if (canScrollVertical) {
       SetState(PANNING_LOCKED_Y);
     }
   } else {
     SetState(PANNING);
   }
 }
@@ -3014,29 +3019,30 @@ 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 =
+        StaticPrefs::apz_axis_lock_breakout_threshold() * GetDPI();
 
     if (fabs(aPanDistance.x) > breakThreshold ||
         fabs(aPanDistance.y) > breakThreshold) {
       if (mState == PANNING_LOCKED_X) {
-        if (!apz::IsCloseToHorizontal(angle,
-                                      StaticPrefs::APZAxisBreakoutAngle())) {
+        if (!apz::IsCloseToHorizontal(
+                angle, StaticPrefs::apz_axis_lock_breakout_angle())) {
           mY.SetAxisLocked(false);
           SetState(PANNING);
         }
       } else if (mState == PANNING_LOCKED_Y) {
-        if (!apz::IsCloseToVertical(angle,
-                                    StaticPrefs::APZAxisBreakoutAngle())) {
+        if (!apz::IsCloseToVertical(
+                angle, StaticPrefs::apz_axis_lock_breakout_angle())) {
           mX.SetAxisLocked(false);
           SetState(PANNING);
         }
       }
     }
   }
 }
 
@@ -3070,25 +3076,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();
+          StaticPrefs::apz_pinch_lock_span_breakout_threshold() * GetDPI();
       mPinchLocked = !(spanDistance > spanBreakoutThreshold);
     }
   } else {
     if (GetPinchLockMode() != PINCH_FREE) {
       ScreenCoord spanLockThreshold =
-          StaticPrefs::APZPinchLockSpanLockThreshold() * GetDPI();
+          StaticPrefs::apz_pinch_lock_span_lock_threshold() * GetDPI();
       ScreenCoord scrollLockThreshold =
-          StaticPrefs::APZPinchLockScrollLockThreshold() * GetDPI();
+          StaticPrefs::apz_pinch_lock_scroll_lock_threshold() * GetDPI();
 
       if (spanDistance < spanLockThreshold &&
           focusChange.Length() > scrollLockThreshold) {
         mPinchLocked = true;
       }
     }
   }
 }
@@ -3252,30 +3258,30 @@ 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) {
+        StaticPrefs::apz_overscroll_min_pan_distance_ratio() * aPanDistance.y) {
       aOverscroll.x = 0;
     }
     if (aPanDistance.y <
-        StaticPrefs::APZMinPanDistanceRatio() * aPanDistance.x) {
+        StaticPrefs::apz_overscroll_min_pan_distance_ratio() * aPanDistance.x) {
       aOverscroll.y = 0;
     }
   }
 
   OverscrollBy(aOverscroll);
 }
 
 void AsyncPanZoomController::OverscrollBy(ParentLayerPoint& aOverscroll) {
-  if (!StaticPrefs::APZOverscrollEnabled()) {
+  if (!StaticPrefs::apz_overscroll_enabled()) {
     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 +3338,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() < StaticPrefs::apz_fling_min_velocity_threshold()) {
     // 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 +3409,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()) {
+        StaticPrefs::apz_overscroll_enabled()) {
       // Obey overscroll-behavior.
       RecursiveMutexAutoLock lock(mRecursiveMutex);
       if (!mX.OverscrollBehaviorAllowsOverscrollEffect()) {
         residualVelocity.x = 0;
       }
       if (!mY.OverscrollBehaviorAllowsOverscrollEffect()) {
         residualVelocity.y = 0;
       }
@@ -3661,50 +3667,50 @@ void AsyncPanZoomController::ScaleWithFo
 }
 
 /**
  * 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();
+      fabsf(aVelocity.x) < StaticPrefs::apz_min_skate_speed();
   bool yIsStationarySpeed =
-      fabsf(aVelocity.y) < StaticPrefs::APZMinSkateSpeed();
+      fabsf(aVelocity.y) < StaticPrefs::apz_min_skate_speed();
   float xMultiplier = xIsStationarySpeed
-                          ? StaticPrefs::APZXStationarySizeMultiplier()
-                          : StaticPrefs::APZXSkateSizeMultiplier();
+                          ? StaticPrefs::apz_x_stationary_size_multiplier()
+                          : StaticPrefs::apz_x_skate_size_multiplier();
   float yMultiplier = yIsStationarySpeed
-                          ? StaticPrefs::APZYStationarySizeMultiplier()
-                          : StaticPrefs::APZYSkateSizeMultiplier();
+                          ? StaticPrefs::apz_y_stationary_size_multiplier()
+                          : StaticPrefs::apz_y_skate_size_multiplier();
 
   if (IsHighMemSystem() && !xIsStationarySpeed) {
-    xMultiplier += StaticPrefs::APZXSkateHighMemAdjust();
+    xMultiplier += StaticPrefs::apz_x_skate_highmem_adjust();
   }
 
   if (IsHighMemSystem() && !yIsStationarySpeed) {
-    yMultiplier += StaticPrefs::APZYSkateHighMemAdjust();
+    yMultiplier += StaticPrefs::apz_y_skate_highmem_adjust();
   }
 
   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()) /
+    dangerZone = LayerSize(StaticPrefs::apz_danger_zone_x(),
+                           StaticPrefs::apz_danger_zone_y()) /
                  aFrameMetrics.LayersPixelsPerCSSPixel();
   }
   const CSSSize compositionSize =
       aFrameMetrics.CalculateBoundedCompositedSizeInCssPixels();
 
   const float xSize = std::max(aDisplayPortSize.width,
                                compositionSize.width + (2 * dangerZone.width));
 
@@ -3754,17 +3760,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 (StaticPrefs::apz_enlarge_displayport_when_clipped()) {
     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 +3779,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 * StaticPrefs::apz_velocity_bias());
 
   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();
@@ -3838,17 +3844,17 @@ bool AsyncPanZoomController::SnapBackIfO
     ScrollSnap();
   }
   return false;
 }
 
 bool AsyncPanZoomController::IsFlingingFast() const {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
   if (mState == FLING && GetVelocityVector().Length() >
-                             StaticPrefs::APZFlingStopOnTapThreshold()) {
+                             StaticPrefs::apz_fling_stop_on_tap_threshold()) {
     APZC_LOG("%p is moving fast\n", this);
     return true;
   }
   return false;
 }
 
 bool AsyncPanZoomController::IsPannable() const {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
@@ -4201,17 +4207,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 (StaticPrefs::apz_allow_zooming() && Metrics().IsRootContent() &&
           Metrics().GetVisualViewport().Size() <=
               Metrics().GetLayoutViewport().Size())
              ? GetCurrentAsyncViewportTransform(aMode)
              : GetCurrentAsyncTransform(aMode);
 }
 
 AsyncTransformComponentMatrix
 AsyncPanZoomController::GetCurrentAsyncTransformWithOverscroll(
@@ -4229,33 +4235,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 (StaticPrefs::apz_frame_delay_enabled() && aMode == eForCompositing) {
     return mCompositedLayoutViewport;
   }
   return Metrics().GetLayoutViewport();
 }
 
 CSSPoint AsyncPanZoomController::GetEffectiveScrollOffset(
     AsyncTransformConsumer aMode) const {
-  if (StaticPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
+  if (StaticPrefs::apz_frame_delay_enabled() && aMode == eForCompositing) {
     return mCompositedScrollOffset;
   }
   return Metrics().GetScrollOffset();
 }
 
 CSSToParentLayerScale2D AsyncPanZoomController::GetEffectiveZoom(
     AsyncTransformConsumer aMode) const {
-  if (StaticPrefs::APZFrameDelayEnabled() && aMode == eForCompositing) {
+  if (StaticPrefs::apz_frame_delay_enabled() && aMode == eForCompositing) {
     return mCompositedZoom;
   }
   return Metrics().GetZoom();
 }
 
 bool AsyncPanZoomController::SampleCompositedAsyncTransform() {
   RecursiveMutexAutoLock lock(mRecursiveMutex);
   if (!mCompositedLayoutViewport.IsEqualEdges(Metrics().GetLayoutViewport()) ||
@@ -4341,17 +4347,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 = StaticPrefs::apz_record_checkerboarding();
   bool forTelemetry = Telemetry::CanRecordExtended();
   uint32_t magnitude = GetCheckerboardMagnitude();
 
   MutexAutoLock lock(mCheckerboardEventLock);
   if (!mCheckerboardEvent && (recordTrace || forTelemetry)) {
     mCheckerboardEvent = MakeUnique<CheckerboardEvent>(recordTrace);
   }
   mPotentialCheckerboardTracker.InTransform(IsTransformingState(mState));
@@ -4370,17 +4376,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 (StaticPrefs::apz_record_checkerboarding()) {
       // 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;
@@ -4680,17 +4686,18 @@ 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 (StaticPrefs::apz_relative_update_enabled() &&
+          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.
@@ -4755,17 +4762,18 @@ 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 (StaticPrefs::apz_relative_update_enabled() &&
+        aLayerMetrics.IsRelative()) {
       Metrics().ApplyRelativeSmoothScrollUpdateFrom(aLayerMetrics);
     } else {
       Metrics().ApplySmoothScrollUpdateFrom(aLayerMetrics);
     }
     needContentRepaint = true;
     mExpectedGeckoMetrics = aLayerMetrics;
 
     SmoothScrollTo(Metrics().GetSmoothScrollOffset());
@@ -5292,17 +5300,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 = StaticPrefs::apz_fling_friction();
   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,19 +1157,19 @@ 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|.
-   * Otherwise, GetCurrentAsyncTransform() always reflects what's stored in
-   * |Metrics()| immediately, without any delay.)
+   * (This is only relevant when StaticPrefs::apz_frame_delay_enabled() is
+   * 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,
    * which deals with async movement of the visual viewport). That is, when
    * this transform is multiplied with the layer's existing transform, it will
--- a/gfx/layers/apz/src/DesktopFlingPhysics.h
+++ b/gfx/layers/apz/src/DesktopFlingPhysics.h
@@ -20,18 +20,18 @@ namespace layers {
 class DesktopFlingPhysics {
  public:
   void Init(const ParentLayerPoint& aStartingVelocity,
             float aPLPPI /* unused */) {
     mVelocity = aStartingVelocity;
   }
   void Sample(const TimeDuration& aDelta, ParentLayerPoint* aOutVelocity,
               ParentLayerPoint* aOutOffset) {
-    float friction = StaticPrefs::APZFlingFriction();
-    float threshold = StaticPrefs::APZFlingStoppedThreshold();
+    float friction = StaticPrefs::apz_fling_friction();
+    float threshold = StaticPrefs::apz_fling_stopped_threshold();
 
     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
@@ -133,17 +133,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 (StaticPrefs::apz_keyboard_passive_listeners()) {
     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
@@ -89,18 +89,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()) {
+            StaticPrefs::apz_fling_accel_interval_ms() &&
+        velocity.Length() >= StaticPrefs::apz_fling_accel_min_velocity()) {
       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 +215,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 * StaticPrefs::apz_fling_accel_base_mult()) +
+           (aSupplemental * StaticPrefs::apz_fling_accel_supplemental_mult());
   }
 
   AsyncPanZoomController& mApzc;
   RefPtr<const OverscrollHandoffChain> mOverscrollHandoffChain;
   RefPtr<const AsyncPanZoomController> mScrolledApzc;
 };
 
 }  // namespace layers
--- a/gfx/layers/apz/src/GestureEventListener.cpp
+++ b/gfx/layers/apz/src/GestureEventListener.cpp
@@ -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 StaticPrefs::apz_max_tap_time()),
       // change state.
       if (MoveDistanceIsLarge()) {
         CancelLongTapTimeoutTask();
         CancelMaxTapTimeoutTask();
         mSingleTapSent = Nothing();
-        if (!StaticPrefs::APZOneTouchPinchEnabled()) {
+        if (!StaticPrefs::apz_one_touch_pinch_enabled()) {
           // 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);
 
@@ -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());
+                                           StaticPrefs::apz_max_tap_time());
 }
 
 }  // namespace layers
 }  // namespace mozilla
--- a/gfx/layers/apz/src/InputBlockState.cpp
+++ b/gfx/layers/apz/src/InputBlockState.cpp
@@ -145,17 +145,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 || (StaticPrefs::apz_allow_immediate_handoff()
                                     ? IsDownchainOf(mScrolledApzc, aApzc)
                                     : mScrolledApzc == aApzc));
 
   mScrolledApzc = aApzc;
 }
 
 AsyncPanZoomController* InputBlockState::GetScrolledApzc() const {
   return mScrolledApzc;
@@ -778,18 +778,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();
+                              ? StaticPrefs::apz_axis_lock_lock_angle()
+                              : StaticPrefs::apz_axis_lock_direct_pan_angle();
   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
@@ -103,17 +103,17 @@ class InputBlockState : public RefCounte
   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
+  // StaticPrefs::apz_allow_immediate_handoff() 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
--- a/gfx/layers/apz/src/InputQueue.cpp
+++ b/gfx/layers/apz/src/InputQueue.cpp
@@ -314,17 +314,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 StaticPrefs::apz_keyboard_passive_listeners()
              ? nsEventStatus_eConsumeDoDefault
              : nsEventStatus_eConsumeNoDefault;
 }
 
 static bool CanScrollTargetHorizontally(const PanGestureInput& aInitialEvent,
                                         PanGestureBlockState* aBlock) {
   PanGestureInput horizontalComponent = aInitialEvent;
   horizontalComponent.mPanDisplacement.y = 0;
@@ -547,17 +547,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 = StaticPrefs::apz_content_response_timeout();
   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/SimpleVelocityTracker.cpp
+++ b/gfx/layers/apz/src/SimpleVelocityTracker.cpp
@@ -81,51 +81,53 @@ 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 < StaticPrefs::apz_velocity_relevance_time_ms()) {
       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() > StaticPrefs::apz_max_velocity_queue_size()) {
     mVelocityQueue.RemoveElementAt(0);
   }
 }
 
 float SimpleVelocityTracker::ApplyFlingCurveToVelocity(float aVelocity) const {
   float newVelocity = aVelocity;
-  if (StaticPrefs::APZMaxVelocity() > 0.0f) {
+  if (StaticPrefs::apz_max_velocity_inches_per_ms() > 0.0f) {
     bool velocityIsNegative = (newVelocity < 0);
     newVelocity = fabs(newVelocity);
 
-    float maxVelocity = mAxis->ToLocalVelocity(StaticPrefs::APZMaxVelocity());
+    float maxVelocity =
+        mAxis->ToLocalVelocity(StaticPrefs::apz_max_velocity_inches_per_ms());
     newVelocity = std::min(newVelocity, maxVelocity);
 
-    if (StaticPrefs::APZCurveThreshold() > 0.0f &&
-        StaticPrefs::APZCurveThreshold() < StaticPrefs::APZMaxVelocity()) {
-      float curveThreshold =
-          mAxis->ToLocalVelocity(StaticPrefs::APZCurveThreshold());
+    if (StaticPrefs::apz_fling_curve_threshold_inches_per_ms() > 0.0f &&
+        StaticPrefs::apz_fling_curve_threshold_inches_per_ms() <
+            StaticPrefs::apz_max_velocity_inches_per_ms()) {
+      float curveThreshold = mAxis->ToLocalVelocity(
+          StaticPrefs::apz_fling_curve_threshold_inches_per_ms());
       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/test/gtest/TestPinching.cpp
+++ b/gfx/layers/apz/test/gtest/TestPinching.cpp
@@ -156,47 +156,50 @@ 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();
+        StaticPrefs::apz_pinch_lock_scroll_lock_threshold() * 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();
+        StaticPrefs::apz_pinch_lock_span_breakout_threshold() * 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();
+        StaticPrefs::apz_pinch_lock_span_breakout_threshold() * 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() &&
@@ -247,32 +250,32 @@ TEST_F(APZCPinchGestureDetectorTester,
 
 TEST_F(APZCPinchGestureDetectorTester,
        Pinch_UseGestureDetector_TouchActionNone_NoAPZZoom) {
   SCOPED_GFX_PREF_BOOL("layout.css.touch_action.enabled", true);
   SCOPED_GFX_PREF_BOOL("apz.allow_zooming", false);
 
   // Since we are preventing the pinch action via touch-action we should not be
   // sending the pinch gesture notifications that would normally be sent when
-  // APZAllowZooming is false.
+  // apz_allow_zooming is false.
   EXPECT_CALL(*mcc, NotifyPinchGesture(_, _, _, _)).Times(0);
   nsTArray<uint32_t> behaviors = {mozilla::layers::AllowedTouchBehavior::NONE,
                                   mozilla::layers::AllowedTouchBehavior::NONE};
   DoPinchTest(false, &behaviors);
 }
 
 TEST_F(APZCPinchGestureDetectorTester, Pinch_PreventDefault) {
   DoPinchWithPreventDefaultTest();
 }
 
 TEST_F(APZCPinchGestureDetectorTester, Pinch_PreventDefault_NoAPZZoom) {
   SCOPED_GFX_PREF_BOOL("apz.allow_zooming", false);
 
   // Since we are preventing the pinch action we should not be sending the pinch
-  // gesture notifications that would normally be sent when APZAllowZooming is
+  // gesture notifications that would normally be sent when apz_allow_zooming is
   // false.
   EXPECT_CALL(*mcc, NotifyPinchGesture(_, _, _, _)).Times(0);
 
   DoPinchWithPreventDefaultTest();
 }
 
 TEST_F(APZCPinchGestureDetectorTester, Panning_TwoFingerFling_ZoomDisabled) {
   SCOPED_GFX_PREF_FLOAT("apz.fling_min_velocity_threshold", 0.0f);
@@ -430,21 +433,21 @@ TEST_F(APZCPinchTester, Panning_Beyond_L
 }
 
 TEST_F(APZCPinchGestureDetectorTester, Pinch_APZZoom_Disabled) {
   SCOPED_GFX_PREF_BOOL("apz.allow_zooming", false);
 
   FrameMetrics originalMetrics = GetPinchableFrameMetrics();
   apzc->SetFrameMetrics(originalMetrics);
 
-  // When APZAllowZooming is false, the ZoomConstraintsClient produces
+  // When apz_allow_zooming is false, the ZoomConstraintsClient produces
   // ZoomConstraints with mAllowZoom set to false.
   MakeApzcUnzoomable();
 
-  // With APZAllowZooming false, we expect the NotifyPinchGesture function to
+  // With apz_allow_zooming false, we expect the NotifyPinchGesture function to
   // get called as the pinch progresses, but the metrics shouldn't change.
   EXPECT_CALL(*mcc,
               NotifyPinchGesture(PinchGestureInput::PINCHGESTURE_START,
                                  apzc->GetGuid(), LayoutDeviceCoord(0), _))
       .Times(1);
   EXPECT_CALL(*mcc, NotifyPinchGesture(PinchGestureInput::PINCHGESTURE_SCALE,
                                        apzc->GetGuid(), _, _))
       .Times(AtLeast(1));
@@ -469,21 +472,21 @@ TEST_F(APZCPinchGestureDetectorTester, P
 
 TEST_F(APZCPinchGestureDetectorTester, Pinch_NoSpan) {
   SCOPED_GFX_PREF_BOOL("apz.allow_zooming", false);
   SCOPED_GFX_PREF_BOOL("layout.css.touch_action.enabled", false);
 
   FrameMetrics originalMetrics = GetPinchableFrameMetrics();
   apzc->SetFrameMetrics(originalMetrics);
 
-  // When APZAllowZooming is false, the ZoomConstraintsClient produces
+  // When apz_allow_zooming is false, the ZoomConstraintsClient produces
   // ZoomConstraints with mAllowZoom set to false.
   MakeApzcUnzoomable();
 
-  // With APZAllowZooming false, we expect the NotifyPinchGesture function to
+  // With apz_allow_zooming false, we expect the NotifyPinchGesture function to
   // get called as the pinch progresses, but the metrics shouldn't change.
   EXPECT_CALL(*mcc,
               NotifyPinchGesture(PinchGestureInput::PINCHGESTURE_START,
                                  apzc->GetGuid(), LayoutDeviceCoord(0), _))
       .Times(1);
   EXPECT_CALL(*mcc, NotifyPinchGesture(PinchGestureInput::PINCHGESTURE_SCALE,
                                        apzc->GetGuid(), _, _))
       .Times(AtLeast(1));
--- a/gfx/layers/apz/test/gtest/TestScrollHandoff.cpp
+++ b/gfx/layers/apz/test/gtest/TestScrollHandoff.cpp
@@ -519,16 +519,17 @@ TEST_F(APZScrollHandoffTester, Scrollgra
 
   // Check that the parent and child have scrolled as much as we expect.
   EXPECT_EQ(20, rootApzc->GetFrameMetrics().GetScrollOffset().y);
   EXPECT_EQ(15, childApzc->GetFrameMetrics().GetScrollOffset().y);
 }
 
 TEST_F(APZScrollHandoffTester, ScrollgrabFling) {
   SCOPED_GFX_PREF_FLOAT("apz.fling_min_velocity_threshold", 0.0f);
+
   // Set up the layer tree
   CreateScrollgrabLayerTree();
 
   RefPtr<TestAsyncPanZoomController> childApzc = ApzcOf(layers[1]);
 
   // Pan on the child, not enough to fully scroll the scrollgrab parent.
   Pan(childApzc, 80, 70);
 
--- a/gfx/layers/apz/util/CheckerboardReportService.cpp
+++ b/gfx/layers/apz/util/CheckerboardReportService.cpp
@@ -186,17 +186,17 @@ 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 StaticPrefs::apz_record_checkerboarding();
 }
 
 void CheckerboardReportService::SetRecordingEnabled(bool aEnabled) {
   Preferences::SetBool("apz.record_checkerboarding", aEnabled);
 }
 
 void CheckerboardReportService::FlushActiveReports() {
   MOZ_ASSERT(XRE_IsParentProcess());
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -224,19 +224,19 @@ bool SharedFrameMetricsHelper::AboutToCh
                     aContentMetrics.GetScrollOffset();
   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()) /
-      aCompositorMetrics.LayersPixelsPerCSSPixel());
+  showing.Inflate(LayerSize(StaticPrefs::apz_danger_zone_x(),
+                            StaticPrefs::apz_danger_zone_y()) /
+                  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());
 
   if (!painted.Contains(showing)) {
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -1482,18 +1482,18 @@ bool AsyncCompositionManager::TransformS
 #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 (StaticPrefs::apz_fixed_margin_override_enabled()) {
+    result.top = StaticPrefs::apz_fixed_margin_override_top();
+    result.bottom = StaticPrefs::apz_fixed_margin_override_bottom();
   }
   return result;
 }
 #endif  // defined(MOZ_WIDGET_ANDROID)
 
 }  // namespace layers
 }  // namespace mozilla
--- a/gfx/layers/composite/ContainerLayerComposite.cpp
+++ b/gfx/layers/composite/ContainerLayerComposite.cpp
@@ -504,17 +504,17 @@ void RenderLayers(ContainerT* aContainer
               asyncTransform * aContainer->GetEffectiveTransform());
           asyncTransform =
               sampler->GetCurrentAsyncTransformWithOverscroll(wrapper)
                   .ToUnknownMatrix() *
               asyncTransform;
         }
       }
 
-      if (StaticPrefs::APZMinimap()) {
+      if (StaticPrefs::apz_minimap_enabled()) {
         RenderMinimap(aContainer, sampler, aManager, aClipRect, layer);
       }
     }
 
     // invariant: our GL context should be current here, I don't think we can
     // assert it though
   }
 }
--- a/gfx/qcms/qcmsint.h
+++ b/gfx/qcms/qcmsint.h
@@ -26,16 +26,20 @@ struct precache_output
 };
 
 #ifdef _MSC_VER
 #define ALIGN __declspec(align(16))
 #else
 #define ALIGN __attribute__(( aligned (16) ))
 #endif
 
+struct _qcms_transform;
+
+typedef void (*transform_fn_t)(const struct _qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length);
+
 struct _qcms_transform {
 	float ALIGN matrix[3][4];
 	float *input_gamma_table_r;
 	float *input_gamma_table_g;
 	float *input_gamma_table_b;
 
 	float *input_clut_table_r;
 	float *input_clut_table_g;
@@ -69,17 +73,17 @@ struct _qcms_transform {
 	size_t output_gamma_lut_b_length;
 
 	size_t output_gamma_lut_gray_length;
 
 	struct precache_output *output_table_r;
 	struct precache_output *output_table_g;
 	struct precache_output *output_table_b;
 
-	void (*transform_fn)(const struct _qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length);
+	transform_fn_t transform_fn;
 };
 
 struct matrix {
 	float m[3][3];
 	bool invalid;
 };
 
 struct qcms_modular_transform;
@@ -259,16 +263,42 @@ static inline float uInt16Number_to_floa
 	return ((int32_t)a)/65535.f;
 }
 
 
 void precache_release(struct precache_output *p);
 bool set_rgb_colorants(qcms_profile *profile, qcms_CIE_xyY white_point, qcms_CIE_xyYTRIPLE primaries);
 bool get_rgb_colorants(struct matrix *colorants, qcms_CIE_xyY white_point, qcms_CIE_xyYTRIPLE primaries);
 
+void qcms_transform_data_rgb_out_lut(const qcms_transform *transform,
+                                     const unsigned char *src,
+                                     unsigned char *dest,
+                                     size_t length);
+void qcms_transform_data_rgba_out_lut(const qcms_transform *transform,
+                                      const unsigned char *src,
+                                      unsigned char *dest,
+                                      size_t length);
+void qcms_transform_data_bgra_out_lut(const qcms_transform *transform,
+                                      const unsigned char *src,
+                                      unsigned char *dest,
+                                      size_t length);
+
+void qcms_transform_data_rgb_out_lut_precache(const qcms_transform *transform,
+                                              const unsigned char *src,
+                                              unsigned char *dest,
+                                              size_t length);
+void qcms_transform_data_rgba_out_lut_precache(const qcms_transform *transform,
+                                               const unsigned char *src,
+                                               unsigned char *dest,
+                                               size_t length);
+void qcms_transform_data_bgra_out_lut_precache(const qcms_transform *transform,
+                                               const unsigned char *src,
+                                               unsigned char *dest,
+                                               size_t length);
+
 void qcms_transform_data_rgb_out_lut_sse2(const qcms_transform *transform,
                                           const unsigned char *src,
                                           unsigned char *dest,
                                           size_t length);
 void qcms_transform_data_rgba_out_lut_sse2(const qcms_transform *transform,
                                           const unsigned char *src,
                                           unsigned char *dest,
                                           size_t length);
--- a/gfx/qcms/transform.cpp
+++ b/gfx/qcms/transform.cpp
@@ -508,27 +508,27 @@ static void qcms_transform_data_template
 		dest[kBIndex] = transform->output_table_b->data[b];
 		if (kAIndex != NO_A_INDEX) {
 			dest[kAIndex] = alpha;
 		}
 		dest += components;
 	}
 }
 
-static void qcms_transform_data_rgb_out_lut_precache(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
+void qcms_transform_data_rgb_out_lut_precache(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
 {
 	qcms_transform_data_template_lut_precache<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX>(transform, src, dest, length);
 }
 
-static void qcms_transform_data_rgba_out_lut_precache(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
+void qcms_transform_data_rgba_out_lut_precache(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
 {
 	qcms_transform_data_template_lut_precache<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX, RGBA_A_INDEX>(transform, src, dest, length);
 }
 
-static void qcms_transform_data_bgra_out_lut_precache(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
+void qcms_transform_data_bgra_out_lut_precache(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
 {
 	qcms_transform_data_template_lut_precache<BGRA_R_INDEX, BGRA_G_INDEX, BGRA_B_INDEX, BGRA_A_INDEX>(transform, src, dest, length);
 }
 
 // Not used
 /* 
 static void qcms_transform_data_clut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length) {
 	unsigned int i;
@@ -767,27 +767,27 @@ static void qcms_transform_data_template
 		dest[kBIndex] = clamp_u8(out_device_b*255);
 		if (kAIndex != NO_A_INDEX) {
 			dest[kAIndex] = alpha;
 		}
 		dest += components;
 	}
 }
 
-static void qcms_transform_data_rgb_out_lut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
+void qcms_transform_data_rgb_out_lut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
 {
 	qcms_transform_data_template_lut<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX>(transform, src, dest, length);
 }
 
-static void qcms_transform_data_rgba_out_lut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
+void qcms_transform_data_rgba_out_lut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
 {
 	qcms_transform_data_template_lut<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX, RGBA_A_INDEX>(transform, src, dest, length);
 }
 
-static void qcms_transform_data_bgra_out_lut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
+void qcms_transform_data_bgra_out_lut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
 {
 	qcms_transform_data_template_lut<BGRA_R_INDEX, BGRA_G_INDEX, BGRA_B_INDEX, BGRA_A_INDEX>(transform, src, dest, length);
 }
 
 #if 0
 static void qcms_transform_data_rgb_out_linear(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length)
 {
 	int i;
--- a/gfx/tests/gtest/TestQcms.cpp
+++ b/gfx/tests/gtest/TestQcms.cpp
@@ -1,71 +1,33 @@
 /* vim:set ts=2 sw=2 sts=2 et: */
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 #include "gtest/gtest.h"
+#include "gtest/MozGTestBench.h"
 #include "gmock/gmock.h"
 
 #include "mozilla/ArrayUtils.h"
+#include "mozilla/UniquePtr.h"
+#include "mozilla/SSE.h"
+#include "mozilla/arm.h"
 #include "qcms.h"
 #include "qcmsint.h"
 #include "transform_util.h"
 
-const size_t allGBSize = 1 * 256 * 256 * 4;
-static unsigned char* createAllGB() {
-  unsigned char* buff = (unsigned char*)malloc(allGBSize);
-  int pos = 0;
-  for (int r = 0; r < 1; r++) {  // Skip all R values for speed
-    for (int g = 0; g < 256; g++) {
-      for (int b = 0; b < 256; b++) {
-        buff[pos * 4 + 0] = r;
-        buff[pos * 4 + 1] = g;
-        buff[pos * 4 + 2] = b;
-        buff[pos * 4 + 3] = 0x80;
-        pos++;
-      }
-    }
-  }
-
-  return buff;
-}
-
-TEST(GfxQcms, Identity)
-{
-  // XXX: This means that we can't have qcms v2 unit test
-  //      without changing the qcms API.
-  qcms_enable_iccv4();
+#include <cmath>
 
-  qcms_profile* input_profile = qcms_profile_sRGB();
-  qcms_profile* output_profile = qcms_profile_sRGB();
-
-  EXPECT_FALSE(qcms_profile_is_bogus(input_profile));
-  EXPECT_FALSE(qcms_profile_is_bogus(output_profile));
-
-  const qcms_intent intent = QCMS_INTENT_DEFAULT;
-  qcms_data_type input_type = QCMS_DATA_RGBA_8;
-  qcms_data_type output_type = QCMS_DATA_RGBA_8;
-
-  qcms_transform* transform = qcms_transform_create(
-      input_profile, input_type, output_profile, output_type, intent);
+/* SSEv1 is only included in non-Windows or non-x86-64-bit builds. */
+#if defined(MOZILLA_MAY_SUPPORT_SSE) && (!(defined(_MSC_VER) && defined(_M_AMD64)))
+#define QCMS_MAY_SUPPORT_SSE
+#endif
 
-  unsigned char* data_in = createAllGB();
-  ;
-  unsigned char* data_out = (unsigned char*)malloc(allGBSize);
-  qcms_transform_data(transform, data_in, data_out, allGBSize / 4);
-
-  qcms_profile_release(input_profile);
-  qcms_profile_release(output_profile);
-  qcms_transform_release(transform);
-
-  free(data_in);
-  free(data_out);
-}
+using namespace mozilla;
 
 TEST(GfxQcms, LutInverseCrash)
 {
   uint16_t lutTable1[] = {
       0x0000, 0x0000, 0x0000, 0x8000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
       0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
       0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
       0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
@@ -169,8 +131,489 @@ TEST(GfxQcms, LutInverseNonMonotonic)
   }
 
   for (uint16_t i = 0; i < 65535; i++) {
     lut_inverse_interp16(i, lutTable, (int)mozilla::ArrayLength(lutTable));
   }
 
   // Make sure we don't crash, hang or let sanitizers do their magic
 }
+
+static bool CmpRgbChannel(const uint8_t* aRef, const uint8_t* aTest,
+                          size_t aIndex) {
+  return std::abs(static_cast<int8_t>(aRef[aIndex] - aTest[aIndex])) <= 1;
+}
+
+template <bool kSwapRB, bool kHasAlpha>
+static bool CmpRgbBufferImpl(const uint8_t* aRefBuffer,
+                             const uint8_t* aTestBuffer, size_t aPixels) {
+  const size_t pixelSize = kHasAlpha ? 4 : 3;
+  if (memcmp(aRefBuffer, aTestBuffer, aPixels * pixelSize) == 0) {
+    return true;
+  }
+
+  const size_t kRIndex = kSwapRB ? 2 : 0;
+  const size_t kGIndex = 1;
+  const size_t kBIndex = kSwapRB ? 0 : 2;
+  const size_t kAIndex = 3;
+
+  size_t remaining = aPixels;
+  const uint8_t* ref = aRefBuffer;
+  const uint8_t* test = aTestBuffer;
+  while (remaining > 0) {
+    if (!CmpRgbChannel(ref, test, kRIndex) ||
+        !CmpRgbChannel(ref, test, kGIndex) ||
+        !CmpRgbChannel(ref, test, kBIndex) ||
+        (kHasAlpha && ref[kAIndex] != test[kAIndex])) {
+      EXPECT_EQ(test[kRIndex], ref[kRIndex]);
+      EXPECT_EQ(test[kGIndex], ref[kGIndex]);
+      EXPECT_EQ(test[kBIndex], ref[kBIndex]);
+      if (kHasAlpha) {
+        EXPECT_EQ(test[kAIndex], ref[kAIndex]);
+      }
+      return false;
+    }
+
+    --remaining;
+    ref += pixelSize;
+    test += pixelSize;
+  }
+
+  return true;
+}
+
+template <bool kSwapRB, bool kHasAlpha>
+static size_t GetRgbInputBufferImpl(UniquePtr<uint8_t[]>& aOutBuffer) {
+  const uint8_t colorSamples[] = {0, 5, 16, 43, 101, 127, 182, 255};
+  const size_t colorSampleMax = sizeof(colorSamples) / sizeof(uint8_t);
+  const size_t pixelSize = kHasAlpha ? 4 : 3;
+  const size_t pixelCount = colorSampleMax * colorSampleMax * 256 * 3;
+
+  aOutBuffer = MakeUnique<uint8_t[]>(pixelCount * pixelSize);
+  if (!aOutBuffer) {
+    return 0;
+  }
+
+  const size_t kRIndex = kSwapRB ? 2 : 0;
+  const size_t kGIndex = 1;
+  const size_t kBIndex = kSwapRB ? 0 : 2;
+  const size_t kAIndex = 3;
+
+  // Sample every red pixel value with a subset of green and blue.
+  uint8_t* color = aOutBuffer.get();
+  for (uint16_t r = 0; r < 256; ++r) {
+    for (uint8_t g : colorSamples) {
+      for (uint8_t b : colorSamples) {
+        color[kRIndex] = r;
+        color[kGIndex] = g;
+        color[kBIndex] = b;
+        if (kHasAlpha) {
+          color[kAIndex] = 0x80;
+        }
+        color += pixelSize;
+      }
+    }
+  }
+
+  // Sample every green pixel value with a subset of red and blue.
+  for (uint8_t r : colorSamples) {
+    for (uint16_t g = 0; g < 256; ++g) {
+      for (uint8_t b : colorSamples) {
+        color[kRIndex] = r;
+        color[kGIndex] = g;
+        color[kBIndex] = b;
+        if (kHasAlpha) {
+          color[kAIndex] = 0x80;
+        }
+        color += pixelSize;
+      }
+    }
+  }
+
+  // Sample every blue pixel value with a subset of red and green.
+  for (uint8_t r : colorSamples) {
+    for (uint8_t g : colorSamples) {
+      for (uint16_t b = 0; b < 256; ++b) {
+        color[kRIndex] = r;
+        color[kGIndex] = g;
+        color[kBIndex] = b;
+        if (kHasAlpha) {
+          color[kAIndex] = 0x80;
+        }
+        color += pixelSize;
+      }
+    }
+  }
+
+  return pixelCount;
+}
+
+static size_t GetRgbInputBuffer(UniquePtr<uint8_t[]>& aOutBuffer) {
+  return GetRgbInputBufferImpl<false, false>(aOutBuffer);
+}
+
+static size_t GetRgbaInputBuffer(UniquePtr<uint8_t[]>& aOutBuffer) {
+  return GetRgbInputBufferImpl<false, true>(aOutBuffer);
+}
+
+static size_t GetBgraInputBuffer(UniquePtr<uint8_t[]>& aOutBuffer) {
+  return GetRgbInputBufferImpl<true, true>(aOutBuffer);
+}
+
+static bool CmpRgbBuffer(const uint8_t* aRefBuffer, const uint8_t* aTestBuffer,
+                         size_t aPixels) {
+  return CmpRgbBufferImpl<false, false>(aRefBuffer, aTestBuffer, aPixels);
+}
+
+static bool CmpRgbaBuffer(const uint8_t* aRefBuffer, const uint8_t* aTestBuffer,
+                          size_t aPixels) {
+  return CmpRgbBufferImpl<false, true>(aRefBuffer, aTestBuffer, aPixels);
+}
+
+static bool CmpBgraBuffer(const uint8_t* aRefBuffer, const uint8_t* aTestBuffer,
+                          size_t aPixels) {
+  return CmpRgbBufferImpl<true, true>(aRefBuffer, aTestBuffer, aPixels);
+}
+
+static void ClearRgbBuffer(uint8_t* aBuffer, size_t aPixels) {
+  if (aBuffer) {
+    memset(aBuffer, 0, aPixels * 3);
+  }
+}
+
+static void ClearRgbaBuffer(uint8_t* aBuffer, size_t aPixels) {
+  if (aBuffer) {
+    memset(aBuffer, 0, aPixels * 4);
+  }
+}
+
+static UniquePtr<uint8_t[]> GetRgbOutputBuffer(size_t aPixels) {
+  UniquePtr<uint8_t[]> buffer = MakeUnique<uint8_t[]>(aPixels * 3);
+  ClearRgbBuffer(buffer.get(), aPixels);
+  return buffer;
+}
+
+static UniquePtr<uint8_t[]> GetRgbaOutputBuffer(size_t aPixels) {
+  UniquePtr<uint8_t[]> buffer = MakeUnique<uint8_t[]>(aPixels * 4);
+  ClearRgbaBuffer(buffer.get(), aPixels);
+  return buffer;
+}
+
+class GfxQcms_ProfilePairBase : public ::testing::Test {
+ protected:
+  GfxQcms_ProfilePairBase()
+      : mInProfile(nullptr),
+        mOutProfile(nullptr),
+        mTransform(nullptr),
+        mPixels(0),
+        mStorageType(QCMS_DATA_RGB_8),
+        mPrecache(false) {}
+
+  void TransformPrecache();
+  void TransformPrecachePlatformExt();
+
+  void SetUp() override {
+    // XXX: This means that we can't have qcms v2 unit test
+    //      without changing the qcms API.
+    qcms_enable_iccv4();
+  }
+
+  void TearDown() override {
+    if (mInProfile) {
+      qcms_profile_release(mInProfile);
+    }
+    if (mOutProfile) {
+      qcms_profile_release(mOutProfile);
+    }
+    if (mTransform) {
+      qcms_transform_release(mTransform);
+    }
+  }
+
+  bool SetTransform(qcms_transform* aTransform) {
+    if (mTransform) {
+      qcms_transform_release(mTransform);
+    }
+    mTransform = aTransform;
+    return !!mTransform;
+  }
+
+  bool SetTransform(qcms_data_type aType) {
+    return SetTransform(qcms_transform_create(mInProfile, aType, mOutProfile,
+                                              aType, QCMS_INTENT_DEFAULT));
+  }
+
+  bool SetBuffers(qcms_data_type aType) {
+    switch (aType) {
+      case QCMS_DATA_RGB_8:
+        mPixels = GetRgbInputBuffer(mInput);
+        mRef = GetRgbOutputBuffer(mPixels);
+        mOutput = GetRgbOutputBuffer(mPixels);
+        break;
+      case QCMS_DATA_RGBA_8:
+        mPixels = GetRgbaInputBuffer(mInput);
+        mRef = GetRgbaOutputBuffer(mPixels);
+        mOutput = GetRgbaOutputBuffer(mPixels);
+        break;
+      case QCMS_DATA_BGRA_8:
+        mPixels = GetBgraInputBuffer(mInput);
+        mRef = GetRgbaOutputBuffer(mPixels);
+        mOutput = GetRgbaOutputBuffer(mPixels);
+        break;
+      default:
+        MOZ_ASSERT_UNREACHABLE("Unknown type!");
+        break;
+    }
+
+    mStorageType = aType;
+    return mInput && mOutput && mRef && mPixels > 0u;
+  }
+
+  void ClearOutputBuffer() {
+    switch (mStorageType) {
+      case QCMS_DATA_RGB_8:
+        ClearRgbBuffer(mOutput.get(), mPixels);
+        break;
+      case QCMS_DATA_RGBA_8:
+      case QCMS_DATA_BGRA_8:
+        ClearRgbaBuffer(mOutput.get(), mPixels);
+        break;
+      default:
+        MOZ_ASSERT_UNREACHABLE("Unknown type!");
+        break;
+    }
+  }
+
+  void ProduceRef(transform_fn_t aFn) {
+    aFn(mTransform, mInput.get(), mRef.get(), mPixels);
+  }
+
+  void CopyInputToRef() {
+    size_t pixelSize = 0;
+    switch (mStorageType) {
+      case QCMS_DATA_RGB_8:
+        pixelSize = 3;
+        break;
+      case QCMS_DATA_RGBA_8:
+      case QCMS_DATA_BGRA_8:
+        pixelSize = 4;
+        break;
+      default:
+        MOZ_ASSERT_UNREACHABLE("Unknown type!");
+        break;
+    }
+
+    memcpy(mRef.get(), mInput.get(), mPixels * pixelSize);
+  }
+
+  void ProduceOutput(transform_fn_t aFn) {
+    ClearOutputBuffer();
+    aFn(mTransform, mInput.get(), mOutput.get(), mPixels);
+  }
+
+  bool VerifyOutput(const UniquePtr<uint8_t[]>& aBuf) {
+    switch (mStorageType) {
+      case QCMS_DATA_RGB_8:
+        return CmpRgbBuffer(aBuf.get(), mOutput.get(), mPixels);
+      case QCMS_DATA_RGBA_8:
+        return CmpRgbaBuffer(aBuf.get(), mOutput.get(), mPixels);
+      case QCMS_DATA_BGRA_8:
+        return CmpBgraBuffer(aBuf.get(), mOutput.get(), mPixels);
+      default:
+        MOZ_ASSERT_UNREACHABLE("Unknown type!");
+        break;
+    }
+
+    return false;
+  }
+
+  bool ProduceVerifyOutput(transform_fn_t aFn) {
+    ProduceOutput(aFn);
+    return VerifyOutput(mRef);
+  }
+
+  void PrecacheOutput() {
+    qcms_profile_precache_output_transform(mOutProfile);
+    mPrecache = true;
+  }
+
+  qcms_profile* mInProfile;
+  qcms_profile* mOutProfile;
+  qcms_transform* mTransform;
+
+  UniquePtr<uint8_t[]> mInput;
+  UniquePtr<uint8_t[]> mOutput;
+  UniquePtr<uint8_t[]> mRef;
+  size_t mPixels;
+  qcms_data_type mStorageType;
+  bool mPrecache;
+};
+
+void GfxQcms_ProfilePairBase::TransformPrecache() {
+  // Produce reference using interpolation and the lookup tables.
+  ASSERT_FALSE(mPrecache);
+  ASSERT_TRUE(SetBuffers(QCMS_DATA_RGB_8));
+  ASSERT_TRUE(SetTransform(QCMS_DATA_RGB_8));
+  ProduceRef(qcms_transform_data_rgb_out_lut);
+
+  // Produce output using lut and precaching.
+  PrecacheOutput();
+  ASSERT_TRUE(SetTransform(QCMS_DATA_RGB_8));
+  EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgb_out_lut_precache));
+}
+
+void GfxQcms_ProfilePairBase::TransformPrecachePlatformExt() {
+  PrecacheOutput();
+
+  // Verify RGB transforms.
+  ASSERT_TRUE(SetBuffers(QCMS_DATA_RGB_8));
+  ASSERT_TRUE(SetTransform(QCMS_DATA_RGB_8));
+  ProduceRef(qcms_transform_data_rgb_out_lut_precache);
+#ifdef QCMS_MAY_SUPPORT_SSE
+  if (mozilla::supports_sse()) {
+    EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgb_out_lut_sse1));
+  }
+#endif
+#ifdef MOZILLA_MAY_SUPPORT_SSE2
+  if (mozilla::supports_sse2()) {
+    EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgb_out_lut_sse2));
+  }
+#endif
+#ifdef MOZILLA_MAY_SUPPORT_NEON
+  if (mozilla::supports_neon()) {
+    EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgb_out_lut_neon));
+  }
+#endif
+
+  // Verify RGBA transforms.
+  ASSERT_TRUE(SetBuffers(QCMS_DATA_RGBA_8));
+  ASSERT_TRUE(SetTransform(QCMS_DATA_RGBA_8));
+  ProduceRef(qcms_transform_data_rgba_out_lut_precache);
+#ifdef QCMS_MAY_SUPPORT_SSE
+  if (mozilla::supports_sse()) {
+    EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgba_out_lut_sse1));
+  }
+#endif
+#ifdef MOZILLA_MAY_SUPPORT_SSE2
+  if (mozilla::supports_sse2()) {
+    EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgba_out_lut_sse2));
+  }
+#endif
+#ifdef MOZILLA_MAY_SUPPORT_NEON
+  if (mozilla::supports_neon()) {
+    EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_rgba_out_lut_neon));
+  }
+#endif
+
+  // Verify BGRA transforms.
+  ASSERT_TRUE(SetBuffers(QCMS_DATA_BGRA_8));
+  ASSERT_TRUE(SetTransform(QCMS_DATA_BGRA_8));
+  ProduceRef(qcms_transform_data_bgra_out_lut_precache);
+#ifdef QCMS_MAY_SUPPORT_SSE
+  if (mozilla::supports_sse()) {
+    EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_bgra_out_lut_sse1));
+  }
+#endif
+#ifdef MOZILLA_MAY_SUPPORT_SSE2
+  if (mozilla::supports_sse2()) {
+    EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_bgra_out_lut_sse2));
+  }
+#endif
+#ifdef MOZILLA_MAY_SUPPORT_NEON
+  if (mozilla::supports_neon()) {
+    EXPECT_TRUE(ProduceVerifyOutput(qcms_transform_data_bgra_out_lut_neon));
+  }
+#endif
+}
+
+class GfxQcms_sRGB_To_sRGB : public GfxQcms_ProfilePairBase {
+ protected:
+  void SetUp() override {
+    GfxQcms_ProfilePairBase::SetUp();
+    mInProfile = qcms_profile_sRGB();
+    mOutProfile = qcms_profile_sRGB();
+  }
+};
+
+class GfxQcms_sRGB_To_SamsungSyncmaster : public GfxQcms_ProfilePairBase {
+ protected:
+  void SetUp() override {
+    GfxQcms_ProfilePairBase::SetUp();
+    mInProfile = qcms_profile_sRGB();
+    mOutProfile = qcms_profile_from_path("lcms_samsung_syncmaster.icc");
+  }
+};
+
+class GfxQcms_sRGB_To_ThinkpadW540 : public GfxQcms_ProfilePairBase {
+ protected:
+  void SetUp() override {
+    GfxQcms_ProfilePairBase::SetUp();
+    mInProfile = qcms_profile_sRGB();
+    mOutProfile = qcms_profile_from_path("lcms_thinkpad_w540.icc");
+  }
+};
+
+#define TEST_QCMS_PROFILE_F(test_fixture)                    \
+  TEST_F(test_fixture, TransformPrecachePlatformExt) {       \
+    GfxQcms_ProfilePairBase::TransformPrecachePlatformExt(); \
+  }
+
+TEST_F(GfxQcms_sRGB_To_sRGB, TransformPrecache) {
+  // TODO(aosmond): This doesn't pass for the non-identity transform. Should
+  // they produce the same results?
+  GfxQcms_ProfilePairBase::TransformPrecache();
+}
+
+TEST_QCMS_PROFILE_F(GfxQcms_sRGB_To_sRGB)
+
+TEST_F(GfxQcms_sRGB_To_sRGB, TransformIdentity) {
+  PrecacheOutput();
+  SetBuffers(QCMS_DATA_RGB_8);
+  SetTransform(QCMS_DATA_RGB_8);
+  qcms_transform_data(mTransform, mInput.get(), mOutput.get(), mPixels);
+  EXPECT_TRUE(VerifyOutput(mInput));
+}
+
+TEST_QCMS_PROFILE_F(GfxQcms_sRGB_To_SamsungSyncmaster)
+TEST_QCMS_PROFILE_F(GfxQcms_sRGB_To_ThinkpadW540)
+
+class GfxQcmsPerf_Base : public GfxQcms_sRGB_To_ThinkpadW540 {
+ protected:
+  explicit GfxQcmsPerf_Base(qcms_data_type aType) { mStorageType = aType; }
+
+  void TransformPerf() { ProduceRef(qcms_transform_data_rgb_out_lut_precache); }
+
+  void TransformPlatformPerf() {
+    qcms_transform_data(mTransform, mInput.get(), mRef.get(), mPixels);
+  }
+
+  void SetUp() override {
+    GfxQcms_sRGB_To_ThinkpadW540::SetUp();
+    PrecacheOutput();
+    SetBuffers(mStorageType);
+    SetTransform(mStorageType);
+  }
+};
+
+class GfxQcmsPerf_Rgb : public GfxQcmsPerf_Base {
+ protected:
+  GfxQcmsPerf_Rgb() : GfxQcmsPerf_Base(QCMS_DATA_RGB_8) {}
+};
+
+class GfxQcmsPerf_Rgba : public GfxQcmsPerf_Base {
+ protected:
+  GfxQcmsPerf_Rgba() : GfxQcmsPerf_Base(QCMS_DATA_RGBA_8) {}
+};
+
+class GfxQcmsPerf_Bgra : public GfxQcmsPerf_Base {
+ protected:
+  GfxQcmsPerf_Bgra() : GfxQcmsPerf_Base(QCMS_DATA_BGRA_8) {}
+};
+
+MOZ_GTEST_BENCH_F(GfxQcmsPerf_Rgb, TransformC, [this] { TransformPerf(); });
+MOZ_GTEST_BENCH_F(GfxQcmsPerf_Rgb, TransformPlatform,
+                  [this] { TransformPlatformPerf(); });
+MOZ_GTEST_BENCH_F(GfxQcmsPerf_Rgba, TransformC, [this] { TransformPerf(); });
+MOZ_GTEST_BENCH_F(GfxQcmsPerf_Rgba, TransformPlatform,
+                  [this] { TransformPlatformPerf(); });
+MOZ_GTEST_BENCH_F(GfxQcmsPerf_Bgra, TransformC, [this] { TransformPerf(); });
+MOZ_GTEST_BENCH_F(GfxQcmsPerf_Bgra, TransformPlatform,
+                  [this] { TransformPlatformPerf(); });
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3dcde88d062d84e9cbf2217b48c1cdebdb44af2e
GIT binary patch
literal 1944
zc$}S7O=uHA6#kk7+lu%{5fz0+deG8HewtW8)LQ@1QnZQ+Qn$O?G@4DqW@8&r@#sbH
z;GqZcAc6`W1wDuqK|JU|5WI;!dg?);2rBV=Gh-7pJ+!;bzV~Ln_syGcUIMgF7aYG5
z+X48+FgSJOfOYQt1*`otR$@K6(1XpkQz;J&51+uI&-^E}iTxNCuHPNu>+6Y!kLTXq
znB9A4=ECB6>RIi26$fbRrJr)jK}i1+{ace^S^Tf`yPOHzrT>e5Z@>b9$aa|@)BYau
zbJ`ykKNvYRNS`@an``pNntW#>@ac08bi2OGxyZEC;QB@J-_sxRz0d}tTY%U#zfg5d
z&2rjRUh&Ln+6^3Aa2hof;ou}}R1m^LAiza(3Myv=6UY;7p-glM<BST-w9M={XFV0m
znuROep@d0(E$&oeR*i@}a^wj)CurGQ<{a8QF-6Yo1msTty{pQ2I;AUH69d}M)$8AG
z1D$VypL6y4&yjll_Y<D|1u)au$Pd2&`-p3M)0pf24s3k{JiphNyGYIl)Ns@LvK`n9
zw;f5RweEbP@_DcykQO;P1Kj24z6oqzOt<A|oiaH#e4?w&%u%aDN@-_7EenHG%crI`
z5j7!k^G;~^)=9sR*3vb!Wodg%pLWrPCcbahpV6+QeMP&Cc9!-s4}V;*M<lO<c0%(;
zrf8`{<b~!_y(f0o;OBK5B`1HCsvog}cAMsp9;8jsh6Z;_^G2sl{M5uRP5i;c!oQLB
zhmK<%I*wT;PU!t(hfRFe#03=(@&*oL)O4>)ZAH(V>QbNT#;Lc*8R<k(y}}un`g&ZI
z&itD{rq*q;)RvKbRo#EZbbFfJ-p`TY>HvoM9>Wlh5a$wiRo%76D9?C`d2-t>ZG6cc
z5^vduaU8{N?s$S#Bw0<C{g=W))-u8|N?eIM1gZ*;J4+phxPFXdl<Y1m&+;8-Zju~X
zjy@{n@|#hN9{D}&;_GpykL&%k9y0`!By%%gNu9gUvepK!qT)Q)3N7nzW-M~2kbDE=
zYMvKWs$8>`W>xiX6f9ZQ24hZT3U3O%9EpXufeDm`qrAxkF<I7|rY`+F!T*?=!lado
z8FjAaz4SkAae*t%uW%*#w#I3`jM6DVn`y$0@sw57XPPa^n@JHNwY5Uk3@Y)rwm&8r
BH<bVY
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c154e7e589f305da007add83d0404edcb90bd419
GIT binary patch
literal 1428
zc$}?N-%Aux6#iz_jFOO&1Tok`BEmIu)eH(+%_OK;Y$J<c8)s&Jlrv3tX4QR@9(s-l
zD)3FPw;p`xA$q95{(&IswbyzGq6osa@7!y;MN&iqXU=!d{mz+l&$)MiraM!PA2s#@
zeh{nivEk&zg^S7Nw`fEHt=NTD+lj(VHhT&iKA&H~68$nIxt5lD_O)MLP@mFwvHN-Z
z(T(Huv(5D)2e7({2c1yG#4hp8nK%^up192^+4LoZ->q06vGCg_4L&BgXmC!j%8ic@
zmxx=7b$GH4J0;~4&k}d}UThQ3Q$p7d_^qZE`m?U@3ce(@`BN2VwPx9Eix-?bOWi@~
zL=GjC5#TDau;C(!^B6!sq_4k^yHXbyksm_g8Va<g;L$eT0==HLWi8440nrTKNjO9y
zs$`T=WS*ElVMj#bbEwPY1oZR(GS^?{6&2Ebrm_~reSWFcK6V1lkAW3ct9_lX)m9dO
zhBv^|>+A9P9l(Jb3|e0Ib-e?&d;^{=uKN_@mghK*XQ8d^wTUOvY14Z?4f1+G$#I6#
zmiy%IrEHyZ%TBx+v03ItxkcGYS(H9fmSonH7nJ>!4`$ukWNfR~#94AaC>HZ#JN0d9
za;$r+{D<Zn)+6dY)UT<BS!jo`6Gy1~F@n=Lfjp+!W5u4D-lo~xJ`C~QyT+K*XTc_`
z%E`#Ye8!|0<8dajUM<o}@ub-F`8v~&Xmb)=RP+S@K7JI(agvg!?eg@cxiZ9B4zs>N
z9MsG{?qh(S0pbEJ(XPg_K8QnHlb8bE_4xvNV%9gRJsF<c4E+(mTVb`1KBF${a>>c?
z4rIwYgE4X>`?Nld9xY+aGQws?mpY~Ii}Whedk|idv4P&dImuOeMsyEC&8_}anRqI!
a&eq+k=o_H^CF=(Fv|r!T|CjHN|BLSwZ}OJ_
--- a/gfx/tests/gtest/moz.build
+++ b/gfx/tests/gtest/moz.build
@@ -52,16 +52,24 @@ UNIFIED_SOURCES += [ '/gfx/2d/unittest/%
 # tests (e g. "error: 'ScriptListTableTest_TestSuccess_Test' has a field
 # 'ScriptListTableTest_TestSuccess_Test::<anonymous>' whose type uses
 # the anonymous namespace").
 SOURCES += [ '/gfx/ots/tests/%s' % p for p in [
     'cff_type2_charstring_test.cc',
     'layout_common_table_test.cc',
 ]]
 
+# ICC profiles used for verifying QCMS transformations. The copyright
+# notice embedded in the profiles should be reviewed to ensure there are
+# no known restrictions on distribution.
+TEST_HARNESS_FILES.gtest += [
+    'icc_profiles/lcms_samsung_syncmaster.icc',
+    'icc_profiles/lcms_thinkpad_w540.icc',
+]
+
 include('/ipc/chromium/chromium-config.mozbuild')
 
 LOCAL_INCLUDES += [
     '/gfx/2d',
     '/gfx/2d/unittest',
     '/gfx/config',
     '/gfx/layers',
     '/gfx/ots/src',
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -3227,17 +3227,17 @@ void gfxPlatform::GetApzSupportInfo(mozi
     aObj.DefineProperty("ApzTouchInput", 1);
   }
 
   if (SupportsApzDragInput()) {
     aObj.DefineProperty("ApzDragInput", 1);
   }
 
   if (SupportsApzKeyboardInput() &&
-      !StaticPrefs::AccessibilityBrowseWithCaret()) {
+      !StaticPrefs::accessibility_browsewithcaret()) {
     aObj.DefineProperty("ApzKeyboardInput", 1);
   }
 
   if (SupportsApzAutoscrolling()) {
     aObj.DefineProperty("ApzAutoscrollInput", 1);
   }
 }
 
@@ -3472,25 +3472,25 @@ void gfxPlatform::ImportGPUDeviceData(
   gfxConfig::ImportChange(Feature::ADVANCED_LAYERS, aData.advancedLayers());
 }
 
 bool gfxPlatform::SupportsApzTouchInput() const {
   return dom::TouchEvent::PrefEnabled(nullptr);
 }
 
 bool gfxPlatform::SupportsApzDragInput() const {
-  return StaticPrefs::APZDragEnabled();
+  return StaticPrefs::apz_drag_enabled();
 }
 
 bool gfxPlatform::SupportsApzKeyboardInput() const {
-  return StaticPrefs::APZKeyboardEnabled();
+  return StaticPrefs::apz_keyboard_enabled();
 }
 
 bool gfxPlatform::SupportsApzAutoscrolling() const {
-  return StaticPrefs::APZAutoscrollEnabled();
+  return StaticPrefs::apz_autoscroll_enabled();
 }
 
 void gfxPlatform::InitOpenGLConfig() {
 #ifdef XP_WIN
   // Don't enable by default on Windows, since it could show up in about:support
   // even though it'll never get used. Only attempt if user enables the pref
   if (!Preferences::GetBool("layers.prefer-opengl")) {
     return;
--- a/js/src/gc/Cell.h
+++ b/js/src/gc/Cell.h
@@ -377,17 +377,17 @@ bool TenuredCell::isInsideZone(JS::Zone*
     MOZ_ASSERT(!RuntimeFromMainThreadIsHeapMajorCollecting(shadowZone));
     Cell* tmp = thing;
     TraceManuallyBarrieredGenericPointerEdge(shadowZone->barrierTracer(), &tmp,
                                              "read barrier");
     MOZ_ASSERT(tmp == thing);
   }
 
   if (thing->isMarkedGray()) {
-    // There shouldn't be anything marked grey unless we're on the main thread.
+    // There shouldn't be anything marked gray unless we're on the main thread.
     MOZ_ASSERT(CurrentThreadCanAccessRuntime(thing->runtimeFromAnyThread()));
     if (!JS::RuntimeHeapIsCollecting()) {
       JS::UnmarkGrayGCThingRecursively(
           JS::GCCellPtr(thing, thing->getTraceKind()));
     }
   }
 }
 
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -5241,17 +5241,17 @@ void GCRuntime::getNextSweepGroup() {
 /*
  * Gray marking:
  *
  * At the end of collection, anything reachable from a gray root that has not
  * otherwise been marked black must be marked gray.
  *
  * This means that when marking things gray we must not allow marking to leave
  * the current compartment group, as that could result in things being marked
- * grey when they might subsequently be marked black.  To achieve this, when we
+ * gray when they might subsequently be marked black.  To achieve this, when we
  * find a cross compartment pointer we don't mark the referent but add it to a
  * singly-linked list of incoming gray pointers that is stored with each
  * compartment.
  *
  * The list head is stored in Compartment::gcIncomingGrayPointers and contains
  * cross compartment wrapper objects. The next pointer is stored in the second
  * extra slot of the cross compartment wrapper.
  *
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -6003,17 +6003,17 @@ void PresShell::Paint(nsView* aViewToPai
   NS_ASSERTION(aViewToPaint, "null view");
 
   MOZ_ASSERT(!mApproximateFrameVisibilityVisited, "Should have been cleared");
 
   if (!mIsActive) {
     return;
   }
 
-  if (StaticPrefs::APZKeyboardEnabled()) {
+  if (StaticPrefs::apz_keyboard_enabled()) {
     // Update the focus target for async keyboard scrolling. This will be
     // forwarded to APZ by nsDisplayList::PaintRoot. We need to to do this
     // before we enter the paint phase because dispatching eVoid events can
     // cause layout to happen.
     mAPZFocusTarget = FocusTarget(this, mAPZFocusSequenceNumber);
   }
 
   nsPresContext* presContext = GetPresContext();
--- a/layout/base/ZoomConstraintsClient.cpp
+++ b/layout/base/ZoomConstraintsClient.cpp
@@ -168,17 +168,17 @@ void ZoomConstraintsClient::ScreenSizeCh
 }
 
 static mozilla::layers::ZoomConstraints ComputeZoomConstraintsFromViewportInfo(
     const nsViewportInfo& aViewportInfo, Document* aDocument) {
   mozilla::layers::ZoomConstraints constraints;
   constraints.mAllowZoom = aViewportInfo.IsZoomAllowed() &&
                            nsLayoutUtils::AllowZoomingForDocument(aDocument);
   constraints.mAllowDoubleTapZoom =
-      constraints.mAllowZoom && StaticPrefs::APZAllowDoubleTapZooming();
+      constraints.mAllowZoom && StaticPrefs::apz_allow_double_tap_zooming();
   if (constraints.mAllowZoom) {
     constraints.mMinZoom.scale = aViewportInfo.GetMinZoom().scale;
     constraints.mMaxZoom.scale = aViewportInfo.GetMaxZoom().scale;
   } else {
     constraints.mMinZoom.scale = aViewportInfo.GetDefaultZoom().scale;
     constraints.mMaxZoom.scale = aViewportInfo.GetDefaultZoom().scale;
   }
   return constraints;
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -753,17 +753,17 @@ bool nsLayoutUtils::AsyncPanZoomEnabled(
   return widget->AsyncPanZoomEnabled();
 }
 
 bool nsLayoutUtils::AllowZoomingForDocument(
     const mozilla::dom::Document* aDocument) {
   // True if we allow zooming for all documents on this platform, or if we are
   // in RDM and handling meta viewports, which force zoom under some
   // circumstances.
-  return StaticPrefs::APZAllowZooming() ||
+  return StaticPrefs::apz_allow_zooming() ||
          (aDocument && aDocument->InRDMPane() &&
           nsLayoutUtils::ShouldHandleMetaViewport(aDocument));
 }
 
 float nsLayoutUtils::GetCurrentAPZResolutionScale(PresShell* aPresShell) {
   return aPresShell ? aPresShell->GetCumulativeNonRootScaleResolution() : 1.0;
 }
 
@@ -1045,17 +1045,17 @@ bool nsLayoutUtils::ShouldDisableApzForE
         return true;
       }
     }
   }
 
   if (!doc) {
     return false;
   }
-  return StaticPrefs::APZDisableForScrollLinkedEffects() &&
+  return StaticPrefs::apz_disable_for_scroll_linked_effects() &&
          doc->HasScrollLinkedEffect();
 }
 
 static bool GetDisplayPortData(
     nsIContent* aContent, DisplayPortPropertyData** aOutRectData,
     DisplayPortMarginsPropertyData** aOutMarginsData) {
   MOZ_ASSERT(aOutRectData && aOutMarginsData);
 
@@ -9248,17 +9248,17 @@ ScrollMetadata nsLayoutUtils::ComputeScr
   frameBounds.Deflate(boundMargins);
 
   metrics.SetCompositionBounds(frameBounds);
 
   metrics.SetRootCompositionSize(nsLayoutUtils::CalculateRootCompositionSize(
       aScrollFrame ? aScrollFrame : aForFrame, isRootContentDocRootScrollFrame,
       metrics));
 
-  if (StaticPrefs::APZPrintTree() || StaticPrefs::apz_test_logging_enabled()) {
+  if (StaticPrefs::apz_printtree() || StaticPrefs::apz_test_logging_enabled()) {
     if (nsIContent* content =
             frameForCompositionBoundsCalculation->GetContent()) {
       nsAutoString contentDescription;
       if (content->IsElement()) {
         content->AsElement()->Describe(contentDescription);
       } else {
         contentDescription.AssignLiteral("(not an element)");
       }
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -1861,17 +1861,17 @@ void nsRefreshDriver::Tick(VsyncId aId, 
   mTickVsyncId = aId;
   mTickVsyncTime = aNowTime;
 
   gfxPlatform::GetPlatform()->SchedulePaintIfDeviceReset();
 
   // We want to process any pending APZ metrics ahead of their positions
   // in the queue. This will prevent us from spending precious time
   // painting a stale displayport.
-  if (StaticPrefs::APZPeekMessages()) {
+  if (StaticPrefs::apz_peek_messages_enabled()) {
     nsLayoutUtils::UpdateDisplayPortMarginsFromPendingMessages();
   }
 
   AutoTArray<nsCOMPtr<nsIRunnable>, 16> earlyRunners;
   earlyRunners.SwapElements(mEarlyRunners);
   for (auto& runner : earlyRunners) {
     runner->Run();
   }
--- a/layout/generic/ScrollVelocityQueue.cpp
+++ b/layout/generic/ScrollVelocityQueue.cpp
@@ -19,17 +19,17 @@ void ScrollVelocityQueue::Sample(const n
   maxVelocity = nsPresContext::CSSPixelsToAppUnits(maxVelocity);
   int maxOffset = maxVelocity * flingSensitivity;
   TimeStamp currentRefreshTime =
       mPresContext->RefreshDriver()->MostRecentRefresh();
   if (mSampleTime.IsNull()) {
     mAccumulator = nsPoint();
   } else {
     uint32_t durationMs = (currentRefreshTime - mSampleTime).ToMilliseconds();
-    if (durationMs > StaticPrefs::APZVelocityRelevanceTime()) {
+    if (durationMs > StaticPrefs::apz_velocity_relevance_time_ms()) {
       mAccumulator = nsPoint();
       mQueue.Clear();
     } else if (durationMs == 0) {
       mAccumulator += aScrollPosition - mLastPosition;
     } else {
       nsPoint velocity = mAccumulator * 1000 / durationMs;
       velocity.Clamp(maxVelocity);
       mQueue.AppendElement(std::make_pair(durationMs, velocity));
@@ -49,17 +49,17 @@ void ScrollVelocityQueue::TrimQueue() {
   }
 
   TimeStamp currentRefreshTime =
       mPresContext->RefreshDriver()->MostRecentRefresh();
   nsPoint velocity;
   uint32_t timeDelta = (currentRefreshTime - mSampleTime).ToMilliseconds();
   for (int i = mQueue.Length() - 1; i >= 0; i--) {
     timeDelta += mQueue[i].first;
-    if (timeDelta >= StaticPrefs::APZVelocityRelevanceTime()) {
+    if (timeDelta >= StaticPrefs::apz_velocity_relevance_time_ms()) {
       // The rest of the samples have expired and should be dropped
       for (; i >= 0; i--) {
         mQueue.RemoveElementAt(0);
       }
     }
   }
 }
 
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -2462,17 +2462,17 @@ void ScrollFrameHelper::MarkRecentlyScro
   // reset the timer.
   ResetDisplayPortExpiryTimer();
 }
 
 void ScrollFrameHelper::ResetDisplayPortExpiryTimer() {
   if (mDisplayPortExpiryTimer) {
     mDisplayPortExpiryTimer->InitWithNamedFuncCallback(
         RemoveDisplayPortCallback, this,
-        StaticPrefs::APZDisplayPortExpiryTime(), nsITimer::TYPE_ONE_SHOT,
+        StaticPrefs::apz_displayport_expiry_ms(), nsITimer::TYPE_ONE_SHOT,
         "ScrollFrameHelper::ResetDisplayPortExpiryTimer");
   }
 }
 
 bool ScrollFrameHelper::AllowDisplayPortExpiration() {
   if (IsAlwaysActive()) {
     return false;
   }
@@ -2482,17 +2482,17 @@ bool ScrollFrameHelper::AllowDisplayPort
   return true;
 }
 
 void ScrollFrameHelper::TriggerDisplayPortExpiration() {
   if (!AllowDisplayPortExpiration()) {
     return;
   }
 
-  if (!StaticPrefs::APZDisplayPortExpiryTime()) {
+  if (!StaticPrefs::apz_displayport_expiry_ms()) {
     // a zero time disables the expiry
     return;
   }
 
   if (!mDisplayPortExpiryTimer) {
     mDisplayPortExpiryTimer = NS_NewTimer();
   }
   ResetDisplayPortExpiryTimer();
@@ -2798,17 +2798,17 @@ void ScrollFrameHelper::ScrollToImpl(nsP
   }
 
   ScrollVisual();
   mAnchor.UserScrolled();
 
   bool schedulePaint = true;
   if (nsLayoutUtils::AsyncPanZoomEnabled(mOuter) &&
       !nsLayoutUtils::ShouldDisableApzForElement(content) &&
-      StaticPrefs::APZPaintSkipping()) {
+      StaticPrefs::apz_paint_skipping_enabled()) {
     // If APZ is enabled with paint-skipping, there are certain conditions in
     // which we can skip paints:
     // 1) If APZ triggered this scroll, and the tile-aligned displayport is
     //    unchanged.
     // 2) If non-APZ triggered this scroll, but we can handle it by just asking
     //    APZ to update the scroll position. Again we make this conditional on
     //    the tile-aligned displayport being unchanged.
     // We do the displayport check first since it's common to all scenarios,
@@ -2833,17 +2833,17 @@ void ScrollFrameHelper::ScrollToImpl(nsP
         mScrollableByAPZ, HasPluginFrames(), HasPerspective(),
         HasBgAttachmentLocal(), mHasOutOfFlowContentInsideFilter);
     if (usingDisplayPort && displayPort.IsEqualEdges(oldDisplayPort) &&
         !HasPerspective() && !HasBgAttachmentLocal() &&
         !mHasOutOfFlowContentInsideFilter) {
       bool haveScrollLinkedEffects =
           content->GetComposedDoc()->HasScrollLinkedEffect();
       bool apzDisabled = haveScrollLinkedEffects &&
-                         StaticPrefs::APZDisableForScrollLinkedEffects();
+                         StaticPrefs::apz_disable_for_scroll_linked_effects();
       if (!apzDisabled && !HasPluginFrames()) {
         if (LastScrollOrigin() == nsGkAtoms::apz) {
           schedulePaint = false;
           PAINT_SKIP_LOG("Skipping due to APZ scroll\n");
         } else if (mScrollableByAPZ) {
           nsIWidget* widget = presContext->GetNearestWidget();
           LayerManager* manager = widget ? widget->GetLayerManager() : nullptr;
           if (manager) {
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -1140,17 +1140,17 @@ void nsDisplayListBuilder::AutoCurrentAc
 /* static */
 nsRect nsDisplayListBuilder::OutOfFlowDisplayData::ComputeVisibleRectForFrame(
     nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
     const nsRect& aVisibleRect, const nsRect& aDirtyRect,
     nsRect* aOutDirtyRect) {
   nsRect visible = aVisibleRect;
   nsRect dirtyRectRelativeToDirtyFrame = aDirtyRect;
 
-  if (StaticPrefs::APZAllowZooming() &&
+  if (StaticPrefs::apz_allow_zooming() &&
       nsLayoutUtils::IsFixedPosFrameInDisplayPort(aFrame) &&
       aBuilder->IsPaintingToWindow()) {
     dirtyRectRelativeToDirtyFrame =
         nsRect(nsPoint(0, 0), aFrame->GetParent()->GetSize());
 
     // If there's a visual viewport size set, restrict the amount of the
     // fixed-position element we paint to the visual viewport. (In general
     // the fixed-position element can be as large as the layout viewport,
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -158,16 +158,17 @@ whitelist-vars = [
     "kNameSpaceID_.*",
     "kGenericFont_.*",
     "kPresContext_.*",
     "nsContentUtils_.*",
     "GECKO_IS_NIGHTLY",
     "mozilla::detail::gGkAtoms",
     "mozilla::detail::kGkAtomsArrayOffset",
     "mozilla::profiler::detail::RacyFeatures::sActiveAndFeatures",
+    "mozilla::StaticPrefs::.*",
 ]
 # TODO(emilio): A bunch of types here can go away once we generate bindings and
 # structs together.
 whitelist-types = [
     "RawGecko.*",
     "RawServo.*",
     "ServoCssRules",
     "nsFontFaceRuleContainer",
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -98,17 +98,17 @@
 #endif
 
 #ifdef XP_WIN
 #  include "windows.h"
 #endif
 
 using namespace mozilla;
 
-using mozilla::ipc::FileDescriptor;
+using ipc::FileDescriptor;
 
 #ifdef DEBUG
 
 #  define ENSURE_PARENT_PROCESS(func, pref)                                   \
     do {                                                                      \
       if (MOZ_UNLIKELY(!XRE_IsParentProcess())) {                             \
         nsPrintfCString msg(                                                  \
             "ENSURE_PARENT_PROCESS: called %s on %s in a non-parent process", \
@@ -885,17 +885,17 @@ class Pref {
   uint32_t mHasUserValue : 1;
   uint32_t mIsSkippedByIteration : 1;
 
   PrefValue mDefaultValue;
   PrefValue mUserValue;
 };
 
 struct PrefHasher {
-  using Key = mozilla::UniquePtr<Pref>;
+  using Key = UniquePtr<Pref>;
   using Lookup = const char*;
 
   static HashNumber hash(const Lookup& aLookup) { return HashString(aLookup); }
 
   static bool match(const Key& aKey, const Lookup& aLookup) {
     if (!aLookup || !aKey->Name()) {
       return false;
     }
@@ -1189,17 +1189,17 @@ class CallbackNode {
 
   // Conceptually this is two fields:
   // - CallbackNode* mNext;
   // - Preferences::MatchKind mMatchKind;
   // They are combined into a tagged pointer to save memory.
   uintptr_t mNextAndMatchKind;
 };
 
-using PrefsHashTable = mozilla::HashSet<mozilla::UniquePtr<Pref>, PrefHasher>;
+using PrefsHashTable = HashSet<UniquePtr<Pref>, PrefHasher>;
 
 static PrefsHashTable* gHashTable;
 
 #ifdef DEBUG
 // This defines the datatype used to store our `Once` StaticPrefs checker.
 // We can't use HashMap for now due to alignment restrictions when dealing with
 // std::function<void()> (see bug 1557617).
 typedef std::function<void()> AntiFootgunCallback;
@@ -1504,17 +1504,17 @@ static PrefSaveData pref_savePrefs() {
 
 // Note that this never changes in the parent process, and is only read in
 // content processes.
 static bool gContentProcessPrefsAreInited = false;
 
 #endif  // DEBUG
 
 static Pref* pref_HashTableLookup(const char* aPrefName) {
-  MOZ_ASSERT(NS_IsMainThread() || mozilla::ServoStyleSet::IsInServoTraversal());
+  MOZ_ASSERT(NS_IsMainThread() || ServoStyleSet::IsInServoTraversal());
 
   MOZ_ASSERT_IF(!XRE_IsParentProcess(), gContentProcessPrefsAreInited);
 
   // We use readonlyThreadsafeLookup() because we often have concurrent lookups
   // from multiple Stylo threads. This is safe because those threads cannot
   // modify gHashTable, and the main thread is blocked while Stylo threads are
   // doing these lookups.
   auto p = gHashTable->readonlyThreadsafeLookup(aPrefName);
@@ -1533,17 +1533,17 @@ Maybe<PrefWrapper> pref_SharedLookup(con
   if (Maybe<SharedPrefMap::Pref> pref = gSharedMap->Get(aPrefName)) {
     return Some(*pref);
   }
   return Nothing();
 }
 
 Maybe<PrefWrapper> pref_Lookup(const char* aPrefName,
                                bool aIncludeTypeNone = false) {
-  MOZ_ASSERT(NS_IsMainThread() || mozilla::ServoStyleSet::IsInServoTraversal());
+  MOZ_ASSERT(NS_IsMainThread() || ServoStyleSet::IsInServoTraversal());
 
   AddAccessCount(aPrefName);
 
   if (gCallbackPref && strcmp(aPrefName, gCallbackPref->Name()) == 0) {
     return Some(*gCallbackPref);
   }
   if (Pref* pref = pref_HashTableLookup(aPrefName)) {
     if (aIncludeTypeNone || !pref->IsTypeNone()) {
@@ -1861,18 +1861,18 @@ class PrefCallback : public PLDHashEntry
 
  public:
   typedef PrefCallback* KeyType;
   typedef const PrefCallback* KeyTypePointer;
 
   static const PrefCallback* KeyToPointer(PrefCallback* aKey) { return aKey; }
 
   static PLDHashNumber HashKey(const PrefCallback* aKey) {
-    uint32_t hash = mozilla::HashString(aKey->mDomain);
-    return mozilla::AddToHash(hash, aKey->mCanonical);
+    uint32_t hash = HashString(aKey->mDomain);
+    return AddToHash(hash, aKey->mCanonical);
   }
 
  public:
   // Create a PrefCallback with a strong reference to its observer.
   PrefCallback(const nsACString& aDomain, nsIObserver* aObserver,
                nsPrefBranch* aBranch)
       : mDomain(aDomain),
         mBranch(aBranch),
@@ -2000,17 +2000,17 @@ class nsPrefBranch final : public nsIPre
   nsPrefBranch() = delete;
 
   static void NotifyObserver(const char* aNewpref, void* aData);
 
   size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
 
  private:
   // Helper class for either returning a raw cstring or nsCString.
-  typedef mozilla::Variant<const char*, const nsCString> PrefNameBase;
+  typedef Variant<const char*, const nsCString> PrefNameBase;
   class PrefName : public PrefNameBase {
    public:
     explicit PrefName(const char* aName) : PrefNameBase(aName) {}
     explicit PrefName(const nsCString& aName) : PrefNameBase(aName) {}
 
     // Use default move constructors, disallow copy constructors.
     PrefName(PrefName&& aOther) = default;
     PrefName& operator=(PrefName&& aOther) = default;
@@ -2099,18 +2099,17 @@ class nsPrefLocalizedString final : publ
 // nsPrefBranch
 //----------------------------------------------------------------------------
 
 nsPrefBranch::nsPrefBranch(const char* aPrefRoot, PrefValueKind aKind)
     : mPrefRoot(aPrefRoot),
       mKind(aKind),
       mFreeingObserverList(false),
       mObservers() {
-  nsCOMPtr<nsIObserverService> observerService =
-      mozilla::services::GetObserverService();
+  nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
   if (observerService) {
     ++mRefCnt;  // must be > 0 when we call this, or we'll get deleted!
 
     // Add weakly so we don't have to clean up at shutdown.
     observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, true);
     --mRefCnt;
   }
 }
@@ -2799,18 +2798,17 @@ void nsPrefBranch::FreeObserverList() {
   for (auto iter = mObservers.Iter(); !iter.Done(); iter.Next()) {
     nsAutoPtr<PrefCallback>& callback = iter.Data();
     Preferences::UnregisterCallback(nsPrefBranch::NotifyObserver,
                                     callback->GetDomain(), callback,
                                     Preferences::PrefixMatch);
     iter.Remove();
   }
 
-  nsCOMPtr<nsIObserverService> observerService =
-      mozilla::services::GetObserverService();
+  nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
   if (observerService) {
     observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
   }
 
   mFreeingObserverList = false;
 }
 
 void nsPrefBranch::RemoveExpiredCallback(PrefCallback* aCallback) {
@@ -2825,17 +2823,17 @@ nsresult nsPrefBranch::GetDefaultFromPro
   nsAutoCString propertyFileURL;
   nsresult rv = Preferences::GetCString(aPrefName, propertyFileURL,
                                         PrefValueKind::Default);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   nsCOMPtr<nsIStringBundleService> bundleService =
-      mozilla::services::GetStringBundleService();
+      services::GetStringBundleService();
   if (!bundleService) {
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIStringBundle> bundle;
   rv = bundleService->CreateBundle(propertyFileURL.get(),
                                    getter_AddRefs(bundle));
   if (NS_FAILED(rv)) {
@@ -2933,19 +2931,19 @@ void Preferences::HandleDirty() {
   if (!sPreferences->mDirty) {
     sPreferences->mDirty = true;
 
     if (sPreferences->mCurrentFile && sPreferences->AllowOffMainThreadSave() &&
         !sPreferences->mSavePending) {
       sPreferences->mSavePending = true;
       static const int PREF_DELAY_MS = 500;
       NS_DelayedDispatchToCurrentThread(
-          mozilla::NewRunnableMethod("Preferences::SavePrefFileAsynchronous",
-                                     sPreferences.get(),
-                                     &Preferences::SavePrefFileAsynchronous),
+          NewRunnableMethod("Preferences::SavePrefFileAsynchronous",
+                            sPreferences.get(),
+                            &Preferences::SavePrefFileAsynchronous),
           PREF_DELAY_MS);
     }
   }
 }
 
 static nsresult openPrefFile(nsIFile* aFile, PrefValueKind aKind);
 
 static nsresult parsePrefData(const nsCString& aData, PrefValueKind aKind);
@@ -3069,17 +3067,17 @@ Atomic<PrefSaveData*> PreferencesWriter:
 
 class PWRunnable : public Runnable {
  public:
   explicit PWRunnable(nsIFile* aFile) : Runnable("PWRunnable"), mFile(aFile) {}
 
   NS_IMETHOD Run() override {
     // If we get a nullptr on the exchange, it means that somebody
     // else has already processed the request, and we can just return.
-    mozilla::UniquePtr<PrefSaveData> prefs(
+    UniquePtr<PrefSaveData> prefs(
         PreferencesWriter::sPendingWriteData.exchange(nullptr));
     nsresult rv = NS_OK;
     if (prefs) {
       rv = PreferencesWriter::Write(mFile, *prefs);
 
       // Make a copy of these so we can have them in runnable lambda.
       // nsIFile is only there so that we would never release the
       // ref counted pointer off main thread.
@@ -3549,17 +3547,17 @@ already_AddRefed<Preferences> Preference
     if (NS_SUCCEEDED(rv)) {
       NS_CreateServicesFromCategory(
           "pref-config-startup",
           static_cast<nsISupports*>(static_cast<void*>(sPreferences)),
           "pref-config-startup");
     }
 
     nsCOMPtr<nsIObserverService> observerService =
-        mozilla::services::GetObserverService();
+        services::GetObserverService();
     if (!observerService) {
       sPreferences = nullptr;
       gCacheDataDesc = "GetObserverService() failed (1)";
       return nullptr;
     }
 
     observerService->AddObserver(sPreferences,
                                  "profile-before-change-telemetry", true);
@@ -3594,17 +3592,17 @@ already_AddRefed<Preferences> Preference
   return do_AddRef(sPreferences);
 }
 
 /* static */
 bool Preferences::IsServiceAvailable() { return !!sPreferences; }
 
 /* static */
 bool Preferences::InitStaticMembers() {
-  MOZ_ASSERT(NS_IsMainThread() || mozilla::ServoStyleSet::IsInServoTraversal());
+  MOZ_ASSERT(NS_IsMainThread() || ServoStyleSet::IsInServoTraversal());
 
   if (MOZ_LIKELY(sPreferences)) {
     return true;
   }
 
   if (!sShutdown) {
     MOZ_ASSERT(NS_IsMainThread());
     nsCOMPtr<nsIPrefService> prefService =
@@ -3700,16 +3698,26 @@ void Preferences::DeserializePreferences
   MOZ_ASSERT(p == aStr + aPrefsLen - 1);
 
 #ifdef DEBUG
   MOZ_ASSERT(!gContentProcessPrefsAreInited);
   gContentProcessPrefsAreInited = true;
 #endif
 }
 
+// Forward declarations.
+namespace StaticPrefs {
+
+static void InitAll(bool aIsStartup);
+static void InitOncePrefs();
+static void InitStaticPrefsFromShared();
+static void RegisterOncePrefs(SharedPrefMapBuilder& aBuilder);
+
+}  // namespace StaticPrefs
+
 /* static */
 FileDescriptor Preferences::EnsureSnapshot(size_t* aSize) {
   MOZ_ASSERT(XRE_IsParentProcess());
 
   if (!gSharedMap) {
     SharedPrefMapBuilder builder;
 
     for (auto iter = gHashTable->iter(); !iter.done(); iter.next()) {
@@ -4060,18 +4068,17 @@ Preferences::ResetStats() {
 
 NS_IMETHODIMP
 Preferences::GetDirty(bool* aRetVal) {
   *aRetVal = mDirty;
   return NS_OK;
 }
 
 nsresult Preferences::NotifyServiceObservers(const char* aTopic) {
-  nsCOMPtr<nsIObserverService> observerService =
-      mozilla::services::GetObserverService();
+  nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
   if (!observerService) {
     return NS_ERROR_FAILURE;
   }
 
   auto subject = static_cast<nsIPrefService*>(this);
   observerService->NotifyObservers(subject, aTopic, nullptr);
 
   return NS_OK;
@@ -4202,18 +4209,17 @@ nsresult Preferences::WritePrefFile(nsIF
   if (!gHashTable) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   AUTO_PROFILER_LABEL("Preferences::WritePrefFile", OTHER);
 
   if (AllowOffMainThreadSave()) {
     nsresult rv = NS_OK;
-    mozilla::UniquePtr<PrefSaveData> prefs =
-        MakeUnique<PrefSaveData>(pref_savePrefs());
+    UniquePtr<PrefSaveData> prefs = MakeUnique<PrefSaveData>(pref_savePrefs());
 
     // Put the newly constructed preference data into sPendingWriteData
     // for the next request to pick up
     prefs.reset(PreferencesWriter::sPendingWriteData.exchange(prefs.release()));
     if (prefs) {
       // There was a previous request that hasn't been processed,
       // and this is the data it had.
       return rv;
@@ -4482,23 +4488,34 @@ Result<Ok, const char*> Preferences::Ini
   // Initialize static prefs before prefs from data files so that the latter
   // will override the former.
   StaticPrefs::InitAll(aIsStartup);
 
   if (!XRE_IsParentProcess()) {
     MOZ_DIAGNOSTIC_ASSERT(gSharedMap);
 
 #ifdef DEBUG
-    // Check that all varcache preferences match their current values. This
-    // can currently fail if the default value of a static varcache preference
-    // is changed in a preference file or at runtime, rather than in
-    // StaticPrefList.h.
-    // StaticPrefs with a Skip policy aren't updated with an overridden value,
-    // and shouldn't be checked.
-
+    // For a VarCache pref like this:
+    //
+    //   VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
+    //
+    // we generate checking code like this:
+    //
+    //   MOZ_ASSERT(StaticPrefs::UpdatePolicy::$POLICY ==
+    //                StaticPrefs::UpdatePolicy::Skip ||
+    //              PreferencesInternalMethods::GetPref<int32_t>(name, value) ==
+    //              StaticPrefs::my_pref(),
+    //              "Incorrect cached value for my.pref");
+    //
+    // This checks that all VarCache preferences match their current values.
+    // This can currently fail if the default value of a static VarCache
+    // preference is changed in a preference file or at runtime, rather than in
+    // StaticPrefList_*.h. StaticPrefs with a Skip policy aren't updated with
+    // an overridden value, and shouldn't be checked.
+    //
 #  define PREF(name, cpp_type, value)
 #  define VARCACHE_PREF(policy, name, id, cpp_type, value)                     \
     MOZ_ASSERT(StaticPrefs::UpdatePolicy::policy ==                            \
                        StaticPrefs::UpdatePolicy::Skip ||                      \
                    PreferencesInternalMethods::GetPref<StripAtomic<cpp_type>>( \
                        name, value) == StaticPrefs::id(),                      \
                "Incorrect cached value for " name);
 #  include "mozilla/StaticPrefList.h"
@@ -4539,18 +4556,17 @@ Result<Ok, const char*> Preferences::Ini
 
   nsresult rv = NS_ERROR_FAILURE;
   nsZipFind* findPtr;
   nsAutoPtr<nsZipFind> find;
   nsTArray<nsCString> prefEntries;
   const char* entryName;
   uint16_t entryNameLen;
 
-  RefPtr<nsZipArchive> jarReader =
-      mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE);
+  RefPtr<nsZipArchive> jarReader = Omnijar::GetReader(Omnijar::GRE);
   if (jarReader) {
 #ifdef MOZ_WIDGET_ANDROID
     // Try to load an architecture-specific greprefs.js first. This will be
     // present in FAT AAR builds of GeckoView on Android.
     const char* abi = getenv("MOZ_ANDROID_CPU_ABI");
     if (abi) {
       nsAutoCString path;
       path.AppendPrintf("%s/greprefs.js", abi);
@@ -4624,23 +4640,22 @@ Result<Ok, const char*> Preferences::Ini
   rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles,
                            ArrayLength(specialFiles));
   if (NS_FAILED(rv)) {
     NS_WARNING("Error parsing application default preferences.");
   }
 
   // Load jar:$app/omni.jar!/defaults/preferences/*.js
   // or jar:$gre/omni.jar!/defaults/preferences/*.js.
-  RefPtr<nsZipArchive> appJarReader =
-      mozilla::Omnijar::GetReader(mozilla::Omnijar::APP);
-
-  // GetReader(mozilla::Omnijar::APP) returns null when `$app == $gre`, in
+  RefPtr<nsZipArchive> appJarReader = Omnijar::GetReader(Omnijar::APP);
+
+  // GetReader(Omnijar::APP) returns null when `$app == $gre`, in
   // which case we look for app-specific default preferences in $gre.
   if (!appJarReader) {
-    appJarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE);
+    appJarReader = Omnijar::GetReader(Omnijar::GRE);
   }
 
   if (appJarReader) {
     rv = appJarReader->FindInit("defaults/preferences/*.js$", &findPtr);
     NS_ENSURE_SUCCESS(rv, Err("appJarReader->FindInit() failed"));
     find = findPtr;
     prefEntries.Clear();
     while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) {
@@ -4684,18 +4699,17 @@ Result<Ok, const char*> Preferences::Ini
 
   if (XRE_IsParentProcess()) {
     SetupTelemetryPref();
   }
 
   NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID, nullptr,
                                 NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID);
 
-  nsCOMPtr<nsIObserverService> observerService =
-      mozilla::services::GetObserverService();
+  nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
   NS_ENSURE_SUCCESS(rv, Err("GetObserverService() failed (2)"));
 
   observerService->NotifyObservers(nullptr, NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID,
                                    nullptr);
 
   return Ok();
 }
 
@@ -5390,148 +5404,142 @@ static void InitVarCachePref(StaticPrefs
       MOZ_LIKELY(aIsStartup)) {
     AddVarCache(aCache, aName, aDefaultValue, true);
   }
 }
 
 static Atomic<bool> sOncePrefRead(false);
 static StaticMutex sOncePrefMutex;
 
-/* static */
-void StaticPrefs::MaybeInitOncePrefs() {
+namespace StaticPrefs {
+
+void MaybeInitOncePrefs() {
   if (MOZ_LIKELY(sOncePrefRead)) {
     // `Once` StaticPrefs have already been initialized to their default value.
     return;
   }
   StaticMutexAutoLock lock(sOncePrefMutex);
   if (NS_IsMainThread()) {
     InitOncePrefs();
   } else {
     RefPtr<Runnable> runnable = NS_NewRunnableFunction(
         "Preferences::MaybeInitOncePrefs", [&]() { InitOncePrefs(); });
     // This logic needs to run on the main thread
-    mozilla::SyncRunnable::DispatchToThread(
-        SystemGroup::EventTargetFor(mozilla::TaskCategory::Other), runnable);
+    SyncRunnable::DispatchToThread(
+        SystemGroup::EventTargetFor(TaskCategory::Other), runnable);
   }
   sOncePrefRead = true;
 }
 
-// For a VarCache pref like this:
+// For a pref like this:
 //
-//   VARCACHE_PREF(Once, "my.varcache", my_varcache, int32_t, 99)
-//
-// we generate a static variable definition and a setter like:
+//   VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
 //
-//   int32_t StaticPrefs::sVarCache_my_varcache(99);
-//   int32_t StaticPrefs::my_varcache() {
-//     if (UpdatePolicy::Skip != UpdatePolicy::Once) {
-//       return sVarCache_myvarcache;
-//     }
-//     MaybeInitOncePrefs();
-//     return sVarCache_myvarcache;
-//   }
-
+// we generate a variable definition like this:
+//
+//   int32_t sVarCache_my_pref(99);
+//
 #define PREF(name, cpp_type, value)
 #define VARCACHE_PREF(policy, name, id, cpp_type, default_value) \
-  cpp_type StaticPrefs::sVarCache_##id(default_value);
+  cpp_type sVarCache_##id(default_value);
 #include "mozilla/StaticPrefList.h"
 #undef PREF
 #undef VARCACHE_PREF
 
-/* static */
-void StaticPrefs::InitAll(bool aIsStartup) {
+static void InitAll(bool aIsStartup) {
+  bool isParent = XRE_IsParentProcess();
+
   // For prefs like these:
   //
   //   PREF("foo.bar.baz", bool, true)
-  //   VARCACHE_PREF(Live, "my.varcache", my_varcache, int32_t, 99)
+  //   VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
   //
-  // we generate registration calls:
+  // we generate registration calls like this:
   //
-  //   if (isParent)
+  //   if (isParent) {
   //     SetPref_bool("foo.bar.baz", true);
-  //   InitVarCachePref(StaticPrefs::UpdatePolicy::Live, "my.varcache",
-  //                    &StaticPrefs::sVarCache_my_varcache, 99, aIsStartup,
-  //                    isParent);
+  //   }
+  //   InitVarCachePref(UpdatePolicy::Live, "my.pref", &sVarCache_my_pref,
+  //                    99, aIsStartup, isParent);
   //
   // The SetPref_*() functions have a type suffix to avoid ambiguity between
   // prefs having int32_t and float default values. That suffix is not needed
   // for the InitVarCachePref() functions because they take a pointer parameter,
   // which prevents automatic int-to-float coercion.
   //
   // In content processes, we rely on the parent to send us the correct initial
   // values via shared memory, so we do not re-initialize them here.
-  bool isParent = XRE_IsParentProcess();
-#define PREF(name, cpp_type, value) \
-  if (isParent) SetPref_##cpp_type(name, value);
-#define VARCACHE_PREF(policy, name, id, cpp_type, value)                   \
-  InitVarCachePref(StaticPrefs::UpdatePolicy::policy,                      \
-                   NS_LITERAL_CSTRING(name), &StaticPrefs::sVarCache_##id, \
-                   value, aIsStartup, isParent);
+#define PREF(name, cpp_type, value)  \
+  if (isParent) {                    \
+    SetPref_##cpp_type(name, value); \
+  }
+#define VARCACHE_PREF(policy, name, id, cpp_type, value)           \
+  InitVarCachePref(UpdatePolicy::policy, NS_LITERAL_CSTRING(name), \
+                   &sVarCache_##id, value, aIsStartup, isParent);
 #include "mozilla/StaticPrefList.h"
 #undef PREF
 #undef VARCACHE_PREF
 }
 
-/* static */
-void StaticPrefs::InitOncePrefs() {
-  // For prefs like these:
+static void InitOncePrefs() {
+  // For a pref like this:
   //
-  //   VARCACHE_PREF(Skip, "my.varcache", my_varcache, int32_t, 99)
+  //   VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
   //
-  // we generate registration calls:
+  // we generate an initialization (in a non-DEBUG build) like this:
   //
-  //   if (UpdatePolicy::Skip == UpdatePolicy::Once) {
-  //     StaticPrefs::sVarCache_my_varcache =
-  //         PreferencesInternalMethods::GetPref("my.varcache",
-  //                                             StripAtomic<int32_t>(99));
+  //   if (UpdatePolicy::$POLICY == UpdatePolicy::Once) {
+  //     sVarCache_my_pref = PreferencesInternalMethods::GetPref("my.pref", 99);
   //   }
   //
   // This is done to get the potentially updated Preference value as we didn't
   // register a callback method for the `Once` policy.
   //
   // On debug build, we also install a mechanism that allows to check if the
   // original Preference is being modified once `Once` StaticPrefs have been
   // initialized as this would indicate a likely misuse of `Once` StaticPrefs
   // and that maybe instead they should have been made `Live`.
+  //
 #define PREF(name, cpp_type, value)
 #ifdef DEBUG
-#  define VARCACHE_PREF(policy, name, id, cpp_type, value)                    \
-    if (UpdatePolicy::policy == UpdatePolicy::Once) {                         \
-      MOZ_ASSERT(gOnceStaticPrefsAntiFootgun);                                \
-      StaticPrefs::sVarCache_##id = PreferencesInternalMethods::GetPref(      \
-          name, StripAtomic<cpp_type>(value));                                \
-      auto checkPref = [&]() {                                                \
-        MOZ_ASSERT(sOncePrefRead);                                            \
-        StripAtomic<cpp_type> staticPrefValue = StaticPrefs::id();            \
-        StripAtomic<cpp_type> preferenceValue =                               \
-            PreferencesInternalMethods::GetPref(                              \
-                StaticPrefs::Get##id##PrefName(),                             \
-                StripAtomic<cpp_type>(value));                                \
-        MOZ_ASSERT(                                                           \
-            staticPrefValue == preferenceValue,                               \
-            "Preference '" name "' got modified since StaticPrefs::" #id      \
-            " got initialized. Consider using a `Live` StaticPrefs instead"); \
-      };                                                                      \
-      gOnceStaticPrefsAntiFootgun->insert(                                    \
-          std::pair<const char*, AntiFootgunCallback>(Get##id##PrefName(),    \
-                                                      std::move(checkPref))); \
+#  define VARCACHE_PREF(policy, name, id, cpp_type, value)                     \
+    if (UpdatePolicy::policy == UpdatePolicy::Once) {                          \
+      MOZ_ASSERT(gOnceStaticPrefsAntiFootgun);                                 \
+      sVarCache_##id = PreferencesInternalMethods::GetPref(                    \
+          name, StripAtomic<cpp_type>(value));                                 \
+      auto checkPref = [&]() {                                                 \
+        MOZ_ASSERT(sOncePrefRead);                                             \
+        StripAtomic<cpp_type> staticPrefValue = id();                          \
+        StripAtomic<cpp_type> preferenceValue =                                \
+            PreferencesInternalMethods::GetPref(Get##id##PrefName(),           \
+                                                StripAtomic<cpp_type>(value)); \
+        MOZ_ASSERT(                                                            \
+            staticPrefValue == preferenceValue,                                \
+            "Preference '" name "' got modified since StaticPrefs::" #id       \
+            " got initialized. Consider using a `Live` StaticPrefs instead");  \
+      };                                                                       \
+      gOnceStaticPrefsAntiFootgun->insert(                                     \
+          std::pair<const char*, AntiFootgunCallback>(Get##id##PrefName(),     \
+                                                      std::move(checkPref)));  \
     }
 #else
-#  define VARCACHE_PREF(policy, name, id, cpp_type, value)               \
-    if (UpdatePolicy::policy == UpdatePolicy::Once) {                    \
-      StaticPrefs::sVarCache_##id = PreferencesInternalMethods::GetPref( \
-          name, StripAtomic<cpp_type>(value));                           \
+#  define VARCACHE_PREF(policy, name, id, cpp_type, value)  \
+    if (UpdatePolicy::policy == UpdatePolicy::Once) {       \
+      sVarCache_##id = PreferencesInternalMethods::GetPref( \
+          name, StripAtomic<cpp_type>(value));              \
     }
 #endif
 
 #include "mozilla/StaticPrefList.h"
 #undef PREF
 #undef VARCACHE_PREF
 }
 
+}  // namespace StaticPrefs
+
 static MOZ_MAYBE_UNUSED void SaveOncePrefToSharedMap(
     SharedPrefMapBuilder& aBuilder, const char* aName, bool aValue) {
   auto oncePref = MakeUnique<Pref>(aName);
   oncePref->SetType(PrefType::Bool);
   oncePref->SetIsSkippedByIteration(true);
   bool valueChanged = false;
   MOZ_ALWAYS_SUCCEEDS(
       oncePref->SetDefaultValue(PrefType::Bool, PrefValue(aValue),
@@ -5573,77 +5581,76 @@ static MOZ_MAYBE_UNUSED void SaveOncePre
       oncePref->SetDefaultValue(PrefType::String, PrefValue(flat.get()),
                                 /* isSticky */ true,
                                 /* isLocked */ true, &valueChanged));
   oncePref->AddToMap(aBuilder);
 }
 
 #define ONCE_PREF_NAME(name) ("$$$" name "$$$")
 
-/* static */
-void StaticPrefs::RegisterOncePrefs(SharedPrefMapBuilder& aBuilder) {
+namespace StaticPrefs {
+
+static void RegisterOncePrefs(SharedPrefMapBuilder& aBuilder) {
   MOZ_ASSERT(XRE_IsParentProcess());
   MOZ_DIAGNOSTIC_ASSERT(!gSharedMap,
                         "Must be called before gSharedMap has been created");
   MaybeInitOncePrefs();
-  // For prefs like these:
+
+  // For a pref like this:
   //
-  //   VARCACHE_PREF(Once, "my.varcache", my_varcache, int32_t, 99)
-  //   (Other StaticPrefs policies are ignored)
+  //   VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
   //
-  // we generate registration calls:
+  // we generate a save call like this:
   //
-  //   if (UpdatePolicy::Once == UpdatePolicy::Once) {
-  //     SaveOncePrefToSharedMap(aBuilder, ONCE_PREF_NAME(my.varcache),
-  //                             sVarCache_myvarcache);
+  //   if (UpdatePolicy::$POLICY == UpdatePolicy::Once) {
+  //     SaveOncePrefToSharedMap(aBuilder, ONCE_PREF_NAME(my.pref),
+  //                             sVarCache_my_pref);
   //   }
   //
   // `Once` StaticPrefs values will be stored in a hidden and locked preferences
   // in the global SharedPreferenceMap. In order for those preferences to be
   // hidden and not appear in about:config nor ever be stored to disk, we add
   // the "$$$" prefix and suffix to the preference name and set the IsVisible
   // flag to false.
-
+  //
 #define PREF(name, cpp_type, value)
 #define VARCACHE_PREF(policy, name, id, cpp_type, value)            \
   if (UpdatePolicy::policy == UpdatePolicy::Once) {                 \
     SaveOncePrefToSharedMap(aBuilder, ONCE_PREF_NAME(name),         \
                             StripAtomic<cpp_type>(sVarCache_##id)); \
   }
 #include "mozilla/StaticPrefList.h"
 #undef PREF
 #undef VARCACHE_PREF
 }
 
-/* static */
-void StaticPrefs::InitStaticPrefsFromShared() {
+static void InitStaticPrefsFromShared() {
   MOZ_ASSERT(!XRE_IsParentProcess());
   MOZ_DIAGNOSTIC_ASSERT(gSharedMap,
                         "Must be called once gSharedMap has been created");
-  // For prefs like these:
+
+  // For a prefs like this:
   //
-  //   VARCACHE_PREF(Once, "my.varcache", my_varcache, int32_t, 99)
-  //   (Other StaticPrefs policies are ignored).
+  //   VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
   //
-  // we generate registration calls:
+  // we generate an initialization like this:
   //
-  //   if (UpdatePolicy::Once != UpdatePolicy::Skip) {
+  //   if (UpdatePolicy::$POLICY != UpdatePolicy::Skip) {
   //     int32_t val;
   //     nsresult rv;
-  //     if (UpdatePolicy::Once == UpdatePolicy::Once) {
+  //     if (UpdatePolicy::$POLICY == UpdatePolicy::Once) {
   //       rv = PreferencesInternalMethods::GetSharedPrefValue(
-  //           "$$$my.varcache$$$", &val);
+  //              "$$$my.pref$$$", &val);
   //     } else if (UpdatePolicy::Once == UpdatePolicy::Live) {
-  //       rv = PreferencesInternalMethods::GetSharedPrefValue(
-  //           "my.varcache", &val);
+  //       rv = PreferencesInternalMethods::GetSharedPrefValue("my.pref", &val);
   //     }
   //     MOZ_DIAGNOSTIC_ALWAYS_TRUE(NS_SUCCEEDED(rv));
-  //     StaticPrefs::sVarCache_my_varcache = val;
+  //     sVarCache_my_pref = val;
   //   }
-
+  //
 #define PREF(name, cpp_type, value)
 #define VARCACHE_PREF(policy, name, id, cpp_type, value)               \
   if (UpdatePolicy::policy != UpdatePolicy::Skip) {                    \
     StripAtomic<cpp_type> val;                                         \
     nsresult rv;                                                       \
     if (UpdatePolicy::policy == UpdatePolicy::Once) {                  \
       rv = PreferencesInternalMethods::GetSharedPrefValue(             \
           ONCE_PREF_NAME(name), &val);                                 \
@@ -5651,22 +5658,25 @@ void StaticPrefs::InitStaticPrefsFromSha
       rv = PreferencesInternalMethods::GetSharedPrefValue(name, &val); \
     }                                                                  \
     MOZ_DIAGNOSTIC_ALWAYS_TRUE(NS_SUCCEEDED(rv));                      \
     StaticPrefs::sVarCache_##id = val;                                 \
   }
 #include "mozilla/StaticPrefList.h"
 #undef PREF
 #undef VARCACHE_PREF
+
   // `Once` StaticPrefs have been set to their value in the step above and
   // outside the parent process they are immutable. So we set sOncePrefRead
   // so that we can directly skip any lazy initializations.
   sOncePrefRead = true;
 }
 
+}  // namespace StaticPrefs
+
 }  // namespace mozilla
 
 #undef ENSURE_PARENT_PROCESS
 
 //===========================================================================
 // Module and factory stuff
 //===========================================================================
 
--- a/modules/libpref/StaticPrefs.h
+++ b/modules/libpref/StaticPrefs.h
@@ -64,72 +64,67 @@ template <typename T>
 struct IsAtomic : FalseType {};
 
 template <typename T, MemoryOrdering Order>
 struct IsAtomic<Atomic<T, Order>> : TrueType {};
 
 template <typename T>
 struct IsAtomic<std::atomic<T>> : TrueType {};
 
-class StaticPrefs {
-  // For a VarCache pref like this:
-  //
-  //   VARCACHE_PREF("my.varcache", my_varcache, int32_t, 99)
-  //
-  // we generate a static variable declaration, a getter and a setter
-  // definition. A StaticPref can be set by using the corresponding Set method.
-  // For example, if the accessor is Foo() then calling SetFoo(...) will update
-  // the preference and also change the return value of subsequent Foo() calls.
-  // Changing StaticPrefs is only allowed on the parent process' main thread.
-  //
-  //   private:
-  //     static int32_t sVarCache_my_varcache;
-  //   public:
-  //     static int32_t my_varcache();
-  //     static const char* Getmy_varcachePrefName() { return "my.varcache"; }
-  //     static int32_t Getmy_varcachePrefDefault() { return 99; }
-  //
+namespace StaticPrefs {
+
+// Enums for the update policy.
+enum class UpdatePolicy {
+  Skip,  // Set the value to default, skip any Preferences calls.
+  Once,  // Evaluate the preference once, unchanged during the session.
+  Live   // Evaluate the preference and set callback so it stays current/live.
+};
+
+void MaybeInitOncePrefs();
 
- public:
-  // Enums for the update policy.
-  enum class UpdatePolicy {
-    Skip,  // Set the value to default, skip any Preferences calls.
-    Once,  // Evaluate the preference once, unchanged during the session.
-    Live   // Evaluate the preference and set callback so it stays current/live.
-  };
-
-#define PREF(str, cpp_type, default_value)
-#define VARCACHE_PREF(policy, str, id, cpp_type, default_value) \
- private:                                                       \
-  static cpp_type sVarCache_##id;                               \
-                                                                \
- public:                                                        \
-  static StripAtomic<cpp_type> id() {                           \
-    if (UpdatePolicy::policy != UpdatePolicy::Once) {           \
-      MOZ_DIAGNOSTIC_ASSERT(                                    \
-          UpdatePolicy::policy == UpdatePolicy::Skip ||         \
-              IsAtomic<cpp_type>::value || NS_IsMainThread(),   \
-          "Non-atomic static pref '" str                        \
-          "' being accessed on background thread by getter");   \
-      return sVarCache_##id;                                    \
-    }                                                           \
-    MaybeInitOncePrefs();                                       \
-    return sVarCache_##id;                                      \
-  }                                                             \
-  static const char* Get##id##PrefName() { return str; }        \
-  static StripAtomic<cpp_type> Get##id##PrefDefault() { return default_value; }
+// For a VarCache pref like this:
+//
+//   VARCACHE_PREF($POLICY, "my.pref", my_pref, int32_t, 99)
+//
+// we generate an extern variable declaration and three getter
+// declarations/definitions.
+//
+//     extern int32_t sVarCache_my_pref;
+//     inline int32_t my_pref() {
+//       if (UpdatePolicy::$POLICY != UpdatePolicy::Once) {
+//         return sVarCache_my_pref;
+//       }
+//       MaybeInitOncePrefs();
+//       return sVarCache_my_pref();
+//     }
+//     inline const char* Getmy_prefPrefName() { return "my.pref"; }
+//     inline int32_t Getmy_prefPrefDefault() { return 99; }
+//
+// The extern declaration of the variable is necessary for bindgen to see it
+// and generate Rust bindings.
+//
+#define PREF(name, cpp_type, default_value)
+#define VARCACHE_PREF(policy, name, id, cpp_type, default_value) \
+  extern cpp_type sVarCache_##id;                                \
+  inline StripAtomic<cpp_type> id() {                            \
+    if (UpdatePolicy::policy != UpdatePolicy::Once) {            \
+      MOZ_DIAGNOSTIC_ASSERT(                                     \
+          UpdatePolicy::policy == UpdatePolicy::Skip ||          \
+              IsAtomic<cpp_type>::value || NS_IsMainThread(),    \
+          "Non-atomic static pref '" name                        \
+          "' being accessed on background thread by getter");    \
+      return sVarCache_##id;                                     \
+    }                                                            \
+    MaybeInitOncePrefs();                                        \
+    return sVarCache_##id;                                       \
+  }                                                              \
+  inline const char* Get##id##PrefName() { return name; }        \
+  inline StripAtomic<cpp_type> Get##id##PrefDefault() { return default_value; }
 
 #include "mozilla/StaticPrefList.h"
 #undef PREF
 #undef VARCACHE_PREF
 
- private:
-  friend class Preferences;
-  static void InitAll(bool aIsStartup);
-  static void MaybeInitOncePrefs();
-  static void InitOncePrefs();
-  static void InitStaticPrefsFromShared();
-  static void RegisterOncePrefs(SharedPrefMapBuilder& aBuilder);
-};
+}  // namespace StaticPrefs
 
 }  // namespace mozilla
 
 #endif  // mozilla_StaticPrefs_h
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -55,17 +55,17 @@
 //   many VarCaches that should be atomic are not, in particular because
 //   Atomic<float> is not available, alas.)
 //
 // Definitions of VarCache prefs in this file has the following form.
 //
 //   VARCACHE_PREF(
 //     <update-policy>,
 //     <pref-name-string>,
-//     <pref-name-id>,
+//      <pref-name-id>,  // indented one space to align with <pref-name-string>
 //     <cpp-type>, <default-value>
 //   )
 //
 // - <update-policy> is one of the following:
 //
 //   * Live: Evaluate the pref and set callback so it stays current/live. This
 //     is the normal policy.
 //
@@ -112,600 +112,584 @@
 
 //---------------------------------------------------------------------------
 // Prefs starting with "accessibility."
 //---------------------------------------------------------------------------
 
 VARCACHE_PREF(
   Live,
   "accessibility.monoaudio.enable",
-  accessibility_monoaudio_enable,
+   accessibility_monoaudio_enable,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "accessibility.browsewithcaret",
-  AccessibilityBrowseWithCaret,
+   accessibility_browsewithcaret,
   RelaxedAtomicBool, false
 )
 
 //---------------------------------------------------------------------------
 // Prefs starting with "apz."
 // The apz prefs are explained in AsyncPanZoomController.cpp
 //---------------------------------------------------------------------------
 
 VARCACHE_PREF(
   Live,
   "apz.allow_double_tap_zooming",
-  APZAllowDoubleTapZooming,
+   apz_allow_double_tap_zooming,
   RelaxedAtomicBool, true
 )
 
 VARCACHE_PREF(
   Live,
   "apz.allow_immediate_handoff",
-  APZAllowImmediateHandoff,
+   apz_allow_immediate_handoff,
   RelaxedAtomicBool, true
 )
 
 VARCACHE_PREF(
   Live,
   "apz.allow_zooming",
-  APZAllowZooming,
+   apz_allow_zooming,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.android.chrome_fling_physics.enabled",
-  APZUseChromeFlingPhysics,
+   apz_android_chrome_fling_physics_enabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.android.chrome_fling_physics.friction",
-  APZChromeFlingPhysicsFriction,
+   apz_android_chrome_fling_physics_friction,
   AtomicFloat, 0.015f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.android.chrome_fling_physics.inflexion",
-  APZChromeFlingPhysicsInflexion,
+   apz_android_chrome_fling_physics_inflexion,
   AtomicFloat, 0.35f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.android.chrome_fling_physics.stop_threshold",
-  APZChromeFlingPhysicsStopThreshold,
+   apz_android_chrome_fling_physics_stop_threshold,
   AtomicFloat, 0.1f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.autoscroll.enabled",
-  APZAutoscrollEnabled,
+   apz_autoscroll_enabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.axis_lock.breakout_angle",
-  APZAxisBreakoutAngle,
+   apz_axis_lock_breakout_angle,
   AtomicFloat, float(M_PI / 8.0) /* 22.5 degrees */
 )
 
 VARCACHE_PREF(
   Live,
   "apz.axis_lock.breakout_threshold",
-  APZAxisBreakoutThreshold,
+   apz_axis_lock_breakout_threshold,
   AtomicFloat, 1.0f / 32.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.axis_lock.direct_pan_angle",
-  APZAllowedDirectPanAngle,
+   apz_axis_lock_direct_pan_angle,
   AtomicFloat, float(M_PI / 3.0) /* 60 degrees */
 )
 
 VARCACHE_PREF(
   Live,
   "apz.axis_lock.lock_angle",
-  APZAxisLockAngle,
+   apz_axis_lock_lock_angle,
   AtomicFloat, float(M_PI / 6.0) /* 30 degrees */
 )
 
 VARCACHE_PREF(
   Live,
   "apz.axis_lock.mode",
-  APZAxisLockMode,
+   apz_axis_lock_mode,
   RelaxedAtomicInt32, 0
 )
 
 VARCACHE_PREF(
   Live,
   "apz.content_response_timeout",
-  APZContentResponseTimeout,
+   apz_content_response_timeout,
   RelaxedAtomicInt32, 400
 )
 
 VARCACHE_PREF(
   Live,
   "apz.danger_zone_x",
-  APZDangerZoneX,
+   apz_danger_zone_x,
   RelaxedAtomicInt32, 50
 )
 
 VARCACHE_PREF(
   Live,
   "apz.danger_zone_y",
-  APZDangerZoneY,
+   apz_danger_zone_y,
   RelaxedAtomicInt32, 100
 )
 
 VARCACHE_PREF(
   Live,
   "apz.disable_for_scroll_linked_effects",
-  APZDisableForScrollLinkedEffects,
+   apz_disable_for_scroll_linked_effects,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.displayport_expiry_ms",
-  APZDisplayPortExpiryTime,
+   apz_displayport_expiry_ms,
   RelaxedAtomicUint32, 15000
 )
 
 VARCACHE_PREF(
   Live,
   "apz.drag.enabled",
-  APZDragEnabled,
+   apz_drag_enabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.drag.initial.enabled",
-  APZDragInitiationEnabled,
+   apz_drag_initial_enabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.drag.touch.enabled",
-  APZTouchDragEnabled,
+   apz_touch_drag_enabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.enlarge_displayport_when_clipped",
-  APZEnlargeDisplayPortWhenClipped,
+   apz_enlarge_displayport_when_clipped,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.fixed-margin-override.enabled",
-  APZFixedMarginOverrideEnabled,
+   apz_fixed_margin_override_enabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.fixed-margin-override.bottom",
-  APZFixedMarginOverrideBottom,
+   apz_fixed_margin_override_bottom,
   RelaxedAtomicInt32, 0
 )
 
 VARCACHE_PREF(
   Live,
   "apz.fixed-margin-override.top",
-  APZFixedMarginOverrideTop,
+   apz_fixed_margin_override_top,
   RelaxedAtomicInt32, 0
 )
 
 VARCACHE_PREF(
   Live,
   "apz.fling_accel_base_mult",
-  APZFlingAccelBaseMultiplier,
+   apz_fling_accel_base_mult,
   AtomicFloat, 1.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.fling_accel_interval_ms",
-  APZFlingAccelInterval,
+   apz_fling_accel_interval_ms,
   RelaxedAtomicInt32, 500
 )
 
 VARCACHE_PREF(
   Live,
   "apz.fling_accel_supplemental_mult",
-  APZFlingAccelSupplementalMultiplier,
+   apz_fling_accel_supplemental_mult,
   AtomicFloat, 1.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.fling_accel_min_velocity",
-  APZFlingAccelMinVelocity,
+   apz_fling_accel_min_velocity,
   AtomicFloat, 1.5f
 )
 
 VARCACHE_PREF(
   Once,
   "apz.fling_curve_function_x1",
-  APZCurveFunctionX1,
+   apz_fling_curve_function_x1,
   float, 0.0f
 )
 
 VARCACHE_PREF(
   Once,
   "apz.fling_curve_function_x2",
-  APZCurveFunctionX2,
+   apz_fling_curve_function_x2,
   float, 1.0f
 )
 
 VARCACHE_PREF(
   Once,
   "apz.fling_curve_function_y1",
-  APZCurveFunctionY1,
+   apz_fling_curve_function_y1,
   float, 0.0f
 )
 
 VARCACHE_PREF(
   Once,
   "apz.fling_curve_function_y2",
-  APZCurveFunctionY2,
+   apz_fling_curve_function_y2,
   float, 1.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.fling_curve_threshold_inches_per_ms",
-  APZCurveThreshold,
+   apz_fling_curve_threshold_inches_per_ms,
   AtomicFloat, -1.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.fling_friction",
-  APZFlingFriction,
+   apz_fling_friction,
   AtomicFloat, 0.002f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.fling_min_velocity_threshold",
-  APZFlingMinVelocityThreshold,
+   apz_fling_min_velocity_threshold,
   AtomicFloat, 0.5f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.fling_stop_on_tap_threshold",
-  APZFlingStopOnTapThreshold,
+   apz_fling_stop_on_tap_threshold,
   AtomicFloat, 0.05f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.fling_stopped_threshold",
-  APZFlingStoppedThreshold,
+   apz_fling_stopped_threshold,
   AtomicFloat, 0.01f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.frame_delay.enabled",
-  APZFrameDelayEnabled,
+   apz_frame_delay_enabled,
   RelaxedAtomicBool, false
 )
 
 #ifdef MOZ_WIDGET_GTK
 VARCACHE_PREF(
   Live,
   "apz.gtk.kinetic_scroll.enabled",
-  APZGTKKineticScrollEnabled,
+   apz_gtk_kinetic_scroll_enabled,
   RelaxedAtomicBool, false
 )
 #endif
 
 #if !defined(MOZ_WIDGET_ANDROID)
 # define PREF_VALUE true
 #else
 # define PREF_VALUE false
 #endif
 VARCACHE_PREF(
   Once,
   "apz.keyboard.enabled",
-  APZKeyboardEnabled,
+   apz_keyboard_enabled,
   bool, PREF_VALUE
 )
 #undef PREF_VALUE
 
 VARCACHE_PREF(
   Live,
   "apz.keyboard.passive-listeners",
-  APZKeyboardPassiveListeners,
+   apz_keyboard_passive_listeners,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.max_tap_time",
-  APZMaxTapTime,
+   apz_max_tap_time,
   RelaxedAtomicInt32, 300
 )
 
 VARCACHE_PREF(
   Live,
   "apz.max_velocity_inches_per_ms",
-  APZMaxVelocity,
+   apz_max_velocity_inches_per_ms,
   AtomicFloat, -1.0f
 )
 
 VARCACHE_PREF(
   Once,
   "apz.max_velocity_queue_size",
-  APZMaxVelocityQueueSize,
+   apz_max_velocity_queue_size,
   uint32_t, 5
 )
 
 VARCACHE_PREF(
   Live,
   "apz.min_skate_speed",
-  APZMinSkateSpeed,
+   apz_min_skate_speed,
   AtomicFloat, 1.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.minimap.enabled",
-  APZMinimap,
+   apz_minimap_enabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.one_touch_pinch.enabled",
-  APZOneTouchPinchEnabled,
+   apz_one_touch_pinch_enabled,
   RelaxedAtomicBool, true
 )
 
 VARCACHE_PREF(
   Live,
   "apz.overscroll.enabled",
-  APZOverscrollEnabled,
+   apz_overscroll_enabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.overscroll.min_pan_distance_ratio",
-  APZMinPanDistanceRatio,
+   apz_overscroll_min_pan_distance_ratio,
   AtomicFloat, 1.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.overscroll.spring_stiffness",
-  APZOverscrollSpringStiffness,
+   apz_overscroll_spring_stiffness,
   AtomicFloat, 0.001f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.overscroll.stop_distance_threshold",
-  APZOverscrollStopDistanceThreshold,
+   apz_overscroll_stop_distance_threshold,
   AtomicFloat, 5.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.paint_skipping.enabled",
-  APZPaintSkipping,
+   apz_paint_skipping_enabled,
   RelaxedAtomicBool, true
 )
 
 VARCACHE_PREF(
   Live,
   "apz.peek_messages.enabled",
-  APZPeekMessages,
+   apz_peek_messages_enabled,
   RelaxedAtomicBool, true
 )
 
 VARCACHE_PREF(
   Live,
   "apz.pinch_lock.mode",
-  APZPinchLockMode,
+   apz_pinch_lock_mode,
   RelaxedAtomicInt32, 1
 )
 
 VARCACHE_PREF(
   Live,
   "apz.pinch_lock.scroll_lock_threshold",
-  APZPinchLockScrollLockThreshold,
+   apz_pinch_lock_scroll_lock_threshold,
   AtomicFloat, 1.0f / 32.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.pinch_lock.span_breakout_threshold",
-  APZPinchLockSpanBreakoutThreshold,
+   apz_pinch_lock_span_breakout_threshold,
   AtomicFloat, 1.0f / 32.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.pinch_lock.span_lock_threshold",
-  APZPinchLockSpanLockThreshold,
+   apz_pinch_lock_span_lock_threshold,
   AtomicFloat, 1.0f / 32.0f
 )
 
 VARCACHE_PREF(
   Once,
   "apz.pinch_lock.buffer_max_age",
-  APZPinchLockBufferMaxAge,
+   apz_pinch_lock_buffer_max_age,
   int32_t, 50 // milliseconds
 )
 
 VARCACHE_PREF(
   Live,
   "apz.popups.enabled",
-  APZPopupsEnabled,
+   apz_popups_enabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.printtree",
-  APZPrintTree,
+   apz_printtree,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.record_checkerboarding",
-  APZRecordCheckerboarding,
+   apz_record_checkerboarding,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.second_tap_tolerance",
-  APZSecondTapTolerance,
+   apz_second_tap_tolerance,
   AtomicFloat, 0.5f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.test.fails_with_native_injection",
-  APZTestFailsWithNativeInjection,
+   apz_test_fails_with_native_injection,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.test.logging_enabled",
-  apz_test_logging_enabled,
+   apz_test_logging_enabled,
   RelaxedAtomicBool, false
 )
 
 VARCACHE_PREF(
   Live,
   "apz.touch_move_tolerance",
-  APZTouchMoveTolerance,
+   apz_touch_move_tolerance,
   AtomicFloat, 0.1f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.touch_start_tolerance",
-  APZTouchStartTolerance,
+   apz_touch_start_tolerance,
   AtomicFloat, 1.0f/4.5f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.velocity_bias",
-  APZVelocityBias,
+   apz_velocity_bias,
   AtomicFloat, 0.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.velocity_relevance_time_ms",
-  APZVelocityRelevanceTime,
+   apz_velocity_relevance_time_ms,
   RelaxedAtomicUint32, 150
 )
 
 VARCACHE_PREF(
   Live,
   "apz.x_skate_highmem_adjust",
-  APZXSkateHighMemAdjust,
+   apz_x_skate_highmem_adjust,
   AtomicFloat, 0.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.x_skate_size_multiplier",
-  APZXSkateSizeMultiplier,
+   apz_x_skate_size_multiplier,
   AtomicFloat, 1.5f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.x_stationary_size_multiplier",
-  APZXStationarySizeMultiplier,
+   apz_x_stationary_size_multiplier,
   AtomicFloat, 3.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.y_skate_highmem_adjust",
-  APZYSkateHighMemAdjust,
+   apz_y_skate_highmem_adjust,
   AtomicFloat, 0.0f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.y_skate_size_multiplier",
-  APZYSkateSizeMultiplier,
+   apz_y_skate_size_multiplier,
   AtomicFloat, 2.5f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.y_stationary_size_multiplier",
-  APZYStationarySizeMultiplier,
+   apz_y_stationary_size_multiplier,
   AtomicFloat, 3.5f
 )
 
 VARCACHE_PREF(
   Live,
   "apz.zoom_animation_duration_ms",
-  APZZoomAnimationDuration,
+   apz_zoom_animation_duration_ms,
   RelaxedAtomicInt32, 250
 )
 
 VARCACHE_PREF(
   Live,
   "apz.scale_repaint_delay_ms",
-  APZScaleRepaintDelay,
+   apz_scale_repaint_delay_ms,
   RelaxedAtomicInt32, 500
 )
 
 VARCACHE_PREF(
   Live,
   "apz.relative-update.enabled",
-  APZRelativeUpdate,
-  RelaxedAtomicBool, false
-)
-
-VARCACHE_PREF(
-  Live,
-  "full-screen-api.mouse-event-allow-left-button-only",
-  full_screen_api_mouse_event_allow_left_button_only,
-  bool, true
-)
-
-// When this pref is set, parent documents may consider child iframes've loaded
-// while they are still loading
-VARCACHE_PREF(
-  Live,
-  "dom.cross_origin_iframes_loaded_in_background",
-   dom_cross_origin_iframes_loaded_in_background,
-  bool, false
+   apz_relative_update_enabled,
+  RelaxedAtomicBool, false
 )
 
 //---------------------------------------------------------------------------
 // Prefs starting with "beacon."
 //---------------------------------------------------------------------------
 
 // Is support for Navigator.sendBeacon enabled?
 VARCACHE_PREF(
@@ -2643,16 +2627,25 @@ VARCACHE_PREF(
 // Is support for XMLDocument.load enabled?
 VARCACHE_PREF(
   Live,
   "dom.xmldocument.load.enabled",
   dom_xmldocument_load_enabled,
   bool, false
 )
 
+// When this pref is set, parent documents may consider child iframes have
+// loaded while they are still loading.
+VARCACHE_PREF(
+  Live,
+  "dom.cross_origin_iframes_loaded_in_background",
+   dom_cross_origin_iframes_loaded_in_background,
+  bool, false
+)
+
 // Is support for Navigator.geolocation enabled?
 VARCACHE_PREF(
   Live,
   "geo.enabled",
   geo_enabled,
   bool, true
 )
 
@@ -2731,16 +2724,23 @@ VARCACHE_PREF(
 
 VARCACHE_PREF(
   Live,
   "full-screen-api.allow-trusted-requests-only",
   full_screen_api_allow_trusted_requests_only,
   bool, true
 )
 
+VARCACHE_PREF(
+  Live,
+  "full-screen-api.mouse-event-allow-left-button-only",
+   full_screen_api_mouse_event_allow_left_button_only,
+  bool, true
+)
+
 //---------------------------------------------------------------------------
 // Prefs starting with "fuzzing.". It's important that these can only be
 // checked in fuzzing builds (when FUZZING is defined), otherwise you could
 // enable the fuzzing stuff on your regular build which would be bad :)
 //---------------------------------------------------------------------------
 
 #ifdef FUZZING
 VARCACHE_PREF(
--- a/servo/components/style/font_face.rs
+++ b/servo/components/style/font_face.rs
@@ -411,23 +411,23 @@ impl Parse for Source {
         }))
     }
 }
 
 macro_rules! is_descriptor_enabled {
     ("font-display") => {
         unsafe {
             use crate::gecko_bindings::structs::mozilla;
-            mozilla::StaticPrefs_sVarCache_layout_css_font_display_enabled
+            mozilla::StaticPrefs::sVarCache_layout_css_font_display_enabled
         }
     };
     ("font-variation-settings") => {
         unsafe {
             use crate::gecko_bindings::structs::mozilla;
-            mozilla::StaticPrefs_sVarCache_layout_css_font_variations_enabled != 0
+            mozilla::StaticPrefs::sVarCache_layout_css_font_variations_enabled != 0
         }
     };
     ($name:tt) => {
         true
     };
 }
 
 macro_rules! font_face_descriptors_common {
--- a/servo/components/style/gecko/media_queries.rs
+++ b/servo/components/style/gecko/media_queries.rs
@@ -266,17 +266,17 @@ impl Device {
     /// Returns whether document colors are enabled.
     #[inline]
     pub fn use_document_colors(&self) -> bool {
         let doc = self.document();
         if doc.mIsBeingUsedAsImage() {
             return true;
         }
         let document_color_use =
-            unsafe { structs::StaticPrefs_sVarCache_browser_display_document_color_use };
+            unsafe { structs::StaticPrefs::sVarCache_browser_display_document_color_use };
         let prefs = self.pref_sheet_prefs();
         match document_color_use {
             1 => true,
             2 => prefs.mIsChrome,
             _ => !prefs.mUseAccessibilityTheme,
         }
     }
 
--- a/servo/components/style/gecko/pseudo_element_definition.mako.rs
+++ b/servo/components/style/gecko/pseudo_element_definition.mako.rs
@@ -107,17 +107,17 @@ impl PseudoElement {
 
     /// Gets the flags associated to this pseudo-element, or 0 if it's an
     /// anonymous box.
     pub fn flags(&self) -> u32 {
         match *self {
             % for pseudo in PSEUDOS:
                 ${pseudo_element_variant(pseudo)} =>
                 % if pseudo.is_tree_pseudo_element():
-                    if unsafe { structs::StaticPrefs_sVarCache_layout_css_xul_tree_pseudos_content_enabled } {
+                    if unsafe { structs::StaticPrefs::sVarCache_layout_css_xul_tree_pseudos_content_enabled } {
                         0
                     } else {
                         structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS_AND_CHROME
                     },
                 % elif pseudo.is_anon_box():
                     structs::CSS_PSEUDO_ELEMENT_ENABLED_IN_UA_SHEETS,
                 % else:
                     structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_${pseudo.pseudo_ident},
@@ -205,17 +205,17 @@ impl PseudoElement {
             "-moz-list-bullet" | "-moz-list-number" => {
                 return Some(PseudoElement::Marker);
             }
             _ => {
                 if starts_with_ignore_ascii_case(name, "-moz-tree-") {
                     return PseudoElement::tree_pseudo_element(name, Box::new([]))
                 }
                 if unsafe {
-                    structs::StaticPrefs_sVarCache_layout_css_unknown_webkit_pseudo_element
+                    structs::StaticPrefs::sVarCache_layout_css_unknown_webkit_pseudo_element
                 } {
                     const WEBKIT_PREFIX: &str = "-webkit-";
                     if starts_with_ignore_ascii_case(name, WEBKIT_PREFIX) {
                         let part = string_as_ascii_lowercase(&name[WEBKIT_PREFIX.len()..]);
                         return Some(PseudoElement::UnknownWebkit(part.into()));
                     }
                 }
             }
--- a/servo/components/style/gecko/selector_parser.rs
+++ b/servo/components/style/gecko/selector_parser.rs
@@ -170,17 +170,17 @@ impl NonTSPseudoClass {
 
     /// Returns whether the pseudo-class is enabled in content sheets.
     fn is_enabled_in_content(&self) -> bool {
         use crate::gecko_bindings::structs::mozilla;
         match *self {
             // For pseudo-classes with pref, the availability in content
             // depends on the pref.
             NonTSPseudoClass::Fullscreen => unsafe {
-                mozilla::StaticPrefs_sVarCache_full_screen_api_unprefix_enabled
+                mozilla::StaticPrefs::sVarCache_full_screen_api_unprefix_enabled
             },
             // Otherwise, a pseudo-class is enabled in content when it
             // doesn't have any enabled flag.
             _ => !self
                 .has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
         }
     }
 
@@ -350,17 +350,17 @@ impl<'a, 'i> ::selectors::Parser<'i> for
     #[inline]
     fn parse_host(&self) -> bool {
         true
     }
 
     #[inline]
     fn parse_part(&self) -> bool {
         self.chrome_rules_enabled() ||
-            unsafe { structs::StaticPrefs_sVarCache_layout_css_shadow_parts_enabled }
+            unsafe { structs::StaticPrefs::sVarCache_layout_css_shadow_parts_enabled }
     }
 
     fn parse_non_ts_pseudo_class(
         &self,
         location: SourceLocation,
         name: CowRcStr<'i>,
     ) -> Result<NonTSPseudoClass, ParseError<'i>> {
         if let Some(pseudo_class) = NonTSPseudoClass::parse_non_functional(&name) {
--- a/servo/components/style/media_queries/media_feature_expression.rs
+++ b/servo/components/style/media_queries/media_feature_expression.rs
@@ -297,17 +297,17 @@ impl MediaFeatureExpression {
                 let mut feature_name = &**ident;
 
                 #[cfg(feature = "gecko")]
                 {
                     if starts_with_ignore_ascii_case(feature_name, "-webkit-") {
                         feature_name = &feature_name[8..];
                         requirements.insert(ParsingRequirements::WEBKIT_PREFIX);
                         if unsafe {
-                            structs::StaticPrefs_sVarCache_layout_css_prefixes_device_pixel_ratio_webkit
+                            structs::StaticPrefs::sVarCache_layout_css_prefixes_device_pixel_ratio_webkit
                         } {
                             requirements.insert(
                                 ParsingRequirements::WEBKIT_DEVICE_PIXEL_RATIO_PREF_ENABLED,
                             );
                         }
                     }
                 }
 
--- a/servo/components/style/properties/cascade.rs
+++ b/servo/components/style/properties/cascade.rs
@@ -681,17 +681,17 @@ impl<'a, 'b: 'a> Cascade<'a, 'b> {
         use crate::gecko_bindings::{bindings, structs};
         use crate::values::computed::font::GenericFontFamily;
 
         if !self.seen.contains(LonghandId::XLang) &&
            !self.seen.contains(LonghandId::FontFamily) {
             return;
         }
 
-        let use_document_fonts = unsafe { structs::StaticPrefs_sVarCache_browser_display_use_document_fonts != 0 };
+        let use_document_fonts = unsafe { structs::StaticPrefs::sVarCache_browser_display_use_document_fonts != 0 };
         let builder = &mut self.context.builder;
         let (default_font_type, prioritize_user_fonts) = {
             let font = builder.get_font().gecko();
 
             // System fonts are all right, and should have the default font type
             // set to none already, so bail out early.
             if font.mFont.systemFont {
                 debug_assert_eq!(font.mFont.fontlist.mDefaultFontType, GenericFontFamily::None);
--- a/servo/components/style/stylesheets/document_rule.rs
+++ b/servo/components/style/stylesheets/document_rule.rs
@@ -255,22 +255,22 @@ impl DocumentCondition {
     fn allowed_in(&self, context: &ParserContext) -> bool {
         use crate::gecko_bindings::structs;
         use crate::stylesheets::Origin;
 
         if context.stylesheet_origin != Origin::Author {
             return true;
         }
 
-        if unsafe { structs::StaticPrefs_sVarCache_layout_css_moz_document_content_enabled } {
+        if unsafe { structs::StaticPrefs::sVarCache_layout_css_moz_document_content_enabled } {
             return true;
         }
 
         if !unsafe {
-            structs::StaticPrefs_sVarCache_layout_css_moz_document_url_prefix_hack_enabled
+            structs::StaticPrefs::sVarCache_layout_css_moz_document_url_prefix_hack_enabled
         } {
             return false;
         }
 
         // Allow a single url-prefix() for compatibility.
         //
         // See bug 1446470 and dependencies.
         if self.0.len() != 1 {
--- a/servo/components/style/stylesheets/supports_rule.rs
+++ b/servo/components/style/stylesheets/supports_rule.rs
@@ -319,17 +319,17 @@ impl ToCss for RawSelector {
 }
 
 impl RawSelector {
     /// Tries to evaluate a `selector()` function.
     pub fn eval(&self, context: &ParserContext, namespaces: &Namespaces) -> bool {
         #[cfg(feature = "gecko")]
         {
             if unsafe {
-                !crate::gecko_bindings::structs::StaticPrefs_sVarCache_layout_css_supports_selector_enabled
+                !crate::gecko_bindings::structs::StaticPrefs::sVarCache_layout_css_supports_selector_enabled
             } {
                 return false;
             }
         }
 
         let mut input = ParserInput::new(&self.0);
         let mut input = Parser::new(&mut input);
         input
--- a/servo/components/style/values/generics/easing.rs
+++ b/servo/components/style/values/generics/easing.rs
@@ -65,17 +65,17 @@ pub enum TimingKeyword {
     EaseIn,
     EaseOut,
     EaseInOut,
 }
 
 #[cfg(feature = "gecko")]
 fn step_position_jump_enabled(_context: &ParserContext) -> bool {
     use crate::gecko_bindings::structs;
-    unsafe { structs::StaticPrefs_sVarCache_layout_css_step_position_jump_enabled }
+    unsafe { structs::StaticPrefs::sVarCache_layout_css_step_position_jump_enabled }
 }
 
 #[cfg(feature = "servo")]
 fn step_position_jump_enabled(_context: &ParserContext) -> bool {
     false
 }
 
 #[allow(missing_docs)]
--- a/servo/components/style/values/generics/text.rs
+++ b/servo/components/style/values/generics/text.rs
@@ -70,17 +70,17 @@ impl<Value> Spacing<Value> {
     }
 }
 
 #[cfg(feature = "gecko")]
 fn line_height_moz_block_height_enabled(context: &ParserContext) -> bool {
     use crate::gecko_bindings::structs;
     context.in_ua_sheet() ||
         unsafe {
-            structs::StaticPrefs_sVarCache_layout_css_line_height_moz_block_height_content_enabled
+            structs::StaticPrefs::sVarCache_layout_css_line_height_moz_block_height_content_enabled
         }
 }
 
 /// A generic value for the `line-height` property.
 #[derive(
     Animate,
     Clone,
     ComputeSquaredDistance,
--- a/servo/components/style/values/specified/basic_shape.rs
+++ b/servo/components/style/values/specified/basic_shape.rs
@@ -55,17 +55,17 @@ pub type ShapeRadius = generic::ShapeRad
 
 /// The specified value of `Polygon`
 pub type Polygon = generic::GenericPolygon<LengthPercentage>;
 
 #[cfg(feature = "gecko")]
 fn is_clip_path_path_enabled(context: &ParserContext) -> bool {
     use crate::gecko_bindings::structs::mozilla;
     context.chrome_rules_enabled() ||
-        unsafe { mozilla::StaticPrefs_sVarCache_layout_css_clip_path_path_enabled }
+        unsafe { mozilla::StaticPrefs::sVarCache_layout_css_clip_path_path_enabled }
 }
 #[cfg(feature = "servo")]
 fn is_clip_path_path_enabled(_: &ParserContext) -> bool {
     false
 }
 
 impl Parse for ClippingShape {
     #[inline]
--- a/servo/components/style/values/specified/box.rs
+++ b/servo/components/style/values/specified/box.rs
@@ -20,25 +20,25 @@ use selectors::parser::SelectorParseErro
 use std::fmt::{self, Write};
 use style_traits::{CssWriter, KeywordsCollectFn, ParseError};
 use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
 
 #[cfg(feature = "gecko")]
 fn moz_display_values_enabled(context: &ParserContext) -> bool {
     use crate::gecko_bindings::structs;
     context.in_ua_or_chrome_sheet() ||
-        unsafe { structs::StaticPrefs_sVarCache_layout_css_xul_display_values_content_enabled }
+        unsafe { structs::StaticPrefs::sVarCache_layout_css_xul_display_values_content_enabled }
 }
 
 #[cfg(feature = "gecko")]
 fn moz_box_display_values_enabled(context: &ParserContext) -> bool {
     use crate::gecko_bindings::structs;
     context.in_ua_or_chrome_sheet() ||
         unsafe {
-            structs::StaticPrefs_sVarCache_layout_css_xul_box_display_values_content_enabled
+            structs::StaticPrefs::sVarCache_layout_css_xul_box_display_values_content_enabled
         }
 }
 
 /// Defines an element’s display type, which consists of
 /// the two basic qualities of how an element generates boxes
 /// <https://drafts.csswg.org/css-display/#propdef-display>
 ///
 ///
--- a/servo/components/style/values/specified/grid.rs
+++ b/servo/components/style/values/specified/grid.rs
@@ -376,17 +376,17 @@ impl ToComputedValue for TrackList<Lengt
         }
     }
 }
 
 #[cfg(feature = "gecko")]
 #[inline]
 fn allow_grid_template_subgrids() -> bool {
     use crate::gecko_bindings::structs::mozilla;
-    unsafe { mozilla::StaticPrefs_sVarCache_layout_css_grid_template_subgrid_value_enabled }
+    unsafe { mozilla::StaticPrefs::sVarCache_layout_css_grid_template_subgrid_value_enabled }
 }
 
 #[cfg(feature = "servo")]
 #[inline]
 fn allow_grid_template_subgrids() -> bool {
     false
 }
 
--- a/servo/components/style/values/specified/svg.rs
+++ b/servo/components/style/values/specified/svg.rs
@@ -31,17 +31,17 @@ pub type SVGWidth = generic::SVGLength<N
 
 /// [ <length> | <percentage> | <number> ]# | context-value
 pub type SVGStrokeDashArray = generic::SVGStrokeDashArray<NonNegativeLengthPercentage>;
 
 /// Whether the `context-value` value is enabled.
 #[cfg(feature = "gecko")]
 pub fn is_context_value_enabled() -> bool {
     use crate::gecko_bindings::structs::mozilla;
-    unsafe { mozilla::StaticPrefs_sVarCache_gfx_font_rendering_opentype_svg_enabled }
+    unsafe { mozilla::StaticPrefs::sVarCache_gfx_font_rendering_opentype_svg_enabled }
 }
 
 /// Whether the `context-value` value is enabled.
 #[cfg(not(feature = "gecko"))]
 pub fn is_context_value_enabled() -> bool {
     false
 }
 
--- a/testing/geckodriver/CHANGES.md
+++ b/testing/geckodriver/CHANGES.md
@@ -4,16 +4,23 @@ Change log
 All notable changes to this program is documented in this file.
 
 
 Unreleased
 ----------
 
 ### Added
 
+- Added support for HTTP `HEAD` requests to the HTTPD
+
+  geckodriver now responds correctly to HTTP `HEAD` requests,
+  which can be used for probing whether it supports a particular API.
+
+  Thanks to [Bastien Orivel] for this patch.
+
 - Added support for searching for Nightly’s default path on macOS
 
   If the location of the Firefox binary is not given, geckodriver
   will from now also look for the location of Firefox Nightly in
   the default locations.  The ordered list of search paths on macOS
   is as follows:
 
     1. `/Applications/Firefox.app/Contents/MacOS/firefox-bin`
deleted file mode 100644
--- a/testing/web-platform/meta/css/cssom-view/scroll-behavior-subframe-root.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[scroll-behavior-subframe-root.html]
-  [Subframe with auto scroll-behavior ; scroll() with smooth behavior]
-    expected:
-      if (os == "android") and not debug and e10s: FAIL
-
--- a/testing/web-platform/meta/service-workers/service-worker/unregister.https.html.ini
+++ b/testing/web-platform/meta/service-workers/service-worker/unregister.https.html.ini
@@ -1,7 +1,4 @@
 [unregister.https.html]
   disabled:
     if (os == "android") and not e10s: https://bugzilla.mozilla.org/show_bug.cgi?id=1499972
-  [Unregister twice]
-    expected:
-      if (os == "android") and not debug: FAIL
 
--- a/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/enable_controls_reposition.html.ini
+++ b/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/enable_controls_reposition.html.ini
@@ -1,4 +1,5 @@
 [enable_controls_reposition.html]
+  disabled:
+    if (os == "android") and debug: intermittent crash, Bug 1553046
   expected:
-    if (os == "android") and debug: FAIL
     FAIL
--- a/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/line_integer_and_percent_mixed_overlap.html.ini
+++ b/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/line_integer_and_percent_mixed_overlap.html.ini
@@ -1,2 +1,4 @@
 [line_integer_and_percent_mixed_overlap.html]
+  disabled:
+    if (os == "android") and debug: intermittent crash, Bug 1553046
   expected: FAIL
--- a/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/bold_object/bold_timestamp_past.html.ini
+++ b/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/bold_object/bold_timestamp_past.html.ini
@@ -1,2 +1,4 @@
 [bold_timestamp_past.html]
+  disabled:
+    if (os == "android") and debug: intermittent crash, Bug 1553046
   expected: FAIL
--- a/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/bold_object/bold_transition_with_timestamp.html.ini
+++ b/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/bold_object/bold_transition_with_timestamp.html.ini
@@ -1,2 +1,4 @@
 [bold_transition_with_timestamp.html]
+  disabled:
+    if (os == "android") and e10s and debug: intermittent crash, Bug 1553046
   expected: FAIL
--- a/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/bold_object/bold_white-space_nowrap.html.ini
+++ b/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/bold_object/bold_white-space_nowrap.html.ini
@@ -1,6 +1,5 @@
 [bold_white-space_nowrap.html]
   disabled:
     if (os == "android") and e10s and debug: intermittent crash, Bug 1553046
   expected:
-    if (os == "android") and debug: ERROR
     FAIL
--- a/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/class_object/class_text-decoration_line-through.html.ini
+++ b/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/class_object/class_text-decoration_line-through.html.ini
@@ -1,2 +1,4 @@
 [class_text-decoration_line-through.html]
+  disabled:
+    if (os == "android") and debug: intermittent crash, Bug 1553046
   expected: FAIL
--- a/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/italic_object/italic_font_properties.html.ini
+++ b/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/italic_object/italic_font_properties.html.ini
@@ -1,2 +1,4 @@
 [italic_font_properties.html]
+  disabled:
+    if (os == "android") and debug: intermittent crash, Bug 1553046
   expected: FAIL
--- a/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/italic_object/italic_font_shorthand.html.ini
+++ b/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/italic_object/italic_font_shorthand.html.ini
@@ -1,2 +1,4 @@
 [italic_font_shorthand.html]
+  disabled:
+    if (os == "android") and debug: intermittent crash, Bug 1553046
   expected: FAIL
--- a/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/italic_object/italic_transition_with_timestamp.html.ini
+++ b/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/cue_function/italic_object/italic_transition_with_timestamp.html.ini
@@ -1,2 +1,5 @@
 [italic_transition_with_timestamp.html]
-  expected: FAIL
+  disabled:
+    if (os == "android") and debug: intermittent crash, Bug 1553046
+  expected:
+    FAIL
--- a/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/default_styles/inherit_as_default_value_inherits_values_from_media_element.html.ini
+++ b/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/selectors/default_styles/inherit_as_default_value_inherits_values_from_media_element.html.ini
@@ -1,2 +1,4 @@
 [inherit_as_default_value_inherits_values_from_media_element.html]
+  disabled:
+    if (os == "android") and debug: intermittent crash, Bug 1553046
   expected: FAIL
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -3570,17 +3570,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
 - (void)magnifyWithEvent:(NSEvent*)anEvent {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   if (!mGeckoChild) {
     return;
   }
 
   // FIXME: bug 1525793 -- this may need to handle zooming or not on a per-document basis.
-  if (StaticPrefs::APZAllowZooming()) {
+  if (StaticPrefs::apz_allow_zooming()) {
     NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(anEvent, [self window]);
     ScreenPoint position =
         ViewAs<ScreenPixel>([self convertWindowCoordinatesRoundDown:locationInWindow],
                             PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
     ExternalPoint screenOffset =
         ViewAs<ExternalPixel>(mGeckoChild->WidgetToScreenOffset(),
                               PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
 
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3052,17 +3052,17 @@ void nsWindow::OnScrollEvent(GdkEventScr
       // the GDK_SCROLL_SMOOTH direction on XInput2 and Wayland devices.
       mLastScrollEventTime = aEvent->time;
 
       // Special handling for touchpads to support flings
       // (also known as kinetic/inertial/momentum scrolling)
       GdkDevice* device = gdk_event_get_source_device((GdkEvent*)aEvent);
       GdkInputSource source = gdk_device_get_source(device);
       if (source == GDK_SOURCE_TOUCHSCREEN || source == GDK_SOURCE_TOUCHPAD) {
-        if (StaticPrefs::APZGTKKineticScrollEnabled() &&
+        if (StaticPrefs::apz_gtk_kinetic_scroll_enabled() &&
             gtk_check_version(3, 20, 0) == nullptr) {
           static auto sGdkEventIsScrollStopEvent =
               (gboolean(*)(const GdkEvent*))dlsym(
                   RTLD_DEFAULT, "gdk_event_is_scroll_stop_event");
 
           LOG(("[%d] pan smooth event dx=%f dy=%f inprogress=%d\n",
                aEvent->time, aEvent->delta_x, aEvent->delta_y, mPanInProgress));
           PanGestureInput::PanGestureType eventType =
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -854,17 +854,17 @@ bool nsBaseWidget::ComputeShouldAccelera
          WidgetTypeSupportsAcceleration();
 }
 
 bool nsBaseWidget::UseAPZ() {
   return (gfxPlatform::AsyncPanZoomEnabled() &&
           (WindowType() == eWindowType_toplevel ||
            WindowType() == eWindowType_child ||
            (WindowType() == eWindowType_popup && HasRemoteContent() &&
-            StaticPrefs::APZPopupsEnabled())));
+            StaticPrefs::apz_popups_enabled())));
 }
 
 bool nsBaseWidget::AllowWebRenderForThisWindow() {
   return WindowType() == eWindowType_toplevel ||
          WindowType() == eWindowType_child ||
          WindowType() == eWindowType_dialog ||
          (WindowType() == eWindowType_popup && HasRemoteContent());
 }
@@ -888,17 +888,17 @@ void nsBaseWidget::ConfigureAPZCTreeMana
   ConfigureAPZControllerThread();
 
   float dpi = GetDPI();
   // On Android the main thread is not the controller thread
   APZThreadUtils::RunOnControllerThread(
       NewRunnableMethod<float>("layers::IAPZCTreeManager::SetDPI", mAPZC,
                                &IAPZCTreeManager::SetDPI, dpi));
 
-  if (StaticPrefs::APZKeyboardEnabled()) {
+  if (StaticPrefs::apz_keyboard_enabled()) {
     KeyboardMap map = nsXBLWindowKeyHandler::CollectKeyboardShortcuts();
     // On Android the main thread is not the controller thread
     APZThreadUtils::RunOnControllerThread(NewRunnableMethod<KeyboardMap>(
         "layers::IAPZCTreeManager::SetKeyboardMap", mAPZC,
         &IAPZCTreeManager::SetKeyboardMap, map));
   }
 
   RefPtr<IAPZCTreeManager> treeManager = mAPZC;  // for capture by the lambdas
--- a/widget/windows/nsWindowBase.cpp
+++ b/widget/windows/nsWindowBase.cpp
@@ -128,17 +128,18 @@ void nsWindowBase::ChangedDPI() {
 }
 
 nsresult nsWindowBase::SynthesizeNativeTouchPoint(
     uint32_t aPointerId, nsIWidget::TouchPointerState aPointerState,
     LayoutDeviceIntPoint aPoint, double aPointerPressure,
     uint32_t aPointerOrientation, nsIObserver* aObserver) {
   AutoObserverNotifier notifier(aObserver, "touchpoint");
 
-  if (StaticPrefs::APZTestFailsWithNativeInjection() || !InitTouchInjection()) {
+  if (StaticPrefs::apz_test_fails_with_native_injection() ||
+      !InitTouchInjection()) {
     // If we don't have touch injection from the OS, or if we are running a test
     // that cannot properly inject events to satisfy the OS requirements (see
     // bug 1313170)  we can just fake it and synthesize the events from here.
     MOZ_ASSERT(NS_IsMainThread());
     if (aPointerState == TOUCH_HOVER) {
       return NS_ERROR_UNEXPECTED;
     }