Bug 1430014 - Part 5: #ifdef out unnecessary code when the old style system is not built. r?xidorn draft
authorCameron McCormack <cam@mcc.id.au>
Tue, 16 Jan 2018 16:53:59 +0800
changeset 720812 6602f764ea2359fa8fb71cce161af3401a20edf6
parent 720811 f9867ad1fd538a3862f9bcbe9c217e6a0a21c20d
child 720813 58617bd3a1de7ae3f4372348ccdf5b5812c521ac
push id95652
push userbmo:cam@mcc.id.au
push dateTue, 16 Jan 2018 09:34:40 +0000
reviewersxidorn
bugs1430014
milestone59.0a1
Bug 1430014 - Part 5: #ifdef out unnecessary code when the old style system is not built. r?xidorn MozReview-Commit-ID: 1FZ9VzjcPzN
dom/animation/Animation.cpp
dom/animation/EffectCompositor.cpp
dom/animation/EffectCompositor.h
dom/animation/EffectSet.h
dom/animation/KeyframeEffectReadOnly.cpp
dom/animation/KeyframeEffectReadOnly.h
dom/animation/KeyframeUtils.cpp
dom/animation/TimingParams.cpp
dom/base/DOMIntersectionObserver.cpp
dom/base/DOMMatrix.cpp
dom/base/Element.cpp
dom/base/Element.h
dom/base/ResponsiveImageSelector.cpp
dom/base/ResponsiveImageSelector.h
dom/base/nsAttrAndChildArray.cpp
dom/base/nsAttrAndChildArray.h
dom/base/nsAttrValue.cpp
dom/base/nsDOMWindowUtils.cpp
dom/base/nsDocument.cpp
dom/base/nsIDocument.h
dom/base/nsINode.cpp
dom/base/nsINode.h
dom/base/nsMappedAttributeElement.cpp
dom/base/nsMappedAttributeElement.h
dom/base/nsMappedAttributes.cpp
dom/base/nsMappedAttributes.h
dom/base/nsStyleLinkElement.cpp
dom/base/nsTreeSanitizer.cpp
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/DocumentRendererChild.cpp
dom/html/HTMLTableCellElement.cpp
dom/html/HTMLTableCellElement.h
dom/ipc/ContentParent.cpp
dom/smil/nsSMILCSSProperty.cpp
dom/smil/nsSMILCSSValueType.cpp
dom/svg/nsSVGElement.cpp
dom/svg/nsSVGElement.h
dom/xbl/nsBindingManager.cpp
dom/xbl/nsBindingManager.h
dom/xbl/nsXBLBinding.cpp
dom/xbl/nsXBLBinding.h
dom/xbl/nsXBLPrototypeBinding.cpp
dom/xbl/nsXBLPrototypeBinding.h
dom/xbl/nsXBLPrototypeResources.cpp
dom/xbl/nsXBLPrototypeResources.h
dom/xbl/nsXBLResourceLoader.cpp
dom/xul/nsXULElement.cpp
dom/xul/nsXULElement.h
editor/libeditor/HTMLEditor.cpp
layout/base/PresShell.cpp
layout/base/PresShell.h
layout/base/RestyleLogging.h
layout/base/RestyleManager.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
layout/base/nsDocumentViewer.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/base/nsPresContext.cpp
layout/base/nsStyleSheetService.cpp
layout/base/nsStyleSheetService.h
layout/build/nsLayoutStatics.cpp
layout/generic/nsFirstLetterFrame.cpp
layout/generic/nsFrame.cpp
layout/inspector/InspectorUtils.cpp
layout/painting/nsDisplayList.cpp
layout/style/CSS.cpp
layout/style/CSSKeyframesRule.cpp
layout/style/CSSKeyframesRule.h
layout/style/DeclarationBlockInlines.h
layout/style/ErrorReporter.h
layout/style/FontFace.cpp
layout/style/FontFaceSet.cpp
layout/style/GenericSpecifiedValuesInlines.h
layout/style/GroupRule.cpp
layout/style/GroupRule.h
layout/style/Loader.cpp
layout/style/MediaList.cpp
layout/style/RuleNodeCacheConditions.h
layout/style/ServoBindings.h
layout/style/ServoDocumentRule.cpp
layout/style/ServoDocumentRule.h
layout/style/ServoMediaRule.cpp
layout/style/ServoMediaRule.h
layout/style/ServoSupportsRule.cpp
layout/style/ServoSupportsRule.h
layout/style/ServoUtils.h
layout/style/StyleAnimationValue.cpp
layout/style/StyleAnimationValue.h
layout/style/StyleRule.h
layout/style/StyleSetHandle.h
layout/style/StyleSetHandleInlines.h
layout/style/StyleSheet.cpp
layout/style/nsAnimationManager.cpp
layout/style/nsAnimationManager.h
layout/style/nsCSSCounterStyleRule.cpp
layout/style/nsCSSParser.h
layout/style/nsComputedDOMStyle.cpp
layout/style/nsDOMCSSAttrDeclaration.cpp
layout/style/nsDOMCSSDeclaration.cpp
layout/style/nsHTMLCSSStyleSheet.cpp
layout/style/nsHTMLCSSStyleSheet.h
layout/style/nsHTMLStyleSheet.cpp
layout/style/nsHTMLStyleSheet.h
layout/style/nsLayoutStylesheetCache.cpp
layout/style/nsRuleProcessorData.h
layout/style/nsStyleContext.cpp
layout/style/nsStyleContext.h
layout/style/nsStyleContextInlines.h
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
layout/style/nsStyleTransformMatrix.cpp
layout/style/nsTransitionManager.cpp
layout/style/nsTransitionManager.h
layout/tables/nsTableColGroupFrame.cpp
layout/xul/nsSplitterFrame.cpp
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -1517,21 +1517,23 @@ Animation::DispatchPlaybackEvent(const n
 bool
 Animation::IsRunningOnCompositor() const
 {
   return mEffect &&
          mEffect->AsKeyframeEffect() &&
          mEffect->AsKeyframeEffect()->IsRunningOnCompositor();
 }
 
+#ifdef MOZ_OLD_STYLE
 template
 void
 Animation::ComposeStyle<RefPtr<AnimValuesStyleRule>&>(
   RefPtr<AnimValuesStyleRule>& aAnimationRule,
   const nsCSSPropertyIDSet& aPropertiesToSkip);
+#endif
 
 template
 void
 Animation::ComposeStyle<RawServoAnimationValueMap&>(
   RawServoAnimationValueMap& aAnimationValues,
   const nsCSSPropertyIDSet& aPropertiesToSkip);
 
 } // namespace dom
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -379,16 +379,17 @@ EffectCompositor::UpdateEffectProperties
   // result.
   effectSet->MarkCascadeNeedsUpdate();
 
   for (KeyframeEffectReadOnly* effect : *effectSet) {
     effect->UpdateProperties(aStyleType);
   }
 }
 
+#ifdef MOZ_OLD_STYLE
 void
 EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
                                            CSSPseudoElementType aPseudoType,
                                            CascadeLevel aCascadeLevel,
                                            nsStyleContext* aStyleContext)
 {
   // First update cascade results since that may cause some elements to
   // be marked as needing a restyle.
@@ -452,16 +453,17 @@ EffectCompositor::GetAnimationRule(dom::
 
   EffectSet* effectSet = EffectSet::GetEffectSet(aElement, aPseudoType);
   if (!effectSet) {
     return nullptr;
   }
 
   return effectSet->AnimationRule(aCascadeLevel);
 }
+#endif
 
 namespace {
   class EffectCompositeOrderComparator {
   public:
     bool Equals(const KeyframeEffectReadOnly* a,
                 const KeyframeEffectReadOnly* b) const
     {
       return a == b;
@@ -566,16 +568,17 @@ EffectCompositor::HasThrottledStyleUpdat
         return true;
       }
     }
   }
 
   return false;
 }
 
+#ifdef MOZ_OLD_STYLE
 void
 EffectCompositor::AddStyleUpdatesTo(RestyleTracker& aTracker)
 {
   if (!mPresContext) {
     return;
   }
 
   for (size_t i = 0; i < kCascadeLevelCount; i++) {
@@ -617,16 +620,17 @@ EffectCompositor::AddStyleUpdatesTo(Rest
         aTracker.AddPendingRestyle(elementToRestyle, rshint, nsChangeHint(0));
       }
     }
 
     elementSet.Clear();
     // Note: mElement pointers in elementsToRestyle might now dangle
   }
 }
+#endif
 
 /* static */ bool
 EffectCompositor::HasAnimationsForCompositor(const nsIFrame* aFrame,
                                              nsCSSPropertyID aProperty)
 {
   return FindAnimationsForCompositor(aFrame, aProperty, nullptr);
 }
 
@@ -709,16 +713,17 @@ EffectCompositor::GetAnimationElementAnd
     return result;
   }
 
   result.emplace(content->AsElement(), pseudoType);
 
   return result;
 }
 
+#ifdef MOZ_OLD_STYLE
 /* static */ void
 EffectCompositor::ComposeAnimationRule(dom::Element* aElement,
                                        CSSPseudoElementType aPseudoType,
                                        CascadeLevel aCascadeLevel)
 {
   EffectSet* effects = EffectSet::GetEffectSet(aElement, aPseudoType);
   if (!effects) {
     return;
@@ -748,42 +753,47 @@ EffectCompositor::ComposeAnimationRule(d
   for (KeyframeEffectReadOnly* effect : sortedEffectList) {
     effect->GetAnimation()->WillComposeStyle();
     effect->GetAnimation()->ComposeStyle(animRule, propertiesToSkip);
   }
 
   MOZ_ASSERT(effects == EffectSet::GetEffectSet(aElement, aPseudoType),
              "EffectSet should not change while composing style");
 }
+#endif
 
 /* static */ nsCSSPropertyIDSet
 EffectCompositor::GetOverriddenProperties(StyleBackendType aBackendType,
                                           EffectSet& aEffectSet,
                                           Element* aElement,
                                           CSSPseudoElementType aPseudoType,
                                           nsStyleContext* aStyleContext)
 {
   MOZ_ASSERT(aBackendType != StyleBackendType::Servo || aElement,
              "Should have an element to get style data from if we are using"
              " the Servo backend");
 
   nsCSSPropertyIDSet result;
 
   Element* elementToRestyle = GetElementToRestyle(aElement, aPseudoType);
   if (aBackendType == StyleBackendType::Gecko && !aStyleContext) {
+#ifdef MOZ_OLD_STYLE
     if (elementToRestyle) {
       nsIFrame* frame = elementToRestyle->GetPrimaryFrame();
       if (frame) {
         aStyleContext = frame->StyleContext();
       }
     }
 
     if (!aStyleContext) {
       return result;
     }
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else if (aBackendType == StyleBackendType::Servo && !elementToRestyle) {
     return result;
   }
 
   AutoTArray<nsCSSPropertyID, LayerAnimationInfo::kRecords> propertiesToTrack;
   {
     nsCSSPropertyIDSet propertiesToTrackAsSet;
     for (KeyframeEffectReadOnly* effect : aEffectSet) {
@@ -809,19 +819,23 @@ EffectCompositor::GetOverriddenPropertie
 
   switch (aBackendType) {
     case StyleBackendType::Servo:
       Servo_GetProperties_Overriding_Animation(elementToRestyle,
                                                &propertiesToTrack,
                                                &result);
       break;
     case StyleBackendType::Gecko:
+#ifdef MOZ_OLD_STYLE
       nsRuleNode::ComputePropertiesOverridingAnimation(propertiesToTrack,
                                                        aStyleContext->AsGecko(),
                                                        result);
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
       break;
 
     default:
       MOZ_ASSERT_UNREACHABLE("Unsupported style backend");
   }
 
   return result;
 }
@@ -1187,16 +1201,17 @@ EffectCompositor::PreTraverse(dom::Eleme
     }
 
     elementSet.Remove(key);
     found = true;
   }
   return found;
 }
 
+#ifdef MOZ_OLD_STYLE
 // ---------------------------------------------------------
 //
 // Nested class: AnimationStyleRuleProcessor
 //
 // ---------------------------------------------------------
 
 NS_IMPL_ISUPPORTS(EffectCompositor::AnimationStyleRuleProcessor,
                   nsIStyleRuleProcessor)
@@ -1301,16 +1316,17 @@ EffectCompositor::AnimationStyleRuleProc
 }
 
 template
 void
 EffectCompositor::UpdateEffectProperties(
   GeckoStyleContext* aStyleContext,
   Element* aElement,
   CSSPseudoElementType aPseudoType);
+#endif
 
 template
 void
 EffectCompositor::UpdateEffectProperties(
   const ServoStyleContext* aStyleContext,
   Element* aElement,
   CSSPseudoElementType aPseudoType);
 
--- a/dom/animation/EffectCompositor.h
+++ b/dom/animation/EffectCompositor.h
@@ -43,21 +43,23 @@ class Element;
 }
 
 class EffectCompositor
 {
 public:
   explicit EffectCompositor(nsPresContext* aPresContext)
     : mPresContext(aPresContext)
   {
+#ifdef MOZ_OLD_STYLE
     for (size_t i = 0; i < kCascadeLevelCount; i++) {
       CascadeLevel cascadeLevel = CascadeLevel(i);
       mRuleProcessors[cascadeLevel] =
         new AnimationStyleRuleProcessor(this, cascadeLevel);
     }
+#endif
   }
 
   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(EffectCompositor)
   NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(EffectCompositor)
 
   void Disconnect() {
     mPresContext = nullptr;
   }
@@ -121,16 +123,17 @@ public:
   // have changed so that any context-sensitive values stored within
   // animation effects (e.g. em-based endpoints used in keyframe effects)
   // can be re-resolved to computed values.
   template<typename StyleType>
   void UpdateEffectProperties(StyleType* aStyleType,
                               dom::Element* aElement,
                               CSSPseudoElementType aPseudoType);
 
+#ifdef MOZ_OLD_STYLE
   // Updates the animation rule stored on the EffectSet for the
   // specified (pseudo-)element for cascade level |aLevel|.
   // If the animation rule is not marked as needing an update,
   // no work is done.
   // |aStyleContext| is used for UpdateCascadingResults.
   // |aStyleContext| can be nullptr if style context, which is associated with
   // the primary frame of the specified (pseudo-)element, is the current style
   // context.
@@ -149,40 +152,43 @@ public:
   // style context.
   // When we are not resolving style context, |aStyleContext| can be nullptr, we
   // will use a style context associated with the primary frame of the specified
   // (pseudo-)element.
   nsIStyleRule* GetAnimationRule(dom::Element* aElement,
                                  CSSPseudoElementType aPseudoType,
                                  CascadeLevel aCascadeLevel,
                                  nsStyleContext* aStyleContext);
+#endif
 
   // Get animation rule for stylo. This is an equivalent of GetAnimationRule
   // and will be called from servo side.
   // The animation rule is stored in |RawServoAnimationValueMapBorrowed|.
   // We need to be careful while doing any modification because it may cause
   // some thread-safe issues.
   bool GetServoAnimationRule(
     const dom::Element* aElement,
     CSSPseudoElementType aPseudoType,
     CascadeLevel aCascadeLevel,
     RawServoAnimationValueMapBorrowedMut aAnimationValues);
 
   bool HasPendingStyleUpdates() const;
   bool HasThrottledStyleUpdates() const;
 
+#ifdef MOZ_OLD_STYLE
   // Tell the restyle tracker about all the animated styles that have
   // pending updates so that it can update the animation rule for these
   // elements.
   void AddStyleUpdatesTo(RestyleTracker& aTracker);
 
   nsIStyleRuleProcessor* RuleProcessor(CascadeLevel aCascadeLevel) const
   {
     return mRuleProcessors[aCascadeLevel];
   }
+#endif
 
   static bool HasAnimationsForCompositor(const nsIFrame* aFrame,
                                          nsCSSPropertyID aProperty);
 
   static nsTArray<RefPtr<dom::Animation>>
   GetAnimationsForCompositor(const nsIFrame* aFrame,
                              nsCSSPropertyID aProperty);
 
@@ -249,21 +255,23 @@ public:
   // pseudo type (other thant CSSPseudoElementType::NotPseudo) returns nullptr.
   // Otherwise, returns |aElement|.
   static dom::Element* GetElementToRestyle(dom::Element* aElement,
                                            CSSPseudoElementType aPseudoType);
 
 private:
   ~EffectCompositor() = default;
 
+#ifdef MOZ_OLD_STYLE
   // Rebuilds the animation rule corresponding to |aCascadeLevel| on the
   // EffectSet associated with the specified (pseudo-)element.
   static void ComposeAnimationRule(dom::Element* aElement,
                                    CSSPseudoElementType aPseudoType,
                                    CascadeLevel aCascadeLevel);
+#endif
 
   // Get the properties in |aEffectSet| that we are able to animate on the
   // compositor but which are also specified at a higher level in the cascade
   // than the animations level.
   //
   // When |aBackendType| is StyleBackendType::Gecko, we determine which
   // properties are specified using the provided |aStyleContext| and
   // |aElement| and |aPseudoType| are ignored. If |aStyleContext| is nullptr,
@@ -307,16 +315,17 @@ private:
   // indicate that the style rule on the element is out of date but without
   // posting a restyle to update it.
   EnumeratedArray<CascadeLevel, CascadeLevel(kCascadeLevelCount),
                   nsDataHashtable<PseudoElementHashEntry, bool>>
                     mElementsToRestyle;
 
   bool mIsInPreTraverse = false;
 
+#ifdef MOZ_OLD_STYLE
   class AnimationStyleRuleProcessor final : public nsIStyleRuleProcessor
   {
   public:
     AnimationStyleRuleProcessor(EffectCompositor* aCompositor,
                                 CascadeLevel aCascadeLevel)
       : mCompositor(aCompositor)
       , mCascadeLevel(aCascadeLevel)
     {
@@ -351,13 +360,14 @@ private:
 
     EffectCompositor* mCompositor;
     CascadeLevel      mCascadeLevel;
   };
 
   EnumeratedArray<CascadeLevel, CascadeLevel(kCascadeLevelCount),
                   OwningNonNull<AnimationStyleRuleProcessor>>
                     mRuleProcessors;
+#endif
 };
 
 } // namespace mozilla
 
 #endif // mozilla_EffectCompositor_h
--- a/dom/animation/EffectSet.h
+++ b/dom/animation/EffectSet.h
@@ -165,21 +165,23 @@ public:
 #ifdef DEBUG
   bool IsBeingEnumerated() const { return mActiveIterators != 0; }
 #endif
 
   bool IsEmpty() const { return mEffects.IsEmpty(); }
 
   size_t Count() const { return mEffects.Count(); }
 
+#ifdef MOZ_OLD_STYLE
   RefPtr<AnimValuesStyleRule>&
   AnimationRule(EffectCompositor::CascadeLevel aCascadeLevel)
   {
     return mAnimationRule[aCascadeLevel];
   }
+#endif
 
   const TimeStamp& LastTransformSyncTime() const
   {
     return mLastTransformSyncTime;
   }
   void UpdateLastTransformSyncTime(const TimeStamp& aRefreshTime)
   {
     mLastTransformSyncTime = aRefreshTime;
@@ -207,25 +209,27 @@ public:
     return mPropertiesForAnimationsLevel;
   }
 
 private:
   static nsAtom* GetEffectSetPropertyAtom(CSSPseudoElementType aPseudoType);
 
   OwningEffectSet mEffects;
 
+#ifdef MOZ_OLD_STYLE
   // These style rules contain the style data for currently animating
   // values.  They only match when styling with animation.  When we
   // style without animation, we need to not use them so that we can
   // detect any new changes; if necessary we restyle immediately
   // afterwards with animation.
   EnumeratedArray<EffectCompositor::CascadeLevel,
                   EffectCompositor::CascadeLevel(
                     EffectCompositor::kCascadeLevelCount),
                   RefPtr<AnimValuesStyleRule>> mAnimationRule;
+#endif
 
   // Refresh driver timestamp from the moment when transform animations in this
   // effect set were last updated and sent to the compositor. This is used for
   // transform animations that run on the compositor but need to be updated on
   // the main thread periodically (e.g. so scrollbars can be updated).
   TimeStamp mLastTransformSyncTime;
 
   // Dirty flag to represent when the mPropertiesWithImportantRules and
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -189,52 +189,61 @@ KeyframeEffectReadOnly::SetKeyframes(JSC
   nsTArray<Keyframe> keyframes =
     KeyframeUtils::GetKeyframesFromObject(aContext, mDocument, aKeyframes, aRv);
   if (aRv.Failed()) {
     return;
   }
 
   RefPtr<nsStyleContext> styleContext = GetTargetStyleContext();
   if (styleContext) {
-    if (auto gecko = styleContext->GetAsGecko()) {
+    if (styleContext->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
+      auto gecko = styleContext->AsGecko();
       SetKeyframes(Move(keyframes), gecko);
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     } else {
       SetKeyframes(Move(keyframes), styleContext->AsServo());
     }
   } else {
     // SetKeyframes has the same behavior for null StyleType* for
     // both backends, just pick one and use it.
-    SetKeyframes(Move(keyframes), (GeckoStyleContext*) nullptr);
+    SetKeyframes(Move(keyframes), (ServoStyleContext*) nullptr);
   }
 }
 
+#ifdef MOZ_OLD_STYLE
 void
 KeyframeEffectReadOnly::SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
                                      GeckoStyleContext* aStyleContext)
 {
   DoSetKeyframes(Move(aKeyframes), Move(aStyleContext));
 }
+#endif
 
 void
 KeyframeEffectReadOnly::SetKeyframes(
   nsTArray<Keyframe>&& aKeyframes,
   const ServoStyleContext* aComputedValues)
 {
   DoSetKeyframes(Move(aKeyframes), aComputedValues);
 }
 
 template<typename StyleType>
 void
 KeyframeEffectReadOnly::DoSetKeyframes(nsTArray<Keyframe>&& aKeyframes,
                                        StyleType* aStyle)
 {
+#ifdef MOZ_OLD_STYLE
   static_assert(IsSame<StyleType, GeckoStyleContext>::value ||
                 IsSame<StyleType, const ServoStyleContext>::value,
                 "StyleType should be GeckoStyleContext* or "
                 "const ServoStyleContext*");
+#endif
 
   if (KeyframesEqualIgnoringComputedOffsets(aKeyframes, mKeyframes)) {
     return;
   }
 
   mKeyframes = Move(aKeyframes);
   KeyframeUtils::DistributeKeyframes(mKeyframes);
 
@@ -308,19 +317,24 @@ SpecifiedKeyframeArraysAreEqual(const ns
 }
 #endif
 
 void
 KeyframeEffectReadOnly::UpdateProperties(nsStyleContext* aStyleContext)
 {
   MOZ_ASSERT(aStyleContext);
 
-  if (auto gecko = aStyleContext->GetAsGecko()) {
+  if (aStyleContext->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
+    auto gecko = aStyleContext->AsGecko();
     DoUpdateProperties(Move(gecko));
     return;
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   UpdateProperties(aStyleContext->AsServo());
 }
 
 void
 KeyframeEffectReadOnly::UpdateProperties(
   const ServoStyleContext* aStyleContext)
@@ -407,16 +421,17 @@ KeyframeEffectReadOnly::CompositeValue(
     }
     default:
       MOZ_ASSERT_UNREACHABLE("Unknown compisite operation type");
       break;
   }
   return StyleAnimationValue();
 }
 
+#ifdef MOZ_OLD_STYLE
 StyleAnimationValue
 KeyframeEffectReadOnly::GetUnderlyingStyle(
   nsCSSPropertyID aProperty,
   const RefPtr<AnimValuesStyleRule>& aAnimationRule)
 {
   StyleAnimationValue result;
 
   if (aAnimationRule && aAnimationRule->HasValue(aProperty)) {
@@ -504,16 +519,17 @@ KeyframeEffectReadOnly::EnsureBaseStyle(
                                               aCachedBaseStyleContext,
                                               result);
 
   MOZ_ASSERT(success, "Should be able to extract computed animation value");
   MOZ_ASSERT(!result.IsNull(), "Should have a valid StyleAnimationValue");
 
   mBaseStyleValues.Put(aProperty, result);
 }
+#endif
 
 void
 KeyframeEffectReadOnly::EnsureBaseStyles(
   const ServoStyleContext* aComputedValues,
   const nsTArray<AnimationProperty>& aProperties)
 {
   if (!mTarget) {
     return;
@@ -585,16 +601,17 @@ KeyframeEffectReadOnly::EnsureBaseStyle(
 void
 KeyframeEffectReadOnly::WillComposeStyle()
 {
   ComputedTiming computedTiming = GetComputedTiming();
   mProgressOnLastCompose = computedTiming.mProgress;
   mCurrentIterationOnLastCompose = computedTiming.mCurrentIteration;
 }
 
+#ifdef MOZ_OLD_STYLE
 void
 KeyframeEffectReadOnly::ComposeStyleRule(
   RefPtr<AnimValuesStyleRule>& aStyleRule,
   const AnimationProperty& aProperty,
   const AnimationPropertySegment& aSegment,
   const ComputedTiming& aComputedTiming)
 {
   StyleAnimationValue fromValue =
@@ -664,16 +681,17 @@ KeyframeEffectReadOnly::ComposeStyleRule
                                        valuePosition, val)) {
     aStyleRule->AddValue(aProperty.mProperty, Move(val));
   } else if (valuePosition < 0.5) {
     aStyleRule->AddValue(aProperty.mProperty, Move(fromValue));
   } else {
     aStyleRule->AddValue(aProperty.mProperty, Move(toValue));
   }
 }
+#endif
 
 void
 KeyframeEffectReadOnly::ComposeStyleRule(
   RawServoAnimationValueMap& aAnimationValues,
   const AnimationProperty& aProperty,
   const AnimationPropertySegment& aSegment,
   const ComputedTiming& aComputedTiming)
 {
@@ -942,20 +960,22 @@ KeyframeEffectReadOnly::ConstructKeyfram
   effect->mProperties = aSource.mProperties;
   return effect.forget();
 }
 
 template<typename StyleType>
 nsTArray<AnimationProperty>
 KeyframeEffectReadOnly::BuildProperties(StyleType* aStyle)
 {
+#ifdef MOZ_OLD_STYLE
   static_assert(IsSame<StyleType, GeckoStyleContext>::value ||
                 IsSame<StyleType, const ServoStyleContext>::value,
                 "StyleType should be GeckoStyleContext* or "
                 "const ServoStyleContext*");
+#endif
 
   MOZ_ASSERT(aStyle);
 
   nsTArray<AnimationProperty> result;
   // If mTarget is null, return an empty property array.
   if (!mTarget) {
     return result;
   }
@@ -1702,16 +1722,17 @@ KeyframeEffectReadOnly::SetPerformanceWa
         nsAutoCString logMessage = NS_ConvertUTF16toUTF8(localizedString);
         AnimationUtils::LogAsyncAnimationFailure(logMessage, mTarget->mElement);
       }
       return;
     }
   }
 }
 
+#ifdef MOZ_OLD_STYLE
 already_AddRefed<nsStyleContext>
 KeyframeEffectReadOnly::CreateStyleContextForAnimationValue(
   nsCSSPropertyID aProperty,
   const AnimationValue& aValue,
   GeckoStyleContext* aBaseStyleContext)
 {
   MOZ_ASSERT(aBaseStyleContext,
              "CreateStyleContextForAnimationValue needs to be called "
@@ -1730,16 +1751,17 @@ KeyframeEffectReadOnly::CreateStyleConte
     styleSet->ResolveStyleByAddingRules(aBaseStyleContext, rules);
 
   // We need to call StyleData to generate cached data for the style context.
   // Otherwise CalcStyleDifference returns no meaningful result.
   styleContext->StyleData(nsCSSProps::kSIDTable[aProperty]);
 
   return styleContext.forget();
 }
+#endif
 
 already_AddRefed<nsStyleContext>
 KeyframeEffectReadOnly::CreateStyleContextForAnimationValue(
   nsCSSPropertyID aProperty,
   const AnimationValue& aValue,
   const ServoStyleContext* aBaseStyleContext)
 {
   MOZ_ASSERT(aBaseStyleContext,
@@ -1961,21 +1983,23 @@ KeyframeEffectReadOnly::UpdateEffectSet(
   if (HasAnimationOfProperty(eCSSProperty_transform)) {
     effectSet->SetMayHaveTransformAnimation();
     if (frame) {
       frame->SetMayHaveTransformAnimation();
     }
   }
 }
 
+#ifdef MOZ_OLD_STYLE
 template
 void
 KeyframeEffectReadOnly::ComposeStyle<RefPtr<AnimValuesStyleRule>&>(
   RefPtr<AnimValuesStyleRule>& aAnimationRule,
   const nsCSSPropertyIDSet& aPropertiesToSkip);
+#endif
 
 template
 void
 KeyframeEffectReadOnly::ComposeStyle<RawServoAnimationValueMap&>(
   RawServoAnimationValueMap& aAnimationValues,
   const nsCSSPropertyIDSet& aPropertiesToSkip);
 
 } // namespace dom
--- a/dom/animation/KeyframeEffectReadOnly.h
+++ b/dom/animation/KeyframeEffectReadOnly.h
@@ -160,18 +160,20 @@ public:
 
   IterationCompositeOperation IterationComposite() const;
   CompositeOperation Composite() const;
   void NotifyAnimationTimingUpdated();
   void RequestRestyle(EffectCompositor::RestyleType aRestyleType);
   void SetAnimation(Animation* aAnimation) override;
   void SetKeyframes(JSContext* aContext, JS::Handle<JSObject*> aKeyframes,
                     ErrorResult& aRv);
+#ifdef MOZ_OLD_STYLE
   void SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
                     GeckoStyleContext* aStyleContext);
+#endif
   void SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
                     const ServoStyleContext* aComputedValues);
 
   // Returns true if the effect includes |aProperty| regardless of whether the
   // property is overridden by !important rule.
   bool HasAnimationOfProperty(nsCSSPropertyID aProperty) const;
 
   // GetEffectiveAnimationOfProperty returns AnimationProperty corresponding
@@ -342,16 +344,17 @@ protected:
   // of building a style context may trigger various forms of infinite
   // recursion.
   already_AddRefed<nsStyleContext> GetTargetStyleContext();
 
   // A wrapper for marking cascade update according to the current
   // target and its effectSet.
   void MarkCascadeNeedsUpdate();
 
+#ifdef MOZ_OLD_STYLE
   // Composites |aValueToComposite| using |aCompositeOperation| onto the value
   // for |aProperty| in |aAnimationRule|, or, if there is no suitable value in
   // |aAnimationRule|, uses the base value for the property recorded on the
   // target element's EffectSet.
   StyleAnimationValue CompositeValue(
     nsCSSPropertyID aProperty,
     const RefPtr<AnimValuesStyleRule>& aAnimationRule,
     const StyleAnimationValue& aValueToComposite,
@@ -360,27 +363,30 @@ protected:
   // Returns underlying style animation value for |aProperty|.
   StyleAnimationValue GetUnderlyingStyle(
     nsCSSPropertyID aProperty,
     const RefPtr<AnimValuesStyleRule>& aAnimationRule);
 
   // Ensure the base styles is available for any properties in |aProperties|.
   void EnsureBaseStyles(GeckoStyleContext* aStyleContext,
                         const nsTArray<AnimationProperty>& aProperties);
+#endif
   void EnsureBaseStyles(const ServoStyleContext* aComputedValues,
                         const nsTArray<AnimationProperty>& aProperties);
 
+#ifdef MOZ_OLD_STYLE
   // If no base style is already stored for |aProperty|, resolves the base style
   // for |aProperty| using |aStyleContext| and stores it in mBaseStyleValues.
   // If |aCachedBaseStyleContext| is non-null, it will be used, otherwise the
   // base style context will be resolved and stored in
   // |aCachedBaseStyleContext|.
   void EnsureBaseStyle(nsCSSPropertyID aProperty,
                        GeckoStyleContext* aStyleContext,
                        RefPtr<GeckoStyleContext>& aCachedBaseStyleContext);
+#endif
   // Stylo version of the above function that also first checks for an additive
   // value in |aProperty|'s list of segments.
   void EnsureBaseStyle(const AnimationProperty& aProperty,
                        nsPresContext* aPresContext,
                        const ServoStyleContext* aComputedValues,
                        RefPtr<mozilla::ServoStyleContext>& aBaseComputedValues);
 
   Maybe<OwningAnimationTarget> mTarget;
@@ -423,30 +429,34 @@ private:
   nsChangeHint mCumulativeChangeHint;
 
   template<typename StyleType>
   void DoSetKeyframes(nsTArray<Keyframe>&& aKeyframes, StyleType* aStyle);
 
   template<typename StyleType>
   void DoUpdateProperties(StyleType* aStyle);
 
+#ifdef MOZ_OLD_STYLE
   void ComposeStyleRule(RefPtr<AnimValuesStyleRule>& aStyleRule,
                         const AnimationProperty& aProperty,
                         const AnimationPropertySegment& aSegment,
                         const ComputedTiming& aComputedTiming);
+#endif
 
   void ComposeStyleRule(RawServoAnimationValueMap& aAnimationValues,
                         const AnimationProperty& aProperty,
                         const AnimationPropertySegment& aSegment,
                         const ComputedTiming& aComputedTiming);
 
+#ifdef MOZ_OLD_STYLE
   already_AddRefed<nsStyleContext> CreateStyleContextForAnimationValue(
     nsCSSPropertyID aProperty,
     const AnimationValue& aValue,
     GeckoStyleContext* aBaseStyleContext);
+#endif
 
   already_AddRefed<nsStyleContext> CreateStyleContextForAnimationValue(
     nsCSSPropertyID aProperty,
     const AnimationValue& aValue,
     const ServoStyleContext* aBaseStyleContext);
 
   nsIFrame* GetAnimationFrame() const;
 
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -359,24 +359,28 @@ MakePropertyValuePair(nsCSSPropertyID aP
 
 static bool
 HasValidOffsets(const nsTArray<Keyframe>& aKeyframes);
 
 #ifdef DEBUG
 static void
 MarkAsComputeValuesFailureKey(PropertyValuePair& aPair);
 
+#ifdef MOZ_OLD_STYLE
 static bool
 IsComputeValuesFailureKey(const PropertyValuePair& aPair);
 #endif
+#endif
 
+#ifdef MOZ_OLD_STYLE
 static nsTArray<ComputedKeyframeValues>
 GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
                           dom::Element* aElement,
                           GeckoStyleContext* aStyleContext);
+#endif
 
 static nsTArray<ComputedKeyframeValues>
 GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
                           dom::Element* aElement,
                           const ServoStyleContext* aComputedValues);
 
 static void
 BuildSegmentsFromValueEntries(nsTArray<KeyframeValueEntry>& aEntries,
@@ -892,16 +896,17 @@ MakePropertyValuePair(nsCSSPropertyID aP
     if (servoDeclarationBlock) {
       result.emplace(aProperty, Move(servoDeclarationBlock));
     } else {
       ReportInvalidPropertyValueToConsole(aProperty, aStringValue, aDocument);
     }
     return result;
   }
 
+#ifdef MOZ_OLD_STYLE
   nsCSSValue value;
   if (!nsCSSProps::IsShorthand(aProperty)) {
     aParser.ParseLonghandProperty(aProperty,
                                   aStringValue,
                                   aDocument->GetDocumentURI(),
                                   aDocument->GetDocumentURI(),
                                   aDocument->NodePrincipal(),
                                   value);
@@ -931,16 +936,19 @@ MakePropertyValuePair(nsCSSPropertyID aP
     MOZ_ASSERT(tokenStream->mShorthandPropertyID == eCSSProperty_UNKNOWN,
                "The shorthand property of a token stream should be initialized"
                " to unknown");
     value.SetTokenStreamValue(tokenStream);
   }
 
   result.emplace(aProperty, Move(value));
   return result;
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 /**
  * Checks that the given keyframes are loosely ordered (each keyframe's
  * offset that is not null is greater than or equal to the previous
  * non-null offset) and that all values are within the range [0.0, 1.0].
  *
  * @return true if the keyframes' offsets are correctly ordered and
@@ -975,33 +983,36 @@ static void
 MarkAsComputeValuesFailureKey(PropertyValuePair& aPair)
 {
   MOZ_ASSERT(nsCSSProps::IsShorthand(aPair.mProperty),
              "Only shorthand property values can be marked as failure values");
 
   aPair.mSimulateComputeValuesFailure = true;
 }
 
+#ifdef MOZ_OLD_STYLE
 /**
  * Returns true if |aPair| is a property-value pair on which we have
  * previously called MarkAsComputeValuesFailureKey (and hence we should
  * simulate failure when calling StyleAnimationValue::ComputeValues using its
  * value).
  *
  * @param aPair The property-value pair to test.
  * @return True if |aPair| represents a failure value.
  */
 static bool
 IsComputeValuesFailureKey(const PropertyValuePair& aPair)
 {
   return nsCSSProps::IsShorthand(aPair.mProperty) &&
          aPair.mSimulateComputeValuesFailure;
 }
 #endif
+#endif
 
+#ifdef MOZ_OLD_STYLE
 /**
  * Calculate the StyleAnimationValues of properties of each keyframe.
  * This involves expanding shorthand properties into longhand properties,
  * removing the duplicated properties for each keyframe, and creating an
  * array of |property:computed value| pairs for each keyframe.
  *
  * These computed values are used when computing the final set of
  * per-property animation values (see GetAnimationPropertiesFromKeyframes).
@@ -1078,16 +1089,17 @@ GetComputedKeyframeValues(const nsTArray
         computedValues->AppendElement(Move(value));
       }
     }
   }
 
   MOZ_ASSERT(result.Length() == aKeyframes.Length(), "Array length mismatch");
   return result;
 }
+#endif
 
 /**
  * The variation of the above function. This is for Servo backend.
  */
 static nsTArray<ComputedKeyframeValues>
 GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
                           dom::Element* aElement,
                           const ServoStyleContext* aStyleContext)
@@ -1627,23 +1639,27 @@ RequiresAdditiveAnimation(const nsTArray
                             : i == 0 ? 0.0 : 0.5;
     double offsetToUse = frame.mOffset
                          ? frame.mOffset.value()
                          : computedOffset;
 
     for (const PropertyValuePair& pair : frame.mPropertyValues) {
       if (nsCSSProps::IsShorthand(pair.mProperty)) {
         if (styleBackend == StyleBackendType::Gecko) {
+#ifdef MOZ_OLD_STYLE
           nsCSSValueTokenStream* tokenStream =
             pair.mValue.GetTokenStreamValue();
           nsCSSParser parser(aDocument->CSSLoader());
           if (!parser.IsValueValidForProperty(pair.mProperty,
                                               tokenStream->mTokenStream)) {
             continue;
           }
+#else
+          MOZ_CRASH("old style system disabled");
+#endif
         }
 
         MOZ_ASSERT(styleBackend != StyleBackendType::Servo ||
                    pair.mServoDeclarationBlock);
         CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(
             prop, pair.mProperty, CSSEnabledState::eForAllContent) {
           addToPropertySets(*prop, offsetToUse);
         }
--- a/dom/animation/TimingParams.cpp
+++ b/dom/animation/TimingParams.cpp
@@ -127,16 +127,17 @@ TimingParams::ParseEasing(const nsAStrin
 
     if (timingFunction.mType == nsTimingFunction::Type::Linear) {
       return Nothing();
     }
 
     return Some(ComputedTimingFunction(timingFunction));
   }
 
+#ifdef MOZ_OLD_STYLE
   nsCSSValue value;
   nsCSSParser parser;
   parser.ParseLonghandProperty(eCSSProperty_animation_timing_function,
                                aEasing,
                                aDocument->GetDocumentURI(),
                                aDocument->GetDocumentURI(),
                                aDocument->NodePrincipal(),
                                value);
@@ -177,16 +178,20 @@ TimingParams::ParseEasing(const nsAStrin
     case eCSSUnit_Null:
       break;
     default:
       MOZ_ASSERT_UNREACHABLE("unexpected animation-timing-function unit");
       break;
   }
 
   aRv.ThrowTypeError<dom::MSG_INVALID_EASING_ERROR>(aEasing);
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
+
   return Nothing();
 }
 
 bool
 TimingParams::operator==(const TimingParams& aOther) const
 {
   // We don't compare mActiveDuration and mEndTime because they are calculated
   // from other timing parameters.
--- a/dom/base/DOMIntersectionObserver.cpp
+++ b/dom/base/DOMIntersectionObserver.cpp
@@ -116,16 +116,17 @@ DOMIntersectionObserver::Constructor(con
 bool
 DOMIntersectionObserver::SetRootMargin(const nsAString& aString)
 {
   if (mDocument && mDocument->IsStyledByServo()) {
     return ServoCSSParser::ParseIntersectionObserverRootMargin(aString,
                                                                &mRootMargin);
   }
 
+#ifdef MOZ_OLD_STYLE
   // By not passing a CSS Loader object we make sure we don't parse in quirks
   // mode so that pixel/percent and unit-less values will be differentiated.
   nsCSSParser parser(nullptr);
   nsCSSValue value;
   if (!parser.ParseMarginString(aString, nullptr, 0, value, true)) {
     return false;
   }
 
@@ -134,16 +135,19 @@ DOMIntersectionObserver::SetRootMargin(c
   for (auto side : nsCSSRect::sides) {
     nsCSSValue& value = mRootMargin.*side;
     if (!(value.IsPixelLengthUnit() || value.IsPercentLengthUnit())) {
       return false;
     }
   }
 
   return true;
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 void
 DOMIntersectionObserver::GetRootMargin(mozilla::dom::DOMString& aRetVal)
 {
   mRootMargin.AppendToString(eCSSProperty_DOM, aRetVal);
 }
 
--- a/dom/base/DOMMatrix.cpp
+++ b/dom/base/DOMMatrix.cpp
@@ -678,16 +678,17 @@ DOMMatrix::SetMatrixValue(const nsAStrin
   if (mIsServo) {
     if (!ServoCSSParser::ParseTransformIntoMatrix(aTransformList,
                                                   contains3dTransform,
                                                   transform.components)) {
       aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
       return nullptr;
     }
   } else {
+#ifdef MOZ_OLD_STYLE
     nsCSSValue value;
     nsCSSParser parser;
     bool parseSuccess = parser.ParseTransformProperty(aTransformList,
                                                       true,
                                                       value);
     if (!parseSuccess) {
       aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
       return nullptr;
@@ -708,16 +709,19 @@ DOMMatrix::SetMatrixValue(const nsAStrin
 
     RuleNodeCacheConditions dummy;
     nsStyleTransformMatrix::TransformReferenceBox dummyBox;
     transform = nsStyleTransformMatrix::ReadTransforms(
                     value.GetSharedListValue()->mHead,
                     nullptr, nullptr, dummy, dummyBox,
                     nsPresContext::AppUnitsPerCSSPixel(),
                     &contains3dTransform);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   if (!contains3dTransform) {
     mMatrix3D = nullptr;
     mMatrix2D = new gfx::Matrix();
 
     SetA(transform._11);
     SetB(transform._12);
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -3538,16 +3538,17 @@ Element::Closest(const nsAString& aSelec
     aResult,
     [&](const RawServoSelectorList* aList) -> Element* {
       if (!aList) {
         return nullptr;
       }
       return const_cast<Element*>(Servo_SelectorList_Closest(this, aList));
     },
     [&](nsCSSSelectorList* aList) -> Element* {
+#ifdef MOZ_OLD_STYLE
       if (!aList) {
         // Either we failed (and aError already has the exception), or this
         // is a pseudo-element-only selector that matches nothing.
         return nullptr;
       }
       TreeMatchContext matchingContext(false,
                                        nsRuleWalker::eRelevantLinkUnvisited,
                                        OwnerDoc(),
@@ -3558,16 +3559,19 @@ Element::Closest(const nsAString& aSelec
         if (node->IsElement() &&
             nsCSSRuleProcessor::SelectorListMatches(node->AsElement(),
                                                     matchingContext,
                                                     aList)) {
           return node->AsElement();
         }
       }
       return nullptr;
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     }
   );
 }
 
 bool
 Element::Matches(const nsAString& aSelector, ErrorResult& aError)
 {
   return WithSelectorList<bool>(
@@ -3575,29 +3579,33 @@ Element::Matches(const nsAString& aSelec
     aError,
     [&](const RawServoSelectorList* aList) {
       if (!aList) {
         return false;
       }
       return Servo_SelectorList_Matches(this, aList);
     },
     [&](nsCSSSelectorList* aList) {
+#ifdef MOZ_OLD_STYLE
       if (!aList) {
         // Either we failed (and aError already has the exception), or this
         // is a pseudo-element-only selector that matches nothing.
         return false;
       }
       TreeMatchContext matchingContext(false,
                                        nsRuleWalker::eRelevantLinkUnvisited,
                                        OwnerDoc(),
                                        TreeMatchContext::eNeverMatchVisited);
       matchingContext.SetHasSpecifiedScope();
       matchingContext.AddScopeElement(this);
       return nsCSSRuleProcessor::SelectorListMatches(this, matchingContext,
                                                      aList);
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     }
   );
 }
 
 static const nsAttrValue::EnumTable kCORSAttributeTable[] = {
   // Order matters here
   // See ParseCORSValue
   { "anonymous",       CORS_ANONYMOUS       },
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -450,20 +450,22 @@ public:
    * Get a hint that tells the style system what to do when
    * an attribute on this node changes, if something needs to happen
    * in response to the change *other* than the result of what is
    * mapped into style data via any type of style rule.
    */
   virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
                                               int32_t aModType) const;
 
+#ifdef MOZ_OLD_STYLE
   NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker)
   {
     return NS_OK;
   }
+#endif
 
   inline Directionality GetDirectionality() const {
     if (HasFlag(NODE_HAS_DIRECTION_RTL)) {
       return eDir_RTL;
     }
 
     if (HasFlag(NODE_HAS_DIRECTION_LTR)) {
       return eDir_LTR;
--- a/dom/base/ResponsiveImageSelector.cpp
+++ b/dom/base/ResponsiveImageSelector.cpp
@@ -244,23 +244,27 @@ ResponsiveImageSelector::SetSizesFromDes
   ClearSelectedCandidate();
 
   if (Document()->IsStyledByServo()) {
     NS_ConvertUTF16toUTF8 sizes(aSizes);
     mServoSourceSizeList.reset(Servo_SourceSizeList_Parse(&sizes));
     return !!mServoSourceSizeList;
   }
 
+#ifdef MOZ_OLD_STYLE
   nsCSSParser cssParser;
 
   mSizeQueries.Clear();
   mSizeValues.Clear();
 
   return cssParser.ParseSourceSizeList(aSizes, nullptr, 0,
                                        mSizeQueries, mSizeValues);
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 void
 ResponsiveImageSelector::AppendCandidateIfUnique(const ResponsiveImageCandidate & aCandidate)
 {
   int numCandidates = mCandidates.Length();
 
   // With the exception of Default, which should not be added until we are done
@@ -454,16 +458,17 @@ ResponsiveImageSelector::ComputeFinalWid
   if (!pctx) {
     return false;
   }
   nscoord effectiveWidth;
   if (doc->IsStyledByServo()) {
     effectiveWidth = presShell->StyleSet()->AsServo()->EvaluateSourceSizeList(
       mServoSourceSizeList.get());
   } else {
+#ifdef MOZ_OLD_STYLE
     unsigned int numSizes = mSizeQueries.Length();
     MOZ_ASSERT(numSizes == mSizeValues.Length(),
                "mSizeValues length differs from mSizeQueries");
 
     unsigned int i;
     for (i = 0; i < numSizes; i++) {
       if (mSizeQueries[i]->Matches(pctx, nullptr)) {
         break;
@@ -474,16 +479,19 @@ ResponsiveImageSelector::ComputeFinalWid
       // No match defaults to 100% viewport
       nsCSSValue defaultWidth(100.0f, eCSSUnit_ViewportWidth);
       effectiveWidth = nsRuleNode::CalcLengthWithInitialFont(pctx,
                                                              defaultWidth);
     } else {
       effectiveWidth = nsRuleNode::CalcLengthWithInitialFont(pctx,
                                                              mSizeValues[i]);
     }
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   *aWidth = nsPresContext::AppUnitsToDoubleCSSPixels(std::max(effectiveWidth, 0));
   return true;
 }
 
 ResponsiveImageCandidate::ResponsiveImageCandidate()
 {
--- a/dom/base/ResponsiveImageSelector.h
+++ b/dom/base/ResponsiveImageSelector.h
@@ -120,19 +120,21 @@ private:
   int mSelectedCandidateIndex;
   // The cached resolved URL for mSelectedCandidateIndex, such that we only
   // resolve the absolute URL at selection time
   nsCOMPtr<nsIURI> mSelectedCandidateURL;
 
   // Servo bits.
   UniquePtr<RawServoSourceSizeList> mServoSourceSizeList;
 
+#ifdef MOZ_OLD_STYLE
   // Gecko bits.
   nsTArray< nsAutoPtr<nsMediaQuery> > mSizeQueries;
   nsTArray<nsCSSValue> mSizeValues;
+#endif
 };
 
 class ResponsiveImageCandidate {
 public:
   ResponsiveImageCandidate();
   ResponsiveImageCandidate(const nsAString& aURLString, double aDensity,
                            nsIPrincipal* aTriggeringPrincipal = nullptr);
 
--- a/dom/base/nsAttrAndChildArray.cpp
+++ b/dom/base/nsAttrAndChildArray.cpp
@@ -624,23 +624,25 @@ nsAttrAndChildArray::DoSetMappedAttrStyl
   RefPtr<nsMappedAttributes> mapped =
     GetModifiableMapped(nullptr, nullptr, false);
 
   mapped->SetStyleSheet(aSheet);
 
   return MakeMappedUnique(mapped);
 }
 
+#ifdef MOZ_OLD_STYLE
 void
 nsAttrAndChildArray::WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker)
 {
   if (mImpl && mImpl->mMappedAttrs) {
     aRuleWalker->Forward(mImpl->mMappedAttrs);
   }
 }
+#endif
 
 void
 nsAttrAndChildArray::Compact()
 {
   if (!mImpl) {
     return;
   }
 
--- a/dom/base/nsAttrAndChildArray.h
+++ b/dom/base/nsAttrAndChildArray.h
@@ -120,17 +120,19 @@ public:
                                 nsHTMLStyleSheet* aSheet,
                                 bool* aHadValue);
   nsresult SetMappedAttrStyleSheet(nsHTMLStyleSheet* aSheet) {
     if (!mImpl || !mImpl->mMappedAttrs) {
       return NS_OK;
     }
     return DoSetMappedAttrStyleSheet(aSheet);
   }
+#ifdef MOZ_OLD_STYLE
   void WalkMappedAttributeStyleRules(nsRuleWalker* aRuleWalker);
+#endif
 
   void Compact();
 
   bool CanFitMoreAttrs() const
   {
     return AttrSlotCount() < ATTRCHILD_ARRAY_MAX_ATTR_COUNT ||
            !AttrSlotIsTaken(ATTRCHILD_ARRAY_MAX_ATTR_COUNT - 1);
   }
--- a/dom/base/nsAttrValue.cpp
+++ b/dom/base/nsAttrValue.cpp
@@ -1743,20 +1743,24 @@ nsAttrValue::ParseStyleAttribute(const n
   RefPtr<DeclarationBlock> decl;
   if (ownerDoc->GetStyleBackendType() == StyleBackendType::Servo) {
     RefPtr<URLExtraData> data = new URLExtraData(baseURI, docURI,
                                                  principal);
     decl = ServoDeclarationBlock::FromCssText(aString, data,
                                               ownerDoc->GetCompatibilityMode(),
                                               ownerDoc->CSSLoader());
   } else {
+#ifdef MOZ_OLD_STYLE
     css::Loader* cssLoader = ownerDoc->CSSLoader();
     nsCSSParser cssParser(cssLoader);
     decl = cssParser.ParseStyleAttribute(aString, docURI, baseURI,
                                          principal);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
   if (!decl) {
     return false;
   }
   decl->SetHTMLCSSStyleSheet(sheet);
   SetTo(decl.forget(), &aString);
 
   if (cachingAllowed) {
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -2877,16 +2877,17 @@ nsDOMWindowUtils::GetUnanimatedComputedS
                                                  propertyID).Consume();
     if (!value) {
       return NS_ERROR_FAILURE;
     }
     Servo_AnimationValue_Serialize(value, propertyID, &aResult);
     return NS_OK;
   }
 
+#ifdef MOZ_OLD_STYLE
   StyleAnimationValue computedValue;
   if (!StyleAnimationValue::ExtractComputedValue(propertyID,
                                                  styleContext->AsGecko(),
                                                  computedValue)) {
     return NS_ERROR_FAILURE;
   }
 
   // Note: ExtractComputedValue can return 'unset', 'initial', or 'inherit' in
@@ -2910,16 +2911,19 @@ nsDOMWindowUtils::GetUnanimatedComputedS
   }
 
   DebugOnly<bool> uncomputeResult =
     StyleAnimationValue::UncomputeValue(propertyID,
                                         Move(computedValue), aResult);
   MOZ_ASSERT(uncomputeResult,
              "Unable to get specified value from computed value");
   return NS_OK;
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 nsresult
 nsDOMWindowUtils::RenderDocument(const nsRect& aRect,
                                  uint32_t aFlags,
                                  nscolor aBackgroundColor,
                                  gfxContext* aThebesContext)
 {
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -1330,31 +1330,37 @@ nsIDocument::SelectorCache::SelectorList
 {
   if (mIsServo) {
     if (mServo) {
       Servo_SelectorList_Drop(mServo);
       mServo = nullptr;
     }
   } else {
     if (mGecko) {
+#ifdef MOZ_OLD_STYLE
       delete mGecko;
       mGecko = nullptr;
-    }
-  }
-}
-
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
+    }
+  }
+}
+
+#ifdef MOZ_OLD_STYLE
 // CacheList takes ownership of aSelectorList.
 void nsIDocument::SelectorCache::CacheList(const nsAString& aSelector,
                                            mozilla::UniquePtr<nsCSSSelectorList>&& aSelectorList)
 {
   MOZ_ASSERT(NS_IsMainThread());
   SelectorCacheKey* key = new SelectorCacheKey(aSelector);
   mTable.Put(key->mKey, SelectorList(Move(aSelectorList)));
   AddObject(key);
 }
+#endif
 
 void nsIDocument::SelectorCache::CacheList(
   const nsAString& aSelector,
   UniquePtr<RawServoSelectorList>&& aSelectorList)
 {
   MOZ_ASSERT(NS_IsMainThread());
   SelectorCacheKey* key = new SelectorCacheKey(aSelector);
   mTable.Put(key->mKey, SelectorList(Move(aSelectorList)));
@@ -1958,17 +1964,19 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
   if (tmp->mBoxObjectTable) {
     for (auto iter = tmp->mBoxObjectTable->Iter(); !iter.Done(); iter.Next()) {
       NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mBoxObjectTable entry");
       cb.NoteXPCOMChild(iter.UserData());
     }
   }
 
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChannel)
+#ifdef MOZ_OLD_STYLE
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStyleAttrStyleSheet)
+#endif
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mXPathEvaluator)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLayoutHistoryState)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnloadBlocker)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFirstBaseNodeWithHref)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDOMImplementation)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mImageMaps)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOrientationPendingPromise)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOriginalDocument)
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -1165,33 +1165,39 @@ public:
         SelectorList& operator=(SelectorList&& aOther)
         {
           Reset();
           mIsServo = aOther.mIsServo;
           if (mIsServo) {
             mServo = aOther.mServo;
             aOther.mServo = nullptr;
           } else {
+#ifdef MOZ_OLD_STYLE
             mGecko = aOther.mGecko;
             aOther.mGecko = nullptr;
+#else
+            MOZ_CRASH("old style system disabled");
+#endif
           }
           return *this;
         }
 
         SelectorList(const SelectorList& aOther) = delete;
 
         explicit SelectorList(mozilla::UniquePtr<RawServoSelectorList>&& aList)
           : mIsServo(true)
           , mServo(aList.release())
         {}
 
+#ifdef MOZ_OLD_STYLE
         explicit SelectorList(mozilla::UniquePtr<nsCSSSelectorList>&& aList)
           : mIsServo(false)
           , mGecko(aList.release())
         {}
+#endif
 
         ~SelectorList() {
           Reset();
         }
 
         bool IsServo() const { return mIsServo; }
         bool IsGecko() const { return !IsServo(); }
 
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -2718,16 +2718,17 @@ nsINode::ParseServoSelectorList(
       NS_LITERAL_CSTRING("' is not a valid selector")
     );
   }
 
   cache.CacheList(aSelectorString, UniquePtr<RawServoSelectorList>(selectorList));
   return selectorList;
 }
 
+#ifdef MOZ_OLD_STYLE
 nsCSSSelectorList*
 nsINode::ParseSelectorList(const nsAString& aSelectorString,
                            ErrorResult& aRv)
 {
   nsIDocument* doc = OwnerDoc();
   nsIDocument::SelectorCache& cache =
     doc->GetSelectorCache(mozilla::StyleBackendType::Gecko);
   nsIDocument::SelectorCache::SelectorList* list =
@@ -2799,21 +2800,24 @@ static void
 AddScopeElements(TreeMatchContext& aMatchContext,
                  nsINode* aMatchContextNode)
 {
   if (aMatchContextNode->IsElement()) {
     aMatchContext.SetHasSpecifiedScope();
     aMatchContext.AddScopeElement(aMatchContextNode->AsElement());
   }
 }
+#endif
 
 namespace {
 struct SelectorMatchInfo {
+#ifdef MOZ_OLD_STYLE
   nsCSSSelectorList* const mSelectorList;
   TreeMatchContext& mMatchContext;
+#endif
 };
 } // namespace
 
 // Given an id, find elements with that id under aRoot that match aMatchInfo if
 // any is provided.  If no SelectorMatchInfo is provided, just find the ones
 // with the given id.  aRoot must be in the document.
 template<bool onlyFirstMatch, class T>
 inline static void
@@ -2839,29 +2843,33 @@ FindMatchingElementsWithId(const nsAStri
   // document and |elements| is long, for some value of "long"?
   for (size_t i = 0; i < elements->Length(); ++i) {
     Element* element = (*elements)[i];
     if (!aRoot->IsElement() ||
         (element != aRoot &&
            nsContentUtils::ContentIsDescendantOf(element, aRoot))) {
       // We have an element with the right id and it's a strict descendant
       // of aRoot.  Make sure it really matches the selector.
-      if (!aMatchInfo ||
-          nsCSSRuleProcessor::SelectorListMatches(element,
-                                                  aMatchInfo->mMatchContext,
-                                                  aMatchInfo->mSelectorList)) {
+      if (!aMatchInfo
+#ifdef MOZ_OLD_STYLE
+          || nsCSSRuleProcessor::SelectorListMatches(element,
+                                                     aMatchInfo->mMatchContext,
+                                                     aMatchInfo->mSelectorList)
+#endif
+      ) {
         aList.AppendElement(element);
         if (onlyFirstMatch) {
           return;
         }
       }
     }
   }
 }
 
+#ifdef MOZ_OLD_STYLE
 // Actually find elements matching aSelectorList (which must not be
 // null) and which are descendants of aRoot and put them in aList.  If
 // onlyFirstMatch, then stop once the first one is found.
 template<bool onlyFirstMatch, class Collector, class T>
 MOZ_ALWAYS_INLINE static void
 FindMatchingElements(nsINode* aRoot, nsCSSSelectorList* aSelectorList, T &aList,
                      ErrorResult& aRv)
 {
@@ -2911,16 +2919,17 @@ FindMatchingElements(nsINode* aRoot, nsC
   const uint32_t len = results.Length();
   if (len) {
     aList.SetCapacity(len);
     for (uint32_t i = 0; i < len; ++i) {
       aList.AppendElement(results.ElementAt(i));
     }
   }
 }
+#endif
 
 struct ElementHolder {
   ElementHolder() : mElement(nullptr) {}
   void AppendElement(Element* aElement) {
     MOZ_ASSERT(!mElement, "Should only get one element");
     mElement = aElement;
   }
   void SetCapacity(uint32_t aCapacity) { MOZ_CRASH("Don't call me!"); }
@@ -2940,24 +2949,28 @@ nsINode::QuerySelector(const nsAString& 
       if (!aList) {
         return nullptr;
       }
       const bool useInvalidation = false;
       return const_cast<Element*>(
           Servo_SelectorList_QueryFirst(this, aList, useInvalidation));
     },
     [&](nsCSSSelectorList* aList) -> Element* {
+#ifdef MOZ_OLD_STYLE
       if (!aList) {
         // Either we failed (and aResult already has the exception), or this
         // is a pseudo-element-only selector that matches nothing.
         return nullptr;
       }
       ElementHolder holder;
       FindMatchingElements<true, ElementHolder>(this, aList, holder, aResult);
       return holder.mElement;
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     }
   );
 }
 
 already_AddRefed<nsINodeList>
 nsINode::QuerySelectorAll(const nsAString& aSelector, ErrorResult& aResult)
 {
   RefPtr<nsSimpleContentList> contentList = new nsSimpleContentList(this);
@@ -2969,21 +2982,25 @@ nsINode::QuerySelectorAll(const nsAStrin
       if (!aList) {
         return;
       }
       const bool useInvalidation = false;
       Servo_SelectorList_QueryAll(
         this, aList, contentList.get(), useInvalidation);
     },
     [&](nsCSSSelectorList* aList) {
+#ifdef MOZ_OLD_STYLE
       if (!aList) {
         return;
       }
       FindMatchingElements<false, AutoTArray<Element*, 128>>(
         this, aList, *contentList, aResult);
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     }
   );
 
   return contentList.forget();
 }
 
 Element*
 nsINode::GetElementById(const nsAString& aId)
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -2133,17 +2133,21 @@ protected:
     const nsAString& aSelectorString,
     mozilla::ErrorResult& aRv,
     const ServoFunctor& aServoFunctor,
     const GeckoFunctor& aGeckoFunctor)
   {
     if (IsStyledByServo()) {
       return aServoFunctor(ParseServoSelectorList(aSelectorString, aRv));
     }
+#ifdef MOZ_OLD_STYLE
     return aGeckoFunctor(ParseSelectorList(aSelectorString, aRv));
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
 public:
   /* Event stuff that documents and elements share.  This needs to be
      NS_IMETHOD because some subclasses implement DOM methods with
      this exact name and signature and then the calling convention
      needs to match.
 
--- a/dom/base/nsMappedAttributeElement.cpp
+++ b/dom/base/nsMappedAttributeElement.cpp
@@ -2,22 +2,24 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsMappedAttributeElement.h"
 #include "nsIDocument.h"
 
+#ifdef MOZ_OLD_STYLE
 nsresult
 nsMappedAttributeElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
 {
   mAttrsAndChildren.WalkMappedAttributeStyleRules(aRuleWalker);
   return NS_OK;
 }
+#endif
 
 bool
 nsMappedAttributeElement::SetAndSwapMappedAttribute(nsAtom* aName,
                                                     nsAttrValue& aValue,
                                                     bool* aValueWasSet,
                                                     nsresult* aRetval)
 {
   nsHTMLStyleSheet* sheet = OwnerDoc()->GetAttributeStyleSheet();
--- a/dom/base/nsMappedAttributeElement.h
+++ b/dom/base/nsMappedAttributeElement.h
@@ -34,17 +34,19 @@ protected:
   {}
 
 public:
   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
 
   static void MapNoAttributesInto(const nsMappedAttributes* aAttributes,
                                   mozilla::GenericSpecifiedValues* aGenericData);
 
+#ifdef MOZ_OLD_STYLE
   NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
+#endif
   virtual bool SetAndSwapMappedAttribute(nsAtom* aName,
                                          nsAttrValue& aValue,
                                          bool* aValueWasSet,
                                          nsresult* aRetval) override;
 
   virtual void NodeInfoChanged(nsIDocument* aOldDoc) override;
 };
 
--- a/dom/base/nsMappedAttributes.cpp
+++ b/dom/base/nsMappedAttributes.cpp
@@ -144,21 +144,23 @@ nsMappedAttributes::LastRelease()
       (*sCachedMappedAttributeAllocations)[mAttrCount] = memoryToCache;
       return;
     }
   }
 
   delete this;
 }
 
+#ifdef MOZ_OLD_STYLE
 NS_IMPL_ADDREF(nsMappedAttributes)
 NS_IMPL_RELEASE_WITH_DESTROY(nsMappedAttributes, LastRelease())
 
 NS_IMPL_QUERY_INTERFACE(nsMappedAttributes,
                         nsIStyleRule)
+#endif
 
 void
 nsMappedAttributes::SetAndSwapAttr(nsAtom* aAttrName, nsAttrValue& aValue,
                                    bool* aValueWasSet)
 {
   NS_PRECONDITION(aAttrName, "null name");
   *aValueWasSet = false;
   uint32_t i;
@@ -249,16 +251,17 @@ void
 nsMappedAttributes::SetStyleSheet(nsHTMLStyleSheet* aSheet)
 {
   if (mSheet) {
     mSheet->DropMappedAttributes(this);
   }
   mSheet = aSheet;  // not ref counted
 }
 
+#ifdef MOZ_OLD_STYLE
 /* virtual */ void
 nsMappedAttributes::MapRuleInfoInto(nsRuleData* aRuleData)
 {
   if (mRuleMapper) {
     (*mRuleMapper)(this, aRuleData);
   }
 }
 
@@ -297,16 +300,17 @@ nsMappedAttributes::List(FILE* out, int3
 
     Attrs()[i].mValue.ToString(tmp);
     LossyAppendUTF16toASCII(tmp, str);
     str.Append('\n');
     fprintf_stderr(out, "%s", str.get());
   }
 }
 #endif
+#endif
 
 void
 nsMappedAttributes::RemoveAttrAt(uint32_t aPos, nsAttrValue& aValue)
 {
   Attrs()[aPos].mValue.SwapValueWith(aValue);
   Attrs()[aPos].~InternalAttr();
   memmove(&Attrs()[aPos], &Attrs()[aPos + 1],
           (mAttrCount - aPos - 1) * sizeof(InternalAttr));
--- a/dom/base/nsMappedAttributes.h
+++ b/dom/base/nsMappedAttributes.h
@@ -17,27 +17,34 @@
 #include "nsIStyleRule.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/ServoBindingTypes.h"
 #include "mozilla/MemoryReporting.h"
 
 class nsAtom;
 class nsHTMLStyleSheet;
 
-class nsMappedAttributes final : public nsIStyleRule
+class nsMappedAttributes final
+#ifdef MOZ_OLD_STYLE
+  : public nsIStyleRule
+#endif
 {
 public:
   nsMappedAttributes(nsHTMLStyleSheet* aSheet,
                      nsMapRuleToAttributesFunc aMapRuleFunc);
 
   // Do not return null.
   void* operator new(size_t size, uint32_t aAttrCount = 1) CPP_THROW_NEW;
   nsMappedAttributes* Clone(bool aWillAddAttr);
 
+#ifdef MOZ_OLD_STYLE
   NS_DECL_ISUPPORTS
+#else
+  NS_INLINE_DECL_REFCOUNTING_WITH_DESTROY(nsMappedAttributes, LastRelease())
+#endif
 
   void SetAndSwapAttr(nsAtom* aAttrName, nsAttrValue& aValue,
                       bool* aValueWasSet);
   const nsAttrValue* GetAttr(nsAtom* aAttrName) const;
   const nsAttrValue* GetAttr(const nsAString& aAttrName) const;
 
   uint32_t Count() const
   {
@@ -85,24 +92,26 @@ public:
     return mServoStyle;
   }
 
   void ClearServoStyle() {
     MOZ_ASSERT(NS_IsMainThread());
     mServoStyle = nullptr;
   }
 
+#ifdef MOZ_OLD_STYLE
   // nsIStyleRule
   virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
   virtual bool MightMapInheritedStyleData() override;
   virtual bool GetDiscretelyAnimatedCSSValue(nsCSSPropertyID aProperty,
                                              nsCSSValue* aValue) override;
 #ifdef DEBUG
   virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
 #endif
+#endif
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
   static void Shutdown();
 private:
 
   void LastRelease();
 
--- a/dom/base/nsStyleLinkElement.cpp
+++ b/dom/base/nsStyleLinkElement.cpp
@@ -422,17 +422,21 @@ nsStyleLinkElement::DoUpdateStyleSheet(n
   }
 
   // XXXheycam ServoStyleSheets do not support <style scoped>.
   Element* oldScopeElement = nullptr;
   if (mStyleSheet) {
     if (mStyleSheet->IsServo()) {
       // XXXheycam ServoStyleSheets don't support <style scoped>.
     } else {
+#ifdef MOZ_OLD_STYLE
       oldScopeElement = mStyleSheet->AsGecko()->GetScopeElement();
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     }
   }
 
   if (mStyleSheet && (aOldDocument || aOldShadowRoot)) {
     MOZ_ASSERT(!(aOldDocument && aOldShadowRoot),
                "ShadowRoot content is never in document, thus "
                "there should not be a old document and old "
                "ShadowRoot simultaneously.");
@@ -594,16 +598,17 @@ nsStyleLinkElement::UpdateStyleSheetScop
   }
 
   if (mStyleSheet->IsServo()) {
     // XXXheycam ServoStyleSheets don't support <style scoped>.
     NS_ERROR("stylo: ServoStyleSheets don't support <style scoped>");
     return;
   }
 
+#ifdef MOZ_OLD_STYLE
   CSSStyleSheet* sheet = mStyleSheet->AsGecko();
 
   nsCOMPtr<nsIContent> thisContent = do_QueryInterface(this);
 
   Element* oldScopeElement = sheet->GetScopeElement();
   Element* newScopeElement = aIsNowScoped ?
                                thisContent->GetParentElement() :
                                nullptr;
@@ -632,9 +637,12 @@ nsStyleLinkElement::UpdateStyleSheetScop
   }
 
   if (oldScopeElement) {
     UpdateIsElementInStyleScopeFlagOnSubtree(oldScopeElement);
   }
   if (newScopeElement) {
     newScopeElement->SetIsElementInStyleScopeFlagOnSubtree(true);
   }
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
--- a/dom/base/nsTreeSanitizer.cpp
+++ b/dom/base/nsTreeSanitizer.cpp
@@ -1089,31 +1089,39 @@ nsTreeSanitizer::SanitizeStyleSheet(cons
   bool didSanitize = false;
   // Create a sheet to hold the parsed CSS
   RefPtr<StyleSheet> sheet;
   if (aDocument->IsStyledByServo()) {
     sheet = new ServoStyleSheet(mozilla::css::eAuthorSheetFeatures,
                                 CORS_NONE, aDocument->GetReferrerPolicy(),
                                 SRIMetadata());
   } else {
+#ifdef MOZ_OLD_STYLE
     sheet = new CSSStyleSheet(mozilla::css::eAuthorSheetFeatures,
                               CORS_NONE, aDocument->GetReferrerPolicy());
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
   sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI);
   sheet->SetPrincipal(aDocument->NodePrincipal());
   if (aDocument->IsStyledByServo()) {
     rv = sheet->AsServo()->ParseSheet(
         aDocument->CSSLoader(), NS_ConvertUTF16toUTF8(aOriginal),
         aDocument->GetDocumentURI(), aBaseURI, aDocument->NodePrincipal(),
         0, aDocument->GetCompatibilityMode());
   } else {
+#ifdef MOZ_OLD_STYLE
     // Create the CSS parser, and parse the CSS text.
     nsCSSParser parser(nullptr, sheet->AsGecko());
     rv = parser.ParseSheet(aOriginal, aDocument->GetDocumentURI(), aBaseURI,
                            aDocument->NodePrincipal(), 0);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
   NS_ENSURE_SUCCESS(rv, true);
   // Mark the sheet as complete.
   MOZ_ASSERT(!sheet->IsModified(),
              "should not get marked modified during parsing");
   sheet->SetComplete();
   // Loop through all the rules found in the CSS text
   ErrorResult err;
@@ -1183,22 +1191,26 @@ nsTreeSanitizer::SanitizeAttributes(mozi
         if (document->IsStyledByServo()) {
           RefPtr<URLExtraData> urlExtra(aElement->GetURLDataForStyleAttr());
           decl = ServoDeclarationBlock::FromCssText(
               value,
               urlExtra,
               document->GetCompatibilityMode(),
               document->CSSLoader());
         } else {
+#ifdef MOZ_OLD_STYLE
           // Pass the CSS Loader object to the parser, to allow parser error
           // reports to include the outer window ID.
           nsCSSParser parser(document->CSSLoader());
           decl = parser.ParseStyleAttribute(value, document->GetDocumentURI(),
                                             aElement->GetBaseURIForStyleAttr(),
                                             document->NodePrincipal());
+#else
+          MOZ_CRASH("old style system disabled");
+#endif
         }
         if (decl) {
           if (SanitizeStyleDeclaration(decl)) {
             nsAutoString cleanValue;
             decl->ToString(cleanValue);
             aElement->SetAttr(kNameSpaceID_None,
                               nsGkAtoms::style,
                               cleanValue,
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -751,27 +751,38 @@ CanvasGradient::AddColorStop(float aOffs
   nscolor color;
   bool ok;
 
   nsIPresShell* shell = mContext ? mContext->GetPresShell() : nullptr;
   ServoStyleSet* servoStyleSet = shell && shell->StyleSet()
     ? shell->StyleSet()->GetAsServo()
     : nullptr;
 
-  if (servoStyleSet) {
+  bool useServoParser =
+#ifdef MOZ_OLD_STYLE
+    servoStyleSet;
+#else
+    true;
+#endif
+
+  if (useServoParser) {
     ok = ServoCSSParser::ComputeColor(servoStyleSet, NS_RGB(0, 0, 0), aColorstr,
                                       &color);
   } else {
+#ifdef MOZ_OLD_STYLE
     nsCSSValue value;
     nsCSSParser parser;
 
     nsPresContext* presContext = shell ? shell->GetPresContext() : nullptr;
 
     ok = parser.ParseColorString(aColorstr, nullptr, 0, value) &&
          nsRuleNode::ComputeColor(value, presContext, nullptr, color);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   if (!ok) {
     aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
     return;
   }
 
   mStops = nullptr;
@@ -1161,21 +1172,27 @@ CanvasRenderingContext2D::WrapObject(JSC
 
 bool
 CanvasRenderingContext2D::ParseColor(const nsAString& aString,
                                      nscolor* aColor)
 {
   nsIDocument* document = mCanvasElement ? mCanvasElement->OwnerDoc() : nullptr;
   css::Loader* loader = document ? document->CSSLoader() : nullptr;
 
-  // FIXME(bug 1420026).
-  if (false) {
-    nsCOMPtr<nsIPresShell> presShell = GetPresShell();
-    ServoStyleSet* set = presShell ? presShell->StyleSet()->AsServo() : nullptr;
-
+  nsCOMPtr<nsIPresShell> presShell = GetPresShell();
+  ServoStyleSet* set = presShell ? presShell->StyleSet()->GetAsServo() : nullptr;
+
+  bool useServoParser =
+#ifdef MOZ_OLD_STYLE
+    set;
+#else
+    true;
+#endif
+
+  if (useServoParser) {
     // First, try computing the color without handling currentcolor.
     bool wasCurrentColor = false;
     if (!ServoCSSParser::ComputeColor(set, NS_RGB(0, 0, 0), aString, aColor,
                                       &wasCurrentColor, loader)) {
       return false;
     }
 
     if (wasCurrentColor) {
@@ -1183,16 +1200,17 @@ CanvasRenderingContext2D::ParseColor(con
       // if necessary.
       RefPtr<nsStyleContext> canvasStyle =
         nsComputedDOMStyle::GetStyleContext(mCanvasElement, nullptr, presShell);
       *aColor = canvasStyle->StyleColor()->mColor;
     }
     return true;
   }
 
+#ifdef MOZ_OLD_STYLE
   // Pass the CSS Loader object to the parser, to allow parser error
   // reports to include the outer window ID.
   nsCSSParser parser(loader);
   nsCSSValue value;
   if (!parser.ParseColorString(aString, nullptr, 0, value)) {
     return false;
   }
 
@@ -1210,16 +1228,19 @@ CanvasRenderingContext2D::ParseColor(con
                                                           presShell);
     }
 
     Unused << nsRuleNode::ComputeColor(
       value, presShell ? presShell->GetPresContext() : nullptr, parentContext,
       *aColor);
   }
   return true;
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 nsresult
 CanvasRenderingContext2D::Reset()
 {
   if (mCanvasElement) {
     mCanvasElement->InvalidateCanvas();
   }
@@ -2662,16 +2683,17 @@ CanvasRenderingContext2D::SetShadowColor
 
   CurrentState().shadowColor = color;
 }
 
 //
 // filters
 //
 
+#ifdef MOZ_OLD_STYLE
 static already_AddRefed<Declaration>
 CreateDeclaration(nsINode* aNode,
   const nsCSSPropertyID aProp1, const nsAString& aValue1, bool* aChanged1,
   const nsCSSPropertyID aProp2, const nsAString& aValue2, bool* aChanged2)
 {
   nsIPrincipal* principal = aNode->NodePrincipal();
   nsIDocument* document = aNode->OwnerDoc();
 
@@ -2814,16 +2836,17 @@ GetFontStyleContext(Element* aElement, c
   // The font getter is required to be reserialized based on what we
   // parsed (including having line-height removed).  (Older drafts of
   // the spec required font sizes be converted to pixels, but that no
   // longer seems to be required.)
   decl->GetPropertyValueByID(eCSSProperty_font, aOutUsedFont);
 
   return sc.forget();
 }
+#endif
 
 static already_AddRefed<RawServoDeclarationBlock>
 CreateDeclarationForServo(nsCSSPropertyID aProperty,
                           const nsAString& aPropertyValue,
                           nsIDocument* aDocument)
 {
   RefPtr<URLExtraData> data =
     new URLExtraData(aDocument->GetDocBaseURI(),
@@ -2923,16 +2946,17 @@ GetFontStyleForServo(Element* aElement, 
   // parsed (including having line-height removed).  (Older drafts of
   // the spec required font sizes be converted to pixels, but that no
   // longer seems to be required.)
   Servo_SerializeFontValueForCanvas(declarations, &aOutUsedFont);
 
   return sc.forget();
 }
 
+#ifdef MOZ_OLD_STYLE
 static already_AddRefed<Declaration>
 CreateFilterDeclaration(const nsAString& aFilter,
                         nsINode* aNode,
                         bool* aOutFilterChanged)
 {
   bool dummy;
   return CreateDeclaration(aNode,
     eCSSProperty_filter, aFilter, aOutFilterChanged,
@@ -2967,16 +2991,17 @@ ResolveFilterStyle(const nsAString& aFil
   nsStyleSet* styleSet = aPresShell->StyleSet()->GetAsGecko();
   MOZ_RELEASE_ASSERT(styleSet);
 
   RefPtr<GeckoStyleContext> sc =
     styleSet->ResolveStyleForRules(aParentContext, rules);
 
   return sc.forget();
 }
+#endif
 
 static already_AddRefed<RawServoDeclarationBlock>
 CreateFilterDeclarationForServo(const nsAString& aFilter,
                                 nsIDocument* aDocument)
 {
   return CreateDeclarationForServo(eCSSProperty_filter, aFilter, aDocument);
 }
 
@@ -3023,31 +3048,36 @@ CanvasRenderingContext2D::ParseFilter(co
   nsCOMPtr<nsIPresShell> presShell = GetPresShell();
   if (!presShell) {
     aError.Throw(NS_ERROR_FAILURE);
     return false;
   }
 
   nsString usedFont;
   if (presShell->StyleSet()->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     RefPtr<GeckoStyleContext> parentContext =
       GetFontStyleContext(mCanvasElement, GetFont(),
                           presShell, usedFont, aError);
     if (!parentContext) {
       aError.Throw(NS_ERROR_FAILURE);
       return false;
     }
     RefPtr<GeckoStyleContext> sc =
       ResolveFilterStyle(aString, presShell, parentContext, aError);
 
     if (!sc) {
       return false;
     }
     aFilterChain = sc->StyleEffects()->mFilters;
     return true;
+#else
+    MOZ_CRASH("old style system disabled");
+    return false;
+#endif
   }
 
   // For stylo
   MOZ_ASSERT(presShell->StyleSet()->IsServo());
 
   RefPtr<ServoStyleContext> parentStyle =
     GetFontStyleForServo(mCanvasElement,
                          GetFont(),
@@ -3975,18 +4005,22 @@ CanvasRenderingContext2D::SetFontInterna
   }
 
   RefPtr<nsStyleContext> sc;
   nsString usedFont;
   if (presShell->StyleSet()->IsServo()) {
     sc =
       GetFontStyleForServo(mCanvasElement, aFont, presShell, usedFont, aError);
   } else {
+#ifdef MOZ_OLD_STYLE
     sc =
       GetFontStyleContext(mCanvasElement, aFont, presShell, usedFont, aError);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
   if (!sc) {
     return false;
   }
 
   const nsStyleFont* fontStyle = sc->StyleFont();
   nsPresContext* c = presShell->GetPresContext();
 
--- a/dom/canvas/DocumentRendererChild.cpp
+++ b/dom/canvas/DocumentRendererChild.cpp
@@ -67,22 +67,26 @@ DocumentRendererChild::RenderDocument(ns
       : nullptr;
 
     if (servoStyleSet) {
       if (!ServoCSSParser::ComputeColor(servoStyleSet, NS_RGB(0, 0, 0),
                                         aBGColor, &bgColor)) {
         return false;
       }
     } else {
+#ifdef MOZ_OLD_STYLE
       nsCSSParser parser;
       nsCSSValue bgColorValue;
       if (!parser.ParseColorString(aBGColor, nullptr, 0, bgColorValue) ||
           !nsRuleNode::ComputeColor(bgColorValue, presContext, nullptr, bgColor)) {
         return false;
       }
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     }
 
     // Draw directly into the output array.
     data.SetLength(renderSize.width * renderSize.height * 4);
 
     RefPtr<DrawTarget> dt =
         Factory::CreateDrawTargetForData(gfxPlatform::GetPlatform()->GetSoftwareBackend(),
                                          reinterpret_cast<uint8_t*>(data.BeginWriting()),
--- a/dom/html/HTMLTableCellElement.cpp
+++ b/dom/html/HTMLTableCellElement.cpp
@@ -88,29 +88,31 @@ HTMLTableCellElement::CellIndex() const
     if (cells->Item(i) == this) {
       return i;
     }
   }
 
   return -1;
 }
 
+#ifdef MOZ_OLD_STYLE
 NS_IMETHODIMP
 HTMLTableCellElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
 {
   nsresult rv = nsGenericHTMLElement::WalkContentStyleRules(aRuleWalker);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (nsMappedAttributes* tableInheritedAttributes = GetMappedAttributesInheritedFromTable()) {
     if (tableInheritedAttributes) {
       aRuleWalker->Forward(tableInheritedAttributes);
     }
   }
   return NS_OK;
 }
+#endif
 
 nsMappedAttributes*
 HTMLTableCellElement::GetMappedAttributesInheritedFromTable() const
 {
   if (HTMLTableElement* table = GetTable()) {
     return table->GetAttributesMappedForCell();
   }
 
--- a/dom/html/HTMLTableCellElement.h
+++ b/dom/html/HTMLTableCellElement.h
@@ -137,17 +137,19 @@ public:
   }
 
   virtual bool ParseAttribute(int32_t aNamespaceID,
                               nsAtom* aAttribute,
                               const nsAString& aValue,
                               nsIPrincipal* aMaybeScriptedPrincipal,
                               nsAttrValue& aResult) override;
   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
+#ifdef MOZ_OLD_STYLE
   NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
+#endif
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
   // Get mapped attributes of ancestor table, if any
   nsMappedAttributes* GetMappedAttributesInheritedFromTable() const;
 
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                          bool aPreallocateChildren) const override;
 
 protected:
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2229,17 +2229,23 @@ ContentParent::InitInternal(ProcessPrior
   // This is only implemented (returns a non-empty list) by MacOSX and Linux
   // at present.
   nsTArray<SystemFontListEntry> fontList;
   gfxPlatform::GetPlatform()->ReadSystemFontList(&fontList);
   nsTArray<LookAndFeelInt> lnfCache = LookAndFeel::GetIntCache();
 
   // Content processes have no permission to access profile directory, so we
   // send the file URL instead.
-  StyleSheet* ucs = nsLayoutStylesheetCache::For(StyleBackendType::Gecko)->UserContentSheet();
+  StyleBackendType backendType =
+#ifdef MOZ_OLD_STYLE
+    StyleBackendType::Gecko;
+#else
+    StyleBackendType::Servo;
+#endif
+  StyleSheet* ucs = nsLayoutStylesheetCache::For(backendType)->UserContentSheet();
   if (ucs) {
     SerializeURI(ucs->GetSheetURI(), xpcomInit.userContentSheetURL());
   } else {
     SerializeURI(nullptr, xpcomInit.userContentSheetURL());
   }
 
   // 1. Build ContentDeviceData first, as it may affect some gfxVars.
   gfxPlatform::GetPlatform()->BuildContentDeviceData(&xpcomInit.contentDeviceData());
@@ -2349,35 +2355,31 @@ ContentParent::InitInternal(ProcessPrior
   }
 
   nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
   if (sheetService) {
     // This looks like a lot of work, but in a normal browser session we just
     // send two loads.
     //
     // The URIs of the Gecko and Servo sheets should be the same, so it
-    // shouldn't matter which we look at.  (The Servo sheets don't exist
-    // in non-MOZ-STYLO builds, though, so look at the Gecko ones.)
-
-    for (StyleSheet* sheet :
-           *sheetService->AgentStyleSheets(StyleBackendType::Gecko)) {
+    // shouldn't matter which we look at.
+
+    for (StyleSheet* sheet : *sheetService->AgentStyleSheets(backendType)) {
       URIParams uri;
       SerializeURI(sheet->GetSheetURI(), uri);
       Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
     }
 
-    for (StyleSheet* sheet :
-           *sheetService->UserStyleSheets(StyleBackendType::Gecko)) {
+    for (StyleSheet* sheet : *sheetService->UserStyleSheets(backendType)) {
       URIParams uri;
       SerializeURI(sheet->GetSheetURI(), uri);
       Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET);
     }
 
-    for (StyleSheet* sheet :
-           *sheetService->AuthorStyleSheets(StyleBackendType::Gecko)) {
+    for (StyleSheet* sheet : *sheetService->AuthorStyleSheets(backendType)) {
       URIParams uri;
       SerializeURI(sheet->GetSheetURI(), uri);
       Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET);
     }
   }
 
 #ifdef MOZ_CONTENT_SANDBOX
   bool shouldSandbox = true;
--- a/dom/smil/nsSMILCSSProperty.cpp
+++ b/dom/smil/nsSMILCSSProperty.cpp
@@ -69,20 +69,26 @@ nsSMILCSSProperty::GetBaseValue() const
   AnimationValue computedValue;
   if (mElement->IsStyledByServo()) {
     computedValue.mServo =
       Servo_ComputedValues_ExtractAnimationValue(mBaseStyleContext->AsServo(), mPropID)
       .Consume();
     if (!computedValue.mServo) {
       return baseValue;
     }
-  } else if (!StyleAnimationValue::ExtractComputedValue(mPropID,
-                                                        mBaseStyleContext->AsGecko(),
-                                                        computedValue.mGecko)) {
-    return baseValue;
+  } else {
+#ifdef MOZ_OLD_STYLE
+    if (!StyleAnimationValue::ExtractComputedValue(mPropID,
+                                                   mBaseStyleContext->AsGecko(),
+                                                   computedValue.mGecko)) {
+      return baseValue;
+    }
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   baseValue =
     nsSMILCSSValueType::ValueFromAnimationValue(mPropID, mElement,
                                                 computedValue);
   return baseValue;
 }
 
--- a/dom/smil/nsSMILCSSValueType.cpp
+++ b/dom/smil/nsSMILCSSValueType.cpp
@@ -178,16 +178,17 @@ FinalizeStyleAnimationValues(const Style
   } else if (*aValue2 == zeroCoord &&
              aValue1->GetUnit() == StyleAnimationValue::eUnit_Float) {
     aValue2 = GetZeroValueForUnit(StyleAnimationValue::eUnit_Float);
   }
 
   return true;
 }
 
+#ifdef MOZ_OLD_STYLE
 static void
 InvertSign(StyleAnimationValue& aValue)
 {
   switch (aValue.GetUnit()) {
     case StyleAnimationValue::eUnit_Coord:
       aValue.SetCoordValue(-aValue.GetCoordValue());
       break;
     case StyleAnimationValue::eUnit_Percent:
@@ -196,16 +197,17 @@ InvertSign(StyleAnimationValue& aValue)
     case StyleAnimationValue::eUnit_Float:
       aValue.SetFloatValue(-aValue.GetFloatValue());
       break;
     default:
       NS_NOTREACHED("Calling InvertSign with an unsupported unit");
       break;
   }
 }
+#endif
 
 static ValueWrapper*
 ExtractValueWrapper(nsSMILValue& aValue)
 {
   return static_cast<ValueWrapper*>(aValue.mU.mPtr);
 }
 
 static const ValueWrapper*
@@ -495,30 +497,34 @@ nsSMILCSSValueType::ComputeDistance(cons
   const ValueWrapper* fromWrapper = ExtractValueWrapper(aFrom);
   const ValueWrapper* toWrapper = ExtractValueWrapper(aTo);
   MOZ_ASSERT(toWrapper, "expecting non-null endpoint");
 
   if (!toWrapper->mServoValues.IsEmpty()) {
     return ComputeDistanceForServo(fromWrapper, *toWrapper, aDistance);
   }
 
+#ifdef MOZ_OLD_STYLE
   const StyleAnimationValue* fromCSSValue = fromWrapper ?
     &fromWrapper->mGeckoValue : nullptr;
   const StyleAnimationValue* toCSSValue = &toWrapper->mGeckoValue;
   if (!FinalizeStyleAnimationValues(fromCSSValue, toCSSValue)) {
     return NS_ERROR_FAILURE;
   }
 
   return StyleAnimationValue::ComputeDistance(toWrapper->mPropID,
                                               fromWrapper->mGeckoValue,
                                               toWrapper->mGeckoValue,
                                               nullptr,
                                               aDistance)
          ? NS_OK
          : NS_ERROR_FAILURE;
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 static nsresult
 InterpolateForGecko(const ValueWrapper* aStartWrapper,
                     const ValueWrapper& aEndWrapper,
                     double aUnitDistance,
                     nsSMILValue& aResult)
 {
@@ -635,16 +641,17 @@ GetPresContextForElement(Element* aElem)
     // and remove anonymous animated content from the document as a result.
     // See bug 534975.
     return nullptr;
   }
   nsIPresShell* shell = doc->GetShell();
   return shell ? shell->GetPresContext() : nullptr;
 }
 
+#ifdef MOZ_OLD_STYLE
 static const nsDependentSubstring
 GetNonNegativePropValue(const nsAString& aString, nsCSSPropertyID aPropID,
                         bool& aIsNegative)
 {
   // If value is negative, we'll strip off the "-" so the CSS parser won't
   // barf, and then manually make the parsed value negative.
   // (This is a partial solution to let us accept some otherwise out-of-bounds
   // CSS values. Bug 501188 will provide a more complete fix.)
@@ -692,16 +699,17 @@ ValueFromStringHelper(nsCSSPropertyID aP
     // Divide out text-zoom, since SVG is supposed to ignore it
     MOZ_ASSERT(aStyleAnimValue.GetUnit() == StyleAnimationValue::eUnit_Coord,
                "'font-size' value with unexpected style unit");
     aStyleAnimValue.SetCoordValue(aStyleAnimValue.GetCoordValue() /
                                   aPresContext->EffectiveTextZoom());
   }
   return true;
 }
+#endif
 
 static ServoAnimationValues
 ValueFromStringHelper(nsCSSPropertyID aPropID,
                       Element* aTargetElement,
                       nsPresContext* aPresContext,
                       nsStyleContext* aStyleContext,
                       const nsAString& aString)
 {
@@ -775,23 +783,27 @@ nsSMILCSSValueType::ValueFromString(nsCS
 
     if (!parsedValues.IsEmpty()) {
       sSingleton.Init(aValue);
       aValue.mU.mPtr = new ValueWrapper(aPropID, Move(parsedValues));
     }
     return;
   }
 
+#ifdef MOZ_OLD_STYLE
   StyleAnimationValue parsedValue;
   if (ValueFromStringHelper(aPropID, aTargetElement, presContext,
                             styleContext->AsGecko(), aString, parsedValue,
                             aIsContextSensitive)) {
     sSingleton.Init(aValue);
     aValue.mU.mPtr = new ValueWrapper(aPropID, parsedValue);
   }
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
 }
 
 // static
 nsSMILValue
 nsSMILCSSValueType::ValueFromAnimationValue(nsCSSPropertyID aPropID,
                                             Element* aTargetElement,
                                             const AnimationValue& aValue)
 {
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -925,16 +925,17 @@ void
 nsSVGElement::NodeInfoChanged(nsIDocument* aOldDoc)
 {
   nsSVGElementBase::NodeInfoChanged(aOldDoc);
   aOldDoc->UnscheduleSVGForPresAttrEvaluation(this);
   mContentDeclarationBlock = nullptr;
   OwnerDoc()->ScheduleSVGForPresAttrEvaluation(this);
 }
 
+#ifdef MOZ_OLD_STYLE
 NS_IMETHODIMP
 nsSVGElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
 {
 #ifdef DEBUG
 //  printf("nsSVGElement(%p)::WalkContentStyleRules()\n", this);
 #endif
   if (!mContentDeclarationBlock) {
     UpdateContentDeclarationBlock(StyleBackendType::Gecko);
@@ -943,16 +944,17 @@ nsSVGElement::WalkContentStyleRules(nsRu
   if (mContentDeclarationBlock) {
     css::Declaration* declaration = mContentDeclarationBlock->AsGecko();
     declaration->SetImmutable();
     aRuleWalker->Forward(declaration);
   }
 
   return NS_OK;
 }
+#endif
 
 NS_IMETHODIMP_(bool)
 nsSVGElement::IsAttributeMapped(const nsAtom* name) const
 {
   if (name == nsGkAtoms::lang) {
     return true;
   }
   return nsSVGElementBase::IsAttributeMapped(name);
@@ -1199,18 +1201,20 @@ public:
   // If we've parsed any values for mapped attributes, this method returns the
   // already_AddRefed css::Declaration that incorporates the parsed
   // values. Otherwise, this method returns null.
   already_AddRefed<DeclarationBlock> GetDeclarationBlock();
 
 private:
   // MEMBER DATA
   // -----------
+  css::Loader*      mLoader;
+#ifdef MOZ_OLD_STYLE
   nsCSSParser       mParser;
-  css::Loader*      mLoader;
+#endif
 
   // Arguments for nsCSSParser::ParseProperty
   nsIURI*           mDocURI;
   nsCOMPtr<nsIURI>  mBaseURI;
 
   // Declaration for storing parsed values (lazily initialized)
   RefPtr<DeclarationBlock> mDecl;
 
@@ -1220,50 +1224,64 @@ private:
   StyleBackendType mBackend;
 };
 
 MappedAttrParser::MappedAttrParser(css::Loader* aLoader,
                                    nsIURI* aDocURI,
                                    already_AddRefed<nsIURI> aBaseURI,
                                    nsSVGElement* aElement,
                                    StyleBackendType aBackend)
-  : mParser(aLoader), mLoader(aLoader), mDocURI(aDocURI), mBaseURI(aBaseURI),
-    mElement(aElement), mBackend(aBackend)
+  : mLoader(aLoader)
+#ifdef MOZ_OLD_STYLE
+  , mParser(aLoader)
+#endif
+  , mDocURI(aDocURI)
+  , mBaseURI(aBaseURI)
+  , mElement(aElement)
+  , mBackend(aBackend)
 {
 }
 
 MappedAttrParser::~MappedAttrParser()
 {
   MOZ_ASSERT(!mDecl,
              "If mDecl was initialized, it should have been returned via "
              "GetDeclarationBlock (and had its pointer cleared)");
 }
 
 void
 MappedAttrParser::ParseMappedAttrValue(nsAtom* aMappedAttrName,
                                        const nsAString& aMappedAttrValue)
 {
   if (!mDecl) {
     if (mBackend == StyleBackendType::Gecko) {
+#ifdef MOZ_OLD_STYLE
       mDecl = new css::Declaration();
       mDecl->AsGecko()->InitializeEmpty();
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     } else {
       mDecl = new ServoDeclarationBlock();
     }
   }
 
   // Get the nsCSSPropertyID ID for our mapped attribute.
   nsCSSPropertyID propertyID =
     nsCSSProps::LookupProperty(nsDependentAtomString(aMappedAttrName),
                                CSSEnabledState::eForAllContent);
   if (propertyID != eCSSProperty_UNKNOWN) {
     bool changed = false; // outparam for ParseProperty.
     if (mBackend == StyleBackendType::Gecko) {
+#ifdef MOZ_OLD_STYLE
       mParser.ParseProperty(propertyID, aMappedAttrValue, mDocURI, mBaseURI,
                             mElement->NodePrincipal(), mDecl->AsGecko(), &changed, false, true);
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     } else {
       NS_ConvertUTF16toUTF8 value(aMappedAttrValue);
       // FIXME (bug 1343964): Figure out a better solution for sending the base uri to servo
       RefPtr<URLExtraData> data = new URLExtraData(mBaseURI, mDocURI,
                                                    mElement->NodePrincipal());
       changed = Servo_DeclarationBlock_SetPropertyById(
         mDecl->AsServo()->Raw(), propertyID, &value, false, data,
         ParsingMode::AllowUnitlessLength, mElement->OwnerDoc()->GetCompatibilityMode(), mLoader);
@@ -1290,22 +1308,26 @@ MappedAttrParser::ParseMappedAttrValue(n
     return;
   }
   MOZ_ASSERT(aMappedAttrName == nsGkAtoms::lang,
              "Only 'lang' should be unrecognized!");
   // nsCSSParser doesn't know about 'lang', so we need to handle it specially.
   if (aMappedAttrName == nsGkAtoms::lang) {
     propertyID = eCSSProperty__x_lang;
     if (mBackend == StyleBackendType::Gecko) {
+#ifdef MOZ_OLD_STYLE
       nsCSSExpandedDataBlock block;
       mDecl->AsGecko()->ExpandTo(&block);
       nsCSSValue cssValue(PromiseFlatString(aMappedAttrValue), eCSSUnit_Ident);
       block.AddLonghandProperty(propertyID, cssValue);
       mDecl->AsGecko()->ValueAppended(propertyID);
       mDecl->AsGecko()->CompressFrom(&block);
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     } else {
       RefPtr<nsAtom> atom = NS_Atomize(aMappedAttrValue);
       Servo_DeclarationBlock_SetIdentStringValue(mDecl->AsServo()->Raw(), propertyID, atom);
     }
   }
 }
 
 already_AddRefed<DeclarationBlock>
--- a/dom/svg/nsSVGElement.h
+++ b/dom/svg/nsSVGElement.h
@@ -111,18 +111,20 @@ public:
   virtual bool IsNodeOfType(uint32_t aFlags) const override;
 
   /**
    * We override the default to unschedule computation of Servo declaration blocks
    * when adopted across documents.
    */
   virtual void NodeInfoChanged(nsIDocument* aOldDoc) override;
 
+#ifdef MOZ_OLD_STYLE
   NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
   void WalkAnimatedContentStyleRules(nsRuleWalker* aRuleWalker);
+#endif
 
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
 
   static const MappedAttributeEntry sFillStrokeMap[];
   static const MappedAttributeEntry sGraphicsMap[];
   static const MappedAttributeEntry sTextContentElementsMap[];
   static const MappedAttributeEntry sFontSpecificationMap[];
   static const MappedAttributeEntry sGradientStopMap[];
--- a/dom/xbl/nsBindingManager.cpp
+++ b/dom/xbl/nsBindingManager.cpp
@@ -668,16 +668,17 @@ nsBindingManager::GetBindingImplementati
       return rv;
     }
   }
 
   *aResult = nullptr;
   return NS_NOINTERFACE;
 }
 
+#ifdef MOZ_OLD_STYLE
 nsresult
 nsBindingManager::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
                             ElementDependentRuleProcessorData* aData,
                             bool* aCutOffInheritance)
 {
   *aCutOffInheritance = false;
 
   NS_ASSERTION(aData->mElement, "How did that happen?");
@@ -708,16 +709,17 @@ nsBindingManager::WalkRules(nsIStyleRule
   } while (content);
 
   // If "content" is non-null that means we cut off inheritance at some point
   // in the loop.
   *aCutOffInheritance = (content != nullptr);
 
   return NS_OK;
 }
+#endif
 
 bool
 nsBindingManager::EnumerateBoundContentBindings(
   const BoundContentBindingCallback& aCallback) const
 {
   if (!mBoundContentSet) {
     return true;
   }
@@ -738,29 +740,31 @@ nsBindingManager::EnumerateBoundContentB
         return false;
       }
     }
   }
 
   return true;
 }
 
+#ifdef MOZ_OLD_STYLE
 void
 nsBindingManager::WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc,
                                ElementDependentRuleProcessorData* aData)
 {
   EnumerateBoundContentBindings([=](nsXBLBinding* aBinding) {
     nsIStyleRuleProcessor* ruleProcessor =
       aBinding->PrototypeBinding()->GetRuleProcessor();
     if (ruleProcessor) {
       (*(aFunc))(ruleProcessor, aData);
     }
     return true;
   });
 }
+#endif
 
 bool
 nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext)
 {
   bool rulesChanged = false;
   RefPtr<nsPresContext> presContext = aPresContext;
   bool isStyledByServo = mDocument->IsStyledByServo();
 
@@ -781,22 +785,26 @@ nsBindingManager::MediumFeaturesChanged(
             styleSet->MediumFeaturesChangedRules(&viewportUnitsUsed);
           MOZ_ASSERT(!viewportUnitsUsed,
                      "Non-master stylesets shouldn't get flagged as using "
                      "viewport units!");
         }
         rulesChanged = rulesChanged || styleSetChanged;
       }
     } else {
+#ifdef MOZ_OLD_STYLE
       nsIStyleRuleProcessor* ruleProcessor =
         aBinding->PrototypeBinding()->GetRuleProcessor();
       if (ruleProcessor) {
         bool thisChanged = ruleProcessor->MediumFeaturesChanged(presContext);
         rulesChanged = rulesChanged || thisChanged;
       }
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     }
     return true;
   });
 
   return rulesChanged;
 }
 
 void
--- a/dom/xbl/nsBindingManager.h
+++ b/dom/xbl/nsBindingManager.h
@@ -119,23 +119,25 @@ public:
   nsresult PutLoadingDocListener(nsIURI* aURL, nsIStreamListener* aListener);
   nsIStreamListener* GetLoadingDocListener(nsIURI* aURL);
   void RemoveLoadingDocListener(nsIURI* aURL);
 
   void FlushSkinBindings();
 
   nsresult GetBindingImplementation(nsIContent* aContent, REFNSIID aIID, void** aResult);
 
+#ifdef MOZ_OLD_STYLE
   // Style rule methods
   nsresult WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
                      ElementDependentRuleProcessorData* aData,
                      bool* aCutOffInheritance);
 
   void WalkAllRules(nsIStyleRuleProcessor::EnumFunc aFunc,
                     ElementDependentRuleProcessorData* aData);
+#endif
 
   // Do any processing that needs to happen as a result of a change in the
   // characteristics of the medium, and return whether this rule processor's
   // rules or the servo style set have changed (e.g., because of media
   // queries).
   bool MediumFeaturesChanged(nsPresContext* aPresContext);
 
   // Update the content bindings in mBoundContentSet due to medium features
--- a/dom/xbl/nsXBLBinding.cpp
+++ b/dom/xbl/nsXBLBinding.cpp
@@ -820,26 +820,28 @@ nsXBLBinding::InheritsStyle() const
     return mPrototypeBinding->InheritsStyle();
 
   if (mNextBinding)
     return mNextBinding->InheritsStyle();
 
   return true;
 }
 
+#ifdef MOZ_OLD_STYLE
 void
 nsXBLBinding::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData)
 {
   if (mNextBinding)
     mNextBinding->WalkRules(aFunc, aData);
 
   nsIStyleRuleProcessor *rules = mPrototypeBinding->GetRuleProcessor();
   if (rules)
     (*aFunc)(rules, aData);
 }
+#endif
 
 ServoStyleSet*
 nsXBLBinding::GetServoStyleSet() const
 {
   return mPrototypeBinding->GetServoStyleSet();
 }
 
 // Internal helper methods ////////////////////////////////////////////////////////////////
--- a/dom/xbl/nsXBLBinding.h
+++ b/dom/xbl/nsXBLBinding.h
@@ -124,17 +124,19 @@ public:
   // object |obj|.  False return means a JS exception was set.
   bool ResolveAllFields(JSContext *cx, JS::Handle<JSObject*> obj) const;
 
   void AttributeChanged(nsAtom* aAttribute, int32_t aNameSpaceID,
                         bool aRemoveFlag, bool aNotify);
 
   void ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocument);
 
+#ifdef MOZ_OLD_STYLE
   void WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc, void* aData);
+#endif
 
   mozilla::ServoStyleSet* GetServoStyleSet() const;
 
   static nsresult DoInitJSClass(JSContext *cx, JS::Handle<JSObject*> obj,
                                 const nsString& aClassName,
                                 nsXBLPrototypeBinding* aProtoBinding,
                                 JS::MutableHandle<JSObject*> aClassObject,
                                 bool* aNew);
--- a/dom/xbl/nsXBLPrototypeBinding.cpp
+++ b/dom/xbl/nsXBLPrototypeBinding.cpp
@@ -558,25 +558,27 @@ nsXBLPrototypeBinding::SetInitialAttribu
             curr = curr->GetNext();
           }
         }
       }
     }
   }
 }
 
+#ifdef MOZ_OLD_STYLE
 nsIStyleRuleProcessor*
 nsXBLPrototypeBinding::GetRuleProcessor()
 {
   if (mResources) {
     return mResources->GetRuleProcessor();
   }
 
   return nullptr;
 }
+#endif
 
 void
 nsXBLPrototypeBinding::ComputeServoStyleSet(nsPresContext* aPresContext)
 {
   if (mResources) {
     mResources->ComputeServoStyleSet(aPresContext);
   }
 }
--- a/dom/xbl/nsXBLPrototypeBinding.h
+++ b/dom/xbl/nsXBLPrototypeBinding.h
@@ -127,17 +127,19 @@ public:
   void AppendStyleSheet(mozilla::StyleSheet* aSheet);
   void RemoveStyleSheet(mozilla::StyleSheet* aSheet);
   void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheet* aSheet);
   mozilla::StyleSheet* StyleSheetAt(size_t aIndex) const;
   size_t SheetCount() const;
   bool HasStyleSheets() const;
   void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheet*>& aResult) const;
 
+#ifdef MOZ_OLD_STYLE
   nsIStyleRuleProcessor* GetRuleProcessor();
+#endif
   void ComputeServoStyleSet(nsPresContext* aPresContext);
   mozilla::ServoStyleSet* GetServoStyleSet() const;
 
   nsresult FlushSkinSheets();
 
   nsAtom* GetBaseTag(int32_t* aNamespaceID);
   void SetBaseTag(int32_t aNamespaceID, nsAtom* aTag);
 
--- a/dom/xbl/nsXBLPrototypeResources.cpp
+++ b/dom/xbl/nsXBLPrototypeResources.cpp
@@ -116,17 +116,21 @@ nsXBLPrototypeResources::FlushSkinSheets
     //
     // FIXME(emilio): We shouldn't skip shadow root style updates just because?
     // Though during unlink is fine I guess...
     if (auto* shell = doc->GetShell()) {
       MOZ_ASSERT(shell->GetPresContext());
       ComputeServoStyleSet(shell->GetPresContext());
     }
   } else {
+#ifdef MOZ_OLD_STYLE
     GatherRuleProcessor();
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   return NS_OK;
 }
 
 nsresult
 nsXBLPrototypeResources::Write(nsIObjectOutputStream* aStream)
 {
@@ -136,49 +140,55 @@ nsXBLPrototypeResources::Write(nsIObject
 }
 
 void
 nsXBLPrototypeResources::Traverse(nsCycleCollectionTraversalCallback &cb)
 {
   NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "proto mResources mLoader");
   cb.NoteXPCOMChild(mLoader);
 
+#ifdef MOZ_OLD_STYLE
   CycleCollectionNoteChild(cb, mRuleProcessor.get(), "mRuleProcessor");
+#endif
   ImplCycleCollectionTraverse(cb, mStyleSheetList, "mStyleSheetList");
 }
 
 void
 nsXBLPrototypeResources::Unlink()
 {
   mStyleSheetList.Clear();
+#ifdef MOZ_OLD_STYLE
   mRuleProcessor = nullptr;
+#endif
 }
 
 void
 nsXBLPrototypeResources::ClearLoader()
 {
   mLoader = nullptr;
 }
 
+#ifdef MOZ_OLD_STYLE
 void
 nsXBLPrototypeResources::GatherRuleProcessor()
 {
   nsTArray<RefPtr<CSSStyleSheet>> sheets(mStyleSheetList.Length());
   for (StyleSheet* sheet : mStyleSheetList) {
     MOZ_ASSERT(sheet->IsGecko(),
                "GatherRuleProcessor must only be called for "
                "nsXBLPrototypeResources objects with Gecko-flavored style "
                "backends");
     sheets.AppendElement(sheet->AsGecko());
   }
   mRuleProcessor = new nsCSSRuleProcessor(Move(sheets),
                                           SheetType::Doc,
                                           nullptr,
                                           mRuleProcessor);
 }
+#endif
 
 void
 nsXBLPrototypeResources::ComputeServoStyleSet(nsPresContext* aPresContext)
 {
   nsTArray<RefPtr<ServoStyleSheet>> sheets(mStyleSheetList.Length());
   for (StyleSheet* sheet : mStyleSheetList) {
     MOZ_ASSERT(sheet->IsServo(),
                "This should only be called with Servo-flavored style backend!");
--- a/dom/xbl/nsXBLPrototypeResources.h
+++ b/dom/xbl/nsXBLPrototypeResources.h
@@ -45,41 +45,45 @@ public:
   void AppendStyleSheet(mozilla::StyleSheet* aSheet);
   void RemoveStyleSheet(mozilla::StyleSheet* aSheet);
   void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheet* aSheet);
   mozilla::StyleSheet* StyleSheetAt(size_t aIndex) const;
   size_t SheetCount() const;
   bool HasStyleSheets() const;
   void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheet*>& aResult) const;
 
+#ifdef MOZ_OLD_STYLE
   /**
    * Recreates mRuleProcessor to represent the current list of style sheets
    * stored in mStyleSheetList.  (Named GatherRuleProcessor to parallel
    * nsStyleSet::GatherRuleProcessors.)
    */
   void GatherRuleProcessor();
 
   nsCSSRuleProcessor* GetRuleProcessor() const { return mRuleProcessor; }
+#endif
 
   // Updates the ServoStyleSet object that holds the result of cascading the
   // sheets in mStyleSheetList. Equivalent to GatherRuleProcessor(), but for
   // the Servo style backend.
   void ComputeServoStyleSet(nsPresContext* aPresContext);
 
   mozilla::ServoStyleSet* GetServoStyleSet() const { return mServoStyleSet.get(); }
 
 private:
   // A loader object. Exists only long enough to load resources, and then it dies.
   RefPtr<nsXBLResourceLoader> mLoader;
 
   // A list of loaded stylesheets for this binding.
   nsTArray<RefPtr<mozilla::StyleSheet>> mStyleSheetList;
 
+#ifdef MOZ_OLD_STYLE
   // The list of stylesheets converted to a rule processor.
   RefPtr<nsCSSRuleProcessor> mRuleProcessor;
+#endif
 
   // The result of cascading the XBL style sheets like mRuleProcessor, but
   // for the Servo style backend.
   // XXX: We might want to design a better representation for the result of
   // cascading the XBL style sheets, like a collection of SelectorMaps.
   mozilla::UniquePtr<mozilla::ServoStyleSet> mServoStyleSet;
 };
 
--- a/dom/xbl/nsXBLResourceLoader.cpp
+++ b/dom/xbl/nsXBLResourceLoader.cpp
@@ -181,17 +181,21 @@ nsXBLResourceLoader::StyleSheetLoaded(St
   mResources->AppendStyleSheet(aSheet);
 
   if (!mInLoadResourcesFunc)
     mPendingSheets--;
 
   if (mPendingSheets == 0) {
     // All stylesheets are loaded.
     if (aSheet->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
       mResources->GatherRuleProcessor();
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     } else {
       mResources->ComputeServoStyleSet(
         mBoundDocument->GetShell()->GetPresContext());
     }
 
     // XXX Check for mPendingScripts when scripts also come online.
     if (!mInLoadResourcesFunc)
       NotifyBoundElements();
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -1321,21 +1321,23 @@ nsXULElement::PreHandleEvent(EventChainV
         return DispatchXULCommand(aVisitor, command);
     }
     return nsStyledElement::PreHandleEvent(aVisitor);
 }
 
 //----------------------------------------------------------------------
 // Implementation methods
 
+#ifdef MOZ_OLD_STYLE
 NS_IMETHODIMP
 nsXULElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
 {
     return NS_OK;
 }
+#endif
 
 nsChangeHint
 nsXULElement::GetAttributeChangeHint(const nsAtom* aAttribute,
                                      int32_t aModType) const
 {
     nsChangeHint retval(nsChangeHint(0));
 
     if (aAttribute == nsGkAtoms::value &&
@@ -2270,19 +2272,23 @@ nsXULPrototypeElement::SetAttrAt(uint32_
         RefPtr<DeclarationBlock> declaration;
         if (nsLayoutUtils::StyloEnabled() &&
             nsLayoutUtils::ShouldUseStylo(aDocumentURI, principal)) {
           RefPtr<URLExtraData> data =
             new URLExtraData(aDocumentURI, aDocumentURI, principal);
           declaration = ServoDeclarationBlock::FromCssText(
               aValue, data, eCompatibility_FullStandards, nullptr);
         } else {
+#ifdef MOZ_OLD_STYLE
           nsCSSParser parser;
           declaration = parser.ParseStyleAttribute(aValue, aDocumentURI,
                                                    aDocumentURI, principal);
+#else
+          MOZ_CRASH("old style system disabled");
+#endif
         }
         if (declaration) {
             mAttributes[aPos].mValue.SetTo(declaration.forget(), &aValue);
 
             return NS_OK;
         }
         // Don't abort if parsing failed, it could just be malformed css.
     }
--- a/dom/xul/nsXULElement.h
+++ b/dom/xul/nsXULElement.h
@@ -383,17 +383,19 @@ public:
     nsIContent* GetBindingParent() const final override
     {
       return mBindingParent;
     }
 
     virtual bool IsNodeOfType(uint32_t aFlags) const override;
     virtual bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) override;
 
+#ifdef MOZ_OLD_STYLE
     NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
+#endif
     virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
                                                 int32_t aModType) const override;
     NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
 
     // nsIDOMNode
     NS_FORWARD_NSIDOMNODE_TO_NSINODE
     // And since that shadowed GetParentElement with the XPCOM
     // signature, pull in the one we care about.
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -2911,17 +2911,21 @@ HTMLEditor::EnableExistingStyleSheet(con
   nsCOMPtr<nsIDocument> document = GetDocument();
   sheet->SetAssociatedDocument(document, StyleSheet::NotOwnedByDocument);
 
   if (sheet->IsServo()) {
     // XXXheycam ServoStyleSheets don't support being enabled/disabled yet.
     NS_ERROR("stylo: ServoStyleSheets can't be disabled yet");
     return true;
   }
+#ifdef MOZ_OLD_STYLE
   sheet->AsGecko()->SetDisabled(false);
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
   return true;
 }
 
 nsresult
 HTMLEditor::AddNewStyleSheetToList(const nsAString& aURL,
                                    StyleSheet* aStyleSheet)
 {
   uint32_t countSS = mStyleSheets.Length();
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -598,18 +598,22 @@ bool PresShell::sProcessInteractable = f
 static void
 VerifyStyleTree(nsPresContext* aPresContext, nsFrameManager* aFrameManager)
 {
   if (nsFrame::GetVerifyStyleTreeEnable()) {
     if (aPresContext->RestyleManager()->IsServo()) {
       NS_ERROR("stylo: cannot verify style tree with a ServoRestyleManager");
       return;
     }
+#ifdef MOZ_OLD_STYLE
     nsIFrame* rootFrame = aFrameManager->GetRootFrame();
     aPresContext->RestyleManager()->AsGecko()->DebugVerifyStyleTree(rootFrame);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 }
 #define VERIFY_STYLE_TREE ::VerifyStyleTree(mPresContext, mFrameConstructor)
 #else
 #define VERIFY_STYLE_TREE
 #endif
 
 static bool gVerifyReflowEnabled;
@@ -4348,18 +4352,22 @@ PresShell::DocumentStatesChanged(nsIDocu
     Element* rootElement = aDocument->GetRootElement();
     bool needRestyle = false;
     if (mStyleSet->IsServo()) {
       needRestyle = rootElement &&
         (mStyleSet->AsServo()->HasDocumentStateDependency(aStateMask) ||
          aDocument->BindingManager()->
            AnyBindingHasDocumentStateDependency(aStateMask));
     } else {
+#ifdef MOZ_OLD_STYLE
       needRestyle = mStyleSet->AsGecko()->
         HasDocumentStateDependentStyle(rootElement, aStateMask);
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     }
     if (needRestyle) {
       mPresContext->RestyleManager()->PostRestyleEvent(rootElement,
                                                        eRestyle_Subtree,
                                                        nsChangeHint(0));
       VERIFY_STYLE_TREE;
     }
   }
@@ -9730,23 +9738,25 @@ CopySheetsIntoClone(StyleSetHandle aSet,
   n = aSet->SheetCount(SheetType::Agent);
   for (i = 0; i < n; i++) {
     StyleSheet* ss = aSet->StyleSheetAt(SheetType::Agent, i);
     if (ss)
       aClone->AppendStyleSheet(SheetType::Agent, ss);
   }
 }
 
+#ifdef MOZ_OLD_STYLE
 nsStyleSet*
 PresShell::CloneStyleSet(nsStyleSet* aSet)
 {
   nsStyleSet* clone = new nsStyleSet();
   CopySheetsIntoClone(aSet, clone);
   return clone;
 }
+#endif
 
 ServoStyleSet*
 PresShell::CloneStyleSet(ServoStyleSet* aSet)
 {
   MOZ_ASSERT(aSet->IsMaster());
 
   ServoStyleSet* clone = new ServoStyleSet(ServoStyleSet::Kind::Master);
   CopySheetsIntoClone(aSet, clone);
@@ -9799,29 +9809,37 @@ PresShell::VerifyIncrementalReflow()
 
   // Make the new presentation context the same size as our
   // presentation context.
   nsRect r = mPresContext->GetVisibleArea();
   cx->SetVisibleArea(r);
 
   // Create a new presentation shell to view the document. Use the
   // exact same style information that this document has.
+#ifdef MOZ_OLD_STYLE
   nsAutoPtr<nsStyleSet> newGeckoSet;
+#endif
   nsAutoPtr<ServoStyleSet> newServoSet;
   StyleSetHandle newSet;
   if (mStyleSet->IsServo()) {
     newServoSet = CloneStyleSet(mStyleSet->AsServo());
     newSet = newServoSet;
   } else {
+#ifdef MOZ_OLD_STYLE
     newGeckoSet = CloneStyleSet(mStyleSet->AsGecko());
     newSet = newGeckoSet;
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
   nsCOMPtr<nsIPresShell> sh = mDocument->CreateShell(cx, vm, newSet);
   NS_ENSURE_TRUE(sh, false);
+#ifdef MOZ_OLD_STYLE
   newGeckoSet.forget();
+#endif
   newServoSet.forget();
   // Note that after we create the shell, we must make sure to destroy it
   sh->SetVerifyReflowEnable(false); // turn off verify reflow while we're reflowing the test frame tree
   vm->SetPresShell(sh);
   {
     nsAutoCauseReflowNotifier crNotifier(this);
     sh->Initialize(r.width, r.height);
   }
@@ -10642,22 +10660,24 @@ PresShell::AddSizeOfIncludingThis(nsWind
   aSizes.mLayoutPresShellSize += mallocSizeOf(this);
   if (mCaret) {
     aSizes.mLayoutPresShellSize += mCaret->SizeOfIncludingThis(mallocSizeOf);
   }
   aSizes.mLayoutPresShellSize +=
     mApproximatelyVisibleFrames.ShallowSizeOfExcludingThis(mallocSizeOf) +
     mFramesToDirty.ShallowSizeOfExcludingThis(mallocSizeOf);
 
-  if (nsStyleSet* styleSet = StyleSet()->GetAsGecko()) {
-    styleSet->AddSizeOfIncludingThis(aSizes);
-  } else if (ServoStyleSet* styleSet = StyleSet()->GetAsServo()) {
-    styleSet->AddSizeOfIncludingThis(aSizes);
+  if (StyleSet()->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
+    StyleSet()->AsGecko()->AddSizeOfIncludingThis(aSizes);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
-    MOZ_CRASH();
+    StyleSet()->AsServo()->AddSizeOfIncludingThis(aSizes);
   }
 
   aSizes.mLayoutTextRunsSize += SizeOfTextRuns(mallocSizeOf);
 
   aSizes.mLayoutPresContextSize +=
     mPresContext->SizeOfIncludingThis(mallocSizeOf);
 
   nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
@@ -10848,20 +10868,25 @@ ToSheetType(uint32_t aServiceSheetType)
   }
 }
 
 nsresult
 nsIPresShell::HasRuleProcessorUsedByMultipleStyleSets(uint32_t aSheetType,
                                                       bool* aRetVal)
 {
   *aRetVal = false;
-  if (nsStyleSet* styleSet = mStyleSet->GetAsGecko()) {
+  if (mStyleSet->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
+    nsStyleSet* styleSet = mStyleSet->AsGecko();
     // ServoStyleSets do not have rule processors.
     SheetType type = ToSheetType(aSheetType);
     *aRetVal = styleSet->HasRuleProcessorUsedByMultipleStyleSets(type);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
   return NS_OK;
 }
 
 void
 PresShell::NotifyStyleSheetServiceSheetAdded(StyleSheet* aSheet,
                                              uint32_t aSheetType)
 {
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -513,17 +513,19 @@ protected:
 
   void SetRenderingState(const RenderingState& aState);
 
   friend class ::nsPresShellEventCB;
 
   bool mCaretEnabled;
 
 #ifdef DEBUG
+#ifdef MOZ_OLD_STYLE
   nsStyleSet* CloneStyleSet(nsStyleSet* aSet);
+#endif
   ServoStyleSet* CloneStyleSet(ServoStyleSet* aSet);
   bool VerifyIncrementalReflow();
   bool mInVerifyReflow;
   void ShowEventTargetDebug();
 #endif
 
   void RecordStyleSheetChange(mozilla::StyleSheet* aStyleSheet,
                               StyleSheet::ChangeType);
--- a/layout/base/RestyleLogging.h
+++ b/layout/base/RestyleLogging.h
@@ -9,18 +9,20 @@
  */
 
 #ifndef mozilla_RestyleLogging_h
 #define mozilla_RestyleLogging_h
 
 #include "mozilla/AutoRestore.h"
 
 #ifdef DEBUG
+#ifdef MOZ_OLD_STYLE
 #define RESTYLE_LOGGING
 #endif
+#endif
 
 #ifdef RESTYLE_LOGGING
 #define LOG_RESTYLE_VAR2(prefix_, suffix_) prefix_##suffix_
 #define LOG_RESTYLE_VAR(prefix_, suffix_) LOG_RESTYLE_VAR2(prefix_, suffix_)
 #define LOG_RESTYLE_DEPTH LOG_RESTYLE_VAR(restyle_depth_, __LINE__)
 #define LOG_RESTYLE_IF(object_, cond_, message_, ...)                         \
   PR_BEGIN_MACRO                                                              \
     if (object_->ShouldLogRestyle() && (cond_)) {                             \
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -477,16 +477,17 @@ RestyleManager::ChangeHintToString(nsCha
 /**
  * Frame construction helpers follow.
  */
 #ifdef DEBUG
 static bool gInApplyRenderingChangeToTree = false;
 #endif
 
 #ifdef DEBUG
+#ifdef MOZ_OLD_STYLE
 static void
 DumpContext(nsIFrame* aFrame, nsStyleContext* aContext)
 {
   if (aFrame) {
     fputs("frame: ", stdout);
     nsAutoString name;
     aFrame->GetFrameName(name);
     fputs(NS_LossyConvertUTF16toASCII(name).get(), stdout);
@@ -623,29 +624,34 @@ VerifyStyleTree(nsIFrame* aFrame)
   // do additional contexts
   int32_t contextIndex = 0;
   for (nsStyleContext* extraContext;
        (extraContext = aFrame->GetAdditionalStyleContext(contextIndex));
        ++contextIndex) {
     VerifyContextParent(aFrame, extraContext->AsGecko(), context);
   }
 }
+#endif
 
 void
 RestyleManager::DebugVerifyStyleTree(nsIFrame* aFrame)
 {
   if (IsServo()) {
     // XXXheycam For now, we know that we don't use the same inheritance
     // hierarchy for certain cases, so just skip these assertions until
     // we work out what we want to assert (bug 1322570).
     return;
   }
+#ifdef MOZ_OLD_STYLE
   if (aFrame) {
     VerifyStyleTree(aFrame);
   }
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 #endif // DEBUG
 
 /**
  * Sync views on aFrame and all of aFrame's descendants (following placeholders),
  * if aChange has nsChangeHint_SyncFrameView.
  * Calls DoApplyRenderingChangeToTree on all aFrame's out-of-flow descendants
@@ -1753,20 +1759,30 @@ RestyleManager::GetAnimationGenerationFo
 }
 
 void
 RestyleManager::IncrementAnimationGeneration()
 {
   // We update the animation generation at start of each call to
   // ProcessPendingRestyles so we should ignore any subsequent (redundant)
   // calls that occur while we are still processing restyles.
-  if ((IsGecko() && !AsGecko()->IsProcessingRestyles()) ||
-      (IsServo() && !mInStyleRefresh)) {
-    ++mAnimationGeneration;
+  if (IsGecko()) {
+#ifdef MOZ_OLD_STYLE
+    if (AsGecko()->IsProcessingRestyles()) {
+      return;
+    }
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
+  } else {
+    if (mInStyleRefresh) {
+      return;
+    }
   }
+  ++mAnimationGeneration;
 }
 
 /* static */ void
 RestyleManager::AddLayerChangesForAnimation(nsIFrame* aFrame,
                                             nsIContent* aContent,
                                             nsStyleChangeList&
                                               aChangeListToProcess)
 {
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -331,16 +331,18 @@ NS_NewScrollbarButtonFrame (nsIPresShell
 #ifdef NOISY_FINDFRAME
 static int32_t FFWC_totalCount=0;
 static int32_t FFWC_doLoop=0;
 static int32_t FFWC_doSibling=0;
 static int32_t FFWC_recursions=0;
 static int32_t FFWC_nextInFlows=0;
 #endif
 
+#ifdef MOZ_OLD_STYLE
+
 // Wrapper class to handle stack-construction a TreeMatchContext only if we're
 // using the Gecko style system.
 class MOZ_STACK_CLASS TreeMatchContextHolder
 {
 public:
   explicit TreeMatchContextHolder(nsIDocument* aDocument)
   {
     if (!aDocument->IsStyledByServo()) {
@@ -357,16 +359,31 @@ public:
     MOZ_ASSERT(mMaybeTreeMatchContext.isSome());
     return mMaybeTreeMatchContext.ptr();
   }
 
 private:
   Maybe<TreeMatchContext> mMaybeTreeMatchContext;
 };
 
+#else
+
+// Define this dummy class so there are fewer call sites to change when the old
+// style system code is compiled out.
+class TreeMatchContextHolder
+{
+public:
+  explicit TreeMatchContextHolder(nsIDocument* aDocument) {}
+  bool Exists() const { return false; }
+  operator TreeMatchContext*() { return nullptr; }
+  TreeMatchContext* operator->() { MOZ_CRASH("old style system disabled"); }
+};
+
+#endif
+
 // Returns true if aFrame is an anonymous flex/grid item.
 static inline bool
 IsAnonymousFlexOrGridItem(const nsIFrame* aFrame)
 {
   const nsAtom* pseudoType = aFrame->StyleContext()->GetPseudo();
   return pseudoType == nsCSSAnonBoxes::anonymousFlexItem ||
          pseudoType == nsCSSAnonBoxes::anonymousGridItem;
 }
@@ -875,17 +892,21 @@ public:
                           nsContainerFrame* aFixedContainingBlock,
                           nsContainerFrame* aAbsoluteContainingBlock,
                           nsContainerFrame* aFloatContainingBlock);
 
   ~nsFrameConstructorState();
 
   bool HasAncestorFilter()
   {
+#ifdef MOZ_OLD_STYLE
     return mTreeMatchContext && mTreeMatchContext->mAncestorFilter.HasFilter();
+#else
+    return false;
+#endif
   }
 
   // Function to push the existing absolute containing block state and
   // create a new scope. Code that uses this function should get matching
   // logic in GetAbsoluteContainingBlock.
   // Also makes aNewAbsoluteContainingBlock the containing block for
   // fixed-pos elements if necessary.
   // aPositionedFrame is the frame whose style actually makes
@@ -1023,16 +1044,33 @@ protected:
 
   // Our list of all pending bindings.  When we're done, we need to call
   // AddToAttachedQueue on all of them, in order.
   LinkedList<PendingBinding> mPendingBindings;
 
   PendingBinding* mCurrentPendingBindingInsertionPoint;
 };
 
+#ifndef MOZ_OLD_STYLE
+
+namespace mozilla {
+
+class AutoDisplayContentsAncestorPusher
+{
+public:
+  AutoDisplayContentsAncestorPusher(TreeMatchContext& aTreeMatchContext,
+                                    nsPresContext* aPresContext,
+                                    nsIContent* aParent) {}
+  bool IsEmpty() const { return false; }
+};
+
+} // namespace mozilla
+
+#endif
+
 nsFrameConstructorState::nsFrameConstructorState(
   nsIPresShell* aPresShell,
   TreeMatchContext* aTreeMatchContext,
   nsContainerFrame* aFixedContainingBlock,
   nsContainerFrame* aAbsoluteContainingBlock,
   nsContainerFrame* aFloatContainingBlock,
   already_AddRefed<nsILayoutHistoryState> aHistoryState)
   : mPresContext(aPresShell->GetPresContext()),
@@ -1965,16 +2003,17 @@ nsCSSFrameConstructor::CreateGeneratedCo
       // If animations are involved, we avoid the SetExplicitStyle optimization
       // above. We need to grab style with animations from the pseudo element
       // and replace old one.
       mPresShell->StyleSet()->AsServo()->StyleNewSubtree(container);
       pseudoStyleContext =
         styleSet->AsServo()->ResolveServoStyle(container);
     }
   } else {
+#ifdef MOZ_OLD_STYLE
     mozilla::GeckoRestyleManager* geckoRM = RestyleManager()->AsGecko();
     GeckoRestyleManager::ReframingStyleContexts* rsc =
       geckoRM->GetReframingStyleContexts();
 
     if (rsc) {
       RefPtr<GeckoStyleContext> newContext =
         GeckoStyleContext::TakeRef(pseudoStyleContext.forget());
       if (auto* oldStyleContext = rsc->Get(container, aPseudoElement)) {
@@ -1984,16 +2023,19 @@ nsCSSFrameConstructor::CreateGeneratedCo
                                                      &newContext);
       } else {
         aState.mPresContext->TransitionManager()->
           PruneCompletedTransitions(aParentContent->AsElement(),
                                     aPseudoElement, newContext);
       }
       pseudoStyleContext = newContext.forget();
     }
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   uint32_t contentCount = pseudoStyleContext->StyleContent()->ContentCount();
   for (uint32_t contentIndex = 0; contentIndex < contentCount; contentIndex++) {
     nsCOMPtr<nsIContent> content =
       CreateGeneratedContent(aState, aParentContent, pseudoStyleContext,
                              contentIndex);
     if (content) {
@@ -3997,17 +4039,17 @@ nsCSSFrameConstructor::ConstructFrameFro
   // not have a frame and would not otherwise be pushed as an ancestor. It is
   // necessary to do so in order to correctly handle style resolution on
   // descendants.  (If !adcp.IsEmpty() then it was already pushed by
   // AutoDisplayContentsAncestorPusher above.)
   TreeMatchContext::AutoAncestorPusher
     insertionPointPusher(aState.mTreeMatchContext);
   if (adcp.isSome() && adcp->IsEmpty() && parent &&
       parent->IsActiveChildrenElement()) {
-    if (aState.mTreeMatchContext->mAncestorFilter.HasFilter()) {
+    if (aState.HasAncestorFilter()) {
       insertionPointPusher.PushAncestorAndStyleScope(parent);
     } else {
       insertionPointPusher.PushStyleScope(parent);
     }
   }
 
   // Push the content as a style ancestor now, so we don't have to do
   // it in our various full-constructor functions.  In particular,
@@ -5287,17 +5329,19 @@ nsCSSFrameConstructor::ResolveStyleConte
                  "shouldn't waste time creating style contexts for "
                  "comments and processing instructions");
     result = styleSet->ResolveStyleForText(aContent, aParentStyleContext);
   }
 
   // ServoRestyleManager does not handle transitions yet, and when it does
   // it probably won't need to track reframed style contexts to start
   // transitions correctly.
-  if (mozilla::GeckoRestyleManager* geckoRM = RestyleManager()->GetAsGecko()) {
+  if (RestyleManager()->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
+    mozilla::GeckoRestyleManager* geckoRM = RestyleManager()->AsGecko();
     GeckoRestyleManager::ReframingStyleContexts* rsc =
       geckoRM->GetReframingStyleContexts();
     if (rsc) {
       GeckoStyleContext* oldStyleContext =
         rsc->Get(aContent, CSSPseudoElementType::NotPseudo);
       nsPresContext* presContext = mPresShell->GetPresContext();
       if (oldStyleContext) {
         RefPtr<GeckoStyleContext> newContext =
@@ -5306,16 +5350,19 @@ nsCSSFrameConstructor::ResolveStyleConte
                                                      oldStyleContext, &newContext);
         result = newContext.forget();
       } else if (aContent->IsElement()) {
         presContext->TransitionManager()->
           PruneCompletedTransitions(aContent->AsElement(),
             CSSPseudoElementType::NotPseudo, result->AsGecko());
       }
     }
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   return result.forget();
 }
 
 // MathML Mod - RBS
 void
 nsCSSFrameConstructor::FlushAccumulatedBlock(nsFrameConstructorState& aState,
@@ -5990,19 +6037,23 @@ nsCSSFrameConstructor::AddFrameConstruct
       if (resolveStyle) {
         // Need to take a different path (Servo directly grabs the style from
         // the element, Gecko needs to actually re-resolve it using the parent
         // style context).
         if (styleContext->IsServo()) {
           styleContext =
             mPresShell->StyleSet()->AsServo()->ResolveServoStyle(aContent->AsElement());
         } else {
+#ifdef MOZ_OLD_STYLE
           styleContext =
             ResolveStyleContext(styleContext->AsGecko()->GetParent(),
                                 aContent, &aState);
+#else
+          MOZ_CRASH("old style system disabled");
+#endif
         }
       }
 
       display = styleContext->StyleDisplay();
       aStyleContext = styleContext;
       aTag = mDocument->BindingManager()->ResolveTag(aContent, &aNameSpaceID);
     }
   }
@@ -7278,29 +7329,35 @@ nsCSSFrameConstructor::MaybeConstructLaz
       child->SetFlags(NODE_NEEDS_FRAME);
     }
   }
 
   // Walk up the tree setting the NODE_DESCENDANTS_NEED_FRAMES bit as we go.
   // We need different handling for servo given the scoped restyle roots.
   CheckBitsForLazyFrameConstruction(parent);
 
-  if (mozilla::GeckoRestyleManager* geckoRM = RestyleManager()->GetAsGecko()) {
+  if (RestyleManager()->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
+    mozilla::GeckoRestyleManager* geckoRM = RestyleManager()->AsGecko();
     while (parent && !parent->HasFlag(NODE_DESCENDANTS_NEED_FRAMES)) {
       parent->SetFlags(NODE_DESCENDANTS_NEED_FRAMES);
       parent = parent->GetFlattenedTreeParent();
     }
     geckoRM->PostRestyleEventForLazyConstruction();
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
     parent->AsElement()->NoteDescendantsNeedFramesForServo();
   }
 
   return true;
 }
 
+#ifdef MOZ_OLD_STYLE
 void
 nsCSSFrameConstructor::CreateNeededFrames(
     nsIContent* aContent,
     TreeMatchContext& aTreeMatchContext)
 {
   MOZ_ASSERT(!aContent->IsStyledByServo());
   NS_ASSERTION(!aContent->HasFlag(NODE_NEEDS_FRAME),
     "shouldn't get here with a content node that has needs frame bit set");
@@ -7389,16 +7446,17 @@ nsCSSFrameConstructor::CreateNeededFrame
     BeginUpdate();
     TreeMatchContext treeMatchContext(
         mDocument, TreeMatchContext::ForFrameConstruction);
     treeMatchContext.InitAncestors(rootElement);
     CreateNeededFrames(rootElement, treeMatchContext);
     EndUpdate();
   }
 }
+#endif
 
 void
 nsCSSFrameConstructor::IssueSingleInsertNofications(nsIContent* aContainer,
                                                     nsIContent* aStartChild,
                                                     nsIContent* aEndChild)
 {
   for (nsIContent* child = aStartChild;
        child != aEndChild;
@@ -9428,16 +9486,17 @@ nsCSSFrameConstructor::CaptureStateForFr
       GetRootFrame();
   }
   for ( ; frame;
         frame = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(frame)) {
     CaptureFrameState(frame, aHistoryState);
   }
 }
 
+#ifdef MOZ_OLD_STYLE
 static bool
 DefinitelyEqualURIsAndPrincipal(mozilla::css::URLValue* aURI1,
                                 mozilla::css::URLValue* aURI2)
 {
   return aURI1 == aURI2 ||
          (aURI1 && aURI2 && aURI1->DefinitelyEqualURIsAndPrincipal(*aURI2));
 }
 
@@ -9479,16 +9538,17 @@ nsCSSFrameConstructor::MaybeRecreateFram
         DefinitelyEqualURIsAndPrincipal(disp->mBinding, oldDisp->mBinding)) {
       return newContext;
     }
   }
 
   RecreateFramesForContent(aElement, InsertionKind::Sync);
   return nullptr;
 }
+#endif
 
 static bool
 IsWhitespaceFrame(nsIFrame* aFrame)
 {
   MOZ_ASSERT(aFrame, "invalid argument");
   return aFrame->IsTextFrame() && aFrame->GetContent()->TextIsOnlyWhitespace();
 }
 
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -96,26 +96,30 @@ public:
 
   mozilla::RestyleManager* RestyleManager() const
     { return mPresShell->GetPresContext()->RestyleManager(); }
 
   nsIFrame* ConstructRootFrame();
 
   void ReconstructDocElementHierarchy(InsertionKind);
 
+#ifdef MOZ_OLD_STYLE
   // Create frames for content nodes that are marked as needing frames. This
   // should be called before ProcessPendingRestyles.
   // Note: It's the caller's responsibility to make sure to wrap a
   // CreateNeededFrames call in a view update batch and a script blocker.
   void CreateNeededFrames();
+#endif
 
 private:
 
+#ifdef MOZ_OLD_STYLE
   void CreateNeededFrames(nsIContent* aContent,
                           TreeMatchContext& aTreeMatchContext);
+#endif
 
   enum Operation {
     CONTENTAPPEND,
     CONTENTINSERT
   };
 
   // aChild is the child being inserted for inserts, and the first
   // child being appended for appends.
@@ -1857,24 +1861,26 @@ private:
                         nsContainerFrame*        aScrolledFrame,
                         nsIContent*              aContent,
                         nsContainerFrame*        aParentFrame,
                         nsStyleContext*          aStyleContext,
                         bool                     aBuildCombobox,
                         PendingBinding*          aPendingBinding,
                         nsFrameItems&            aFrameItems);
 
+#ifdef MOZ_OLD_STYLE
   /**
    * ReResolve style for aElement then recreate frames if required.
    * Do nothing for other types of style changes, except for undisplayed nodes
    * (display:none/contents) which will have their style context updated in the
    * frame manager undisplayed maps.
    * @return null if frames were recreated, the new style context otherwise
    */
   nsStyleContext* MaybeRecreateFramesForElement(Element* aElement);
+#endif
 
   /**
    * Recreate frames for aContent.
    * @param aContent the content to recreate frames for
    * @param aFlags normally you want to pass REMOVE_FOR_RECONSTRUCTION here
    */
   void RecreateFramesForContent(nsIContent*   aContent,
                                 InsertionKind aInsertionKind);
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -2325,17 +2325,21 @@ nsDocumentViewer::CreateStyleSet(nsIDocu
 
   // this should eventually get expanded to allow for creating
   // different sets for different media
 
   StyleBackendType backendType = aDocument->GetStyleBackendType();
 
   StyleSetHandle styleSet;
   if (backendType == StyleBackendType::Gecko) {
+#ifdef MOZ_OLD_STYLE
     styleSet = new nsStyleSet();
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
     styleSet = new ServoStyleSet(ServoStyleSet::Kind::Master);
   }
 
   styleSet->BeginUpdate();
 
   // The document will fill in the document sheets when we create the presshell
 
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -8283,16 +8283,17 @@ nsLayoutUtils::Shutdown()
   nsStyleList::Shutdown();
 }
 
 #ifdef MOZ_STYLO
 /* static */
 bool
 nsLayoutUtils::ShouldUseStylo(nsIURI* aDocumentURI, nsIPrincipal* aPrincipal)
 {
+#ifdef MOZ_OLD_STYLE
   // Disable stylo for system principal because XUL hasn't been fully
   // supported. Other principal aren't able to use XUL by default, and
   // the back door to enable XUL is mostly just for testing, which means
   // they don't matter, and we shouldn't respect them at the same time.
   if (!StyloChromeEnabled() &&
       nsContentUtils::IsSystemPrincipal(aPrincipal)) {
     return false;
   }
@@ -8309,16 +8310,17 @@ nsLayoutUtils::ShouldUseStylo(nsIURI* aD
         return false;
       }
     }
   }
   // Check the stylo block list.
   if (IsInStyloBlocklist(aPrincipal)) {
     return false;
   }
+#endif
   return true;
 }
 
 /* static */
 bool
 nsLayoutUtils::IsInStyloBlocklist(nsIPrincipal* aPrincipal)
 {
   if (!sStyloBlocklist) {
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2513,18 +2513,20 @@ public:
   static bool TextCombineUprightDigitsEnabled() {
     return sTextCombineUprightDigitsEnabled;
   }
 
   // Stylo (the Servo backend for Gecko's style system) is generally enabled
   // or disabled at compile-time. However, we provide the additional capability
   // to disable it dynamically in stylo-enabled builds via a pref.
   static bool StyloEnabled() {
-#ifdef MOZ_STYLO
+#if defined(MOZ_STYLO) && defined(MOZ_OLD_STYLE)
     return sStyloEnabled && StyloSupportedInCurrentProcess();
+#elif defined(MOZ_STYLO)
+    return true;
 #else
     return false;
 #endif
   }
 
   // Whether Stylo should be allowed to be enabled in this process.
   static bool StyloSupportedInCurrentProcess() {
 #ifdef MOZ_STYLO
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -152,24 +152,35 @@ nsPresContext::MakeColorPref(const nsStr
 {
   bool ok;
   nscolor result;
 
   ServoStyleSet* servoStyleSet = mShell && mShell->StyleSet()
     ? mShell->StyleSet()->GetAsServo()
     : nullptr;
 
-  if (servoStyleSet) {
+  bool useServoParser =
+#ifdef MOZ_OLD_STYLE
+    servoStyleSet;
+#else
+    true;
+#endif
+
+  if (useServoParser) {
     ok = ServoCSSParser::ComputeColor(servoStyleSet, NS_RGB(0, 0, 0), aColor,
                                       &result);
   } else {
+#ifdef MOZ_OLD_STYLE
     nsCSSParser parser;
     nsCSSValue value;
     ok = parser.ParseColorString(aColor, nullptr, 0, value) &&
          nsRuleNode::ComputeColor(value, this, nullptr, result);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   if (!ok) {
     // Any better choices?
     result = NS_RGB(0, 0, 0);
   }
 
   return result;
@@ -1006,17 +1017,21 @@ void
 nsPresContext::AttachShell(nsIPresShell* aShell, StyleBackendType aBackendType)
 {
   MOZ_ASSERT(!mShell);
   mShell = aShell;
 
   if (aBackendType == StyleBackendType::Servo) {
     mRestyleManager = new ServoRestyleManager(this);
   } else {
+#ifdef MOZ_OLD_STYLE
     mRestyleManager = new GeckoRestyleManager(this);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   // Since CounterStyleManager is also the name of a method of
   // nsPresContext, it is necessary to prefix the class with the mozilla
   // namespace here.
   mCounterStyleManager = new mozilla::CounterStyleManager(this);
 
   nsIDocument *doc = mShell->GetDocument();
@@ -2041,18 +2056,22 @@ nsPresContext::RebuildAllStyleData(nsCha
 {
   if (!mShell) {
     // We must have been torn down. Nothing to do here.
     return;
   }
 
   mUsesRootEMUnits = false;
   mUsesExChUnits = false;
-  if (nsStyleSet* styleSet = mShell->StyleSet()->GetAsGecko()) {
-    styleSet->SetUsesViewportUnits(false);
+  if (mShell->StyleSet()->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
+    mShell->StyleSet()->AsGecko()->SetUsesViewportUnits(false);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
   mDocument->RebuildUserFontSet();
   RebuildCounterStyles();
   RebuildFontFeatureValues();
 
   RestyleManager()->RebuildAllStyleData(aExtraHint, aRestyleHint);
 }
 
@@ -2264,21 +2283,26 @@ nsPresContext::UpdateIsChrome()
   mIsChrome = mContainer &&
               nsIDocShellTreeItem::typeChrome == mContainer->ItemType();
 }
 
 bool
 nsPresContext::HasAuthorSpecifiedRules(const nsIFrame* aFrame,
                                        uint32_t aRuleTypeMask) const
 {
-  if (auto* geckoStyleContext = aFrame->StyleContext()->GetAsGecko()) {
+  if (aFrame->StyleContext()->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
+    auto* geckoStyleContext = aFrame->StyleContext()->AsGecko();
     return
       nsRuleNode::HasAuthorSpecifiedRules(geckoStyleContext,
                                           aRuleTypeMask,
                                           UseDocumentColors());
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
   Element* elem = aFrame->GetContent()->AsElement();
 
   // We need to handle non-generated content pseudos too, so we use
   // the parent of generated content pseudo to be consistent.
   if (elem->GetPseudoElementType() != CSSPseudoElementType::NotPseudo) {
     MOZ_ASSERT(elem->GetParent(), "Pseudo element has no parent element?");
     elem = elem->GetParent()->AsElement();
@@ -2784,25 +2808,28 @@ nsPresContext::NotifyDidPaintForSubtree(
 
 bool
 nsPresContext::HasCachedStyleData()
 {
   if (!mShell) {
     return false;
   }
 
-  nsStyleSet* styleSet = mShell->StyleSet()->GetAsGecko();
-  if (!styleSet) {
-    // XXXheycam ServoStyleSets do not use the rule tree, so just assume for now
-    // that we need to restyle when e.g. dppx changes assuming we're sufficiently
-    // bootstrapped.
-    return mShell->DidInitialize();
+  if (mShell->StyleSet()->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
+    return mShell->StyleSet()->AsGecko()->HasCachedStyleData();
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
-  return styleSet->HasCachedStyleData();
+  // XXXheycam ServoStyleSets do not use the rule tree, so just assume for now
+  // that we need to restyle when e.g. dppx changes assuming we're sufficiently
+  // bootstrapped.
+  return mShell->DidInitialize();
 }
 
 already_AddRefed<nsITimer>
 nsPresContext::CreateTimer(nsTimerCallbackFunc aCallback,
                            const char* aName,
                            uint32_t aDelay)
 {
   nsCOMPtr<nsITimer> timer;
--- a/layout/base/nsStyleSheetService.cpp
+++ b/layout/base/nsStyleSheetService.cpp
@@ -95,19 +95,17 @@ SheetHasURI(StyleSheet* aSheet, nsIURI* 
          result;
 }
 
 int32_t
 nsStyleSheetService::FindSheetByURI(mozilla::StyleBackendType aBackendType,
                                     uint32_t aSheetType,
                                     nsIURI* aSheetURI)
 {
-  SheetArray& sheets = aBackendType == mozilla::StyleBackendType::Gecko ?
-                         mGeckoSheets[aSheetType] :
-                         mServoSheets[aSheetType];
+  SheetArray& sheets = Sheets(aBackendType)[aSheetType];
   for (int32_t i = sheets.Length() - 1; i >= 0; i-- ) {
     if (SheetHasURI(sheets[i], aSheetURI)) {
       return i;
     }
   }
 
   return -1;
 }
@@ -179,21 +177,19 @@ nsStyleSheetService::LoadAndRegisterShee
 #ifdef MOZ_STYLO
     servoSheetWasAdded = nsLayoutUtils::StyloSupportedInCurrentProcess();
 #endif
 
     // Hold on to a copy of the registered PresShells.
     nsTArray<nsCOMPtr<nsIPresShell>> toNotify(mPresShells);
     for (nsIPresShell* presShell : toNotify) {
       if (presShell->StyleSet()) {
-        bool isGecko = presShell->StyleSet()->IsGecko();
-        // We always have a Gecko sheet; we sometimes have a Servo sheet.
-        if (isGecko || servoSheetWasAdded) {
-          StyleSheet* sheet = isGecko ? mGeckoSheets[aSheetType].LastElement() :
-            mServoSheets[aSheetType].LastElement();
+        StyleBackendType backendType = presShell->StyleSet()->BackendType();
+        if (backendType == StyleBackendType::Gecko || servoSheetWasAdded) {
+          StyleSheet* sheet = Sheets(backendType)[aSheetType].LastElement();
           presShell->NotifyStyleSheetServiceSheetAdded(sheet, aSheetType);
         } else {
           MOZ_ASSERT_UNREACHABLE("Servo pres shell, but stylo unsupported?");
         }
       }
     }
 
     if (XRE_IsParentProcess()) {
@@ -245,30 +241,31 @@ nsStyleSheetService::LoadAndRegisterShee
       parsingMode = css::eAuthorSheetFeatures;
       break;
 
     default:
       NS_WARNING("invalid sheet type argument");
       return NS_ERROR_INVALID_ARG;
   }
 
-  nsresult rv;
 
-  RefPtr<StyleSheet> geckoSheet;
-
-  rv = LoadSheet(aSheetURI, parsingMode, StyleBackendType::Gecko, &geckoSheet);
-  NS_ENSURE_SUCCESS(rv, rv);
-  MOZ_ASSERT(geckoSheet);
-  mGeckoSheets[aSheetType].AppendElement(geckoSheet);
+#ifdef MOZ_OLD_STYLE
+  {
+    RefPtr<StyleSheet> geckoSheet;
+    nsresult rv = LoadSheet(aSheetURI, parsingMode, StyleBackendType::Gecko, &geckoSheet);
+    NS_ENSURE_SUCCESS(rv, rv);
+    MOZ_ASSERT(geckoSheet);
+    mGeckoSheets[aSheetType].AppendElement(geckoSheet);
+  }
+#endif
 
 #ifdef MOZ_STYLO
   if (nsLayoutUtils::StyloSupportedInCurrentProcess()) {
     RefPtr<StyleSheet> servoSheet;
-
-    rv = LoadSheet(aSheetURI, parsingMode, StyleBackendType::Servo, &servoSheet);
+    nsresult rv = LoadSheet(aSheetURI, parsingMode, StyleBackendType::Servo, &servoSheet);
     NS_ENSURE_SUCCESS(rv, rv);
     MOZ_ASSERT(servoSheet);
     mServoSheets[aSheetType].AppendElement(servoSheet);
   }
 #endif
 
   return NS_OK;
 }
@@ -278,19 +275,24 @@ nsStyleSheetService::SheetRegistered(nsI
                                      uint32_t aSheetType, bool *_retval)
 {
   NS_ENSURE_ARG(aSheetType == AGENT_SHEET ||
                 aSheetType == USER_SHEET ||
                 aSheetType == AUTHOR_SHEET);
   NS_ENSURE_ARG_POINTER(sheetURI);
   NS_PRECONDITION(_retval, "Null out param");
 
-  // Check to see if we have the Gecko sheet.
-  *_retval = (FindSheetByURI(mozilla::StyleBackendType::Gecko,
-                             aSheetType, sheetURI) >= 0);
+  // Check to see if we have the sheet.
+  StyleBackendType backendType =
+#ifdef MOZ_OLD_STYLE
+    StyleBackendType::Gecko;
+#else
+    StyleBackendType::Servo;
+#endif
+  *_retval = (FindSheetByURI(backendType, aSheetType, sheetURI) >= 0);
 
   return NS_OK;
 }
 
 static nsresult
 GetParsingMode(uint32_t aSheetType, css::SheetParsingMode* aParsingMode)
 {
   switch (aSheetType) {
@@ -373,39 +375,47 @@ NS_IMETHODIMP
 nsStyleSheetService::UnregisterSheet(nsIURI *aSheetURI, uint32_t aSheetType)
 {
   NS_ENSURE_ARG(aSheetType == AGENT_SHEET ||
                 aSheetType == USER_SHEET ||
                 aSheetType == AUTHOR_SHEET);
   NS_ENSURE_ARG_POINTER(aSheetURI);
 
   // We have to search for Gecko and Servo sheets separately.
-  // Gecko first, which should always be present.
-  int32_t foundIndex = FindSheetByURI(StyleBackendType::Gecko,
-                                      aSheetType, aSheetURI);
+  int32_t foundIndex;
+
+#ifdef MOZ_OLD_STYLE
+  // Gecko first, which should always be present, if the old style system
+  // is enabled.
+  foundIndex = FindSheetByURI(StyleBackendType::Gecko, aSheetType, aSheetURI);
   NS_ENSURE_TRUE(foundIndex >= 0, NS_ERROR_INVALID_ARG);
 
   RefPtr<StyleSheet> geckoSheet = mGeckoSheets[aSheetType][foundIndex];
   mGeckoSheets[aSheetType].RemoveElementAt(foundIndex);
+#endif
 
   // Now search for Servo, which may or may not be present.
   RefPtr<StyleSheet> servoSheet;
   foundIndex = FindSheetByURI(StyleBackendType::Servo,
                               aSheetType, aSheetURI);
   if (foundIndex >= 0) {
     servoSheet = mServoSheets[aSheetType][foundIndex];
     mServoSheets[aSheetType].RemoveElementAt(foundIndex);
   }
 
   // Hold on to a copy of the registered PresShells.
   nsTArray<nsCOMPtr<nsIPresShell>> toNotify(mPresShells);
   for (nsIPresShell* presShell : toNotify) {
     if (presShell->StyleSet()) {
-      StyleSheet* sheet = presShell->StyleSet()->IsGecko() ? geckoSheet
-                                                           : servoSheet;
+      StyleSheet* sheet =
+#ifdef MOZ_OLD_STYLE
+        presShell->StyleSet()->IsGecko() ? geckoSheet : servoSheet;
+#else
+        servoSheet;
+#endif
       if (sheet) {
         presShell->NotifyStyleSheetServiceSheetRemoved(sheet, aSheetType);
       }
     }
   }
 
   if (XRE_IsParentProcess()) {
     nsTArray<dom::ContentParent*> children;
@@ -454,17 +464,22 @@ nsStyleSheetService::CollectReports(nsIH
 
   return NS_OK;
 }
 
 size_t
 nsStyleSheetService::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
 {
   size_t n = aMallocSizeOf(this);
-  for (auto* sheetArrays : { &mGeckoSheets, &mServoSheets }) {
+  for (auto* sheetArrays : {
+#ifdef MOZ_OLD_STYLE
+      &mGeckoSheets,
+#endif
+      &mServoSheets,
+    }) {
     for (auto& sheetArray : *sheetArrays) {
       n += sheetArray.ShallowSizeOfExcludingThis(aMallocSizeOf);
       for (StyleSheet* sheet : sheetArray) {
         if (sheet) {
           n += sheet->SizeOfIncludingThis(aMallocSizeOf);
         }
       }
     }
--- a/layout/base/nsStyleSheetService.h
+++ b/layout/base/nsStyleSheetService.h
@@ -80,21 +80,29 @@ private:
 
   // Like LoadAndRegisterSheet, but doesn't notify.  If successful, the
   // new sheet will be the last sheet in mSheets[aSheetType].
   nsresult LoadAndRegisterSheetInternal(nsIURI *aSheetURI,
                                         uint32_t aSheetType);
 
   mozilla::Array<SheetArray, 3>& Sheets(mozilla::StyleBackendType aType)
   {
-    return aType == mozilla::StyleBackendType::Gecko ? mGeckoSheets
-                                                     : mServoSheets;
+#ifdef MOZ_OLD_STYLE
+    if (aType == mozilla::StyleBackendType::Gecko) {
+      return mGeckoSheets;
+    }
+#else
+    MOZ_ASSERT(aType == mozilla::StyleBackendType::Servo);
+#endif
+    return mServoSheets;
   }
 
+#ifdef MOZ_OLD_STYLE
   mozilla::Array<SheetArray, 3> mGeckoSheets;
+#endif
   mozilla::Array<SheetArray, 3> mServoSheets;
 
   // Registered PresShells that will be notified when sheets are added and
   // removed from the style sheet service.
   nsTArray<nsCOMPtr<nsIPresShell>> mPresShells;
 };
 
 #endif
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -285,17 +285,19 @@ nsLayoutStatics::Initialize()
 
   CacheObserver::Init();
 
   IMEStateManager::Init();
 
   ServiceWorkerRegistrar::Initialize();
 
 #ifdef DEBUG
+#ifdef MOZ_OLD_STYLE
   GeckoStyleContext::Initialize();
+#endif
   mozilla::LayerAnimationInfo::Initialize();
 #endif
 
   MediaDecoder::InitStatics();
 
   PromiseDebugging::Init();
 
   mozilla::dom::WebCryptoThreadPool::Initialize();
@@ -343,17 +345,19 @@ nsLayoutStatics::Shutdown()
 #ifdef MOZ_XUL
   nsXULPopupManager::Shutdown();
 #endif
   StorageObserver::Shutdown();
   txMozillaXSLTProcessor::Shutdown();
   Attr::Shutdown();
   EventListenerManager::Shutdown();
   IMEStateManager::Shutdown();
+#ifdef MOZ_OLD_STYLE
   nsCSSParser::Shutdown();
+#endif
   nsMediaFeatures::Shutdown();
   nsHTMLDNSPrefetch::Shutdown();
   nsCSSRendering::Shutdown();
   StaticPresData::Shutdown();
 #ifdef DEBUG
   nsFrame::DisplayReflowShutdown();
 #endif
   nsCellMap::Shutdown();
@@ -381,17 +385,19 @@ nsLayoutStatics::Shutdown()
 
   mozilla::css::ErrorReporter::ReleaseGlobals();
 
   nsTextFragment::Shutdown();
 
   nsAttrValue::Shutdown();
   nsContentUtils::Shutdown();
   nsLayoutStylesheetCache::Shutdown();
+#ifdef MOZ_OLD_STYLE
   RuleProcessorCache::Shutdown();
+#endif
 
   ShutdownJSEnvironment();
   nsGlobalWindowInner::ShutDown();
   nsGlobalWindowOuter::ShutDown();
   nsDOMClassInfo::ShutDown();
   WebIDLGlobalNameHash::Shutdown();
   nsListControlFrame::Shutdown();
   nsXBLService::Shutdown();
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -75,18 +75,20 @@ void
 nsFirstLetterFrame::SetInitialChildList(ChildListID  aListID,
                                         nsFrameList& aChildList)
 {
   MOZ_ASSERT(aListID == kPrincipalList, "Principal child list is the only "
              "list that nsFirstLetterFrame should set via this function");
   for (nsIFrame* f : aChildList) {
     MOZ_ASSERT(f->GetParent() == this, "Unexpected parent");
     MOZ_ASSERT(f->IsTextFrame(), "We should not have kids that are containers!");
+#ifdef MOZ_OLD_STYLE
     MOZ_ASSERT_IF(f->StyleContext()->IsGecko(),
                   f->StyleContext()->AsGecko()->GetParent() == StyleContext());
+#endif
     nsLayoutUtils::MarkDescendantsDirty(f); // Drops cached textruns
   }
 
   mFrames.SetFrames(aChildList);
 }
 
 nsresult
 nsFirstLetterFrame::GetChildFrameContainingOffset(int32_t inContentOffset,
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -774,24 +774,28 @@ nsFrame::DestroyFrom(nsIFrame* aDestruct
     // This needs to happen before we clear our Properties() table.
     ActiveLayerTracker::TransferActivityToContent(this, mContent);
 
     // Unfortunately, we need to do this for all frames being reframed
     // and not only those whose current style involves CSS transitions,
     // because what matters is whether the new style (not the old)
     // specifies CSS transitions.
     if (presContext->RestyleManager()->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
       // stylo: ServoRestyleManager does not handle transitions yet, and when
       // it does it probably won't need to track reframed style contexts to
       // initiate transitions correctly.
       GeckoRestyleManager::ReframingStyleContexts* rsc =
         presContext->RestyleManager()->AsGecko()->GetReframingStyleContexts();
       if (rsc) {
         rsc->Put(mContent, mStyleContext->AsGecko());
       }
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     }
   }
 
   if (HasCSSAnimations() || HasCSSTransitions() ||
       EffectSet::GetEffectSet(this)) {
     // If no new frame for this element is created by the end of the
     // restyling process, stop animations and transitions for this frame
     RestyleManager::AnimationsWithDestroyedFrame* adf =
@@ -7742,28 +7746,30 @@ nsIFrame::ListGeneric(nsACString& aTo, c
   aTo += nsPrintfCString(" [sc=%p", static_cast<void*>(mStyleContext));
   if (mStyleContext) {
     nsAtom* pseudoTag = mStyleContext->GetPseudo();
     if (pseudoTag) {
       nsAutoString atomString;
       pseudoTag->ToString(atomString);
       aTo += nsPrintfCString("%s", NS_LossyConvertUTF16toASCII(atomString).get());
     }
+#ifdef MOZ_OLD_STYLE
     if (auto* geckoContext = mStyleContext->GetAsGecko()) {
       if (!geckoContext->GetParent() ||
           (GetParent() && GetParent()->StyleContext() != geckoContext->GetParent())) {
         aTo += nsPrintfCString("^%p", geckoContext->GetParent());
         if (geckoContext->GetParent()) {
           aTo += nsPrintfCString("^%p", geckoContext->GetParent()->GetParent());
           if (geckoContext->GetParent()->GetParent()) {
             aTo += nsPrintfCString("^%p", geckoContext->GetParent()->GetParent()->GetParent());
           }
         }
       }
     }
+#endif
   }
   aTo += "]";
 }
 
 void
 nsIFrame::List(FILE* out, const char* aPrefix, uint32_t aFlags) const
 {
   nsCString str;
--- a/layout/inspector/InspectorUtils.cpp
+++ b/layout/inspector/InspectorUtils.cpp
@@ -178,17 +178,19 @@ InspectorUtils::GetCSSStyleRules(GlobalO
     GetCleanStyleContextForElement(&aElement, pseudoElt);
   if (!styleContext) {
     // This can fail for elements that are not in the document or
     // if the document they're in doesn't have a presshell.  Bail out.
     return;
   }
 
 
-  if (auto gecko = styleContext->GetAsGecko()) {
+  if (styleContext->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
+    auto gecko = styleContext->AsGecko();
     nsRuleNode* ruleNode = gecko->RuleNode();
     if (!ruleNode) {
       return;
     }
 
     AutoTArray<nsRuleNode*, 16> ruleNodes;
     while (!ruleNode->IsRoot()) {
       ruleNodes.AppendElement(ruleNode);
@@ -199,16 +201,19 @@ InspectorUtils::GetCSSStyleRules(GlobalO
       RefPtr<Declaration> decl = do_QueryObject(ruleNode->GetRule());
       if (decl) {
         css::Rule* owningRule = decl->GetOwningRule();
         if (owningRule) {
           aResult.AppendElement(owningRule);
         }
       }
     }
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
     nsIDocument* doc = aElement.OwnerDoc();
     nsIPresShell* shell = doc->GetShell();
     if (!shell) {
       return;
     }
 
     ServoStyleContext* servo = styleContext->AsServo();
@@ -1068,24 +1073,26 @@ InspectorUtils::ClearPseudoClassLocks(Gl
 }
 
 /* static */ void
 InspectorUtils::ParseStyleSheet(GlobalObject& aGlobalObject,
                                 StyleSheet& aSheet,
                                 const nsAString& aInput,
                                 ErrorResult& aRv)
 {
+#ifdef MOZ_OLD_STYLE
   RefPtr<CSSStyleSheet> geckoSheet = do_QueryObject(&aSheet);
   if (geckoSheet) {
     nsresult rv = geckoSheet->ReparseSheet(aInput);
     if (NS_FAILED(rv)) {
       aRv.Throw(rv);
     }
     return;
   }
+#endif
 
   RefPtr<ServoStyleSheet> servoSheet = do_QueryObject(&aSheet);
   if (servoSheet) {
     nsresult rv = servoSheet->ReparseSheet(aInput);
     if (NS_FAILED(rv)) {
       aRv.Throw(rv);
     }
     return;
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -169,19 +169,22 @@ static void AddTransformFunctions(const 
                                   nsPresContext* aPresContext,
                                   TransformReferenceBox& aRefBox,
                                   InfallibleTArray<TransformFunction>& aFunctions)
 {
   if (aList->mValue.GetUnit() == eCSSUnit_None) {
     return;
   }
 
-  GeckoStyleContext* contextIfGecko = aContext
-                                      ? aContext->GetAsGecko()
-                                      : nullptr;
+  GeckoStyleContext* contextIfGecko =
+#ifdef MOZ_OLD_STYLE
+    aContext ? aContext->GetAsGecko() : nullptr;
+#else
+    nullptr;
+#endif
 
   for (const nsCSSValueList* curr = aList; curr; curr = curr->mNext) {
     const nsCSSValue& currElem = curr->mValue;
     NS_ASSERTION(currElem.GetUnit() == eCSSUnit_Function,
                  "Stream should consist solely of functions!");
     nsCSSValue::Array* array = currElem.GetArrayValue();
     RuleNodeCacheConditions conditions;
     switch (nsStyleTransformMatrix::TransformFunctionOf(array)) {
--- a/layout/style/CSS.cpp
+++ b/layout/style/CSS.cpp
@@ -64,19 +64,23 @@ CSS::Supports(const GlobalObject& aGloba
   }
 
   if (info.mStyleBackendType == StyleBackendType::Servo) {
     NS_ConvertUTF16toUTF8 property(aProperty);
     NS_ConvertUTF16toUTF8 value(aValue);
     return Servo_CSSSupports2(&property, &value);
   }
 
+#ifdef MOZ_OLD_STYLE
   nsCSSParser parser;
   return parser.EvaluateSupportsDeclaration(aProperty, aValue, info.mDocURI,
                                             info.mBaseURI, info.mPrincipal);
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 /* static */ bool
 CSS::Supports(const GlobalObject& aGlobal,
               const nsAString& aCondition,
               ErrorResult& aRv)
 {
   SupportsParsingInfo info;
@@ -87,20 +91,25 @@ CSS::Supports(const GlobalObject& aGloba
     return false;
   }
 
   if (info.mStyleBackendType == StyleBackendType::Servo) {
     NS_ConvertUTF16toUTF8 cond(aCondition);
     return Servo_CSSSupports(&cond);
   }
 
+#ifdef MOZ_OLD_STYLE
   nsCSSParser parser;
   return parser.EvaluateSupportsCondition(aCondition, info.mDocURI,
                                           info.mBaseURI, info.mPrincipal,
                                           css::SupportsParsingSettings::ImpliedParentheses);
+#else
+  MOZ_CRASH("old style system disabled");
+  return false;
+#endif
 }
 
 /* static */ void
 CSS::Escape(const GlobalObject& aGlobal,
             const nsAString& aIdent,
             nsAString& aReturn)
 {
   nsStyleUtil::AppendEscapedCSSIdent(aIdent, aReturn);
--- a/layout/style/CSSKeyframesRule.cpp
+++ b/layout/style/CSSKeyframesRule.cpp
@@ -6,23 +6,25 @@
 
 #include "mozilla/dom/CSSKeyframesRule.h"
 
 #include "mozilla/dom/CSSKeyframesRuleBinding.h"
 
 namespace mozilla {
 namespace dom {
 
+#ifdef MOZ_OLD_STYLE
 /* virtual */ bool
 CSSKeyframesRule::UseForPresentation(nsPresContext* aPresContext,
                                      nsMediaQueryResultCacheKey& aKey)
 {
   MOZ_ASSERT_UNREACHABLE("should not be called");
   return false;
 }
+#endif
 
 /* virtual */ JSObject*
 CSSKeyframesRule::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return CSSKeyframesRuleBinding::Wrap(aCx, this, aGivenProto);
 }
 
 } // namespace dom
--- a/layout/style/CSSKeyframesRule.h
+++ b/layout/style/CSSKeyframesRule.h
@@ -26,18 +26,20 @@ public:
   uint16_t Type() const final override { return CSSRuleBinding::KEYFRAMES_RULE; }
   virtual void GetName(nsAString& aName) const = 0;
   virtual void SetName(const nsAString& aName) = 0;
   virtual CSSRuleList* CssRules() = 0;
   virtual void AppendRule(const nsAString& aRule) = 0;
   virtual void DeleteRule(const nsAString& aKey) = 0;
   virtual CSSKeyframeRule* FindRule(const nsAString& aKey) = 0;
 
+#ifdef MOZ_OLD_STYLE
   bool UseForPresentation(nsPresContext* aPresContext,
                           nsMediaQueryResultCacheKey& aKey) final override;
+#endif
 
   size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override = 0;
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final override;
 };
 
 } // namespace dom
 } // namespace mozilla
--- a/layout/style/DeclarationBlockInlines.h
+++ b/layout/style/DeclarationBlockInlines.h
@@ -26,31 +26,37 @@ DeclarationBlock::Release()
   MOZ_STYLO_FORWARD(Release, ())
 }
 
 already_AddRefed<DeclarationBlock>
 DeclarationBlock::Clone() const
 {
   RefPtr<DeclarationBlock> result;
   if (IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     result = new css::Declaration(*AsGecko());
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
     result = new ServoDeclarationBlock(*AsServo());
   }
   return result.forget();
 }
 
 already_AddRefed<DeclarationBlock>
 DeclarationBlock::EnsureMutable()
 {
 #ifdef DEBUG
+#ifdef MOZ_OLD_STYLE
   if (IsGecko()) {
     AsGecko()->AssertNotExpanded();
   }
 #endif
+#endif
   if (IsServo() && !IsDirty()) {
     // In stylo, the old DeclarationBlock is stored in element's rule node tree
     // directly, to avoid new values replacing the DeclarationBlock in the tree
     // directly, we need to copy the old one here if we haven't yet copied.
     // As a result the new value does not replace rule node tree until traversal
     // happens.
     return Clone();
   }
--- a/layout/style/ErrorReporter.h
+++ b/layout/style/ErrorReporter.h
@@ -14,17 +14,18 @@
 
 #include "nsString.h"
 
 struct nsCSSToken;
 class nsCSSScanner;
 class nsIURI;
 
 namespace mozilla {
-class CSSStyleSheet;
+class ServoStyleSheet;
+class StyleSheet;
 
 namespace css {
 
 class Loader;
 
 // If CSS_REPORT_PARSE_ERRORS is not defined, all of this class's
 // methods become inline stubs.
 class ErrorReporter {
@@ -88,17 +89,17 @@ private:
   uint32_t mErrorLineNumber;
   uint32_t mPrevErrorLineNumber;
   uint32_t mErrorColNumber;
 #endif
 };
 
 #ifndef CSS_REPORT_PARSE_ERRORS
 inline ErrorReporter::ErrorReporter(const nsCSSScanner&,
-                                    const CSSStyleSheet*,
+                                    const StyleSheet*,
                                     const Loader*,
                                     nsIURI*) {}
 inline ErrorReporter::~ErrorReporter() {}
 
 inline void ErrorReporter::ReleaseGlobals() {}
 
 inline void ErrorReporter::OutputError() {}
 inline void ErrorReporter::ClearError() {}
--- a/layout/style/FontFace.cpp
+++ b/layout/style/FontFace.cpp
@@ -521,27 +521,31 @@ FontFace::ParseDescriptor(nsCSSFontDesc 
   nsCOMPtr<nsIURI> docURI = window->GetDocumentURI();
   nsCOMPtr<nsIURI> base = window->GetDocBaseURI();
 
   if (mFontFaceSet->Document()->IsStyledByServo()) {
     RefPtr<URLExtraData> url = new URLExtraData(base, docURI, principal);
     return ServoCSSParser::ParseFontDescriptor(aDescID, aString, url, aResult);
   }
 
+#ifdef MOZ_OLD_STYLE
   nsCSSParser parser;
   if (!parser.ParseFontFaceDescriptor(aDescID, aString,
                                       docURI, // aSheetURL
                                       base,
                                       principal,
                                       aResult)) {
     aResult.Reset();
     return false;
   }
 
   return true;
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 void
 FontFace::SetDescriptor(nsCSSFontDesc aFontDesc,
                         const nsAString& aValue,
                         ErrorResult& aRv)
 {
   NS_ASSERTION(!HasRule(),
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -218,16 +218,17 @@ FontFaceSet::ParseFontShorthandForMatchi
       return;
     }
     aWeight = weight.GetIntValue();
     aStretch = stretch.GetIntValue();
     aStyle = style.GetIntValue();
     return;
   }
 
+#ifdef MOZ_OLD_STYLE
   // Parse aFont as a 'font' property value.
   RefPtr<Declaration> declaration = new Declaration;
   declaration->InitializeEmpty();
 
   bool changed = false;
   nsCSSParser parser;
   parser.ParseProperty(eCSSProperty_font,
                        aFont,
@@ -270,16 +271,19 @@ FontFaceSet::ParseFontShorthandForMatchi
   } else if (weight == NS_STYLE_FONT_WEIGHT_LIGHTER) {
     weight = NS_FONT_WEIGHT_THIN;
   }
 
   aWeight = weight;
 
   aStretch = data->ValueFor(eCSSProperty_font_stretch)->GetIntValue();
   aStyle = data->ValueFor(eCSSProperty_font_style)->GetIntValue();
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 static bool
 HasAnyCharacterInUnicodeRange(gfxUserFontEntry* aEntry,
                               const nsAString& aInput)
 {
   const char16_t* p = aInput.Data();
   const char16_t* end = p + aInput.Length();
--- a/layout/style/GenericSpecifiedValuesInlines.h
+++ b/layout/style/GenericSpecifiedValuesInlines.h
@@ -29,17 +29,21 @@ GenericSpecifiedValues::ShouldIgnoreColo
 {
   if (IsServo()) {
     // Servo handles this during cascading.
     //
     // FIXME(emilio): We should eventually move it to the document though.
     return false;
   }
 
+#ifdef MOZ_OLD_STYLE
   return !AsGecko()->mPresContext->UseDocumentColors();
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 bool
 GenericSpecifiedValues::PropertyIsSet(nsCSSPropertyID aId)
 {
   MOZ_STYLO_FORWARD(PropertyIsSet, (aId))
 }
 
@@ -72,33 +76,39 @@ GenericSpecifiedValues::SetIdentAtomValu
   if (!PropertyIsSet(aId)) {
     SetIdentAtomValue(aId, aValue);
   }
 }
 
 void
 GenericSpecifiedValues::SetKeywordValue(nsCSSPropertyID aId, int32_t aValue)
 {
+#ifdef MOZ_OLD_STYLE
   // there are some static asserts in MOZ_STYLO_FORWARD which
   // won't work with the overloaded SetKeywordValue function,
   // so we copy its expansion and use SetIntValue for decltype
   // instead
   static_assert(
     !mozilla::IsSame<decltype(&MOZ_STYLO_THIS_TYPE::SetIntValue),
                      decltype(&MOZ_STYLO_GECKO_TYPE::SetKeywordValue)>::value,
     "Gecko subclass should define its own SetKeywordValue");
   static_assert(
     !mozilla::IsSame<decltype(&MOZ_STYLO_THIS_TYPE::SetIntValue),
                      decltype(&MOZ_STYLO_SERVO_TYPE::SetKeywordValue)>::value,
     "Servo subclass should define its own SetKeywordValue");
+#endif
 
   if (IsServo()) {
     return AsServo()->SetKeywordValue(aId, aValue);
   }
+#ifdef MOZ_OLD_STYLE
   return AsGecko()->SetKeywordValue(aId, aValue);
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 void
 GenericSpecifiedValues::SetKeywordValueIfUnset(nsCSSPropertyID aId,
                                                int32_t aValue)
 {
   if (!PropertyIsSet(aId)) {
     SetKeywordValue(aId, aValue);
--- a/layout/style/GroupRule.cpp
+++ b/layout/style/GroupRule.cpp
@@ -13,21 +13,29 @@
 
 #include "mozilla/dom/CSSRuleList.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 namespace css {
 
+#ifdef MOZ_OLD_STYLE
 #define CALL_INNER(inner_, call_)               \
   ((inner_).is<GeckoGroupRuleRules>()           \
     ? (inner_).as<GeckoGroupRuleRules>().call_  \
     : (inner_).as<ServoGroupRuleRules>().call_)
+#else
+#define CALL_INNER(inner_, call_)               \
+  ((inner_).is<DummyGroupRuleRules>()           \
+    ? (inner_).as<DummyGroupRuleRules>().call_  \
+    : (inner_).as<ServoGroupRuleRules>().call_)
+#endif
 
+#ifdef MOZ_OLD_STYLE
 // -------------------------------
 // Style Rule List for group rules
 //
 
 class GroupRuleRuleList final : public dom::CSSRuleList
 {
 public:
   explicit GroupRuleRuleList(GroupRule *aGroupRule);
@@ -188,16 +196,17 @@ GeckoGroupRuleRules::SizeOfExcludingThis
     n += rule->SizeOfIncludingThis(aMallocSizeOf);
   }
 
   // Measurement of the following members may be added later if DMD finds it is
   // worthwhile:
   // - mRuleCollection
   return n;
 }
+#endif
 
 // -------------------------------
 // ServoGroupRuleRules
 //
 
 ServoGroupRuleRules::~ServoGroupRuleRules()
 {
   if (mRuleList) {
@@ -221,17 +230,21 @@ ServoGroupRuleRules::SizeOfExcludingThis
 }
 
 // -------------------------------
 // GroupRule
 //
 
 GroupRule::GroupRule(uint32_t aLineNumber, uint32_t aColumnNumber)
   : Rule(aLineNumber, aColumnNumber)
+#ifdef MOZ_OLD_STYLE
   , mInner(GeckoGroupRuleRules())
+#else
+  , mInner(DummyGroupRuleRules())
+#endif
 {
 }
 
 GroupRule::GroupRule(already_AddRefed<ServoCssRules> aRules,
                      uint32_t aLineNumber, uint32_t aColumnNumber)
   : Rule(aLineNumber, aColumnNumber)
   , mInner(ServoGroupRuleRules(Move(aRules)))
 {
@@ -291,16 +304,17 @@ GroupRule::SetStyleSheet(StyleSheet* aSh
   // depth when seting the sheet to null during unlink, if we happen to unlin in
   // order from most nested rule up to least nested rule.
   if (aSheet != GetStyleSheet()) {
     CALL_INNER(mInner, SetStyleSheet(aSheet));
     Rule::SetStyleSheet(aSheet);
   }
 }
 
+#ifdef MOZ_OLD_STYLE
 void
 GroupRule::AppendStyleRule(Rule* aRule)
 {
   GeckoRules().AppendObject(aRule);
   StyleSheet* sheet = GetStyleSheet();
   aRule->SetStyleSheet(sheet);
   aRule->SetParentRule(this);
   if (sheet) {
@@ -338,16 +352,17 @@ GroupRule::AppendRulesToCssText(nsAStrin
     nsAutoString cssText;
     rule->GetCssText(cssText);
     aCssText.AppendLiteral("  ");
     aCssText.Append(cssText);
     aCssText.Append('\n');
   }
   aCssText.Append('}');
 }
+#endif
 
 CSSRuleList*
 GroupRule::CssRules()
 {
   return CALL_INNER(mInner, CssRules(this));
 }
 
 uint32_t
--- a/layout/style/GroupRule.h
+++ b/layout/style/GroupRule.h
@@ -32,16 +32,17 @@ namespace dom {
 class CSSRuleList;
 } // namespace dom
 
 namespace css {
 
 class GroupRule;
 class GroupRuleRuleList;
 
+#ifdef MOZ_OLD_STYLE
 struct GeckoGroupRuleRules
 {
   GeckoGroupRuleRules();
   GeckoGroupRuleRules(GeckoGroupRuleRules&& aOther);
   GeckoGroupRuleRules(const GeckoGroupRuleRules& aCopy);
   ~GeckoGroupRuleRules();
 
   void SetParentRule(GroupRule* aParentRule) {
@@ -71,16 +72,17 @@ struct GeckoGroupRuleRules
 
   dom::CSSRuleList* CssRules(GroupRule* aParentRule);
 
   size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const;
 
   IncrementalClearCOMRuleArray mRules;
   RefPtr<GroupRuleRuleList> mRuleCollection; // lazily constructed
 };
+#endif
 
 struct ServoGroupRuleRules
 {
   explicit ServoGroupRuleRules(already_AddRefed<ServoCssRules> aRawRules)
     : mRuleList(new ServoCSSRuleList(Move(aRawRules), nullptr)) {}
   ServoGroupRuleRules(ServoGroupRuleRules&& aOther)
     : mRuleList(Move(aOther.mRuleList)) {}
   ServoGroupRuleRules(const ServoGroupRuleRules& aCopy) {
@@ -127,22 +129,47 @@ struct ServoGroupRuleRules
     return mRuleList;
   }
 
   size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const;
 
   RefPtr<ServoCSSRuleList> mRuleList;
 };
 
+struct DummyGroupRuleRules
+{
+  void SetParentRule(GroupRule* aParentRule) {}
+  void SetStyleSheet(StyleSheet* aSheet) {}
+  void Clear() {}
+  void Traverse(nsCycleCollectionTraversalCallback& cb) {}
+#ifdef DEBUG
+  void List(FILE* out, int32_t aIndex) const {}
+#endif
+  int32_t StyleRuleCount() const { return 0; }
+  Rule* GetStyleRuleAt(int32_t aIndex) const { return nullptr; }
+  nsresult DeleteStyleRuleAt(uint32_t aIndex) { return NS_ERROR_NOT_IMPLEMENTED; }
+  dom::CSSRuleList* CssRules(GroupRule* aParentRule) { return nullptr; }
+  size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const { return 0; }
+};
+
+#ifdef MOZ_OLD_STYLE
 #define REDIRECT_TO_INNER(call_)                   \
   if (mInner.is<GeckoGroupRuleRules>()) {          \
     return mInner.as<GeckoGroupRuleRules>().call_; \
   } else {                                         \
     return mInner.as<ServoGroupRuleRules>().call_; \
-  }                                                \
+  }
+#else
+#define REDIRECT_TO_INNER(call_)                   \
+  if (mInner.is<DummyGroupRuleRules>()) {          \
+    return mInner.as<DummyGroupRuleRules>().call_; \
+  } else {                                         \
+    return mInner.as<ServoGroupRuleRules>().call_; \
+  }
+#endif
 
 // inherits from Rule so it can be shared between
 // MediaRule and DocumentRule
 class GroupRule : public Rule
 {
 protected:
   GroupRule(uint32_t aLineNumber, uint32_t aColumnNumber);
   GroupRule(already_AddRefed<ServoCssRules> aRules,
@@ -158,66 +185,82 @@ public:
 #ifdef DEBUG
   void List(FILE* out = stdout, int32_t aIndent = 0) const override {
     REDIRECT_TO_INNER(List(out, aIndent))
   }
 #endif
   virtual void SetStyleSheet(StyleSheet* aSheet) override;
 
 public:
+#ifdef MOZ_OLD_STYLE
   void AppendStyleRule(Rule* aRule);
+#endif
 
   int32_t StyleRuleCount() const {
     REDIRECT_TO_INNER(StyleRuleCount())
   }
   Rule* GetStyleRuleAt(uint32_t aIndex) const {
     REDIRECT_TO_INNER(GetStyleRuleAt(aIndex))
   }
 
+#ifdef MOZ_OLD_STYLE
   typedef bool (*RuleEnumFunc)(Rule* aElement, void* aData);
   bool EnumerateRulesForwards(RuleEnumFunc aFunc, void * aData) const;
+#endif
 
   /*
    * The next two methods should never be called unless you have first
    * called WillDirty() on the parent stylesheet.  After they are
    * called, DidDirty() needs to be called on the sheet.
    */
   nsresult DeleteStyleRuleAt(uint32_t aIndex) {
     REDIRECT_TO_INNER(DeleteStyleRuleAt(aIndex));
   }
+#ifdef MOZ_OLD_STYLE
   nsresult InsertStyleRuleAt(uint32_t aIndex, Rule* aRule);
 
   virtual bool UseForPresentation(nsPresContext* aPresContext,
                                     nsMediaQueryResultCacheKey& aKey) = 0;
+#endif
 
   // non-virtual -- it is only called by subclasses
   size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
     REDIRECT_TO_INNER(SizeOfExcludingThis(aMallocSizeOf))
   }
   virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override = 0;
 
   // WebIDL API
   dom::CSSRuleList* CssRules();
   uint32_t InsertRule(const nsAString& aRule, uint32_t aIndex,
                       ErrorResult& aRv);
   void DeleteRule(uint32_t aIndex, ErrorResult& aRv);
 
 protected:
+#ifdef MOZ_OLD_STYLE
   void AppendRulesToCssText(nsAString& aCssText) const;
 
   // Must only be called if this is a Gecko GroupRule.
   IncrementalClearCOMRuleArray& GeckoRules() {
     return mInner.as<GeckoGroupRuleRules>().mRules;
   }
   const IncrementalClearCOMRuleArray& GeckoRules() const {
     return mInner.as<GeckoGroupRuleRules>().mRules;
   }
+#endif
 
 private:
+#ifdef MOZ_OLD_STYLE
   Variant<GeckoGroupRuleRules, ServoGroupRuleRules> mInner;
+#else
+  // This only reason for the DummyGroupRuleRules is that ServoKeyframesRule
+  // inherits from CSSKeyframesRules (and thus GroupRule). Once
+  // ServoKeyframesRule can be made to inherit from Rule, the
+  // DummyGroupRuleRules can be removed.
+  Variant<DummyGroupRuleRules, ServoGroupRuleRules> mInner;
+#endif
 };
 
 #undef REDIRECT_TO_INNER
 
 // Implementation of WebIDL CSSConditionRule.
 class ConditionRule : public GroupRule
 {
 protected:
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -1109,17 +1109,21 @@ Loader::CreateSheet(nsIURI* aURI,
       if (mDocument && mDocument->GetDocumentURI()) {
         mDocument->GetDocumentURI()->GetAsciiSpec(sourceUri);
       }
       SRICheck::IntegrityMetadata(aIntegrity, sourceUri, mReporter,
                                   &sriMetadata);
     }
 
     if (GetStyleBackendType() == StyleBackendType::Gecko) {
+#ifdef MOZ_OLD_STYLE
       *aSheet = new CSSStyleSheet(aParsingMode, aCORSMode, aReferrerPolicy, sriMetadata);
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     } else {
       *aSheet = new ServoStyleSheet(aParsingMode, aCORSMode, aReferrerPolicy, sriMetadata);
     }
     (*aSheet)->SetURIs(sheetURI, originalURI, baseURI);
   }
 
   NS_ASSERTION(*aSheet, "We should have a sheet by now!");
   NS_ASSERTION(aSheetState != eSheetStateUnknown, "Have to set a state!");
@@ -1152,17 +1156,21 @@ Loader::PrepareSheet(StyleSheet* aSheet,
   }
 
   aSheet->SetMedia(mediaList);
 
   aSheet->SetTitle(aTitle);
   aSheet->SetEnabled(!aIsAlternate);
 
   if (aSheet->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     aSheet->AsGecko()->SetScopeElement(aScopeElement);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
     if (aScopeElement) {
       NS_WARNING("stylo: scoped style sheets not supported");
     }
   }
 }
 
 /**
@@ -1266,17 +1274,21 @@ Loader::InsertChildSheet(StyleSheet* aSh
   MOZ_ASSERT(aSheet, "Nothing to insert");
   MOZ_ASSERT(aParentSheet, "Need a parent to insert into");
   MOZ_ASSERT(aSheet->IsGecko() == !!aGeckoParentRule);
 
   // child sheets should always start out enabled, even if they got
   // cloned off of top-level sheets which were disabled
   aSheet->SetEnabled(true);
   if (aGeckoParentRule) {
+#ifdef MOZ_OLD_STYLE
     aGeckoParentRule->SetSheet(aSheet->AsGecko()); // This sets the ownerRule on the sheet
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
   aParentSheet->PrependStyleSheet(aSheet);
 
   LOG(("  Inserting into parent sheet"));
   return NS_OK;
 }
 
 /**
@@ -1678,22 +1690,26 @@ Loader::ParseSheet(const nsAString& aUTF
   // Push our load data on the stack so any kids can pick it up
   mParsingDatas.AppendElement(aLoadData);
   nsIURI* sheetURI = aLoadData->mSheet->GetSheetURI();
   nsIURI* baseURI = aLoadData->mSheet->GetBaseURI();
 
   nsresult rv;
 
   if (aLoadData->mSheet->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     nsCSSParser parser(this, aLoadData->mSheet->AsGecko());
     rv = parser.ParseSheet(aUTF16,
                            sheetURI,
                            baseURI,
                            aLoadData->mSheet->Principal(),
                            aLoadData->mLineNumber);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
     rv = aLoadData->mSheet->AsServo()->ParseSheet(
       this,
       aUTF8.IsEmpty() ? NS_ConvertUTF16toUTF8(aUTF16) : aUTF8,
       sheetURI,
       baseURI,
       aLoadData->mSheet->Principal(),
       aLoadData->mLineNumber,
@@ -2192,17 +2208,21 @@ Loader::LoadChildSheet(StyleSheet* aPare
   }
 
   // Now that we know it's safe to load this (passes security check and not a
   // loop) do so.
   RefPtr<StyleSheet> sheet;
   StyleSheetState state;
   if (aReusableSheets && aReusableSheets->FindReusableStyleSheet(aURL, sheet)) {
     if (aParentSheet->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
       aGeckoParentRule->SetSheet(sheet->AsGecko());
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     }
     state = eSheetComplete;
   } else {
     bool isAlternate;
     const nsAString& empty = EmptyString();
     // For now, use CORS_NONE for child sheets
     rv = CreateSheet(aURL, nullptr, principal,
                      aParentSheet->ParsingMode(),
--- a/layout/style/MediaList.cpp
+++ b/layout/style/MediaList.cpp
@@ -76,20 +76,24 @@ MediaList::Create(
     const nsAString& aMedia,
     CallerType aCallerType)
 {
   if (aBackendType == StyleBackendType::Servo) {
     RefPtr<ServoMediaList> mediaList = new ServoMediaList(aMedia, aCallerType);
     return mediaList.forget();
   }
 
+#ifdef MOZ_OLD_STYLE
   nsCSSParser parser;
   RefPtr<nsMediaList> mediaList = new nsMediaList();
   parser.ParseMediaList(aMedia, nullptr, 0, mediaList, aCallerType);
   return mediaList.forget();
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 void
 MediaList::GetMediaText(nsAString& aMediaText)
 {
   GetText(aMediaText);
 }
 
--- a/layout/style/RuleNodeCacheConditions.h
+++ b/layout/style/RuleNodeCacheConditions.h
@@ -8,16 +8,18 @@
  * an object that stores the result of determining whether a style struct that
  * was computed can be cached in the rule tree, and if so, what the conditions
  * it relies on are
  */
 
 #ifndef RuleNodeCacheConditions_h_
 #define RuleNodeCacheConditions_h_
 
+#ifdef MOZ_OLD_STYLE
+
 #include "mozilla/Attributes.h"
 #include "nsCoord.h"
 #include "nsTArray.h"
 
 class nsStyleContext;
 
 namespace mozilla {
 
@@ -149,9 +151,23 @@ private:
   //   bit 1:      do we have a font size value?
   //   bit 2:      do we have a writing mode value?
   uint8_t mBits;
   uint8_t mWritingMode;
 };
 
 } // namespace mozilla
 
+#else
+
+namespace mozilla {
+
+// Define this dummy class so there are fewer call sites to change when the old
+// style system code is compiled out.
+class RuleNodeCacheConditions
+{
+};
+
+} // namespace mozilla
+
+#endif
+
 #endif // !defined(RuleNodeCacheConditions_h_)
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -39,16 +39,17 @@ namespace mozilla {
   struct FontFamilyName;
   enum FontFamilyType : uint32_t;
   class SharedFontList;
   enum class CSSPseudoElementType : uint8_t;
   struct Keyframe;
   enum Side;
   struct StyleTransition;
   namespace css {
+    class ErrorReporter;
     struct URLValue;
     struct ImageValue;
     class LoaderReusableStyleSheets;
   };
   namespace dom {
     enum class IterationCompositeOperation : uint8_t;
   };
   enum class UpdateAnimationsTasks : uint8_t;
--- a/layout/style/ServoDocumentRule.cpp
+++ b/layout/style/ServoDocumentRule.cpp
@@ -37,25 +37,27 @@ ServoDocumentRule::Clone() const
 {
   // Rule::Clone is only used when CSSStyleSheetInner is cloned in
   // preparation of being mutated. However, ServoStyleSheet never clones
   // anything, so this method should never be called.
   MOZ_ASSERT_UNREACHABLE("Shouldn't be cloning ServoDocumentRule");
   return nullptr;
 }
 
+#ifdef MOZ_OLD_STYLE
 /* virtual */ bool
 ServoDocumentRule::UseForPresentation(nsPresContext* aPresContext,
                                       nsMediaQueryResultCacheKey& aKey)
 {
   // GroupRule::UseForPresentation is only used in nsCSSRuleProcessor,
   // so this should never be called.
   MOZ_ASSERT_UNREACHABLE("Shouldn't be calling UseForPresentation");
   return false;
 }
+#endif
 
 #ifdef DEBUG
 /* virtual */ void
 ServoDocumentRule::List(FILE* out, int32_t aIndent) const
 {
   nsAutoCString str;
   for (int32_t i = 0; i < aIndent; i++) {
     str.AppendLiteral("  ");
--- a/layout/style/ServoDocumentRule.h
+++ b/layout/style/ServoDocumentRule.h
@@ -18,18 +18,20 @@ class ServoDocumentRule final : public d
 {
 public:
   ServoDocumentRule(RefPtr<RawServoDocumentRule> aRawRule,
                     uint32_t aLine, uint32_t aColumn);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   already_AddRefed<css::Rule> Clone() const override;
+#ifdef MOZ_OLD_STYLE
   bool UseForPresentation(nsPresContext* aPresContext,
                           nsMediaQueryResultCacheKey& aKey) final override;
+#endif
 #ifdef DEBUG
   void List(FILE* out = stdout, int32_t aIndent = 0) const final override;
 #endif
 
   RawServoDocumentRule* Raw() const { return mRawRule; }
 
   // WebIDL interface
   void GetCssTextImpl(nsAString& aCssText) const final override;
--- a/layout/style/ServoMediaRule.cpp
+++ b/layout/style/ServoMediaRule.cpp
@@ -54,25 +54,27 @@ ServoMediaRule::Clone() const
 {
   // Rule::Clone is only used when CSSStyleSheetInner is cloned in
   // preparation of being mutated. However, ServoStyleSheet never clones
   // anything, so this method should never be called.
   MOZ_ASSERT_UNREACHABLE("Shouldn't be cloning ServoMediaRule");
   return nullptr;
 }
 
+#ifdef MOZ_OLD_STYLE
 /* virtual */ bool
 ServoMediaRule::UseForPresentation(nsPresContext* aPresContext,
                                    nsMediaQueryResultCacheKey& aKey)
 {
   // GroupRule::UseForPresentation is only used in nsCSSRuleProcessor,
   // so this should never be called.
   MOZ_ASSERT_UNREACHABLE("Shouldn't be calling UseForPresentation");
   return false;
 }
+#endif
 
 /* virtual */ void
 ServoMediaRule::SetStyleSheet(StyleSheet* aSheet)
 {
   if (mMediaList) {
     mMediaList->SetStyleSheet(aSheet);
   }
   CSSMediaRule::SetStyleSheet(aSheet);
--- a/layout/style/ServoMediaRule.h
+++ b/layout/style/ServoMediaRule.h
@@ -21,18 +21,20 @@ class ServoMediaRule final : public dom:
 public:
   ServoMediaRule(RefPtr<RawServoMediaRule> aRawRule,
                  uint32_t aLine, uint32_t aColumn);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServoMediaRule, dom::CSSMediaRule)
 
   already_AddRefed<css::Rule> Clone() const override;
+#ifdef MOZ_OLD_STYLE
   bool UseForPresentation(nsPresContext* aPresContext,
                           nsMediaQueryResultCacheKey& aKey) final override;
+#endif
   void SetStyleSheet(StyleSheet* aSheet) override;
 #ifdef DEBUG
   void List(FILE* out = stdout, int32_t aIndent = 0) const final override;
 #endif
 
   RawServoMediaRule* Raw() const { return mRawRule; }
 
   // WebIDL interface
--- a/layout/style/ServoSupportsRule.cpp
+++ b/layout/style/ServoSupportsRule.cpp
@@ -38,25 +38,27 @@ ServoSupportsRule::Clone() const
 {
   // Rule::Clone is only used when CSSStyleSheetInner is cloned in
   // preparation of being mutated. However, ServoStyleSheet never clones
   // anything, so this method should never be called.
   MOZ_ASSERT_UNREACHABLE("Shouldn't be cloning ServoSupportsRule");
   return nullptr;
 }
 
+#ifdef MOZ_OLD_STYLE
 /* virtual */ bool
 ServoSupportsRule::UseForPresentation(nsPresContext* aPresContext,
                                       nsMediaQueryResultCacheKey& aKey)
 {
   // GroupRule::UseForPresentation is only used in nsCSSRuleProcessor,
   // so this should never be called.
   MOZ_ASSERT_UNREACHABLE("Shouldn't be calling UseForPresentation");
   return false;
 }
+#endif
 
 #ifdef DEBUG
 /* virtual */ void
 ServoSupportsRule::List(FILE* out, int32_t aIndent) const
 {
   nsAutoCString str;
   for (int32_t i = 0; i < aIndent; i++) {
     str.AppendLiteral("  ");
--- a/layout/style/ServoSupportsRule.h
+++ b/layout/style/ServoSupportsRule.h
@@ -18,18 +18,20 @@ class ServoSupportsRule final : public d
 {
 public:
   ServoSupportsRule(RefPtr<RawServoSupportsRule> aRawRule,
                     uint32_t aLine, uint32_t aColumn);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   already_AddRefed<css::Rule> Clone() const override;
+#ifdef MOZ_OLD_STYLE
   bool UseForPresentation(nsPresContext* aPresContext,
                           nsMediaQueryResultCacheKey& aKey) final override;
+#endif
 #ifdef DEBUG
   void List(FILE* out = stdout, int32_t aIndent = 0) const final override;
 #endif
 
   RawServoSupportsRule* Raw() const { return mRawRule; }
 
   // WebIDL interface
   void GetCssTextImpl(nsAString& aCssText) const final override;
--- a/layout/style/ServoUtils.h
+++ b/layout/style/ServoUtils.h
@@ -13,99 +13,131 @@
 
 namespace mozilla {
 
 // Defined in ServoBindings.cpp.
 void AssertIsMainThreadOrServoFontMetricsLocked();
 
 } // namespace mozilla
 
-#ifdef MOZ_STYLO
+#if defined(MOZ_STYLO) && defined(MOZ_OLD_STYLE)
 # define MOZ_DECL_STYLO_CHECK_METHODS \
   bool IsGecko() const { return !IsServo(); } \
   bool IsServo() const { return mType == StyleBackendType::Servo; }
+#elif defined(MOZ_STYLO)
+# define MOZ_DECL_STYLO_CHECK_METHODS \
+  bool IsGecko() const { return false; } \
+  bool IsServo() const { return true; }
 #else
 # define MOZ_DECL_STYLO_CHECK_METHODS \
   bool IsGecko() const { return true; } \
   bool IsServo() const { return false; }
 #endif
 
-#define MOZ_DECL_STYLO_CONVERT_METHODS(geckotype_, servotype_)  \
-  inline geckotype_* AsGecko();                         \
+#define MOZ_DECL_STYLO_CONVERT_METHODS_SERVO(servotype_) \
   inline servotype_* AsServo();                         \
-  inline const geckotype_* AsGecko() const;             \
   inline const servotype_* AsServo() const;             \
+  inline servotype_* GetAsServo();                      \
+  inline const servotype_* GetAsServo() const;
+
+#define MOZ_DECL_STYLO_CONVERT_METHODS_GECKO(geckotype_) \
+  inline geckotype_* AsGecko();                         \
+  inline const geckotype_* AsGecko() const;             \
   inline geckotype_* GetAsGecko();                      \
-  inline servotype_* GetAsServo();                      \
-  inline const geckotype_* GetAsGecko() const;          \
-  inline const servotype_* GetAsServo() const;
+  inline const geckotype_* GetAsGecko() const;
+
+#ifdef MOZ_OLD_STYLE
+#define MOZ_DECL_STYLO_CONVERT_METHODS(geckotype_, servotype_) \
+  MOZ_DECL_STYLO_CONVERT_METHODS_SERVO(servotype_) \
+  MOZ_DECL_STYLO_CONVERT_METHODS_GECKO(geckotype_)
+#else
+#define MOZ_DECL_STYLO_CONVERT_METHODS(geckotype_, servotype_) \
+  MOZ_DECL_STYLO_CONVERT_METHODS_SERVO(servotype_)
+#endif
 
 /**
  * Macro used in a base class of |geckotype_| and |servotype_|.
  * The class should define |StyleBackendType mType;| itself.
  */
 #define MOZ_DECL_STYLO_METHODS(geckotype_, servotype_)  \
   MOZ_DECL_STYLO_CHECK_METHODS                          \
   MOZ_DECL_STYLO_CONVERT_METHODS(geckotype_, servotype_)
 
+#define MOZ_DEFINE_STYLO_METHODS_GECKO(type_, geckotype_) \
+  geckotype_* type_::AsGecko() {                                \
+    MOZ_ASSERT(IsGecko());                                      \
+    return static_cast<geckotype_*>(this);                      \
+  }                                                             \
+  const geckotype_* type_::AsGecko() const {                    \
+    MOZ_ASSERT(IsGecko());                                      \
+    return static_cast<const geckotype_*>(this);                \
+  }                                                             \
+  geckotype_* type_::GetAsGecko() {                             \
+    return IsGecko() ? AsGecko() : nullptr;                     \
+  }                                                             \
+  const geckotype_* type_::GetAsGecko() const {                 \
+    return IsGecko() ? AsGecko() : nullptr;                     \
+  }
+
+#define MOZ_DEFINE_STYLO_METHODS_SERVO(type_, servotype_) \
+  servotype_* type_::AsServo() {                                \
+    MOZ_ASSERT(IsServo());                                      \
+    return static_cast<servotype_*>(this);                      \
+  }                                                             \
+  const servotype_* type_::AsServo() const {                    \
+    MOZ_ASSERT(IsServo());                                      \
+    return static_cast<const servotype_*>(this);                \
+  }                                                             \
+  servotype_* type_::GetAsServo() {                             \
+    return IsServo() ? AsServo() : nullptr;                     \
+  }                                                             \
+  const servotype_* type_::GetAsServo() const {                 \
+    return IsServo() ? AsServo() : nullptr;                     \
+  }
+
+
 /**
  * Macro used in inline header of class |type_| with its Gecko and Servo
  * subclasses named |geckotype_| and |servotype_| correspondingly for
  * implementing the inline methods defined by MOZ_DECL_STYLO_METHODS.
  */
+#ifdef MOZ_OLD_STYLE
 #define MOZ_DEFINE_STYLO_METHODS(type_, geckotype_, servotype_) \
-  geckotype_* type_::AsGecko() {                                \
-    MOZ_ASSERT(IsGecko());                                      \
-    return static_cast<geckotype_*>(this);                      \
-  }                                                             \
-  servotype_* type_::AsServo() {                                \
-    MOZ_ASSERT(IsServo());                                      \
-    return static_cast<servotype_*>(this);                      \
-  }                                                             \
-  const geckotype_* type_::AsGecko() const {                    \
-    MOZ_ASSERT(IsGecko());                                      \
-    return static_cast<const geckotype_*>(this);                \
-  }                                                             \
-  const servotype_* type_::AsServo() const {                    \
-    MOZ_ASSERT(IsServo());                                      \
-    return static_cast<const servotype_*>(this);                \
-  }                                                             \
-  geckotype_* type_::GetAsGecko() {                             \
-    return IsGecko() ? AsGecko() : nullptr;                     \
-  }                                                             \
-  servotype_* type_::GetAsServo() {                             \
-    return IsServo() ? AsServo() : nullptr;                     \
-  }                                                             \
-  const geckotype_* type_::GetAsGecko() const {                 \
-    return IsGecko() ? AsGecko() : nullptr;                     \
-  }                                                             \
-  const servotype_* type_::GetAsServo() const {                 \
-    return IsServo() ? AsServo() : nullptr;                     \
-  }
+  MOZ_DEFINE_STYLO_METHODS_SERVO(type_, servotype_) \
+  MOZ_DEFINE_STYLO_METHODS_GECKO(type_, geckotype_)
+#else
+#define MOZ_DEFINE_STYLO_METHODS(type_, geckotype_, servotype_) \
+  MOZ_DEFINE_STYLO_METHODS_SERVO(type_, servotype_)
+#endif
 
 #define MOZ_STYLO_THIS_TYPE  mozilla::RemovePointer<decltype(this)>::Type
 #define MOZ_STYLO_GECKO_TYPE mozilla::RemovePointer<decltype(AsGecko())>::Type
 #define MOZ_STYLO_SERVO_TYPE mozilla::RemovePointer<decltype(AsServo())>::Type
 
 /**
  * Macro used to forward a method call to the concrete method defined by
  * the Servo or Gecko implementation. The class of the method using it
  * should use MOZ_DECL_STYLO_METHODS to define basic stylo methods.
  */
+#ifdef MOZ_OLD_STYLE
 #define MOZ_STYLO_FORWARD_CONCRETE(method_, geckoargs_, servoargs_)         \
   static_assert(!mozilla::IsSame<decltype(&MOZ_STYLO_THIS_TYPE::method_),   \
                                  decltype(&MOZ_STYLO_GECKO_TYPE::method_)>  \
                 ::value, "Gecko subclass should define its own " #method_); \
   static_assert(!mozilla::IsSame<decltype(&MOZ_STYLO_THIS_TYPE::method_),   \
                                  decltype(&MOZ_STYLO_SERVO_TYPE::method_)>  \
                 ::value, "Servo subclass should define its own " #method_); \
   if (IsServo()) {                                                          \
     return AsServo()->method_ servoargs_;                                   \
   }                                                                         \
   return AsGecko()->method_ geckoargs_;
+#else
+#define MOZ_STYLO_FORWARD_CONCRETE(method_, geckoargs_, servoargs_)         \
+  return AsServo()->method_ servoargs_;
+#endif
 
 #define MOZ_STYLO_FORWARD(method_, args_) \
   MOZ_STYLO_FORWARD_CONCRETE(method_, args_, args_)
 
 // Warning in MOZ_STYLO builds and non-fatally assert in regular builds.
 #define NS_ASSERTION_STYLO_WARNING_EXPAND(X) X
 #ifdef MOZ_STYLO
 #define NS_ASSERTION_STYLO_WARNING(...) \
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -319,16 +319,17 @@ ToPrimitive(nsCSSValue::Array* aArray)
       break;
     }
     default:
       arr = aArray;
   }
   return arr.forget();
 }
 
+#ifdef MOZ_OLD_STYLE
 static void
 AppendCSSShadowValue(const nsCSSShadowItem *aShadow,
                      nsCSSValueList **&aResultTail,
                      nsCSSPropertyID aProperty)
 {
   MOZ_ASSERT(aShadow, "shadow expected");
 
   // X, Y, Radius, Spread, Color, Inset
@@ -346,16 +347,17 @@ AppendCSSShadowValue(const nsCSSShadowIt
     arr->Item(5).SetEnumValue(StyleBoxShadowType::Inset);
   }
 
   nsCSSValueList *resultItem = new nsCSSValueList;
   resultItem->mValue.SetArrayValue(arr, eCSSUnit_Array);
   *aResultTail = resultItem;
   aResultTail = &resultItem->mNext;
 }
+#endif
 
 // Like nsStyleCoord::CalcValue, but with length in float pixels instead
 // of nscoord.
 struct PixelCalcValue
 {
   float mLength, mPercent;
   bool mHasPercent;
 };
@@ -428,21 +430,23 @@ ExtractCalcValue(const nsCSSValue& aValu
     result.mLength = 0.0f;
     result.mPercent = aValue.GetPercentValue();
     result.mHasPercent = true;
     return result;
   }
   return ExtractCalcValueInternal(aValue);
 }
 
+#ifdef MOZ_OLD_STYLE
 static void
 CalcValueToCSSValue(const nsStyleCoord::CalcValue* aCalc, nsCSSValue& aValue)
 {
   aValue.SetCalcValue(aCalc);
 }
+#endif
 
 static void
 CalcValueToCSSValue(const PixelCalcValue& aCalc, nsCSSValue& aValue)
 {
   RefPtr<nsCSSValue::Array> arr = nsCSSValue::Array::Create(1);
   if (!aCalc.mHasPercent) {
     arr->Item(0).SetFloatValue(aCalc.mLength, eCSSUnit_Pixel);
   } else {
@@ -879,16 +883,17 @@ enum class ColorAdditionType {
 static UniquePtr<nsCSSValueList>
 AddWeightedFilterFunction(double aCoeff1, const nsCSSValueList* aList1,
                           double aCoeff2, const nsCSSValueList* aList2,
                           ColorAdditionType aColorAdditionType);
 
 static inline float
 GetNumberOrPercent(const nsCSSValue &aValue);
 
+#ifdef MOZ_OLD_STYLE
 static bool
 ComputeSingleShadowSquareDistance(const nsCSSValueList* aShadow1,
                                   const nsCSSValueList* aShadow2,
                                   double& aSquareDistance,
                                   nsCSSPropertyID aProperty)
 {
   MOZ_ASSERT(aShadow1->mValue.GetUnit() == eCSSUnit_Array, "wrong unit");
   MOZ_ASSERT(aShadow2->mValue.GetUnit() == eCSSUnit_Array, "wrong unit");
@@ -1067,28 +1072,30 @@ ComputeFilterListDistance(const nsCSSVal
       aList1 = aList1->mNext;
       aList2 = aList2->mNext;
     }
     squareDistance += currentSquareDistance;
   }
   aDistance = sqrt(squareDistance);
   return true;
 }
+#endif
 
 enum class Restrictions {
   Enable,
   Disable
 };
 
 static already_AddRefed<nsCSSValue::Array>
 AddShapeFunction(nsCSSPropertyID aProperty,
                  double aCoeff1, const nsCSSValue::Array* aArray1,
                  double aCoeff2, const nsCSSValue::Array* aArray2,
                  Restrictions aRestriction = Restrictions::Enable);
 
+#ifdef MOZ_OLD_STYLE
 static bool
 ComputeShapeDistance(nsCSSPropertyID aProperty,
                      const nsCSSValue::Array* aArray1,
                      const nsCSSValue::Array* aArray2,
                      double& aDistance)
 {
   // Use AddShapeFunction to get the difference between two shape functions.
   RefPtr<nsCSSValue::Array> diffShape =
@@ -1155,22 +1162,24 @@ ComputeShapeDistance(nsCSSPropertyID aPr
       break;
     }
     default:
       MOZ_ASSERT_UNREACHABLE("Unknown shape type");
   }
   aDistance = sqrt(squareDistance);
   return true;
 }
+#endif
 
 static nsCSSValueList*
 AddTransformLists(double aCoeff1, const nsCSSValueList* aList1,
                   double aCoeff2, const nsCSSValueList* aList2,
                   nsCSSKeyword aOperatorType = eCSSKeyword_interpolatematrix);
 
+#ifdef MOZ_OLD_STYLE
 static double
 ComputeTransform2DMatrixDistance(const Matrix& aMatrix1,
                                  const Matrix& aMatrix2)
 {
   Point3D scale1(1, 1, 1);
   Point3D translate1;
   gfxQuaternion rotate1;
   nsStyleTransformMatrix::ShearArray shear1{0.0f, 0.0f, 0.0f};
@@ -1947,16 +1956,17 @@ StyleAnimationValue::ComputeDistance(nsC
       aDistance = sqrt(squareDistance);
       return true;
     }
   }
 
   MOZ_ASSERT(false, "Can't compute distance using the given common unit");
   return false;
 }
+#endif
 
 static inline void
 AddCSSValueNumber(double aCoeff1, const nsCSSValue &aValue1,
                   double aCoeff2, const nsCSSValue &aValue2,
                   nsCSSValue &aResult, uint32_t aValueRestrictions = 0)
 {
   MOZ_ASSERT(aValue1.GetUnit() == eCSSUnit_Number, "unexpected unit");
   MOZ_ASSERT(aValue2.GetUnit() == eCSSUnit_Number, "unexpected unit");
@@ -3405,16 +3415,17 @@ StyleAnimationValue::Accumulate(nsCSSPro
                             1.0, result,
                             aCount, aA,
                             result);
       break;
   }
   return result;
 }
 
+#ifdef MOZ_OLD_STYLE
 already_AddRefed<css::StyleRule>
 BuildStyleRule(nsCSSPropertyID aProperty,
                dom::Element* aTargetElement,
                const nsAString& aSpecifiedValue,
                bool aUseSVGMode)
 {
   // Set up an empty CSS Declaration
   RefPtr<css::Declaration> declaration(new css::Declaration());
@@ -3676,16 +3687,17 @@ StyleAnimationValue::ComputeValues(
     bool aUseSVGMode,
     nsTArray<PropertyStyleAnimationValuePair>& aResult)
 {
   return ComputeValuesFromSpecifiedValue(aProperty, aEnabledState,
                                          aTargetElement, aStyleContext,
                                          aSpecifiedValue, aUseSVGMode,
                                          aResult);
 }
+#endif
 
 bool
 StyleAnimationValue::UncomputeValue(nsCSSPropertyID aProperty,
                                     const StyleAnimationValue& aComputedValue,
                                     nsCSSValue& aSpecifiedValue)
 {
   Unit unit = aComputedValue.GetUnit();
   switch (unit) {
@@ -3862,16 +3874,17 @@ StyleAnimationValue::UncomputeValue(nsCS
 template<typename T>
 inline const T&
 StyleDataAtOffset(const void* aStyleStruct, ptrdiff_t aOffset)
 {
   return *reinterpret_cast<const T*>(
     reinterpret_cast<const uint8_t*>(aStyleStruct) + aOffset);
 }
 
+#ifdef MOZ_OLD_STYLE
 static bool
 StyleCoordToValue(const nsStyleCoord& aCoord, StyleAnimationValue& aValue)
 {
   switch (aCoord.GetUnit()) {
     case eStyleUnit_Normal:
       aValue.SetNormalValue();
       break;
     case eStyleUnit_Auto:
@@ -4888,16 +4901,17 @@ StyleAnimationValue::ExtractComputedValu
                                               eUnit_DiscreteCSSValue);
       return true;
     }
     case eStyleAnimType_None:
       NS_NOTREACHED("shouldn't use on non-animatable properties");
   }
   return false;
 }
+#endif
 
 Size
 StyleAnimationValue::GetScaleValue(const nsIFrame* aForFrame) const
 {
   MOZ_ASSERT(GetUnit() == StyleAnimationValue::eUnit_Transform);
 
   nsCSSValueSharedList* list = GetCSSValueSharedListValue();
   return nsStyleTransformMatrix::GetScaleValue(list, aForFrame);
@@ -5432,23 +5446,27 @@ AnimationValue::ComputeDistance(nsCSSPro
   double distance= 0.0;
   if (mServo) {
     distance = Servo_AnimationValues_ComputeDistance(mServo, aOther.mServo);
     return distance < 0.0
            ? 0.0
            : distance;
   }
 
+#ifdef MOZ_OLD_STYLE
   return StyleAnimationValue::ComputeDistance(aProperty,
                                               mGecko,
                                               aOther.mGecko,
                                               aStyleContext->AsGecko(),
                                               distance)
          ? distance
          : 0.0;
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 /* static */ AnimationValue
 AnimationValue::FromString(nsCSSPropertyID aProperty,
                            const nsAString& aValue,
                            Element* aElement)
 {
   MOZ_ASSERT(aElement);
@@ -5487,23 +5505,27 @@ AnimationValue::FromString(nsCSSProperty
     result.mServo = presContext->StyleSet()
                                ->AsServo()
                                ->ComputeAnimationValue(aElement,
                                                        declarations,
                                                        servoContext);
     return result;
   }
 
+#ifdef MOZ_OLD_STYLE
   if (!StyleAnimationValue::ComputeValue(aProperty, aElement,
                                          styleContext->AsGecko(),
                                          aValue, false /* |aUseSVGMode| */,
                                          result.mGecko)) {
     MOZ_ASSERT(result.IsNull());
   }
   return result;
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 /* static */ AnimationValue
 AnimationValue::Opacity(StyleBackendType aBackendType, float aOpacity)
 {
   AnimationValue result;
 
   switch (aBackendType) {
--- a/layout/style/StyleAnimationValue.h
+++ b/layout/style/StyleAnimationValue.h
@@ -83,16 +83,17 @@ public:
    *                    should be calculated.
    * @param aEndColor   The end of the interval for which the distance
    *                    should be calculated.
    * @return the result of the calculation.
    */
   static double ComputeColorDistance(const css::RGBAColorData& aStartColor,
                                      const css::RGBAColorData& aEndColor);
 
+#ifdef MOZ_OLD_STYLE
   /**
    * Calculates a measure of 'distance' between two values.
    *
    * This measure of Distance is guaranteed to be proportional to
    * portions passed to Interpolate, Add, or AddWeighted.  However, for
    * some types of StyleAnimationValue it may not produce sensible results
    * for paced animation.
    *
@@ -109,16 +110,17 @@ public:
    * @return true on success, false on failure.
    */
   static MOZ_MUST_USE bool
   ComputeDistance(nsCSSPropertyID aProperty,
                   const StyleAnimationValue& aStartValue,
                   const StyleAnimationValue& aEndValue,
                   GeckoStyleContext* aStyleContext,
                   double& aDistance);
+#endif
 
   /**
    * Calculates an interpolated value that is the specified |aPortion| between
    * the two given values.
    *
    * This really just does the following calculation:
    *   aResultValue = (1.0 - aPortion) * aStartValue + aPortion * aEndValue
    *
@@ -170,16 +172,17 @@ public:
   static StyleAnimationValue
   Accumulate(nsCSSPropertyID aProperty,
              const StyleAnimationValue& aA,
              StyleAnimationValue&& aB,
              uint64_t aCount = 1);
 
   // Type-conversion methods
   // -----------------------
+#ifdef MOZ_OLD_STYLE
   /**
    * Creates a computed value for the given specified value
    * (property ID + string).  A style context is needed in case the
    * specified value depends on inherited style or on the values of other
    * properties.
    *
    * @param aProperty       The property whose value we're computing.
    * @param aTargetElement  The content node to which our computed value is
@@ -240,16 +243,17 @@ public:
   static MOZ_MUST_USE bool
   ComputeValues(nsCSSPropertyID aProperty,
                 mozilla::CSSEnabledState aEnabledState,
                 mozilla::dom::Element* aTargetElement,
                 mozilla::GeckoStyleContext* aStyleContext,
                 const nsCSSValue& aSpecifiedValue,
                 bool aUseSVGMode,
                 nsTArray<PropertyStyleAnimationValuePair>& aResult);
+#endif
 
   /**
    * Creates a specified value for the given computed value.
    *
    * The first two overloads fill in an nsCSSValue object; the third
    * produces a string.  For the overload that takes a const
    * StyleAnimationValue& reference, the nsCSSValue result may depend on
    * objects owned by the |aComputedValue| object, so users of that variant
@@ -271,16 +275,17 @@ public:
   UncomputeValue(nsCSSPropertyID aProperty,
                  StyleAnimationValue&& aComputedValue,
                  nsCSSValue& aSpecifiedValue);
   static MOZ_MUST_USE bool
   UncomputeValue(nsCSSPropertyID aProperty,
                  const StyleAnimationValue& aComputedValue,
                  nsAString& aSpecifiedValue);
 
+#ifdef MOZ_OLD_STYLE
   /**
    * Gets the computed value for the given property from the given style
    * context.
    *
    * Obtaining the computed value allows us to animate properties when the
    * content author has specified a value like "inherit" or "initial" or some
    * other keyword that isn't directly interpolatable, but which *computes* to
    * something interpolatable.
@@ -289,16 +294,17 @@ public:
    * @param aStyleContext The style context to check for the computed value.
    * @param [out] aComputedValue The resulting computed value.
    * @return true on success, false on failure.
    */
   static MOZ_MUST_USE bool ExtractComputedValue(
     nsCSSPropertyID aProperty,
     mozilla::GeckoStyleContext* aStyleContext,
     StyleAnimationValue& aComputedValue);
+#endif
 
   /**
    * The types and values for the values that we extract and animate.
    */
   enum Unit {
     eUnit_Null, // not initialized
     eUnit_Normal,
     eUnit_Auto,
--- a/layout/style/StyleRule.h
+++ b/layout/style/StyleRule.h
@@ -354,21 +354,23 @@ public:
   nsCSSSelectorList* Selector() { return mSelector; }
 
   Declaration* GetDeclaration() const { return mDeclaration; }
 
   void SetDeclaration(Declaration* aDecl);
 
   int32_t GetType() const override;
 
+#ifdef MOZ_OLD_STYLE
   CSSStyleSheet* GetStyleSheet() const
   {
     StyleSheet* sheet = Rule::GetStyleSheet();
     return sheet ? sheet->AsGecko() : nullptr;
   }
+#endif
 
   already_AddRefed<Rule> Clone() const override;
 
 #ifdef DEBUG
   void List(FILE* out = stdout, int32_t aIndent = 0) const override;
 #endif
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
--- a/layout/style/StyleSetHandle.h
+++ b/layout/style/StyleSetHandle.h
@@ -56,60 +56,76 @@ public:
   // wrapped pointer, rather than putting these methods on StyleSetHandle
   // itself, so that we can have StyleSetHandle behave like a smart pointer and
   // be dereferenced with operator->.
   class Ptr
   {
   public:
     friend class ::mozilla::StyleSetHandle;
 
-    bool IsGecko() const { return !IsServo(); }
+    bool IsGecko() const
+    {
+#ifdef MOZ_OLD_STYLE
+      return !IsServo();
+#else
+      return false;
+#endif
+    }
+
     bool IsServo() const
     {
       MOZ_ASSERT(mValue, "StyleSetHandle null pointer dereference");
 #ifdef MOZ_STYLO
       return mValue & SERVO_BIT;
 #else
       return false;
 #endif
     }
 
     StyleBackendType BackendType() const
     {
       return IsGecko() ? StyleBackendType::Gecko :
                          StyleBackendType::Servo;
     }
 
+#ifdef MOZ_OLD_STYLE
     nsStyleSet* AsGecko()
     {
       MOZ_ASSERT(IsGecko());
       return reinterpret_cast<nsStyleSet*>(mValue);
     }
+#endif
 
     ServoStyleSet* AsServo()
     {
       MOZ_ASSERT(IsServo());
       return reinterpret_cast<ServoStyleSet*>(mValue & ~SERVO_BIT);
     }
 
+#ifdef MOZ_OLD_STYLE
     nsStyleSet* GetAsGecko() { return IsGecko() ? AsGecko() : nullptr; }
+#endif
     ServoStyleSet* GetAsServo() { return IsServo() ? AsServo() : nullptr; }
 
+#ifdef MOZ_OLD_STYLE
     const nsStyleSet* AsGecko() const
     {
       return const_cast<Ptr*>(this)->AsGecko();
     }
+#endif
 
     const ServoStyleSet* AsServo() const
     {
       MOZ_ASSERT(IsServo());
       return const_cast<Ptr*>(this)->AsServo();
     }
 
+#ifdef MOZ_OLD_STYLE
     const nsStyleSet* GetAsGecko() const { return IsGecko() ? AsGecko() : nullptr; }
+#endif
     const ServoStyleSet* GetAsServo() const { return IsServo() ? AsServo() : nullptr; }
 
     // These inline methods are defined in StyleSetHandleInlines.h.
     inline void Delete();
 
     // Style set interface.  These inline methods are defined in
     // StyleSetHandleInlines.h and just forward to the underlying
     // nsStyleSet or ServoStyleSet.  See corresponding comments in
--- a/layout/style/StyleSetHandleInlines.h
+++ b/layout/style/StyleSetHandleInlines.h
@@ -6,45 +6,62 @@
 
 #ifndef mozilla_StyleSetHandleInlines_h
 #define mozilla_StyleSetHandleInlines_h
 
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/ServoStyleSet.h"
 #include "nsStyleSet.h"
 
+#ifdef MOZ_OLD_STYLE
+
 #define FORWARD_CONCRETE(method_, geckoargs_, servoargs_) \
   if (IsGecko()) { \
     return AsGecko()->method_ geckoargs_; \
   } else { \
     return AsServo()->method_ servoargs_; \
   }
 
 #define FORWARD_WITH_PARENT(method_, parent_, args_) \
   if (IsGecko()) { \
     auto* parent = parent_ ? parent_->AsGecko() : nullptr; \
     return AsGecko()->method_ args_; \
   } else { \
     auto* parent = parent_ ? parent_->AsServo() : nullptr; \
     return AsServo()->method_ args_; \
   }
 
+#else
+
+#define FORWARD_CONCRETE(method_, geckoargs_, servoargs_) \
+  return AsServo()->method_ servoargs_;
+
+#define FORWARD_WITH_PARENT(method_, parent_, args_) \
+  auto* parent = parent_ ? parent_->AsServo() : nullptr; \
+  return AsServo()->method_ args_;
+
+#endif
+
 #define FORWARD(method_, args_) FORWARD_CONCRETE(method_, args_, args_)
 
 namespace mozilla {
 
 void
 StyleSetHandle::Ptr::Delete()
 {
   if (mValue) {
     if (IsGecko()) {
+#ifdef MOZ_OLD_STYLE
       delete AsGecko();
-    } else {
-      delete AsServo();
+      return;
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     }
+    delete AsServo();
   }
 }
 
 void
 StyleSetHandle::Ptr::Init(nsPresContext* aPresContext,
                           nsBindingManager* aBindingManager)
 {
   FORWARD(Init, (aPresContext, aBindingManager));
@@ -97,23 +114,27 @@ StyleSetHandle::Ptr::ResolveStyleFor(dom
 
 already_AddRefed<nsStyleContext>
 StyleSetHandle::Ptr::ResolveStyleFor(dom::Element* aElement,
                                      nsStyleContext* aParentContext,
                                      LazyComputeBehavior aMayCompute,
                                      TreeMatchContext* aTreeMatchContext)
 {
   if (IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     MOZ_ASSERT(aTreeMatchContext);
     auto* parent = aParentContext ? aParentContext->AsGecko() : nullptr;
     return AsGecko()->ResolveStyleFor(aElement, parent, aMayCompute, *aTreeMatchContext);
-  } else {
-    auto* parent = aParentContext ? aParentContext->AsServo() : nullptr;
-    return AsServo()->ResolveStyleFor(aElement, parent, aMayCompute);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
+
+  auto* parent = aParentContext ? aParentContext->AsServo() : nullptr;
+  return AsServo()->ResolveStyleFor(aElement, parent, aMayCompute);
 }
 
 already_AddRefed<nsStyleContext>
 StyleSetHandle::Ptr::ResolveStyleForText(nsIContent* aTextNode,
                                          nsStyleContext* aParentContext)
 {
   FORWARD_WITH_PARENT(ResolveStyleForText, aParentContext, (aTextNode, parent));
 }
@@ -186,28 +207,32 @@ StyleSetHandle::Ptr::RemoveStyleSheet(Sh
                                      (aType, aSheet->AsServo()));
 }
 
 nsresult
 StyleSetHandle::Ptr::ReplaceSheets(SheetType aType,
                        const nsTArray<RefPtr<StyleSheet>>& aNewSheets)
 {
   if (IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     nsTArray<RefPtr<CSSStyleSheet>> newSheets(aNewSheets.Length());
     for (auto& sheet : aNewSheets) {
       newSheets.AppendElement(sheet->AsGecko());
     }
     return AsGecko()->ReplaceSheets(aType, newSheets);
-  } else {
-    nsTArray<RefPtr<ServoStyleSheet>> newSheets(aNewSheets.Length());
-    for (auto& sheet : aNewSheets) {
-      newSheets.AppendElement(sheet->AsServo());
-    }
-    return AsServo()->ReplaceSheets(aType, newSheets);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
+
+  nsTArray<RefPtr<ServoStyleSheet>> newSheets(aNewSheets.Length());
+  for (auto& sheet : aNewSheets) {
+    newSheets.AppendElement(sheet->AsServo());
+  }
+  return AsServo()->ReplaceSheets(aType, newSheets);
 }
 
 nsresult
 StyleSetHandle::Ptr::InsertStyleSheetBefore(SheetType aType,
                                 StyleSheet* aNewSheet,
                                 StyleSheet* aReferenceSheet)
 {
   FORWARD_CONCRETE(
@@ -311,43 +336,58 @@ StyleSetHandle::Ptr::ProbePseudoElementS
 
 already_AddRefed<nsStyleContext>
 StyleSetHandle::Ptr::ProbePseudoElementStyle(dom::Element* aParentElement,
                                              CSSPseudoElementType aType,
                                              nsStyleContext* aParentContext,
                                              TreeMatchContext* aTreeMatchContext)
 {
   if (IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     MOZ_ASSERT(aTreeMatchContext);
     auto* parent = aParentContext ? aParentContext->AsGecko() : nullptr;
     return AsGecko()->ProbePseudoElementStyle(aParentElement, aType, parent,
                                               *aTreeMatchContext);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
+
   auto* parent = aParentContext ? aParentContext->AsServo() : nullptr;
   return AsServo()->ProbePseudoElementStyle(aParentElement, aType, parent);
 }
 
 void
 StyleSetHandle::Ptr::RootStyleContextAdded()
 {
   if (IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     AsGecko()->RootStyleContextAdded();
-  } else {
-    // Not needed.
+    return;
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
+
+  // Not needed.
 }
 
 void
 StyleSetHandle::Ptr::RootStyleContextRemoved()
 {
   if (IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     AsGecko()->RootStyleContextRemoved();
-  } else {
-    // Not needed.
+    return;
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
+
+  // Not needed.
 }
 
 bool
 StyleSetHandle::Ptr::
 AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray)
 {
   FORWARD(AppendFontFaceRules, (aArray));
 }
--- a/layout/style/StyleSheet.cpp
+++ b/layout/style/StyleSheet.cpp
@@ -71,17 +71,21 @@ StyleSheet::~StyleSheet()
 void
 StyleSheet::LastRelease()
 {
   MOZ_ASSERT(mInner, "Should have an mInner at time of destruction.");
   MOZ_ASSERT(mInner->mSheets.Contains(this), "Our mInner should include us.");
 
   UnparentChildren();
   if (IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     AsGecko()->LastRelease();
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
     AsServo()->LastRelease();
   }
 
   mInner->RemoveSheet(this);
   mInner = nullptr;
 
   DropMedia();
@@ -401,24 +405,28 @@ StyleSheet::EnsureUniqueInner()
     return;
   }
 
   StyleSheetInfo* clone = mInner->CloneFor(this);
   MOZ_ASSERT(clone);
   mInner->RemoveSheet(this);
   mInner = clone;
 
-  if (CSSStyleSheet* geckoSheet = GetAsGecko()) {
+  if (IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     // Ensure we're using the new rules.
     //
     // NOTE: In Servo, all kind of changes that change the set of selectors or
     // rules we match are covered by the PresShell notifications. In Gecko
     // that's true too, but this is probably needed because selectors are not
     // refcounted and can become stale.
-    geckoSheet->ClearRuleCascades();
+    AsGecko()->ClearRuleCascades();
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
     // Fixup the child lists and parent links in the Servo sheet. This is done
     // here instead of in StyleSheetInner::CloneFor, because it's just more
     // convenient to do so instead.
     AsServo()->BuildChildListAfterInnerClone();
   }
 
   // let our containing style sets know that if we call
@@ -434,21 +442,29 @@ StyleSheet::AppendAllChildSheets(nsTArra
 {
   for (StyleSheet* child = GetFirstChild(); child; child = child->mNext) {
     aArray.AppendElement(child);
   }
 }
 
 // WebIDL CSSStyleSheet API
 
+#ifdef MOZ_OLD_STYLE
 #define FORWARD_INTERNAL(method_, args_) \
   if (IsServo()) { \
     return AsServo()->method_ args_; \
   } \
   return AsGecko()->method_ args_;
+#else
+#define FORWARD_INTERNAL(method_, args_) \
+  if (IsServo()) { \
+    return AsServo()->method_ args_; \
+  } \
+  MOZ_CRASH("old style system disabled");
+#endif
 
 dom::CSSRuleList*
 StyleSheet::GetCssRules(nsIPrincipal& aSubjectPrincipal,
                         ErrorResult& aRv)
 {
   if (!AreRulesAvailable(aSubjectPrincipal, aRv)) {
     return nullptr;
   }
@@ -598,17 +614,21 @@ StyleSheet::InsertRuleIntoGroup(const ns
 
   // parse and grab the rule
   mozAutoDocUpdate updateBatch(mDocument, UPDATE_STYLE, true);
 
   WillDirty();
 
   nsresult result;
   if (IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     result = AsGecko()->InsertRuleIntoGroupInternal(aRule, aGroup, aIndex);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
     result = AsServo()->InsertRuleIntoGroupInternal(aRule, aGroup, aIndex);
   }
   NS_ENSURE_SUCCESS(result, result);
   RuleAdded(*aGroup->GetStyleRuleAt(aIndex));
 
   return NS_OK;
 }
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -364,16 +364,17 @@ PopExistingAnimation(const nsAtom* aName
       aCollection->mAnimations.RemoveElementAt(idx);
       return match.forget();
     }
   }
 
   return nullptr;
 }
 
+#ifdef MOZ_OLD_STYLE
 class ResolvedStyleCache {
 public:
   ResolvedStyleCache() : mCache() {}
   GeckoStyleContext* Get(nsPresContext* aPresContext,
                          GeckoStyleContext* aParentStyleContext,
                          Declaration* aKeyframeDeclaration);
 
 private:
@@ -408,16 +409,17 @@ ResolvedStyleCache::Get(nsPresContext* a
     RefPtr<GeckoStyleContext> resultStrong =
       aPresContext->StyleSet()->AsGecko()->
         ResolveStyleByAddingRules(aParentStyleContext, rules);
     mCache.Put(aKeyframeDeclaration, resultStrong);
     result = resultStrong;
   }
   return result;
 }
+#endif
 
 class MOZ_STACK_CLASS ServoCSSAnimationBuilder final {
 public:
   explicit ServoCSSAnimationBuilder(const ServoStyleContext* aStyleContext)
     : mStyleContext(aStyleContext)
   {
     MOZ_ASSERT(aStyleContext);
   }
@@ -460,33 +462,34 @@ public:
   // As a result, when we are using the Servo backend, whenever we have an added
   // or removed animation we need to explicitly trigger a restyle.
   //
   // This code should eventually disappear along with the Gecko style backend
   // and we should simply call Play() / Pause() / Cancel() etc. which will
   // post the required restyles.
   void NotifyNewOrRemovedAnimation(const Animation& aAnimation)
   {
-    AnimationEffectReadOnly* effect = aAnimation.GetEffect();
+    dom::AnimationEffectReadOnly* effect = aAnimation.GetEffect();
     if (!effect) {
       return;
     }
 
     KeyframeEffectReadOnly* keyframeEffect = effect->AsKeyframeEffect();
     if (!keyframeEffect) {
       return;
     }
 
     keyframeEffect->RequestRestyle(EffectCompositor::RestyleType::Standard);
   }
 
 private:
   const ServoStyleContext* mStyleContext;
 };
 
+#ifdef MOZ_OLD_STYLE
 class MOZ_STACK_CLASS GeckoCSSAnimationBuilder final {
 public:
   GeckoCSSAnimationBuilder(GeckoStyleContext* aStyleContext,
                            const NonOwningAnimationTarget& aTarget)
     : mStyleContext(aStyleContext)
     , mTarget(aTarget)
   {
     MOZ_ASSERT(aStyleContext);
@@ -527,16 +530,17 @@ private:
   RefPtr<GeckoStyleContext> mStyleContext;
   NonOwningAnimationTarget mTarget;
 
   ResolvedStyleCache mResolvedStyles;
 };
 
 static Maybe<ComputedTimingFunction>
 ConvertTimingFunction(const nsTimingFunction& aTimingFunction);
+#endif
 
 template<class BuilderType>
 static void
 UpdateOldAnimationPropertiesWithNew(
     CSSAnimation& aOld,
     TimingParams& aNewTiming,
     nsTArray<Keyframe>&& aNewKeyframes,
     bool aNewIsStylePaused,
@@ -664,16 +668,17 @@ BuildAnimation(nsPresContext* aPresConte
     animation->PlayFromStyle();
   }
 
   aBuilder.NotifyNewOrRemovedAnimation(*animation);
 
   return animation.forget();
 }
 
+#ifdef MOZ_OLD_STYLE
 bool
 GeckoCSSAnimationBuilder::BuildKeyframes(nsPresContext* aPresContext,
                                          nsAtom* aName,
                                          const nsTimingFunction& aTimingFunction,
                                          nsTArray<Keyframe>& aKeyframes)
 {
   MOZ_ASSERT(aPresContext);
   MOZ_ASSERT(aPresContext->StyleSet()->IsGecko());
@@ -1009,16 +1014,17 @@ GeckoCSSAnimationBuilder::FillInMissingK
     }
     if (endKeyframe && !aPropertiesSetAtEnd.HasProperty(prop)) {
       // An uninitialized nsCSSValue represents the underlying value.
       PropertyValuePair propertyValue(prop, Move(nsCSSValue()));
       endKeyframe->mPropertyValues.AppendElement(Move(propertyValue));
     }
   }
 }
+#endif
 
 template<class BuilderType>
 static nsAnimationManager::OwningCSSAnimationPtrArray
 BuildAnimations(nsPresContext* aPresContext,
                 const NonOwningAnimationTarget& aTarget,
                 const nsStyleDisplay& aStyleDisplay,
                 BuilderType& aBuilder,
                 nsAnimationManager::CSSAnimationCollection* aCollection)
@@ -1046,16 +1052,17 @@ BuildAnimations(nsPresContext* aPresCont
     }
 
     dest->SetAnimationIndex(static_cast<uint64_t>(animIdx));
     result.AppendElement(dest);
   }
   return result;
 }
 
+#ifdef MOZ_OLD_STYLE
 void
 nsAnimationManager::UpdateAnimations(GeckoStyleContext* aStyleContext,
                                      mozilla::dom::Element* aElement)
 {
   MOZ_ASSERT(mPresContext->IsDynamic(),
              "Should not update animations for print or print preview");
   MOZ_ASSERT(aElement->IsInComposedDoc(),
              "Should not update animations that are not attached to the "
@@ -1067,16 +1074,17 @@ nsAnimationManager::UpdateAnimations(Gec
   }
 
   NonOwningAnimationTarget target(aElement, aStyleContext->GetPseudoType());
   GeckoCSSAnimationBuilder builder(aStyleContext, target);
 
   const nsStyleDisplay* disp = aStyleContext->StyleDisplay();
   DoUpdateAnimations(target, *disp, builder);
 }
+#endif
 
 void
 nsAnimationManager::UpdateAnimations(
   dom::Element* aElement,
   CSSPseudoElementType aPseudoType,
   const ServoStyleContext* aStyleContext)
 {
   MOZ_ASSERT(mPresContext->IsDynamic(),
--- a/layout/style/nsAnimationManager.h
+++ b/layout/style/nsAnimationManager.h
@@ -324,26 +324,28 @@ public:
   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsAnimationManager)
   NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsAnimationManager)
 
   typedef mozilla::AnimationCollection<mozilla::dom::CSSAnimation>
     CSSAnimationCollection;
   typedef nsTArray<RefPtr<mozilla::dom::CSSAnimation>>
     OwningCSSAnimationPtrArray;
 
+#ifdef MOZ_OLD_STYLE
   /**
    * Update the set of animations on |aElement| based on |aStyleContext|.
    * If necessary, this will notify the corresponding EffectCompositor so
    * that it can update its animation rule.
    *
    * aStyleContext may be a style context for aElement or for its
    * :before or :after pseudo-element.
    */
   void UpdateAnimations(mozilla::GeckoStyleContext* aStyleContext,
                         mozilla::dom::Element* aElement);
+#endif
 
   /**
    * This function does the same thing as the above UpdateAnimations()
    * but with servo's computed values.
    */
   void UpdateAnimations(
     mozilla::dom::Element* aElement,
     mozilla::CSSPseudoElementType aPseudoType,
--- a/layout/style/nsCSSCounterStyleRule.cpp
+++ b/layout/style/nsCSSCounterStyleRule.cpp
@@ -125,18 +125,22 @@ void
 nsCSSCounterStyleRule::SetName(const nsAString& aName)
 {
   RefPtr<nsAtom> name;
 
   nsIDocument* doc = GetDocument();
   if (!doc || doc->IsStyledByServo()) {
     name = ServoCSSParser::ParseCounterStyleName(aName);
   } else {
+#ifdef MOZ_OLD_STYLE
     nsCSSParser parser;
     name = parser.ParseCounterStyleName(aName, nullptr);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   if (name) {
     MOZ_AUTO_DOC_UPDATE(doc, UPDATE_STYLE, true);
 
     mName = name;
 
     if (StyleSheet* sheet = GetStyleSheet()) {
@@ -407,21 +411,25 @@ nsCSSCounterStyleRule::SetDescriptor(nsC
   bool useServo = false;
 #endif
 
   if (useServo) {
     URLExtraData* data = sheet ? sheet->AsServo()->URLData() : nullptr;
     ok = ServoCSSParser::ParseCounterStyleDescriptor(aDescID, aValue, data,
                                                      value);
   } else {
+#ifdef MOZ_OLD_STYLE
     nsCSSParser parser;
     nsIURI* baseURL = sheet ? sheet->GetBaseURI() : nullptr;
     nsIPrincipal* principal = sheet ? sheet->Principal() : nullptr;
     ok = parser.ParseCounterDescriptor(aDescID, aValue, nullptr,
                                        baseURL, principal, value);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   if (ok && CheckDescValue(GetSystem(), aDescID, value)) {
     SetDesc(aDescID, value);
   }
 }
 
 #define CSS_COUNTER_DESC_SETTER(name_)                        \
--- a/layout/style/nsCSSParser.h
+++ b/layout/style/nsCSSParser.h
@@ -4,16 +4,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* parsing of CSS stylesheets, based on a token stream from the CSS scanner */
 
 #ifndef nsCSSParser_h___
 #define nsCSSParser_h___
 
+#ifdef MOZ_OLD_STYLE
+
 #include "mozilla/Attributes.h"
 #include "mozilla/css/Loader.h"
 
 #include "nsCSSPropertyID.h"
 #include "nsCSSScanner.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsStringFwd.h"
@@ -344,9 +346,27 @@ public:
 
 protected:
   // This is a CSSParserImpl*, but if we expose that type name in this
   // header, we can't put the type definition (in nsCSSParser.cpp) in
   // the anonymous namespace.
   void* mImpl;
 };
 
+#else
+
+namespace mozilla {
+namespace css {
+class Loader;
+} // namespace css
+} // namespace mozilla
+
+// Define this dummy class so there are fewer call sites to change when the old
+// style system code is compiled out.
+class nsCSSParser
+{
+public:
+  explicit nsCSSParser(mozilla::css::Loader* aLoader = nullptr) {}
+};
+
+#endif
+
 #endif /* nsCSSParser_h___ */
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -99,16 +99,17 @@ GetBackgroundList(T nsStyleImageLayers::
     RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
     val->SetIdent(nsCSSProps::ValueToKeywordEnum(aLayers.mLayers[i].*aMember, aTable));
     valueList->AppendCSSValue(val.forget());
   }
 
   return valueList.forget();
 }
 
+#ifdef MOZ_OLD_STYLE
 // Whether there is any pending restyle for the element or any of its ancestors.
 static bool
 ContentNeedsRestyle(nsIContent* aContent)
 {
   MOZ_ASSERT(aContent);
   nsIContent* node = aContent;
   while (node) {
     if (node->IsElement()) {
@@ -126,16 +127,17 @@ ContentNeedsRestyle(nsIContent* aContent
     if (node->HasFlag(ELEMENT_ALL_RESTYLE_FLAGS |
                       ELEMENT_HAS_CHILD_WITH_LATER_SIBLINGS_HINT)) {
       return true;
     }
     node = node->GetFlattenedTreeParent();
   }
   return false;
 }
+#endif
 
 // Whether aDocument needs to restyle for aElement
 static bool
 DocumentNeedsRestyle(
   const nsIDocument* aDocument,
   Element* aElement,
   nsAtom* aPseudo)
 {
@@ -180,26 +182,30 @@ DocumentNeedsRestyle(
     // Then if there is a restyle root, we check if the root is an ancestor of
     // this content. If it is not, then we don't need to restyle immediately.
     // Note this is different from Gecko: we only check if any ancestor needs
     // to restyle _itself_, not descendants, since dirty descendants can be
     // another subtree.
     return restyleManager->HasPendingRestyleAncestor(aElement);
   }
 
+#ifdef MOZ_OLD_STYLE
   // For Gecko, first check if there is any pending restyle, then we check if
   // any ancestor has dirty bits for restyle.
   GeckoRestyleManager* restyleManager =
     presContext->RestyleManager()->AsGecko();
   if (!presContext->EffectCompositor()->HasPendingStyleUpdates() &&
       !restyleManager->HasPendingRestyles()) {
     return false;
   }
 
   return ContentNeedsRestyle(aElement);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
 }
 
 /**
  * An object that represents the ordered set of properties that are exposed on
  * an nsComputedDOMStyle object and how their computed values can be obtained.
  */
 struct nsComputedStyleMap
 {
@@ -446,19 +452,25 @@ nsComputedDOMStyle::GetLength(uint32_t* 
   NS_PRECONDITION(aLength, "Null aLength!  Prepare to die!");
 
   uint32_t length = GetComputedStyleMap()->Length();
 
   // Make sure we have up to date style so that we can include custom
   // properties.
   UpdateCurrentStyleSources(false);
   if (mStyleContext) {
-    length += mStyleContext->IsServo()
-      ? Servo_GetCustomPropertiesCount(mStyleContext->AsServo())
-      : StyleVariables()->mVariables.Count();
+    if (mStyleContext->IsServo()) {
+      length += Servo_GetCustomPropertiesCount(mStyleContext->AsServo());
+    } else {
+#ifdef MOZ_OLD_STYLE
+      length += StyleVariables()->mVariables.Count();
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
+    }
   }
 
   *aLength = length;
 
   ClearCurrentStyleSources();
 
   return NS_OK;
 }
@@ -510,16 +522,17 @@ nsComputedDOMStyle::GetStyleContext(Elem
       return nullptr;
   }
 
   presShell->FlushPendingNotifications(FlushType::Style);
 
   return GetStyleContextNoFlush(aElement, aPseudo, presShell, aStyleType);
 }
 
+#ifdef MOZ_OLD_STYLE
 namespace {
 class MOZ_STACK_CLASS StyleResolver final
 {
 public:
   StyleResolver(nsPresContext* aPresContext,
                 nsComputedDOMStyle::AnimationFlag aAnimationFlag)
     : mAnimationFlag(aAnimationFlag)
   {
@@ -628,16 +641,17 @@ public:
   }
 
 private:
   GeckoRestyleManager* mRestyleManager = nullptr;
   bool mOldSkipAnimationRules = false;
   nsComputedDOMStyle::AnimationFlag mAnimationFlag;
 };
 }
+#endif
 
 /**
  * The following function checks whether we need to explicitly resolve the style
  * again, even though we have a style context coming from the frame.
  *
  * This basically checks whether the style is or may be under a ::first-line or
  * ::first-letter frame, in which case we can't return the frame style, and we
  * need to resolve it. See bug 505515.
@@ -650,18 +664,22 @@ MustReresolveStyle(const nsStyleContext*
   if (aContext->HasPseudoElementData()) {
     if (!aContext->GetPseudo() ||
         aContext->IsServo()) {
       // TODO(emilio): When ::first-line is supported in Servo, we may want to
       // fix this to avoid re-resolving pseudo-element styles.
       return true;
     }
 
+#ifdef MOZ_OLD_STYLE
     return aContext->AsGecko()->GetParent() &&
            aContext->AsGecko()->GetParent()->HasPseudoElementData();
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   return false;
 }
 
 already_AddRefed<nsStyleContext>
 nsComputedDOMStyle::DoGetStyleContextNoFlush(Element* aElement,
                                              nsAtom* aPseudo,
@@ -733,20 +751,24 @@ nsComputedDOMStyle::DoGetStyleContextNoF
       // for this element / pseudo.
       if (!MustReresolveStyle(result)) {
         // The existing style context may have animation styles so check if we
         // need to remove them.
         if (aAnimationFlag == eWithoutAnimation) {
           nsPresContext* presContext = presShell->GetPresContext();
           MOZ_ASSERT(presContext, "Should have a prescontext if we have a frame");
           if (presContext && presContext->StyleSet()->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
             nsStyleSet* styleSet = presContext->StyleSet()->AsGecko();
             return styleSet->ResolveStyleByRemovingAnimation(
                      aElement, result->AsGecko(),
                      eRestyle_AllHintsWithAnimations);
+#else
+            MOZ_CRASH("old style system disabled");
+#endif
           } else {
             Element* elementOrPseudoElement =
               EffectCompositor::GetElementToRestyle(aElement, pseudoType);
             if (!elementOrPseudoElement) {
               return nullptr;
             }
             return presContext->StyleSet()->AsServo()->
               GetBaseContextForElement(elementOrPseudoElement,
@@ -788,16 +810,17 @@ nsComputedDOMStyle::DoGetStyleContextNoF
     if (!elementOrPseudoElement) {
       return nullptr;
     }
     return servoSet->GetBaseContextForElement(elementOrPseudoElement,
                                               presContext,
                                               result);
   }
 
+#ifdef MOZ_OLD_STYLE
   RefPtr<GeckoStyleContext> parentContext;
   nsIContent* parent = aPseudo ? aElement : aElement->GetParent();
   // Don't resolve parent context for document fragments.
   if (parent && parent->IsElement()) {
     RefPtr<nsStyleContext> p =
       GetStyleContextNoFlush(parent->AsElement(), nullptr,
                              aPresShell, aStyleType);
     MOZ_ASSERT(p && p->IsGecko());
@@ -813,16 +836,19 @@ nsComputedDOMStyle::DoGetStyleContextNoF
                                               aStyleType,
                                               inDocWithShell);
   }
 
   return styleResolver.ResolveWithoutAnimation(styleSet->AsGecko(),
                                                aElement, pseudoType,
                                                parentContext,
                                                inDocWithShell);
+#else
+  MOZ_CRASH("old style system disabled");
+#endif
 }
 
 nsMargin
 nsComputedDOMStyle::GetAdjustedValuesForBoxSizing()
 {
   // We want the width/height of whatever parts 'width' or 'height' controls,
   // which can be different depending on the value of the 'box-sizing' property.
   const nsStylePosition* stylePos = StylePosition();
@@ -1036,16 +1062,17 @@ nsComputedDOMStyle::UpdateCurrentStyleSo
       SetFrameStyleContext(mInnerFrame->StyleContext(), currentGeneration);
       NS_ASSERTION(mStyleContext, "Frame without style context?");
     }
   }
 
   if (!mStyleContext || MustReresolveStyle(mStyleContext)) {
 #ifdef DEBUG
     if (mStyleContext && mStyleContext->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
       // We want to check that going through this path because of
       // HasPseudoElementData is rare, because it slows us down a good
       // bit.  So check that we're really inside something associated
       // with a pseudo-element that contains elements.  (We also allow
       // the element to be NAC, just in case some chrome JS calls
       // getComputedStyle on a NAC-implemented pseudo.)
       GeckoStyleContext* topWithPseudoElementData = mStyleContext->AsGecko();
       while (topWithPseudoElementData->GetParent()->HasPseudoElementData()) {
@@ -1055,16 +1082,19 @@ nsComputedDOMStyle::UpdateCurrentStyleSo
       nsAtom* pseudoAtom = nsCSSPseudoElements::GetPseudoAtom(pseudo);
       nsAutoString assertMsg(
         NS_LITERAL_STRING("we should be in a pseudo-element that is expected to contain elements ("));
       assertMsg.Append(nsDependentString(pseudoAtom->GetUTF16String()));
       assertMsg.Append(')');
       NS_ASSERTION(nsCSSPseudoElements::PseudoElementContainsElements(pseudo) ||
                    mContent->IsNativeAnonymous(),
                    NS_LossyConvertUTF16toASCII(assertMsg).get());
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     }
 #endif
     // Need to resolve a style context
     RefPtr<nsStyleContext> resolvedStyleContext =
       nsComputedDOMStyle::GetStyleContextNoFlush(
           mContent->AsElement(),
           mPseudo,
           presShellForContent ? presShellForContent.get() : mPresShell,
@@ -1084,25 +1114,29 @@ nsComputedDOMStyle::UpdateCurrentStyleSo
                    "why should we have flushed style again?");
 
     SetResolvedStyleContext(Move(resolvedStyleContext), currentGeneration);
     NS_ASSERTION(mPseudo || !mStyleContext->HasPseudoElementData(),
                  "should not have pseudo-element data");
   }
 
   if (mAnimationFlag == eWithoutAnimation) {
+#ifdef MOZ_OLD_STYLE
     // We will support Servo in bug 1311257.
     MOZ_ASSERT(mPresShell->StyleSet()->IsGecko(),
                "eWithoutAnimationRules support Gecko only");
     nsStyleSet* styleSet = mPresShell->StyleSet()->AsGecko();
     RefPtr<nsStyleContext> unanimatedStyleContext =
       styleSet->ResolveStyleByRemovingAnimation(
         mContent->AsElement(), mStyleContext->AsGecko(),
         eRestyle_AllHintsWithAnimations);
     SetResolvedStyleContext(Move(unanimatedStyleContext), currentGeneration);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   // mExposeVisitedStyle is set to true only by testing APIs that
   // require chrome privilege.
   MOZ_ASSERT(!mExposeVisitedStyle || nsContentUtils::IsCallerChrome(),
              "mExposeVisitedStyle set incorrectly");
   if (mExposeVisitedStyle && mStyleContext->RelevantLinkVisited()) {
     nsStyleContext *styleIfVisited = mStyleContext->GetStyleIfVisited();
@@ -1236,32 +1270,45 @@ nsComputedDOMStyle::IndexedGetter(uint32
   UpdateCurrentStyleSources(false);
   if (!mStyleContext) {
     aFound = false;
     return;
   }
 
   bool isServo = mStyleContext->IsServo();
 
+#ifdef MOZ_OLD_STYLE
   const nsStyleVariables* variables = isServo
     ? nullptr
     : StyleVariables();
-
-  const uint32_t count = isServo
-    ? Servo_GetCustomPropertiesCount(mStyleContext->AsServo())
-    : variables->mVariables.Count();
+#endif
+
+  uint32_t count;
+  if (isServo) {
+    count = Servo_GetCustomPropertiesCount(mStyleContext->AsServo());
+  } else {
+#ifdef MOZ_OLD_STYLE
+    count = variables->mVariables.Count();
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
+  }
 
   const uint32_t index = aIndex - length;
   if (index < count) {
     aFound = true;
     nsString varName;
     if (isServo) {
       Servo_GetCustomPropertyNameAt(mStyleContext->AsServo(), index, &varName);
     } else {
+#ifdef MOZ_OLD_STYLE
       variables->mVariables.GetVariableAt(index, varName);
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     }
     aPropName.AssignLiteral("--");
     aPropName.Append(varName);
   } else {
     aFound = false;
   }
 
   ClearCurrentStyleSources();
@@ -7138,19 +7185,27 @@ MarkComputedStyleMapDirty(const char* aP
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetCustomProperty(const nsAString& aPropertyName)
 {
   MOZ_ASSERT(nsCSSProps::IsCustomPropertyName(aPropertyName));
 
   nsString variableValue;
   const nsAString& name = Substring(aPropertyName,
                                     CSS_CUSTOM_NAME_PREFIX_LENGTH);
-  bool present = mStyleContext->IsServo()
-    ? Servo_GetCustomPropertyValue(mStyleContext->AsServo(), &name, &variableValue)
-    : StyleVariables()->mVariables.Get(name, variableValue);
+  bool present;
+  if (mStyleContext->IsServo()) {
+    present = Servo_GetCustomPropertyValue(mStyleContext->AsServo(), &name,
+                                           &variableValue);
+  } else {
+#ifdef MOZ_OLD_STYLE
+    present = StyleVariables()->mVariables.Get(name, variableValue);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
+  }
   if (!present) {
     return nullptr;
   }
 
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetString(variableValue);
 
   return val.forget();
--- a/layout/style/nsDOMCSSAttrDeclaration.cpp
+++ b/layout/style/nsDOMCSSAttrDeclaration.cpp
@@ -139,18 +139,22 @@ nsDOMCSSAttributeDeclaration::GetCSSDecl
     return nullptr;
   }
 
   // cannot fail
   RefPtr<DeclarationBlock> decl;
   if (mElement->IsStyledByServo()) {
     decl = new ServoDeclarationBlock();
   } else {
+#ifdef MOZ_OLD_STYLE
     decl = new css::Declaration();
     decl->AsGecko()->InitializeEmpty();
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   // this *can* fail (inside SetAttrAndNotify, at least).
   nsresult rv;
   if (mIsSMILOverride) {
     rv = mElement->SetSMILOverrideStyleDeclaration(decl, false);
   } else {
     rv = mElement->SetInlineStyleDeclaration(decl, nullptr, false);
@@ -195,17 +199,17 @@ nsDOMCSSAttributeDeclaration::GetParentR
 }
 
 /* virtual */ nsINode*
 nsDOMCSSAttributeDeclaration::GetParentObject()
 {
   return mElement;
 }
 
-/* virtual */ DocGroup*
+/* virtual */ dom::DocGroup*
 nsDOMCSSAttributeDeclaration::GetDocGroup() const
 {
   return mElement ? mElement->OwnerDoc()->GetDocGroup() : nullptr;
 }
 
 NS_IMETHODIMP
 nsDOMCSSAttributeDeclaration::SetPropertyValue(const nsCSSPropertyID aPropID,
                                                const nsAString& aValue,
--- a/layout/style/nsDOMCSSDeclaration.cpp
+++ b/layout/style/nsDOMCSSDeclaration.cpp
@@ -127,16 +127,17 @@ nsDOMCSSDeclaration::SetCssText(const ns
         aSubjectPrincipal);
     if (!servoEnv.mUrlExtraData) {
       return NS_ERROR_NOT_AVAILABLE;
     }
 
     newdecl = ServoDeclarationBlock::FromCssText(aCssText, servoEnv.mUrlExtraData,
                                                  servoEnv.mCompatMode, servoEnv.mLoader);
   } else {
+#ifdef MOZ_OLD_STYLE
     CSSParsingEnvironment geckoEnv;
     GetCSSParsingEnvironment(geckoEnv, aSubjectPrincipal);
     if (!geckoEnv.mPrincipal) {
       return NS_ERROR_NOT_AVAILABLE;
     }
 
     RefPtr<css::Declaration> decl(new css::Declaration());
     decl->InitializeEmpty();
@@ -144,16 +145,19 @@ nsDOMCSSDeclaration::SetCssText(const ns
     bool changed;
     nsresult result = cssParser.ParseDeclarations(aCssText, geckoEnv.mSheetURI,
                                                   geckoEnv.mBaseURI, geckoEnv.mPrincipal,
                                                   decl, &changed);
     if (NS_FAILED(result) || !changed) {
       return result;
     }
     newdecl = decl.forget();
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   return SetCSSDeclaration(newdecl);
 }
 
 NS_IMETHODIMP
 nsDOMCSSDeclaration::GetLength(uint32_t* aLength)
 {
@@ -310,23 +314,27 @@ nsDOMCSSDeclaration::ModifyDeclaration(n
   // need to start the update now so that the old rule doesn't get used
   // between when we mutate the declaration and when we set the new
   // rule (see stack in bug 209575).
   mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
   RefPtr<DeclarationBlock> decl = olddecl->EnsureMutable();
 
   bool changed;
   if (decl->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     CSSParsingEnvironment geckoEnv;
     GetCSSParsingEnvironment(geckoEnv, aSubjectPrincipal);
     if (!geckoEnv.mPrincipal) {
       return NS_ERROR_NOT_AVAILABLE;
     }
 
     aGeckoFunc(decl->AsGecko(), geckoEnv, &changed);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
     ServoCSSParsingEnvironment servoEnv = GetServoCSSParsingEnvironment(
         aSubjectPrincipal);
     if (!servoEnv.mUrlExtraData) {
       return NS_ERROR_NOT_AVAILABLE;
     }
 
     changed = aServoFunc(decl->AsServo(), servoEnv);
@@ -343,20 +351,24 @@ nsresult
 nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSPropertyID aPropID,
                                         const nsAString& aPropValue,
                                         bool aIsImportant,
                                         nsIPrincipal* aSubjectPrincipal)
 {
   return ModifyDeclaration(
     aSubjectPrincipal,
     [&](css::Declaration* decl, CSSParsingEnvironment& env, bool* changed) {
+#ifdef MOZ_OLD_STYLE
       nsCSSParser cssParser(env.mCSSLoader);
       cssParser.ParseProperty(aPropID, aPropValue,
                               env.mSheetURI, env.mBaseURI, env.mPrincipal,
                               decl, changed, aIsImportant);
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     },
     [&](ServoDeclarationBlock* decl, ServoCSSParsingEnvironment& env) {
       NS_ConvertUTF16toUTF8 value(aPropValue);
       return Servo_DeclarationBlock_SetPropertyById(
         decl->Raw(), aPropID, &value, aIsImportant, env.mUrlExtraData,
         ParsingMode::Default, env.mCompatMode, env.mLoader);
     });
 }
@@ -366,21 +378,25 @@ nsDOMCSSDeclaration::ParseCustomProperty
                                               const nsAString& aPropValue,
                                               bool aIsImportant,
                                               nsIPrincipal* aSubjectPrincipal)
 {
   MOZ_ASSERT(nsCSSProps::IsCustomPropertyName(aPropertyName));
   return ModifyDeclaration(
     aSubjectPrincipal,
     [&](css::Declaration* decl, CSSParsingEnvironment& env, bool* changed) {
+#ifdef MOZ_OLD_STYLE
       nsCSSParser cssParser(env.mCSSLoader);
       auto propName = Substring(aPropertyName, CSS_CUSTOM_NAME_PREFIX_LENGTH);
       cssParser.ParseVariable(propName, aPropValue, env.mSheetURI,
                               env.mBaseURI, env.mPrincipal, decl,
                               changed, aIsImportant);
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     },
     [&](ServoDeclarationBlock* decl, ServoCSSParsingEnvironment& env) {
       NS_ConvertUTF16toUTF8 property(aPropertyName);
       NS_ConvertUTF16toUTF8 value(aPropValue);
       return Servo_DeclarationBlock_SetProperty(
         decl->Raw(), &property, &value, aIsImportant, env.mUrlExtraData,
         ParsingMode::Default, env.mCompatMode, env.mLoader);
     });
--- a/layout/style/nsHTMLCSSStyleSheet.cpp
+++ b/layout/style/nsHTMLCSSStyleSheet.cpp
@@ -46,16 +46,17 @@ nsHTMLCSSStyleSheet::~nsHTMLCSSStyleShee
       MOZ_ASSERT_UNREACHABLE("unexpected cached nsAttrValue type");
     }
 
     value->mValue.mCached = 0;
     iter.Remove();
   }
 }
 
+#ifdef MOZ_OLD_STYLE
 NS_IMPL_ISUPPORTS(nsHTMLCSSStyleSheet, nsIStyleRuleProcessor)
 
 /* virtual */ void
 nsHTMLCSSStyleSheet::RulesMatching(ElementRuleProcessorData* aData)
 {
   ElementRulesMatching(aData->mPresContext, aData->mElement,
                        aData->mRuleWalker);
 }
@@ -185,16 +186,17 @@ nsHTMLCSSStyleSheet::SizeOfExcludingThis
   return n;
 }
 
 /* virtual */ size_t
 nsHTMLCSSStyleSheet::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
 {
   return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
 }
+#endif
 
 void
 nsHTMLCSSStyleSheet::CacheStyleAttr(const nsAString& aSerialized,
                                     MiscContainer* aValue)
 {
   mCachedStyleAttrs.Put(aSerialized, aValue);
 }
 
--- a/layout/style/nsHTMLCSSStyleSheet.h
+++ b/layout/style/nsHTMLCSSStyleSheet.h
@@ -22,21 +22,25 @@ struct MiscContainer;
 
 namespace mozilla {
 enum class CSSPseudoElementType : uint8_t;
 namespace dom {
 class Element;
 } // namespace dom
 } // namespace mozilla
 
-class nsHTMLCSSStyleSheet final : public nsIStyleRuleProcessor
+class nsHTMLCSSStyleSheet final
+#ifdef MOZ_OLD_STYLE
+  : public nsIStyleRuleProcessor
+#endif
 {
 public:
   nsHTMLCSSStyleSheet();
 
+#ifdef MOZ_OLD_STYLE
   NS_DECL_ISUPPORTS
 
   // nsIStyleRuleProcessor
   virtual void RulesMatching(ElementRuleProcessorData* aData) override;
   virtual void RulesMatching(PseudoElementRuleProcessorData* aData) override;
   virtual void RulesMatching(AnonBoxRuleProcessorData* aData) override;
 #ifdef MOZ_XUL
   virtual void RulesMatching(XULTreeRuleProcessorData* aData) override;
@@ -58,16 +62,19 @@ public:
   void ElementRulesMatching(nsPresContext* aPresContext,
                             mozilla::dom::Element* aElement,
                             nsRuleWalker* aRuleWalker);
   // aPseudoElement here is the content node for the pseudo-element, not
   // its corresponding real element.
   void PseudoElementRulesMatching(mozilla::dom::Element* aPseudoElement,
                                   mozilla::CSSPseudoElementType aPseudoType,
                                   nsRuleWalker* aRuleWalker);
+#else
+  NS_INLINE_DECL_REFCOUNTING(nsHTMLCSSStyleSheet)
+#endif
 
   void CacheStyleAttr(const nsAString& aSerialized, MiscContainer* aValue);
   void EvictStyleAttr(const nsAString& aSerialized, MiscContainer* aValue);
   MiscContainer* LookupStyleAttr(const nsAString& aSerialized);
 
 private:
   ~nsHTMLCSSStyleSheet();
 
--- a/layout/style/nsHTMLStyleSheet.cpp
+++ b/layout/style/nsHTMLStyleSheet.cpp
@@ -28,16 +28,17 @@
 #include "mozilla/OperatorNewExtensions.h"
 #include "mozilla/RestyleManager.h"
 #include "mozilla/RestyleManagerInlines.h"
 #include "mozilla/ServoStyleSet.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
+#ifdef MOZ_OLD_STYLE
 NS_IMPL_ISUPPORTS(nsHTMLStyleSheet::HTMLColorRule, nsIStyleRule)
 
 /* virtual */ void
 nsHTMLStyleSheet::HTMLColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
 {
   if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Color)) {
     nsCSSValue* color = aRuleData->ValueForColor();
     if (color->GetUnit() == eCSSUnit_Null &&
@@ -177,16 +178,17 @@ nsHTMLStyleSheet::LangRule::List(FILE* o
     str.AppendLiteral("  ");
   }
   str.AppendLiteral("[lang rule] { language: \"");
   AppendUTF16toUTF8(nsDependentAtomString(mLang), str);
   str.AppendLiteral("\" }\n");
   fprintf_stderr(out, "%s", str.get());
 }
 #endif
+#endif
 
 // -----------------------------------------------------------
 
 struct MappedAttrTableEntry : public PLDHashEntryHdr {
   nsMappedAttributes *mAttributes;
 };
 
 static PLDHashNumber
@@ -223,16 +225,17 @@ static const PLDHashTableOps MappedAttrT
   MappedAttrTable_MatchEntry,
   PLDHashTable::MoveEntryStub,
   MappedAttrTable_ClearEntry,
   nullptr
 };
 
 // -----------------------------------------------------------
 
+#ifdef MOZ_OLD_STYLE
 struct LangRuleTableEntry : public PLDHashEntryHdr {
   RefPtr<nsHTMLStyleSheet::LangRule> mRule;
 };
 
 static PLDHashNumber
 LangRuleTable_HashKey(const void *key)
 {
   auto* lang = static_cast<const nsAtom*>(key);
@@ -270,30 +273,36 @@ LangRuleTable_InitEntry(PLDHashEntryHdr 
 
 static const PLDHashTableOps LangRuleTable_Ops = {
   LangRuleTable_HashKey,
   LangRuleTable_MatchEntry,
   PLDHashTable::MoveEntryStub,
   LangRuleTable_ClearEntry,
   LangRuleTable_InitEntry
 };
+#endif
 
 // -----------------------------------------------------------
 
 nsHTMLStyleSheet::nsHTMLStyleSheet(nsIDocument* aDocument)
   : mDocument(aDocument)
+#ifdef MOZ_OLD_STYLE
   , mTableQuirkColorRule(new TableQuirkColorRule())
   , mTableTHRule(new TableTHRule())
+#endif
   , mMappedAttrTable(&MappedAttrTable_Ops, sizeof(MappedAttrTableEntry))
   , mMappedAttrsDirty(false)
+#ifdef MOZ_OLD_STYLE
   , mLangRuleTable(&LangRuleTable_Ops, sizeof(LangRuleTableEntry))
+#endif
 {
   MOZ_ASSERT(aDocument);
 }
 
+#ifdef MOZ_OLD_STYLE
 NS_IMPL_ISUPPORTS(nsHTMLStyleSheet, nsIStyleRuleProcessor)
 
 /* virtual */ void
 nsHTMLStyleSheet::RulesMatching(ElementRuleProcessorData* aData)
 {
   nsRuleWalker *ruleWalker = aData->mRuleWalker;
   if (!ruleWalker->AuthorStyleDisabled()) {
     // if we have anchor colors, check if this is an anchor with an href
@@ -452,94 +461,119 @@ nsHTMLStyleSheet::RulesMatching(AnonBoxR
 }
 
 #ifdef MOZ_XUL
 /* virtual */ void
 nsHTMLStyleSheet::RulesMatching(XULTreeRuleProcessorData* aData)
 {
 }
 #endif
+#endif
 
 void
 nsHTMLStyleSheet::SetOwningDocument(nsIDocument* aDocument)
 {
   mDocument = aDocument; // not refcounted
 }
 
 void
 nsHTMLStyleSheet::Reset()
 {
+#ifdef MOZ_OLD_STYLE
   mLinkRule          = nullptr;
   mVisitedRule       = nullptr;
   mActiveRule        = nullptr;
+#endif
 
   mServoUnvisitedLinkDecl = nullptr;
   mServoVisitedLinkDecl = nullptr;
   mServoActiveLinkDecl = nullptr;
 
+#ifdef MOZ_OLD_STYLE
   mLangRuleTable.Clear();
+#endif
   mMappedAttrTable.Clear();
   mMappedAttrsDirty = false;
 }
 
 nsresult
 nsHTMLStyleSheet::ImplLinkColorSetter(
+#ifdef MOZ_OLD_STYLE
     RefPtr<HTMLColorRule>& aRule,
+#endif
     RefPtr<RawServoDeclarationBlock>& aDecl,
     nscolor aColor)
 {
   if (!mDocument || !mDocument->GetShell()) {
     return NS_OK;
   }
 
   RestyleManager* restyle =
     mDocument->GetShell()->GetPresContext()->RestyleManager();
 
   if (restyle->IsServo()) {
     MOZ_ASSERT(!ServoStyleSet::IsInServoTraversal());
     aDecl = Servo_DeclarationBlock_CreateEmpty().Consume();
     Servo_DeclarationBlock_SetColorValue(aDecl.get(), eCSSProperty_color,
                                          aColor);
   } else {
+#ifdef MOZ_OLD_STYLE
     if (aRule && aRule->mColor == aColor) {
       return NS_OK;
     }
 
     aRule = new HTMLColorRule(aColor);
     if (!aRule) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   // Now make sure we restyle any links that might need it.  This
   // shouldn't happen often, so just rebuilding everything is ok.
   Element* root = mDocument->GetRootElement();
   if (root) {
     restyle->PostRestyleEvent(root, eRestyle_Subtree, nsChangeHint(0));
   }
   return NS_OK;
 }
 
 nsresult
 nsHTMLStyleSheet::SetLinkColor(nscolor aColor)
 {
-  return ImplLinkColorSetter(mLinkRule, mServoUnvisitedLinkDecl, aColor);
+  return ImplLinkColorSetter(
+#ifdef MOZ_OLD_STYLE
+      mLinkRule,
+#endif
+      mServoUnvisitedLinkDecl,
+      aColor);
 }
 
-
 nsresult
 nsHTMLStyleSheet::SetActiveLinkColor(nscolor aColor)
 {
-  return ImplLinkColorSetter(mActiveRule, mServoActiveLinkDecl, aColor);
+  return ImplLinkColorSetter(
+#ifdef MOZ_OLD_STYLE
+      mActiveRule,
+#endif
+      mServoActiveLinkDecl,
+      aColor);
 }
 
 nsresult
 nsHTMLStyleSheet::SetVisitedLinkColor(nscolor aColor)
 {
-  return ImplLinkColorSetter(mVisitedRule, mServoVisitedLinkDecl, aColor);
+  return ImplLinkColorSetter(
+#ifdef MOZ_OLD_STYLE
+      mVisitedRule,
+#endif
+      mServoVisitedLinkDecl,
+      aColor);
 }
 
 already_AddRefed<nsMappedAttributes>
 nsHTMLStyleSheet::UniqueMappedAttributes(nsMappedAttributes* aMapped)
 {
   mMappedAttrsDirty = true;
   auto entry = static_cast<MappedAttrTableEntry*>
                           (mMappedAttrTable.Add(aMapped, fallible));
@@ -574,27 +608,29 @@ nsHTMLStyleSheet::CalculateMappedServoDe
     if (attr->mAttributes->GetServoStyle()) {
       // Only handle cases which haven't been filled in already
       continue;
     }
     attr->mAttributes->LazilyResolveServoDeclaration(mDocument);
   }
 }
 
+#ifdef MOZ_OLD_STYLE
 nsIStyleRule*
 nsHTMLStyleSheet::LangRuleFor(const nsAtom* aLanguage)
 {
   auto entry =
     static_cast<LangRuleTableEntry*>(mLangRuleTable.Add(aLanguage, fallible));
   if (!entry) {
     NS_ASSERTION(false, "out of memory");
     return nullptr;
   }
   return entry->mRule;
 }
+#endif
 
 size_t
 nsHTMLStyleSheet::DOMSizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
 {
   size_t n = aMallocSizeOf(this);
 
   n += mMappedAttrTable.ShallowSizeOfExcludingThis(aMallocSizeOf);
   for (auto iter = mMappedAttrTable.ConstIter(); !iter.Done(); iter.Next()) {
--- a/layout/style/nsHTMLStyleSheet.h
+++ b/layout/style/nsHTMLStyleSheet.h
@@ -21,23 +21,27 @@
 #include "mozilla/Attributes.h"
 #include "mozilla/MemoryReporting.h"
 #include "nsString.h"
 
 class nsIDocument;
 class nsMappedAttributes;
 struct RawServoDeclarationBlock;
 
-class nsHTMLStyleSheet final : public nsIStyleRuleProcessor
+class nsHTMLStyleSheet final
+#ifdef MOZ_OLD_STYLE
+  : public nsIStyleRuleProcessor
+#endif
 {
 public:
   explicit nsHTMLStyleSheet(nsIDocument* aDocument);
 
   void SetOwningDocument(nsIDocument* aDocument);
 
+#ifdef MOZ_OLD_STYLE
   NS_DECL_ISUPPORTS
 
   // nsIStyleRuleProcessor API
   virtual void RulesMatching(ElementRuleProcessorData* aData) override;
   virtual void RulesMatching(PseudoElementRuleProcessorData* aData) override;
   virtual void RulesMatching(AnonBoxRuleProcessorData* aData) override;
 #ifdef MOZ_XUL
   virtual void RulesMatching(XULTreeRuleProcessorData* aData) override;
@@ -48,16 +52,22 @@ public:
   virtual nsRestyleHint
     HasAttributeDependentStyle(AttributeRuleProcessorData* aData,
                                mozilla::RestyleHintData& aRestyleHintDataResult) override;
   virtual bool MediumFeaturesChanged(nsPresContext* aPresContext) override;
   virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
     const MOZ_MUST_OVERRIDE override;
   virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
     const MOZ_MUST_OVERRIDE override;
+
+  nsIStyleRule* LangRuleFor(const nsAtom* aLanguage);
+#else
+  NS_INLINE_DECL_REFCOUNTING(nsHTMLStyleSheet)
+#endif
+
   size_t DOMSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
   void Reset();
   nsresult SetLinkColor(nscolor aColor);
   nsresult SetActiveLinkColor(nscolor aColor);
   nsresult SetVisitedLinkColor(nscolor aColor);
 
   const RefPtr<RawServoDeclarationBlock>& GetServoUnvisitedLinkDecl() const {
@@ -74,24 +84,23 @@ public:
   already_AddRefed<nsMappedAttributes>
     UniqueMappedAttributes(nsMappedAttributes* aMapped);
   void DropMappedAttributes(nsMappedAttributes* aMapped);
   // For each mapped presentation attribute in the cache, resolve
   // the attached ServoDeclarationBlock by running the mapping
   // and converting the ruledata to Servo specified values.
   void CalculateMappedServoDeclarations();
 
-  nsIStyleRule* LangRuleFor(const nsAtom* aLanguage);
-
 private:
   nsHTMLStyleSheet(const nsHTMLStyleSheet& aCopy) = delete;
   nsHTMLStyleSheet& operator=(const nsHTMLStyleSheet& aCopy) = delete;
 
   ~nsHTMLStyleSheet() {}
 
+#ifdef MOZ_OLD_STYLE
   class HTMLColorRule;
   friend class HTMLColorRule;
   class HTMLColorRule final : public nsIStyleRule {
   private:
     ~HTMLColorRule() {}
   public:
     explicit HTMLColorRule(nscolor aColor)
       : mColor(aColor)
@@ -106,21 +115,16 @@ private:
                                                nsCSSValue* aValue) override;
   #ifdef DEBUG
     virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
   #endif
 
     nscolor mColor;
   };
 
-  // Implementation of SetLink/VisitedLink/ActiveLinkColor
-  nsresult ImplLinkColorSetter(RefPtr<HTMLColorRule>& aRule,
-                               RefPtr<RawServoDeclarationBlock>& aDecl,
-                               nscolor aColor);
-
   class GenericTableRule;
   friend class GenericTableRule;
   class GenericTableRule : public nsIStyleRule {
   protected:
     virtual ~GenericTableRule() {}
   public:
     GenericTableRule() {}
 
@@ -154,19 +158,29 @@ private:
   public:
     TableQuirkColorRule() {}
 
     virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
     virtual bool MightMapInheritedStyleData() override;
     virtual bool GetDiscretelyAnimatedCSSValue(nsCSSPropertyID aProperty,
                                                nsCSSValue* aValue) override;
   };
+#endif
+
+  // Implementation of SetLink/VisitedLink/ActiveLinkColor
+  nsresult ImplLinkColorSetter(
+#ifdef MOZ_OLD_STYLE
+      RefPtr<HTMLColorRule>& aRule,
+#endif
+      RefPtr<RawServoDeclarationBlock>& aDecl,
+      nscolor aColor);
 
 public: // for mLangRuleTable structures only
 
+#ifdef MOZ_OLD_STYLE
   // Rule to handle xml:lang attributes, of which we have exactly one
   // per language string, maintained in mLangRuleTable.
   // We also create one extra rule for the "x-math" language string, used on
   // <math> elements.
   class LangRule final : public nsIStyleRule {
   private:
     ~LangRule() {}
   public:
@@ -180,29 +194,36 @@ public: // for mLangRuleTable structures
     virtual bool GetDiscretelyAnimatedCSSValue(nsCSSPropertyID aProperty,
                                                nsCSSValue* aValue) override;
   #ifdef DEBUG
     virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
   #endif
 
     RefPtr<nsAtom> mLang;
   };
+#endif
 
 private:
   nsIDocument*            mDocument;
+#ifdef MOZ_OLD_STYLE
   RefPtr<HTMLColorRule> mLinkRule;
   RefPtr<HTMLColorRule> mVisitedRule;
   RefPtr<HTMLColorRule> mActiveRule;
+#endif
   RefPtr<RawServoDeclarationBlock> mServoUnvisitedLinkDecl;
   RefPtr<RawServoDeclarationBlock> mServoVisitedLinkDecl;
   RefPtr<RawServoDeclarationBlock> mServoActiveLinkDecl;
+#ifdef MOZ_OLD_STYLE
   RefPtr<TableQuirkColorRule> mTableQuirkColorRule;
   RefPtr<TableTHRule>   mTableTHRule;
+#endif
 
   PLDHashTable            mMappedAttrTable;
   // Whether or not the mapped attributes table
   // has been changed since the last call to
   // CalculateMappedServoDeclarations()
   bool                    mMappedAttrsDirty;
+#ifdef MOZ_OLD_STYLE
   PLDHashTable            mLangRuleTable;
+#endif
 };
 
 #endif /* !defined(nsHTMLStyleSheet_h_) */
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -881,18 +881,22 @@ nsLayoutStylesheetCache::InvalidatePrefe
   }
 }
 
 void
 nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<StyleSheet>* aSheet,
                                               nsPresContext* aPresContext)
 {
   if (mBackendType == StyleBackendType::Gecko) {
+#ifdef MOZ_OLD_STYLE
     *aSheet = new CSSStyleSheet(eAgentSheetFeatures, CORS_NONE,
                                 mozilla::net::RP_Unset);
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
     *aSheet = new ServoStyleSheet(eAgentSheetFeatures, CORS_NONE,
                                   mozilla::net::RP_Unset, dom::SRIMetadata());
   }
 
   StyleSheet* sheet = *aSheet;
 
   nsCOMPtr<nsIURI> uri;
@@ -982,17 +986,21 @@ nsLayoutStylesheetCache::BuildPreference
         NS_GET_R_G_B(focusBG));
   }
 
   NS_ASSERTION(sheetText.Length() <= kPreallocSize,
                "kPreallocSize should be big enough to build preference style "
                "sheet without reallocation");
 
   if (sheet->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     sheet->AsGecko()->ReparseSheet(NS_ConvertUTF8toUTF16(sheetText));
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
     ServoStyleSheet* servoSheet = sheet->AsServo();
     // NB: The pref sheet never has @import rules.
     nsresult rv = servoSheet->ParseSheet(
       nullptr, sheetText, uri, uri, nullptr, 0, eCompatibility_FullStandards);
     // Parsing the about:PreferenceStyleSheet URI can only fail on OOM. If we
     // are OOM before we parsed any documents we might as well abort.
     MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
--- a/layout/style/nsRuleProcessorData.h
+++ b/layout/style/nsRuleProcessorData.h
@@ -7,16 +7,18 @@
 /*
  * data structures passed to nsIStyleRuleProcessor methods (to pull loop
  * invariant computations out of the loop)
  */
 
 #ifndef nsRuleProcessorData_h_
 #define nsRuleProcessorData_h_
 
+#ifdef MOZ_OLD_STYLE
+
 #include "nsAutoPtr.h"
 #include "nsChangeHint.h"
 #include "nsCompatibility.h"
 #include "nsCSSPseudoElements.h"
 #include "nsRuleWalker.h"
 #include "nsNthIndexCache.h"
 #include "nsILoadContext.h"
 #include "nsIDocument.h"
@@ -633,9 +635,41 @@ struct MOZ_STACK_CLASS AttributeRuleProc
   int32_t mNameSpaceID; // Namespace of the attribute involved.
   nsAtom* mAttribute; // |HasAttributeDependentStyle| for which attribute?
   // non-null if we have the value.
   const nsAttrValue* mOtherValue;
   int32_t mModType;    // The type of modification (see nsIDOMMutationEvent).
   bool mAttrHasChanged; // Whether the attribute has already changed.
 };
 
+#else
+
+// Define this dummy class so there are fewer call sites to change when the old
+// style system code is compiled out.
+struct TreeMatchContext
+{
+public:
+  class AutoAncestorPusher
+  {
+  public:
+    explicit AutoAncestorPusher(TreeMatchContext* aTreeMatchContext) {}
+    void PushAncestorAndStyleScope(nsIContent* aContent) {}
+    void PushStyleScope(nsIContent* aContent) {}
+  };
+
+  class AutoParentDisplayBasedStyleFixupSkipper
+  {
+  public:
+    explicit AutoParentDisplayBasedStyleFixupSkipper(
+        TreeMatchContext& aTreeMatchContext,
+        bool aSkipParentDisplayBasedStyleFixup = true) {}
+  };
+
+  enum ForFrameConstructionTag { ForFrameConstruction };
+
+  TreeMatchContext(nsIDocument* aDocument, ForFrameConstructionTag) {}
+
+  void InitAncestors(mozilla::dom::Element* aElement) {}
+};
+
+#endif
+
 #endif /* !defined(nsRuleProcessorData_h_) */
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -130,16 +130,17 @@ nsStyleContext::CalcStyleDifference(nsSt
   // nobody ever looked at that struct's data).  In other words, we
   // can't skip later structs if we get a big change up front, because
   // we could later get a small change in one of those structs that we
   // don't want to miss.
 
   DebugOnly<uint32_t> structsFound = 0;
 
   if (IsGecko()) {
+#ifdef MOZ_OLD_STYLE
     // CalcStyleDifference is always called on the main thread for Gecko
     // style contexts.  This assertion helps the heap write static analysis.
     MOZ_ASSERT(NS_IsMainThread());
 
     // FIXME(heycam): We should just do the comparison in
     // nsStyleVariables::CalcDifference, returning NeutralChange if there are
     // any Variables differences.
     const nsStyleVariables* thisVariables = PeekStyleVariables();
@@ -150,16 +151,19 @@ nsStyleContext::CalcStyleDifference(nsSt
         *aSamePointerStructs |= NS_STYLE_INHERIT_BIT(Variables);
         *aEqualStructs |= NS_STYLE_INHERIT_BIT(Variables);
       } else if (thisVariables->mVariables == otherVariables->mVariables) {
         *aEqualStructs |= NS_STYLE_INHERIT_BIT(Variables);
       }
     } else {
       *aEqualStructs |= NS_STYLE_INHERIT_BIT(Variables);
     }
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   } else {
     if (aIgnoreVariables ||
         Servo_ComputedValues_EqualCustomProperties(
           AsServo()->ComputedData(),
           aNewContext->ComputedData())) {
       *aEqualStructs |= NS_STYLE_INHERIT_BIT(Variables);
     }
   }
@@ -368,16 +372,17 @@ nsStyleContext::CalcStyleDifference(nsSt
 
   MOZ_ASSERT(NS_IsHintSubset(hint, nsChangeHint_AllHints),
              "Added a new hint without bumping AllHints?");
   return hint & ~nsChangeHint_NeutralChange;
 }
 
 namespace mozilla {
 
+#ifdef MOZ_OLD_STYLE
 void
 GeckoStyleContext::EnsureSameStructsCached(nsStyleContext* aOldContext)
 {
   // NOTE(emilio): We could do better here for stylo, where we only call
   // Style##name_() because we need to run FinishStyle, but otherwise this
   // is only a bitwise or.
   //
   // We could reduce the FFI traffic we do only doing it for structs that have
@@ -385,81 +390,97 @@ GeckoStyleContext::EnsureSameStructsCach
 
 #define STYLE_STRUCT(name_, checkdata_cb_)                                    \
   if (aOldContext->PeekStyle##name_()) {                                      \
     Style##name_();                                                           \
   }
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 }
+#endif
 
 } // namespace mozilla
 
 #ifdef DEBUG
 void nsStyleContext::List(FILE* out, int32_t aIndent, bool aListDescendants)
 {
   nsAutoCString str;
   // Indent
   int32_t ix;
   for (ix = aIndent; --ix >= 0; ) {
     str.AppendLiteral("  ");
   }
   str.Append(nsPrintfCString("%p(%d) parent=%p ",
-                             (void*)this, IsGecko() ? AsGecko()->mRefCnt : 0,
-                             IsGecko() ? AsGecko()->GetParent() : nullptr));
+                             (void*)this,
+#ifdef MOZ_OLD_STYLE
+                             IsGecko() ? AsGecko()->mRefCnt : 0,
+                             IsGecko() ? AsGecko()->GetParent() : nullptr
+#else
+                             0, nullptr
+#endif
+                             ));
   if (mPseudoTag) {
     nsAutoString  buffer;
     mPseudoTag->ToString(buffer);
     AppendUTF16toUTF8(buffer, str);
     str.Append(' ');
   }
 
   if (IsServo()) {
     fprintf_stderr(out, "%s{ServoComputedData}\n", str.get());
-  } else if (nsRuleNode* ruleNode = AsGecko()->RuleNode()) {
-    fprintf_stderr(out, "%s{\n", str.get());
-    str.Truncate();
-    while (ruleNode) {
-      nsIStyleRule *styleRule = ruleNode->GetRule();
-      if (styleRule) {
-        styleRule->List(out, aIndent + 1);
+  } else {
+#ifdef MOZ_OLD_STYLE
+    if (nsRuleNode* ruleNode = AsGecko()->RuleNode()) {
+      fprintf_stderr(out, "%s{\n", str.get());
+      str.Truncate();
+      while (ruleNode) {
+        nsIStyleRule *styleRule = ruleNode->GetRule();
+        if (styleRule) {
+          styleRule->List(out, aIndent + 1);
+        }
+        ruleNode = ruleNode->GetParent();
       }
-      ruleNode = ruleNode->GetParent();
-    }
-    for (ix = aIndent; --ix >= 0; ) {
-      str.AppendLiteral("  ");
+      for (ix = aIndent; --ix >= 0; ) {
+        str.AppendLiteral("  ");
+      }
+      fprintf_stderr(out, "%s}\n", str.get());
+    } else {
+      fprintf_stderr(out, "%s{}\n", str.get());
     }
-    fprintf_stderr(out, "%s}\n", str.get());
-  }
-  else {
-    fprintf_stderr(out, "%s{}\n", str.get());
+#else
+    MOZ_CRASH("old style system disabled");
+#endif
   }
 
   if (aListDescendants) {
+#ifdef MOZ_OLD_STYLE
     if (GeckoStyleContext* gecko = GetAsGecko()) {
       gecko->ListDescendants(out, aIndent);
     }
+#endif
   }
 }
 #endif
 
+#ifdef MOZ_OLD_STYLE
 already_AddRefed<GeckoStyleContext>
 NS_NewStyleContext(GeckoStyleContext* aParentContext,
                    nsAtom* aPseudoTag,
                    CSSPseudoElementType aPseudoType,
                    nsRuleNode* aRuleNode,
                    bool aSkipParentDisplayBasedStyleFixup)
 {
   RefPtr<nsRuleNode> node = aRuleNode;
   RefPtr<GeckoStyleContext> context =
     new (aRuleNode->PresContext())
     GeckoStyleContext(aParentContext, aPseudoTag, aPseudoType, node.forget(),
                    aSkipParentDisplayBasedStyleFixup);
   return context.forget();
 }
+#endif
 
 nsIPresShell*
 nsStyleContext::Arena()
 {
   return PresContext()->PresShell();
 }
 
 template<typename Func>
@@ -569,21 +590,25 @@ nsStyleContext::LookupStruct(const nsACS
   else
     return false;
   return true;
 }
 
 void
 nsStyleContext::FrameAddRef()
 {
+#ifdef MOZ_OLD_STYLE
   if (auto gecko = GetAsGecko()) {
     gecko->FrameAddRef();
   }
+#endif
 }
 
 void
 nsStyleContext::FrameRelease()
 {
+#ifdef MOZ_OLD_STYLE
   if (auto gecko = GetAsGecko()) {
     gecko->FrameRelease();
   }
+#endif
 }
 #endif
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -195,17 +195,19 @@ public:
    * given style struct and it does NOT own that struct.  This can
    * happen because it was inherited from the parent style context, or
    * because it was stored conditionally on the rule node.
    */
   bool HasCachedDependentStyleData(nsStyleStructID aSID) {
     return mBits & GetBitForSID(aSID);
   }
 
+#ifdef MOZ_OLD_STYLE
   inline nsRuleNode* RuleNode();
+#endif
   inline const ServoComputedData* ComputedData();
 
   void AddStyleBit(const uint64_t& aBit) { mBits |= aBit; }
 
   /**
    * Define typesafe getter functions for each style struct by
    * preprocessing the list of style structs.  These functions are the
    * preferred way to get style data.  The macro creates functions like:
@@ -344,16 +346,18 @@ protected:
   {
     return !!(sDependencyTable[aOuterSID] & GetBitForSID(aInnerSID));
   }
 
   static const uint32_t sDependencyTable[];
 #endif
 };
 
+#ifdef MOZ_OLD_STYLE
 already_AddRefed<mozilla::GeckoStyleContext>
 NS_NewStyleContext(mozilla::GeckoStyleContext* aParentContext,
                    nsAtom* aPseudoTag,
                    mozilla::CSSPseudoElementType aPseudoType,
                    nsRuleNode* aRuleNode,
                    bool aSkipParentDisplayBasedStyleFixup);
+#endif
 
 #endif
--- a/layout/style/nsStyleContextInlines.h
+++ b/layout/style/nsStyleContextInlines.h
@@ -19,22 +19,24 @@
 #include "mozilla/GeckoStyleContext.h"
 #include "mozilla/ServoUtils.h"
 #include "mozilla/ServoBindings.h"
 
 MOZ_DEFINE_STYLO_METHODS(nsStyleContext,
                          mozilla::GeckoStyleContext,
                          mozilla::ServoStyleContext);
 
+#ifdef MOZ_OLD_STYLE
 nsRuleNode*
 nsStyleContext::RuleNode()
 {
-    MOZ_RELEASE_ASSERT(IsGecko());
-    return AsGecko()->RuleNode();
+  MOZ_RELEASE_ASSERT(IsGecko());
+  return AsGecko()->RuleNode();
 }
+#endif
 
 const ServoComputedData*
 nsStyleContext::ComputedData()
 {
     MOZ_RELEASE_ASSERT(IsServo());
     return AsServo()->ComputedData();
 }
 
@@ -63,21 +65,20 @@ nsStyleContext::ThreadsafeStyle##name_()
   return Style##name_();                                        \
 }                                                               \
 const nsStyle##name_ * nsStyleContext::PeekStyle##name_() {     \
   return DoGetStyle##name_<false>();                            \
 }
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 
-// Helper functions for GetStyle* and PeekStyle*
-#define STYLE_STRUCT_INHERITED(name_, checkdata_cb_)                \
-template<bool aComputeData>                                         \
-const nsStyle##name_ * nsStyleContext::DoGetStyle##name_() {        \
-  if (auto gecko = GetAsGecko()) {                                  \
+#ifdef MOZ_OLD_STYLE
+#define DO_GET_STYLE_INHERITED_GECKO(name_, checkdata_cb_)          \
+  {                                                                 \
+    auto gecko = AsGecko();                                         \
     const nsStyle##name_ * cachedData =                             \
       static_cast<nsStyle##name_*>(                                 \
         gecko->mCachedInheritedData                                 \
         .mStyleStructs[eStyleStruct_##name_]);                      \
     if (cachedData) /* Have it cached already, yay */               \
       return cachedData;                                            \
     if (!aComputeData) {                                            \
       /* We always cache inherited structs on the context when we */\
@@ -90,16 +91,28 @@ const nsStyle##name_ * nsStyleContext::D
       gecko->RuleNode()->                                           \
         GetStyle##name_<aComputeData>(gecko, mBits);                \
     /* always cache inherited data on the style context; the rule */\
     /* node set the bit in mBits for us if needed. */               \
     gecko->mCachedInheritedData                                     \
       .mStyleStructs[eStyleStruct_##name_] =                        \
       const_cast<nsStyle##name_ *>(newData);                        \
     return newData;                                                 \
+  }
+#else
+#define DO_GET_STYLE_INHERITED_GECKO(name_, checkdata_cb_)          \
+  MOZ_CRASH("old style system disabled");
+#endif
+
+// Helper functions for GetStyle* and PeekStyle*
+#define STYLE_STRUCT_INHERITED(name_, checkdata_cb_)                \
+template<bool aComputeData>                                         \
+const nsStyle##name_ * nsStyleContext::DoGetStyle##name_() {        \
+  if (IsGecko()) {                                                  \
+    DO_GET_STYLE_INHERITED_GECKO(name_, checkdata_cb_)              \
   }                                                                 \
   const bool needToCompute = !(mBits & NS_STYLE_INHERIT_BIT(name_));\
   if (!aComputeData && needToCompute) {                             \
     return nullptr;                                                 \
   }                                                                 \
                                                                     \
   const nsStyle##name_* data = ComputedData()->GetStyle##name_();   \
                                                                     \
@@ -109,30 +122,41 @@ const nsStyle##name_ * nsStyleContext::D
     MOZ_ASSERT(!mozilla::ServoStyleSet::IsInServoTraversal());      \
     const_cast<nsStyle##name_*>(data)->FinishStyle(PresContext());  \
     /* the ServoStyleContext owns the struct */                     \
     AddStyleBit(NS_STYLE_INHERIT_BIT(name_));                       \
   }                                                                 \
   return data;                                                      \
 }
 
-#define STYLE_STRUCT_RESET(name_, checkdata_cb_)                              \
-template<bool aComputeData>                                                   \
-const nsStyle##name_ * nsStyleContext::DoGetStyle##name_() {                  \
-  if (auto* gecko = GetAsGecko()) {                                           \
+#ifdef MOZ_OLD_STYLE
+#define DO_GET_STYLE_RESET_GECKO(name_, checkdata_cb_)                        \
+  {                                                                           \
+    auto gecko = AsGecko();                                                   \
     if (gecko->mCachedResetData) {                                            \
       const nsStyle##name_ * cachedData =                                     \
         static_cast<nsStyle##name_*>(                                         \
           gecko->mCachedResetData->mStyleStructs[eStyleStruct_##name_]);      \
       if (cachedData) /* Have it cached already, yay */                       \
         return cachedData;                                                    \
     }                                                                         \
     /* Have the rulenode deal */                                              \
     AUTO_CHECK_DEPENDENCY(gecko, eStyleStruct_##name_);                       \
     return gecko->RuleNode()->GetStyle##name_<aComputeData>(gecko);           \
+  }
+#else
+#define DO_GET_STYLE_RESET_GECKO(name_, checkdata_cb_)                        \
+  MOZ_CRASH("old style system disabled");
+#endif
+
+#define STYLE_STRUCT_RESET(name_, checkdata_cb_)                              \
+template<bool aComputeData>                                                   \
+const nsStyle##name_ * nsStyleContext::DoGetStyle##name_() {                  \
+  if (IsGecko()) {                                                            \
+    DO_GET_STYLE_RESET_GECKO(name_, checkdata_cb_)                            \
   }                                                                           \
   const bool needToCompute = !(mBits & NS_STYLE_INHERIT_BIT(name_));          \
   if (!aComputeData && needToCompute) {                                       \
     return nullptr;                                                           \
   }                                                                           \
   const nsStyle##name_* data = ComputedData()->GetStyle##name_();             \
   /* perform any remaining main thread work on the struct */                  \
   if (needToCompute) {                                                        \
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -4713,17 +4713,19 @@ nsStyleVariables::nsStyleVariables()
 }
 
 nsStyleVariables::nsStyleVariables(const nsPresContext* aContext)
 {
   MOZ_COUNT_CTOR(nsStyleVariables);
 }
 
 nsStyleVariables::nsStyleVariables(const nsStyleVariables& aSource)
+#ifdef MOZ_OLD_STYLE
   : mVariables(aSource.mVariables)
+#endif
 {
   MOZ_COUNT_CTOR(nsStyleVariables);
 }
 
 nsStyleVariables::~nsStyleVariables()
 {
   MOZ_COUNT_DTOR(nsStyleVariables);
 }
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -3633,16 +3633,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   float            mStopOpacity;      // [reset]
   float            mFloodOpacity;     // [reset]
 
   uint8_t          mDominantBaseline; // [reset] see nsStyleConsts.h
   uint8_t          mVectorEffect;     // [reset] see nsStyleConsts.h
   uint8_t          mMaskType;         // [reset] see nsStyleConsts.h
 };
 
+// XXX This can be removed once the old style system is gone.
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVariables
 {
   nsStyleVariables();
   explicit nsStyleVariables(const nsPresContext* aContext);
   nsStyleVariables(const nsStyleVariables& aSource);
   ~nsStyleVariables();
   void FinishStyle(nsPresContext* aPresContext) {}
   const static bool kHasFinishStyle = false;
@@ -3655,17 +3656,19 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
   void Destroy(nsPresContext* aContext) {
     this->~nsStyleVariables();
     aContext->PresShell()->
       FreeByObjectID(mozilla::eArenaObjectID_nsStyleVariables, this);
   }
 
   nsChangeHint CalcDifference(const nsStyleVariables& aNewData) const;
 
+#ifdef MOZ_OLD_STYLE
   mozilla::CSSVariableValues mVariables;
+#endif
 };
 
 struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleEffects
 {
   explicit nsStyleEffects(const nsPresContext* aContext);
   nsStyleEffects(const nsStyleEffects& aSource);
   ~nsStyleEffects();
   void FinishStyle(nsPresContext* aPresContext) {}
--- a/layout/style/nsStyleTransformMatrix.cpp
+++ b/layout/style/nsStyleTransformMatrix.cpp
@@ -157,39 +157,47 @@ ProcessTranslatePart(const nsCSSValue& a
     // function have already been computed to pixels and percents.
     //
     // Raw numbers are treated as being pixels.
     //
     // Don't convert to aValue to AppUnits here to avoid precision issues.
     return aValue.GetFloatValue();
   } else if (aValue.IsCalcUnit()) {
     if (aContext) {
+#ifdef MOZ_OLD_STYLE
       // Gecko backend
       nsRuleNode::ComputedCalc result =
         nsRuleNode::SpecifiedCalcToComputedCalc(aValue, aContext, aPresContext,
                                                 aConditions);
       percent = result.mPercent;
       offset = result.mLength;
+#else
+      MOZ_CRASH("old style system disabled");
+#endif
     } else {
       // Servo backend. We can retrieve the Calc value directly because it has
       // been computed from Servo side and set by nsCSSValue::SetCalcValue().
       // We don't use nsRuleNode::SpecifiedCalcToComputedCalc() because it
       // asserts for null context and we always pass null context for Servo
       // backend.
       nsStyleCoord::CalcValue calc = aValue.GetCalcValue();
       percent = calc.mPercent;
       offset = calc.mLength;
     }
   } else {
     // Note: The unit of nsCSSValue passed from Servo side would be number,
     //       pixel, percent, or eCSSUnit_Calc, so it is impossible to go into
     //       this branch.
+#ifdef MOZ_OLD_STYLE
     MOZ_ASSERT(aContext, "We need a valid context to compute the length");
     offset = nsRuleNode::CalcLength(aValue, aContext, aPresContext,
                                     aConditions);
+#else
+    MOZ_CRASH("unexpected unit in ProcessTranslatePart");
+#endif
   }
 
   float translation =
     NSAppUnitsToFloatPixels(offset, nsPresContext::AppUnitsPerCSSPixel());
   // We want to avoid calling aDimensionGetter if there's no percentage to be
   // resolved (for performance reasons - see TransformReferenceBox).
   if (percent != 0.0f && aRefBox && !aRefBox->IsEmpty()) {
     translation +=
@@ -535,17 +543,21 @@ ProcessMatrixOperator(Matrix4x4& aMatrix
 
     Matrix4x4 matrix;
     if (!list) {
       return matrix;
     }
 
     float appUnitPerCSSPixel = nsPresContext::AppUnitsPerCSSPixel();
     matrix = nsStyleTransformMatrix::ReadTransforms(list,
+#ifdef MOZ_OLD_STYLE
                                                     aContext,
+#else
+                                                    nullptr,
+#endif
                                                     aPresContext,
                                                     aConditions,
                                                     aRefBox,
                                                     appUnitPerCSSPixel,
                                                     aContains3dTransform);
     return matrix;
   };
 
@@ -1017,19 +1029,22 @@ ReadTransforms(const nsCSSValueList* aLi
                nsStyleContext* aContext,
                nsPresContext* aPresContext,
                RuleNodeCacheConditions& aConditions,
                TransformReferenceBox& aRefBox,
                float aAppUnitsPerMatrixUnit,
                bool* aContains3dTransform)
 {
   Matrix4x4 result;
-  GeckoStyleContext* contextIfGecko = aContext
-                                      ? aContext->GetAsGecko()
-                                      : nullptr;
+  GeckoStyleContext* contextIfGecko =
+#ifdef MOZ_OLD_STYLE
+    aContext ? aContext->GetAsGecko() : nullptr;
+#else
+    nullptr;
+#endif
 
   for (const nsCSSValueList* curr = aList; curr != nullptr; curr = curr->mNext) {
     const nsCSSValue &currElem = curr->mValue;
     if (currElem.GetUnit() != eCSSUnit_Function) {
       NS_ASSERTION(currElem.GetUnit() == eCSSUnit_None &&
                    !aList->mNext,
                    "stream should either be a list of functions or a "
                    "lone None");
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -440,26 +440,28 @@ CSSTransition::SetEffectFromStyle(dom::A
 
 ////////////////////////// nsTransitionManager ////////////////////////////
 
 NS_IMPL_CYCLE_COLLECTION(nsTransitionManager, mEventDispatcher)
 
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsTransitionManager, AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsTransitionManager, Release)
 
+#ifdef MOZ_OLD_STYLE
 static inline bool
 ExtractNonDiscreteComputedValue(nsCSSPropertyID aProperty,
                                 GeckoStyleContext* aStyleContext,
                                 AnimationValue& aAnimationValue)
 {
   return (nsCSSProps::kAnimTypeTable[aProperty] != eStyleAnimType_Discrete ||
           aProperty == eCSSProperty_visibility) &&
          StyleAnimationValue::ExtractComputedValue(aProperty, aStyleContext,
                                                    aAnimationValue.mGecko);
 }
+#endif
 
 static inline bool
 ExtractNonDiscreteComputedValue(nsCSSPropertyID aProperty,
                                 const ServoStyleContext* aComputedStyle,
                                 AnimationValue& aAnimationValue)
 {
   if (Servo_Property_IsDiscreteAnimatable(aProperty) &&
       aProperty != eCSSProperty_visibility) {
@@ -467,16 +469,17 @@ ExtractNonDiscreteComputedValue(nsCSSPro
   }
 
   aAnimationValue.mServo =
     Servo_ComputedValues_ExtractAnimationValue(aComputedStyle,
                                                aProperty).Consume();
   return !!aAnimationValue.mServo;
 }
 
+#ifdef MOZ_OLD_STYLE
 void
 nsTransitionManager::StyleContextChanged(dom::Element *aElement,
                                          GeckoStyleContext* aOldStyleContext,
                                          RefPtr<GeckoStyleContext>* aNewStyleContext /* inout */)
 {
   GeckoStyleContext* newStyleContext = *aNewStyleContext;
 
   NS_PRECONDITION(aOldStyleContext->GetPseudo() == newStyleContext->GetPseudo(),
@@ -627,16 +630,17 @@ nsTransitionManager::StyleContextChanged
     // The check of collection->mCheckGeneration against the restyle
     // manager's GetAnimationGeneration() will ensure that we don't go
     // through the rest of this function again when we do.
     mPresContext->EffectCompositor()->PostRestyleForAnimation(aElement,
                                                               pseudoType,
                                                               cascadeLevel);
   }
 }
+#endif
 
 bool
 nsTransitionManager::UpdateTransitions(
   dom::Element *aElement,
   CSSPseudoElementType aPseudoType,
   const ServoStyleContext* aOldStyle,
   const ServoStyleContext* aNewStyle)
 {
@@ -1116,16 +1120,17 @@ nsTransitionManager::ConsiderInitiatingT
   if (effectSet) {
     effectSet->UpdateAnimationGeneration(mPresContext);
   }
 
   *aStartedAny = true;
   aWhichStarted->AddProperty(aProperty);
 }
 
+#ifdef MOZ_OLD_STYLE
 void
 nsTransitionManager::PruneCompletedTransitions(mozilla::dom::Element* aElement,
                                                CSSPseudoElementType aPseudoType,
                                                GeckoStyleContext* aNewStyleContext)
 {
   MOZ_ASSERT(!aElement->IsGeneratedContentContainerForBefore() &&
              !aElement->IsGeneratedContentContainerForAfter());
 
@@ -1164,8 +1169,9 @@ nsTransitionManager::PruneCompletedTrans
   } while (i != 0);
 
   if (collection->mAnimations.IsEmpty()) {
     collection->Destroy();
     // |collection| is now a dangling pointer!
     collection = nullptr;
   }
 }
+#endif
--- a/layout/style/nsTransitionManager.h
+++ b/layout/style/nsTransitionManager.h
@@ -352,16 +352,17 @@ public:
   }
 
   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsTransitionManager)
   NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsTransitionManager)
 
   typedef mozilla::AnimationCollection<mozilla::dom::CSSTransition>
     CSSTransitionCollection;
 
+#ifdef MOZ_OLD_STYLE
   /**
    * StyleContextChanged
    *
    * To be called from RestyleManager::TryInitiatingTransition when the
    * style of an element has changed, to initiate transitions from
    * that style change.  For style contexts with :before and :after
    * pseudos, aElement is expected to be the generated before/after
    * element.
@@ -369,37 +370,40 @@ public:
    * It may modify the new style context (by replacing
    * *aNewStyleContext) to cover up some of the changes for the duration
    * of the restyling of descendants.  If it does, this function will
    * take care of causing the necessary restyle afterwards.
    */
   void StyleContextChanged(mozilla::dom::Element *aElement,
                            mozilla::GeckoStyleContext* aOldStyleContext,
                            RefPtr<mozilla::GeckoStyleContext>* aNewStyleContext /* inout */);
+#endif
 
   /**
    * Update transitions for stylo.
    */
   bool UpdateTransitions(
     mozilla::dom::Element *aElement,
     mozilla::CSSPseudoElementType aPseudoType,
     const mozilla::ServoStyleContext* aOldStyle,
     const mozilla::ServoStyleContext* aNewStyle);
 
+#ifdef MOZ_OLD_STYLE
   /**
    * When we're resolving style for an element that previously didn't have
    * style, we might have some old finished transitions for it, if,
    * say, it was display:none for a while, but previously displayed.
    *
    * This method removes any finished transitions that don't match the
    * new style.
    */
   void PruneCompletedTransitions(mozilla::dom::Element* aElement,
                                  mozilla::CSSPseudoElementType aPseudoType,
                                  mozilla::GeckoStyleContext* aNewStyleContext);
+#endif
 
   void SetInAnimationOnlyStyleUpdate(bool aInAnimationOnlyUpdate) {
     mInAnimationOnlyStyleUpdate = aInAnimationOnlyUpdate;
   }
 
   bool InAnimationOnlyStyleUpdate() const {
     return mInAnimationOnlyStyleUpdate;
   }
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -289,31 +289,33 @@ nsTableColGroupFrame::RemoveFrame(ChildL
     nsTableColFrame* colFrame = (nsTableColFrame*)aOldFrame;
     if (colFrame->GetColType() == eColContent) {
       contentRemoval = true;
       // Remove any anonymous column frames this <col> produced via a colspan
       nsTableColFrame* col = colFrame->GetNextCol();
       nsTableColFrame* nextCol;
       while (col && col->GetColType() == eColAnonymousCol) {
 #ifdef DEBUG
+#ifdef MOZ_OLD_STYLE
         nsIFrame* providerFrame;
         nsStyleContext* psc = colFrame->GetParentStyleContext(&providerFrame);
         if (psc->IsGecko()) {
           // This check code is useful only in Gecko-backed style system.
           if (colFrame->StyleContext()->AsGecko()->GetParent() == psc->AsGecko()) {
             NS_ASSERTION(col->StyleContext() == colFrame->StyleContext() &&
                          col->GetContent() == colFrame->GetContent(),
                          "How did that happen??");
           }
           // else colFrame is being removed because of a frame
           // reconstruct on it, and its style context is still the old
           // one, so we can't assert anything about how it compares to
           // col's style context.
         }
 #endif
+#endif
         nextCol = col->GetNextCol();
         RemoveFrame(kPrincipalList, col);
         col = nextCol;
       }
     }
 
     int32_t colIndex = colFrame->GetColIndex();
     // The RemoveChild call handles calling FrameNeedsReflow on us.
--- a/layout/xul/nsSplitterFrame.cpp
+++ b/layout/xul/nsSplitterFrame.cpp
@@ -285,24 +285,28 @@ nsSplitterFrame::Init(nsIContent*       
   // have a frame at all.  This really needs a better solution.
   if (aParent && aParent->IsXULBoxFrame()) {
     if (!aParent->IsXULHorizontal()) {
       if (!nsContentUtils::HasNonEmptyAttr(aContent, kNameSpaceID_None,
                                            nsGkAtoms::orient)) {
         aContent->AsElement()->SetAttr(kNameSpaceID_None, nsGkAtoms::orient,
                                        NS_LITERAL_STRING("vertical"), false);
         if (StyleContext()->IsGecko()) {
+#ifdef MOZ_OLD_STYLE
           // FIXME(emilio): Even if we did this in Servo, this just won't
           // work, and we'd need a specific "really re-resolve the style" API...
           GeckoStyleContext* parentStyleContext =
             StyleContext()->AsGecko()->GetParent();
           RefPtr<nsStyleContext> newContext = PresContext()->StyleSet()->
             ResolveStyleFor(aContent->AsElement(), parentStyleContext,
                             LazyComputeBehavior::Allow);
           SetStyleContextWithoutNotification(newContext);
+#else
+          MOZ_CRASH("old style system disabled");
+#endif
         }
       }
     }
   }
 
   nsBoxFrame::Init(aContent, aParent, aPrevInFlow);
 
   mInner->mState = nsSplitterFrameInner::Open;