Bug 1464496 - Part 1: Merge ServoDeclarationBlock and DeclarationBlock r=emilio
authorNazım Can Altınova <canaltinova@gmail.com>
Wed, 30 May 2018 18:15:25 +0200
changeset 474866 d6e582ce9bab5ca688a024fb20eeba097ad45dfe
parent 474865 426ab5b84824dc046ad0796b0c4c836f33bd8bbc
child 474867 edc3670ec282285c1757fabe1fb189f52c88dc76
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1464496
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1464496 - Part 1: Merge ServoDeclarationBlock and DeclarationBlock r=emilio MozReview-Commit-ID: By9fV70Oq0K
dom/base/Element.cpp
dom/base/FragmentOrElement.cpp
dom/base/nsAttrValue.cpp
dom/base/nsMappedAttributes.cpp
dom/base/nsStyledElement.cpp
dom/base/nsTreeSanitizer.cpp
dom/html/nsGenericHTMLElement.cpp
dom/smil/nsSMILCSSValueType.cpp
dom/svg/nsSVGElement.cpp
dom/xul/nsXULElement.cpp
editor/libeditor/CSSEditUtils.cpp
layout/style/DeclarationBlock.cpp
layout/style/DeclarationBlock.h
layout/style/DeclarationBlockInlines.h
layout/style/ServoBindings.cpp
layout/style/ServoBindings.toml
layout/style/ServoDeclarationBlock.cpp
layout/style/ServoDeclarationBlock.h
layout/style/ServoFontFaceRule.cpp
layout/style/ServoKeyframeRule.cpp
layout/style/ServoKeyframeRule.h
layout/style/ServoPageRule.cpp
layout/style/ServoPageRule.h
layout/style/ServoStyleRule.cpp
layout/style/ServoStyleRule.h
layout/style/ServoStyleSet.h
layout/style/moz.build
layout/style/nsDOMCSSAttrDeclaration.cpp
layout/style/nsDOMCSSDeclaration.cpp
layout/style/nsHTMLCSSStyleSheet.cpp
layout/style/nsHTMLStyleSheet.h
servo/components/style/gecko/wrapper.rs
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -54,17 +54,17 @@
 #include "mozilla/dom/AnimatableBinding.h"
 #include "mozilla/dom/HTMLDivElement.h"
 #include "mozilla/dom/HTMLSpanElement.h"
 #include "mozilla/dom/KeyframeAnimationOptionsBinding.h"
 #include "mozilla/dom/MutationEventBinding.h"
 #include "mozilla/AnimationComparator.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/ContentEvents.h"
-#include "mozilla/DeclarationBlockInlines.h"
+#include "mozilla/DeclarationBlock.h"
 #include "mozilla/EffectSet.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/InternalMutationEvent.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/RestyleManager.h"
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -11,17 +11,17 @@
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Likely.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/StaticPtr.h"
 
 #include "mozilla/dom/FragmentOrElement.h"
 
 #include "mozilla/AsyncEventDispatcher.h"
-#include "mozilla/DeclarationBlockInlines.h"
+#include "mozilla/DeclarationBlock.h"
 #include "mozilla/EffectSet.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/HTMLEditor.h"
 #include "mozilla/RestyleManager.h"
 #include "mozilla/TextEditor.h"
 #include "mozilla/TouchEvents.h"
--- a/dom/base/nsAttrValue.cpp
+++ b/dom/base/nsAttrValue.cpp
@@ -15,17 +15,17 @@
 #include "nsAttrValue.h"
 #include "nsAttrValueInlines.h"
 #include "nsAtom.h"
 #include "nsUnicharUtils.h"
 #include "mozilla/CORSMode.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/ServoBindingTypes.h"
 #include "mozilla/ServoUtils.h"
-#include "mozilla/DeclarationBlockInlines.h"
+#include "mozilla/DeclarationBlock.h"
 #include "nsContentUtils.h"
 #include "nsReadableUtils.h"
 #include "nsHTMLCSSStyleSheet.h"
 #include "nsStyledElement.h"
 #include "nsIURI.h"
 #include "nsIDocument.h"
 #include <algorithm>
 
@@ -1696,17 +1696,17 @@ nsAttrValue::ParseStyleAttribute(const n
       NS_ADDREF(cont);
       SetPtrValueAndType(cont, eOtherBase);
       return true;
     }
   }
 
   RefPtr<URLExtraData> data = new URLExtraData(baseURI, docURI,
                                                 principal);
-  RefPtr<DeclarationBlock> decl = ServoDeclarationBlock::
+  RefPtr<DeclarationBlock> decl = DeclarationBlock::
     FromCssText(aString, data,
                 ownerDoc->GetCompatibilityMode(),
                 ownerDoc->CSSLoader());
   if (!decl) {
     return false;
   }
   decl->SetHTMLCSSStyleSheet(sheet);
   SetTo(decl.forget(), &aString);
@@ -1944,17 +1944,17 @@ nsAttrValue::SizeOfExcludingThis(MallocS
           static_cast<ValueBaseType>(container->mStringBits & NS_ATTRVALUE_BASETYPE_MASK) == eStringBase) {
         nsStringBuffer* str = static_cast<nsStringBuffer*>(otherPtr);
         n += str ? str->SizeOfIncludingThisIfUnshared(aMallocSizeOf) : 0;
       }
 
       if (Type() == eCSSDeclaration && container->mValue.mCSSDeclaration) {
         // TODO: mCSSDeclaration might be owned by another object which
         //       would make us count them twice, bug 677493.
-        // Bug 1281964: For ServoDeclarationBlock if we do measure we'll
+        // Bug 1281964: For DeclarationBlock if we do measure we'll
         // need a way to call the Servo heap_size_of function.
         //n += container->mCSSDeclaration->SizeOfIncludingThis(aMallocSizeOf);
       } else if (Type() == eAtomArray && container->mValue.mAtomArray) {
         // Don't measure each nsAtom, they are measured separatly.
         n += container->mValue.mAtomArray->ShallowSizeOfIncludingThis(aMallocSizeOf);
       }
       break;
     }
--- a/dom/base/nsMappedAttributes.cpp
+++ b/dom/base/nsMappedAttributes.cpp
@@ -6,20 +6,20 @@
 
 /*
  * A unique per-element set of attributes that is used as an
  * nsIStyleRule; used to implement presentational attributes.
  */
 
 #include "nsMappedAttributes.h"
 #include "nsHTMLStyleSheet.h"
+#include "mozilla/DeclarationBlock.h"
 #include "mozilla/GenericSpecifiedValues.h"
 #include "mozilla/HashFunctions.h"
 #include "mozilla/MemoryReporting.h"
-#include "mozilla/ServoDeclarationBlock.h"
 #include "mozilla/ServoSpecifiedValues.h"
 
 using namespace mozilla;
 
 bool
 nsMappedAttributes::sShuttingDown = false;
 nsTArray<void*>*
 nsMappedAttributes::sCachedMappedAttributeAllocations = nullptr;
@@ -49,17 +49,17 @@ nsMappedAttributes::nsMappedAttributes(n
   MOZ_ASSERT(mRefCnt == 0); // Ensure caching works as expected.
 }
 
 nsMappedAttributes::nsMappedAttributes(const nsMappedAttributes& aCopy)
   : mAttrCount(aCopy.mAttrCount),
     mSheet(aCopy.mSheet),
     mRuleMapper(aCopy.mRuleMapper),
     // This is only called by ::Clone, which is used to create independent
-    // nsMappedAttributes objects which should not share a ServoDeclarationBlock
+    // nsMappedAttributes objects which should not share a DeclarationBlock
     mServoStyle(nullptr)
 {
   NS_ASSERTION(mBufferSize >= aCopy.mAttrCount, "can't fit attributes");
   MOZ_ASSERT(mRefCnt == 0); // Ensure caching works as expected.
 
   uint32_t i;
   for (i = 0; i < mAttrCount; ++i) {
     new (&Attrs()[i]) InternalAttr(aCopy.Attrs()[i]);
--- a/dom/base/nsStyledElement.cpp
+++ b/dom/base/nsStyledElement.cpp
@@ -12,17 +12,17 @@
 #include "mozilla/dom/ElementInlines.h"
 #include "mozilla/dom/MutationEventBinding.h"
 #include "mozilla/InternalMutationEvent.h"
 #include "mozilla/StaticPrefs.h"
 #include "nsDOMCSSDeclaration.h"
 #include "nsDOMCSSAttrDeclaration.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIDocument.h"
-#include "mozilla/DeclarationBlockInlines.h"
+#include "mozilla/DeclarationBlock.h"
 #include "mozilla/css/Loader.h"
 #include "nsXULElement.h"
 #include "nsContentUtils.h"
 #include "nsStyleUtil.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
--- a/dom/base/nsTreeSanitizer.cpp
+++ b/dom/base/nsTreeSanitizer.cpp
@@ -4,18 +4,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsTreeSanitizer.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/BindingStyleRule.h"
 #include "mozilla/DeclarationBlock.h"
-#include "mozilla/DeclarationBlockInlines.h"
-#include "mozilla/ServoDeclarationBlock.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/css/Rule.h"
 #include "mozilla/dom/CSSRuleList.h"
 #include "mozilla/dom/DocumentFragment.h"
 #include "mozilla/dom/SRIMetadata.h"
 #include "nsCSSPropertyID.h"
 #include "nsUnicharInputStream.h"
 #include "nsAttrName.h"
@@ -1171,17 +1169,17 @@ nsTreeSanitizer::SanitizeAttributes(mozi
 
     if (kNameSpaceID_None == attrNs) {
       if (aAllowStyle && nsGkAtoms::style == attrLocal) {
         nsAutoString value;
         aElement->GetAttr(attrNs, attrLocal, value);
         nsIDocument* document = aElement->OwnerDoc();
         RefPtr<URLExtraData> urlExtra(aElement->GetURLDataForStyleAttr());
         RefPtr<DeclarationBlock> decl =
-          ServoDeclarationBlock::FromCssText(
+          DeclarationBlock::FromCssText(
             value,
             urlExtra,
             document->GetCompatibilityMode(),
             document->CSSLoader());
         if (decl) {
           if (SanitizeStyleDeclaration(decl)) {
             nsAutoString cleanValue;
             decl->ToString(cleanValue);
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/ArrayUtils.h"
-#include "mozilla/DeclarationBlockInlines.h"
+#include "mozilla/DeclarationBlock.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/GenericSpecifiedValuesInlines.h"
 #include "mozilla/Likely.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/TextEditor.h"
--- a/dom/smil/nsSMILCSSValueType.cpp
+++ b/dom/smil/nsSMILCSSValueType.cpp
@@ -11,19 +11,18 @@
 #include "nsComputedDOMStyle.h"
 #include "nsString.h"
 #include "nsSMILParserUtils.h"
 #include "nsSMILValue.h"
 #include "nsCSSProps.h"
 #include "nsCSSValue.h"
 #include "nsColor.h"
 #include "nsPresContext.h"
-#include "mozilla/DeclarationBlockInlines.h"
+#include "mozilla/DeclarationBlock.h"
 #include "mozilla/ServoBindings.h"
-#include "mozilla/ServoDeclarationBlock.h"
 #include "mozilla/StyleAnimationValue.h" // For AnimationValue
 #include "mozilla/ServoCSSParser.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/dom/BaseKeyframeTypesBinding.h" // For CompositeOperation
 #include "mozilla/dom/Element.h"
 #include "nsDebug.h"
 #include "nsStyleUtil.h"
 #include "nsIDocument.h"
@@ -589,17 +588,17 @@ nsSMILCSSValueType::SetPropertyValues(co
   if (!wrapper) {
     return false;
   }
 
   bool changed = false;
   for (const auto& value : wrapper->mServoValues) {
     changed |=
       Servo_DeclarationBlock_SetPropertyToAnimationValue(
-        aDecl.AsServo()->Raw(), value);
+        aDecl.Raw(), value);
   }
 
   return changed;
 }
 
 // static
 nsCSSPropertyID
 nsSMILCSSValueType::PropertyFromValue(const nsSMILValue& aValue)
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -48,17 +48,16 @@
 #include "nsQueryObject.h"
 #include <stdarg.h>
 #include "SVGMotionSMILAttr.h"
 #include "nsAttrValueOrString.h"
 #include "nsSMILAnimationController.h"
 #include "mozilla/dom/MutationEventBinding.h"
 #include "mozilla/dom/SVGElementBinding.h"
 #include "mozilla/DeclarationBlock.h"
-#include "mozilla/DeclarationBlockInlines.h"
 #include "mozilla/Unused.h"
 #include "mozilla/RestyleManager.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::dom::SVGUnitTypesBinding;
 
 // This is needed to ensure correct handling of calls to the
@@ -1183,31 +1182,31 @@ MappedAttrParser::~MappedAttrParser()
              "GetDeclarationBlock (and had its pointer cleared)");
 }
 
 void
 MappedAttrParser::ParseMappedAttrValue(nsAtom* aMappedAttrName,
                                        const nsAString& aMappedAttrValue)
 {
   if (!mDecl) {
-    mDecl = new ServoDeclarationBlock();
+    mDecl = new DeclarationBlock();
   }
 
   // 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.
     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,
+      mDecl->Raw(), propertyID, &value, false, data,
       ParsingMode::AllowUnitlessLength, mElement->OwnerDoc()->GetCompatibilityMode(), mLoader);
 
     if (changed) {
       // The normal reporting of use counters by the nsCSSParser won't happen
       // since it doesn't have a sheet.
       if (nsCSSProps::IsShorthand(propertyID)) {
         CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subprop, propertyID,
                                              CSSEnabledState::eForAllContent) {
@@ -1226,17 +1225,17 @@ 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;
     RefPtr<nsAtom> atom = NS_Atomize(aMappedAttrValue);
-    Servo_DeclarationBlock_SetIdentStringValue(mDecl->AsServo()->Raw(), propertyID, atom);
+    Servo_DeclarationBlock_SetIdentStringValue(mDecl->Raw(), propertyID, atom);
   }
 }
 
 already_AddRefed<DeclarationBlock>
 MappedAttrParser::GetDeclarationBlock()
 {
   return mDecl.forget();
 }
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -13,17 +13,17 @@
 #include "nsIDOMXULCommandDispatcher.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsIDocument.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
-#include "mozilla/DeclarationBlockInlines.h"
+#include "mozilla/DeclarationBlock.h"
 #include "nsFocusManager.h"
 #include "nsHTMLStyleSheet.h"
 #include "nsNameSpaceManager.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
 #include "nsIPresShell.h"
 #include "nsIPrincipal.h"
 #include "nsIScriptContext.h"
@@ -2318,17 +2318,17 @@ nsXULPrototypeElement::SetAttrAt(uint32_
           mNodeInfo->NodeInfoManager()->DocumentPrincipal();
         // XXX Get correct Base URI (need GetBaseURI on *prototype* element)
         // TODO: If we implement Content Security Policy for chrome documents
         // as has been discussed, the CSP should be checked here to see if
         // inline styles are allowed to be applied.
         RefPtr<URLExtraData> data =
           new URLExtraData(aDocumentURI, aDocumentURI, principal);
         RefPtr<DeclarationBlock> declaration =
-          ServoDeclarationBlock::FromCssText(
+          DeclarationBlock::FromCssText(
             aValue, data, eCompatibility_FullStandards, nullptr);
         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/editor/libeditor/CSSEditUtils.cpp
+++ b/editor/libeditor/CSSEditUtils.cpp
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/CSSEditUtils.h"
 
 #include "mozilla/Assertions.h"
 #include "mozilla/ChangeStyleTransaction.h"
 #include "mozilla/HTMLEditor.h"
 #include "mozilla/Preferences.h"
-#include "mozilla/DeclarationBlockInlines.h"
+#include "mozilla/DeclarationBlock.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/mozalloc.h"
 #include "nsAString.h"
 #include "nsCOMPtr.h"
 #include "nsCSSProps.h"
 #include "nsColor.h"
 #include "nsComputedDOMStyle.h"
 #include "nsDebug.h"
new file mode 100644
--- /dev/null
+++ b/layout/style/DeclarationBlock.cpp
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/DeclarationBlock.h"
+
+#include "mozilla/ServoBindings.h"
+
+#include "nsCSSProps.h"
+
+namespace mozilla {
+
+/* static */ already_AddRefed<DeclarationBlock>
+DeclarationBlock::FromCssText(const nsAString& aCssText,
+                              URLExtraData* aExtraData,
+                              nsCompatibility aMode,
+                              css::Loader* aLoader)
+{
+  NS_ConvertUTF16toUTF8 value(aCssText);
+  RefPtr<RawServoDeclarationBlock>
+      raw = Servo_ParseStyleAttribute(&value, aExtraData, aMode, aLoader).Consume();
+  RefPtr<DeclarationBlock> decl = new DeclarationBlock(raw.forget());
+  return decl.forget();
+}
+
+// TODO: We can make them inline.
+void
+DeclarationBlock::GetPropertyValue(const nsAString& aProperty,
+                                   nsAString& aValue) const
+{
+  NS_ConvertUTF16toUTF8 property(aProperty);
+  Servo_DeclarationBlock_GetPropertyValue(mRaw, &property, &aValue);
+}
+
+void
+DeclarationBlock::GetPropertyValueByID(nsCSSPropertyID aPropID,
+                                       nsAString& aValue) const
+{
+  Servo_DeclarationBlock_GetPropertyValueById(mRaw, aPropID, &aValue);
+}
+
+bool
+DeclarationBlock::GetPropertyIsImportant(const nsAString& aProperty) const
+{
+  NS_ConvertUTF16toUTF8 property(aProperty);
+  return Servo_DeclarationBlock_GetPropertyIsImportant(mRaw, &property);
+}
+
+bool
+DeclarationBlock::RemoveProperty(const nsAString& aProperty)
+{
+  AssertMutable();
+  NS_ConvertUTF16toUTF8 property(aProperty);
+  return Servo_DeclarationBlock_RemoveProperty(mRaw, &property);
+}
+
+bool
+DeclarationBlock::RemovePropertyByID(nsCSSPropertyID aPropID)
+{
+  AssertMutable();
+  return Servo_DeclarationBlock_RemovePropertyById(mRaw, aPropID);
+}
+
+} // namespace mozilla
--- a/layout/style/DeclarationBlock.h
+++ b/layout/style/DeclarationBlock.h
@@ -8,51 +8,58 @@
  * representation of a declaration block in a CSS stylesheet, or of
  * a style attribute
  */
 
 #ifndef mozilla_DeclarationBlock_h
 #define mozilla_DeclarationBlock_h
 
 #include "mozilla/Atomics.h"
-#include "mozilla/ServoUtils.h"
+#include "mozilla/ServoBindings.h"
 
 #include "nsCSSPropertyID.h"
 
 class nsHTMLCSSStyleSheet;
 
 namespace mozilla {
 
-class ServoDeclarationBlock;
-
 namespace css {
 class Declaration;
 class Rule;
 } // namespace css
 
-class DeclarationBlock
+class DeclarationBlock final
 {
-protected:
-  DeclarationBlock()
+public:
+  explicit DeclarationBlock(
+    already_AddRefed<RawServoDeclarationBlock> aRaw)
     : mImmutable(false)
     , mIsDirty(false)
+    , mRaw(aRaw)
   {
     mContainer.mRaw = 0;
   }
 
-  DeclarationBlock(const DeclarationBlock& aCopy)
-    : DeclarationBlock() {}
+  DeclarationBlock()
+    : DeclarationBlock(Servo_DeclarationBlock_CreateEmpty().Consume()) {}
 
-public:
-  MOZ_DECL_STYLO_METHODS(css::Declaration, ServoDeclarationBlock)
+  DeclarationBlock(const DeclarationBlock& aCopy)
+    : mImmutable(false)
+    , mIsDirty(false)
+    , mRaw(Servo_DeclarationBlock_Clone(aCopy.mRaw).Consume())
+  {
+    mContainer.mRaw = 0;
+  }
 
-  inline MozExternalRefCountType AddRef();
-  inline MozExternalRefCountType Release();
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DeclarationBlock)
 
-  inline already_AddRefed<DeclarationBlock> Clone() const;
+  inline already_AddRefed<DeclarationBlock> Clone() const
+  {
+    return do_AddRef(new DeclarationBlock(*this));
+  }
 
   /**
    * Return whether |this| may be modified.
    */
   bool IsMutable() const {
     return !mImmutable;
   }
 
@@ -82,17 +89,33 @@ public:
   /**
    * Mark this declaration as not dirty.
    */
   void UnsetDirty() { mIsDirty = false; }
 
   /**
    * Copy |this|, if necessary to ensure that it can be modified.
    */
-  inline already_AddRefed<DeclarationBlock> EnsureMutable();
+  inline already_AddRefed<DeclarationBlock>
+  EnsureMutable()
+  {
+    if (!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();
+    }
+
+    if (!IsMutable()) {
+      return Clone();
+    }
+    return do_AddRef(this);
+  }
 
   void SetOwningRule(css::Rule* aRule) {
     MOZ_ASSERT(!mContainer.mOwningRule || !aRule,
                "should never overwrite one rule with another");
     mContainer.mOwningRule = aRule;
   }
 
   css::Rule* GetOwningRule() const {
@@ -115,32 +138,65 @@ public:
     if (!(mContainer.mRaw & 0x1)) {
       return nullptr;
     }
     auto c = mContainer;
     c.mRaw &= ~uintptr_t(1);
     return c.mHTMLCSSStyleSheet;
   }
 
-  inline void ToString(nsAString& aString) const;
+  static already_AddRefed<DeclarationBlock>
+  FromCssText(const nsAString& aCssText, URLExtraData* aExtraData,
+              nsCompatibility aMode, css::Loader* aLoader);
 
-  inline uint32_t Count() const;
-  inline bool GetNthProperty(uint32_t aIndex, nsAString& aReturn) const;
+  RawServoDeclarationBlock* Raw() const { return mRaw; }
+  RawServoDeclarationBlock* const* RefRaw() const
+  {
+    static_assert(sizeof(RefPtr<RawServoDeclarationBlock>) ==
+                  sizeof(RawServoDeclarationBlock*),
+                  "RefPtr should just be a pointer");
+    return reinterpret_cast<RawServoDeclarationBlock* const*>(&mRaw);
+  }
 
-  inline void GetPropertyValue(const nsAString& aProperty,
-                               nsAString& aValue) const;
-  inline void GetPropertyValueByID(nsCSSPropertyID aPropID,
-                                   nsAString& aValue) const;
-  inline bool GetPropertyIsImportant(const nsAString& aProperty) const;
+  const RawServoDeclarationBlockStrong* RefRawStrong() const
+  {
+    static_assert(sizeof(RefPtr<RawServoDeclarationBlock>) ==
+                  sizeof(RawServoDeclarationBlock*),
+                  "RefPtr should just be a pointer");
+    static_assert(sizeof(RefPtr<RawServoDeclarationBlock>) ==
+                  sizeof(RawServoDeclarationBlockStrong),
+                  "RawServoDeclarationBlockStrong should be the same as RefPtr");
+    return reinterpret_cast<const RawServoDeclarationBlockStrong*>(&mRaw);
+  }
+
+  void ToString(nsAString& aResult) const {
+    Servo_DeclarationBlock_GetCssText(mRaw, &aResult);
+  }
+
+  uint32_t Count() const {
+    return Servo_DeclarationBlock_Count(mRaw);
+  }
+
+  bool GetNthProperty(uint32_t aIndex, nsAString& aReturn) const {
+    aReturn.Truncate();
+    return Servo_DeclarationBlock_GetNthProperty(mRaw, aIndex, &aReturn);
+  }
+
+  void GetPropertyValue(const nsAString& aProperty,
+                        nsAString& aValue) const;
+  void GetPropertyValueByID(nsCSSPropertyID aPropID,
+                            nsAString& aValue) const;
+  bool GetPropertyIsImportant(const nsAString& aProperty) const;
   // Returns whether the property was removed.
-  inline bool RemoveProperty(const nsAString& aProperty);
+  bool RemoveProperty(const nsAString& aProperty);
   // Returns whether the property was removed.
-  inline bool RemovePropertyByID(nsCSSPropertyID aProperty);
+  bool RemovePropertyByID(nsCSSPropertyID aProperty);
 
 private:
+  ~DeclarationBlock() = default;
   union {
     // We only ever have one of these since we have an
     // nsHTMLCSSStyleSheet only for style attributes, and style
     // attributes never have an owning rule.
 
     // It's an nsHTMLCSSStyleSheet if the low bit is set.
 
     uintptr_t mRaw;
@@ -163,13 +219,15 @@ private:
   // Note that although a single DeclarationBlock can be shared between
   // different rule nodes (due to the style="" attribute cache), whenever a
   // DeclarationBlock has its mIsDirty flag set to true, we always clone it to
   // a unique object first. So when we clear this flag during Servo traversal,
   // we know that we are clearing it on a DeclarationBlock that has a single
   // reference, and there is no problem with another user of the same
   // DeclarationBlock thinking that it is not dirty.
   Atomic<bool, MemoryOrdering::Relaxed> mIsDirty;
+
+  RefPtr<RawServoDeclarationBlock> mRaw;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_DeclarationBlock_h
deleted file mode 100644
--- a/layout/style/DeclarationBlockInlines.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_DeclarationBlockInlines_h
-#define mozilla_DeclarationBlockInlines_h
-
-#include "mozilla/ServoDeclarationBlock.h"
-
-namespace mozilla {
-
-MOZ_DEFINE_STYLO_METHODS(DeclarationBlock, css::Declaration, ServoDeclarationBlock)
-
-MozExternalRefCountType
-DeclarationBlock::AddRef()
-{
-  MOZ_STYLO_FORWARD(AddRef, ())
-}
-
-MozExternalRefCountType
-DeclarationBlock::Release()
-{
-  MOZ_STYLO_FORWARD(Release, ())
-}
-
-already_AddRefed<DeclarationBlock>
-DeclarationBlock::Clone() const
-{
-  return do_AddRef(new ServoDeclarationBlock(*AsServo()));
-}
-
-already_AddRefed<DeclarationBlock>
-DeclarationBlock::EnsureMutable()
-{
-  if (!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();
-  }
-
-  if (!IsMutable()) {
-    return Clone();
-  }
-  return do_AddRef(this);
-}
-
-void
-DeclarationBlock::ToString(nsAString& aString) const
-{
-  MOZ_STYLO_FORWARD(ToString, (aString))
-}
-
-uint32_t
-DeclarationBlock::Count() const
-{
-  MOZ_STYLO_FORWARD(Count, ())
-}
-
-bool
-DeclarationBlock::GetNthProperty(uint32_t aIndex, nsAString& aReturn) const
-{
-  MOZ_STYLO_FORWARD(GetNthProperty, (aIndex, aReturn))
-}
-
-void
-DeclarationBlock::GetPropertyValue(const nsAString& aProperty,
-                                   nsAString& aValue) const
-{
-  MOZ_STYLO_FORWARD(GetPropertyValue, (aProperty, aValue))
-}
-
-void
-DeclarationBlock::GetPropertyValueByID(nsCSSPropertyID aPropID,
-                                       nsAString& aValue) const
-{
-  MOZ_STYLO_FORWARD(GetPropertyValueByID, (aPropID, aValue))
-}
-
-bool
-DeclarationBlock::GetPropertyIsImportant(const nsAString& aProperty) const
-{
-  MOZ_STYLO_FORWARD(GetPropertyIsImportant, (aProperty))
-}
-
-bool
-DeclarationBlock::RemoveProperty(const nsAString& aProperty)
-{
-  MOZ_STYLO_FORWARD(RemoveProperty, (aProperty))
-}
-
-bool
-DeclarationBlock::RemovePropertyByID(nsCSSPropertyID aProperty)
-{
-  MOZ_STYLO_FORWARD(RemovePropertyByID, (aProperty))
-}
-
-} // namespace mozilla
-
-#endif // mozilla_DeclarationBlockInlines_h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -42,17 +42,17 @@
 #include "nsStyleStruct.h"
 #include "nsStyleUtil.h"
 #include "nsSVGElement.h"
 #include "nsTArray.h"
 #include "nsTransitionManager.h"
 #include "nsWindowSizes.h"
 
 #include "mozilla/CORSMode.h"
-#include "mozilla/DeclarationBlockInlines.h"
+#include "mozilla/DeclarationBlock.h"
 #include "mozilla/EffectCompositor.h"
 #include "mozilla/EffectSet.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/FontPropertyTypes.h"
 #include "mozilla/Keyframe.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ServoElementSnapshot.h"
@@ -386,17 +386,17 @@ Gecko_HaveSeenPtr(SeenPtrs* aTable, cons
 
 RawServoDeclarationBlockStrongBorrowedOrNull
 Gecko_GetStyleAttrDeclarationBlock(RawGeckoElementBorrowed aElement)
 {
   DeclarationBlock* decl = aElement->GetInlineStyleDeclaration();
   if (!decl) {
     return nullptr;
   }
-  return decl->AsServo()->RefRawStrong();
+  return decl->RefRawStrong();
 }
 
 void
 Gecko_UnsetDirtyStyleAttr(RawGeckoElementBorrowed aElement)
 {
   DeclarationBlock* decl = aElement->GetInlineStyleDeclaration();
   if (!decl) {
     return;
@@ -416,17 +416,17 @@ AsRefRawStrong(const RefPtr<RawServoDecl
 RawServoDeclarationBlockStrongBorrowedOrNull
 Gecko_GetHTMLPresentationAttrDeclarationBlock(RawGeckoElementBorrowed aElement)
 {
   const nsMappedAttributes* attrs = aElement->GetMappedAttributes();
   if (!attrs) {
     auto* svg = nsSVGElement::FromNodeOrNull(aElement);
     if (svg) {
       if (auto decl = svg->GetContentDeclarationBlock()) {
-        return decl->AsServo()->RefRawStrong();
+        return decl->RefRawStrong();
       }
     }
     return nullptr;
   }
 
   return AsRefRawStrong(attrs->GetServoStyle());
 }
 
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -50,16 +50,17 @@ args = [
 headers = [
     "nsStyleStruct.h",
     "mozilla/StyleAnimationValue.h",
     "gfxFontConstants.h",
     "gfxFontFeatures.h",
     "nsThemeConstants.h",
     "mozilla/css/Loader.h",
     "mozilla/css/SheetLoadData.h",
+    "mozilla/DeclarationBlock.h",
     "mozilla/dom/AnimationEffectBinding.h",
     "mozilla/dom/HTMLSlotElement.h",
     "mozilla/dom/KeyframeEffectBinding.h",
     "mozilla/dom/MediaList.h",
     "mozilla/dom/ShadowRoot.h",
     "mozilla/AnimationPropertySegment.h",
     "mozilla/ComputedTiming.h",
     "mozilla/ComputedTimingFunction.h",
@@ -69,17 +70,16 @@ headers = [
     "mozilla/css/ErrorReporter.h",
     "mozilla/dom/Element.h",
     "mozilla/dom/ChildIterator.h",
     "mozilla/dom/NameSpaceConstants.h",
     "mozilla/LookAndFeel.h",
     "mozilla/StaticPrefs.h",
     "mozilla/ServoBindings.h",
     "mozilla/ComputedStyle.h",
-    "mozilla/ServoDeclarationBlock.h",
     "mozilla/ServoTraversalStatistics.h",
     "mozilla/SizeOfState.h",
     "nsCSSProps.h",
     "nsContentUtils.h",
     "nsNameSpaceManager.h",
     "nsMediaFeatures.h",
     "nsXBLBinding.h",
 ]
@@ -354,22 +354,22 @@ whitelist-types = [
     "StaticRefPtr",
     "StyleAnimation",
     "StyleBasicShapeType",
     "StyleGeometryBox",
     "StyleShapeSource",
     "StyleTransition",
     "ThemeWidgetType",
     "mozilla::UniquePtr",
+    "mozilla::DeclarationBlock",
     "mozilla::DefaultDelete",
     "mozilla::Side",
     "mozilla::binding_danger::AssertAndSuppressCleanupPolicy",
     "mozilla::ParsingMode",
     "mozilla::InheritTarget",
-    "mozilla::ServoDeclarationBlock",
     "mozilla::dom::MediaList",
     "mozilla::StyleRuleInclusion",
     "nsStyleTransformMatrix::MatrixTransformOperator",
 ]
 opaque-types = [
     "std::pair__PCCP",
     "std::namespace::atomic___base", "std::atomic__My_base",
     "std::atomic",
deleted file mode 100644
--- a/layout/style/ServoDeclarationBlock.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/ServoDeclarationBlock.h"
-
-#include "mozilla/ServoBindings.h"
-
-#include "nsCSSProps.h"
-
-namespace mozilla {
-
-/* static */ already_AddRefed<ServoDeclarationBlock>
-ServoDeclarationBlock::FromCssText(const nsAString& aCssText,
-                                   URLExtraData* aExtraData,
-                                   nsCompatibility aMode,
-                                   css::Loader* aLoader)
-{
-  NS_ConvertUTF16toUTF8 value(aCssText);
-  // FIXME (bug 1343964): Figure out a better solution for sending the base uri to servo
-  RefPtr<RawServoDeclarationBlock>
-      raw = Servo_ParseStyleAttribute(&value, aExtraData, aMode, aLoader).Consume();
-  RefPtr<ServoDeclarationBlock> decl = new ServoDeclarationBlock(raw.forget());
-  return decl.forget();
-}
-
-void
-ServoDeclarationBlock::GetPropertyValue(const nsAString& aProperty,
-                                        nsAString& aValue) const
-{
-  NS_ConvertUTF16toUTF8 property(aProperty);
-  Servo_DeclarationBlock_GetPropertyValue(mRaw, &property, &aValue);
-}
-
-void
-ServoDeclarationBlock::GetPropertyValueByID(nsCSSPropertyID aPropID,
-                                            nsAString& aValue) const
-{
-  Servo_DeclarationBlock_GetPropertyValueById(mRaw, aPropID, &aValue);
-}
-
-bool
-ServoDeclarationBlock::GetPropertyIsImportant(const nsAString& aProperty) const
-{
-  NS_ConvertUTF16toUTF8 property(aProperty);
-  return Servo_DeclarationBlock_GetPropertyIsImportant(mRaw, &property);
-}
-
-bool
-ServoDeclarationBlock::RemoveProperty(const nsAString& aProperty)
-{
-  AssertMutable();
-  NS_ConvertUTF16toUTF8 property(aProperty);
-  return Servo_DeclarationBlock_RemoveProperty(mRaw, &property);
-}
-
-bool
-ServoDeclarationBlock::RemovePropertyByID(nsCSSPropertyID aPropID)
-{
-  AssertMutable();
-  return Servo_DeclarationBlock_RemovePropertyById(mRaw, aPropID);
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/layout/style/ServoDeclarationBlock.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_ServoDeclarationBlock_h
-#define mozilla_ServoDeclarationBlock_h
-
-#include "mozilla/ServoBindings.h"
-#include "mozilla/DeclarationBlock.h"
-
-namespace mozilla {
-
-class ServoDeclarationBlock final : public DeclarationBlock
-{
-public:
-  explicit ServoDeclarationBlock(
-    already_AddRefed<RawServoDeclarationBlock> aRaw)
-    : DeclarationBlock(), mRaw(aRaw) {}
-
-  ServoDeclarationBlock()
-    : ServoDeclarationBlock(Servo_DeclarationBlock_CreateEmpty().Consume()) {}
-
-  ServoDeclarationBlock(const ServoDeclarationBlock& aCopy)
-    : DeclarationBlock(aCopy)
-    , mRaw(Servo_DeclarationBlock_Clone(aCopy.mRaw).Consume()) {}
-
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ServoDeclarationBlock)
-
-  static already_AddRefed<ServoDeclarationBlock>
-  FromCssText(const nsAString& aCssText, URLExtraData* aExtraData,
-              nsCompatibility aMode, css::Loader* aLoader);
-
-  RawServoDeclarationBlock* Raw() const { return mRaw; }
-  RawServoDeclarationBlock* const* RefRaw() const {
-    static_assert(sizeof(RefPtr<RawServoDeclarationBlock>) ==
-                  sizeof(RawServoDeclarationBlock*),
-                  "RefPtr should just be a pointer");
-    return reinterpret_cast<RawServoDeclarationBlock* const*>(&mRaw);
-  }
-
-  const RawServoDeclarationBlockStrong* RefRawStrong() const
-  {
-    static_assert(sizeof(RefPtr<RawServoDeclarationBlock>) ==
-                  sizeof(RawServoDeclarationBlock*),
-                  "RefPtr should just be a pointer");
-    static_assert(sizeof(RefPtr<RawServoDeclarationBlock>) ==
-                  sizeof(RawServoDeclarationBlockStrong),
-                  "RawServoDeclarationBlockStrong should be the same as RefPtr");
-    return reinterpret_cast<const RawServoDeclarationBlockStrong*>(&mRaw);
-  }
-
-  void ToString(nsAString& aResult) const {
-    Servo_DeclarationBlock_GetCssText(mRaw, &aResult);
-  }
-
-  uint32_t Count() const {
-    return Servo_DeclarationBlock_Count(mRaw);
-  }
-  bool GetNthProperty(uint32_t aIndex, nsAString& aReturn) const {
-    aReturn.Truncate();
-    return Servo_DeclarationBlock_GetNthProperty(mRaw, aIndex, &aReturn);
-  }
-
-  void GetPropertyValue(const nsAString& aProperty, nsAString& aValue) const;
-  void GetPropertyValueByID(nsCSSPropertyID aPropID, nsAString& aValue) const;
-  bool GetPropertyIsImportant(const nsAString& aProperty) const;
-  // The two functions blow return whether any property was removed.
-  bool RemoveProperty(const nsAString& aProperty);
-  bool RemovePropertyByID(nsCSSPropertyID aPropID);
-
-private:
-  ~ServoDeclarationBlock() {}
-
-  RefPtr<RawServoDeclarationBlock> mRaw;
-};
-
-} // namespace mozilla
-
-#endif // mozilla_ServoDeclarationBlock_h
--- a/layout/style/ServoFontFaceRule.cpp
+++ b/layout/style/ServoFontFaceRule.cpp
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/ServoFontFaceRule.h"
 
 #include "mozilla/dom/CSSFontFaceRuleBinding.h"
 #include "mozilla/dom/CSSStyleDeclarationBinding.h"
+#include "nsCSSProps.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 // -------------------------------------------
 // ServoFontFaceRuleDecl and related routines
 //
 
--- a/layout/style/ServoKeyframeRule.cpp
+++ b/layout/style/ServoKeyframeRule.cpp
@@ -1,34 +1,33 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/ServoKeyframeRule.h"
 
-#include "mozilla/DeclarationBlockInlines.h"
-#include "mozilla/ServoDeclarationBlock.h"
+#include "mozilla/DeclarationBlock.h"
 #include "nsDOMCSSDeclaration.h"
 #include "mozAutoDocUpdate.h"
 
 namespace mozilla {
 
 // -------------------------------------------
 // ServoKeyframeDeclaration
 //
 
 class ServoKeyframeDeclaration : public nsDOMCSSDeclaration
 {
 public:
   explicit ServoKeyframeDeclaration(ServoKeyframeRule* aRule)
     : mRule(aRule)
   {
-    mDecls = new ServoDeclarationBlock(
+    mDecls = new DeclarationBlock(
       Servo_Keyframe_GetStyle(aRule->Raw()).Consume());
   }
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(
     ServoKeyframeDeclaration, nsICSSDeclaration)
 
   css::Rule* GetParentRule() final { return mRule; }
@@ -45,17 +44,17 @@ public:
   nsresult SetCSSDeclaration(DeclarationBlock* aDecls) final
   {
     if (!mRule) {
       return NS_OK;
     }
     mRule->UpdateRule([this, aDecls]() {
       if (mDecls != aDecls) {
         mDecls->SetOwningRule(nullptr);
-        mDecls = aDecls->AsServo();
+        mDecls = aDecls;
         mDecls->SetOwningRule(mRule);
         Servo_Keyframe_SetStyle(mRule->Raw(), mDecls->Raw());
       }
     });
     return NS_OK;
   }
   ParsingEnvironment GetParsingEnvironment(
       nsIPrincipal* aSubjectPrincipal) const final
@@ -77,17 +76,17 @@ public:
   }
 
 private:
   virtual ~ServoKeyframeDeclaration() {
     MOZ_ASSERT(!mRule, "Backpointer should have been cleared");
   }
 
   ServoKeyframeRule* mRule;
-  RefPtr<ServoDeclarationBlock> mDecls;
+  RefPtr<DeclarationBlock> mDecls;
 };
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(ServoKeyframeDeclaration)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(ServoKeyframeDeclaration)
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(ServoKeyframeDeclaration)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServoKeyframeDeclaration)
--- a/layout/style/ServoKeyframeRule.h
+++ b/layout/style/ServoKeyframeRule.h
@@ -9,17 +9,17 @@
 
 #include "mozilla/dom/CSSKeyframeRule.h"
 #include "mozilla/ServoBindingTypes.h"
 
 class nsICSSDeclaration;
 
 namespace mozilla {
 
-class ServoDeclarationBlock;
+class DeclarationBlock;
 class ServoKeyframeDeclaration;
 
 class ServoKeyframeRule final : public dom::CSSKeyframeRule
 {
 public:
   ServoKeyframeRule(already_AddRefed<RawServoKeyframe> aRaw,
                     uint32_t aLine, uint32_t aColumn)
     : CSSKeyframeRule(aLine, aColumn)
--- a/layout/style/ServoPageRule.cpp
+++ b/layout/style/ServoPageRule.cpp
@@ -3,29 +3,28 @@
 /* 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/. */
 
 /* representation of CSSPageRule for stylo */
 
 #include "mozilla/ServoPageRule.h"
 
-#include "mozilla/DeclarationBlockInlines.h"
+#include "mozilla/DeclarationBlock.h"
 #include "mozilla/ServoBindings.h"
-#include "mozilla/ServoDeclarationBlock.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 
 // -- ServoPageRuleDeclaration ---------------------------------------
 
 ServoPageRuleDeclaration::ServoPageRuleDeclaration(
   already_AddRefed<RawServoDeclarationBlock> aDecls)
-  : mDecls(new ServoDeclarationBlock(Move(aDecls)))
+  : mDecls(new DeclarationBlock(Move(aDecls)))
 {
 }
 
 ServoPageRuleDeclaration::~ServoPageRuleDeclaration()
 {
   mDecls->SetOwningRule(nullptr);
 }
 
@@ -67,17 +66,17 @@ ServoPageRuleDeclaration::GetCSSDeclarat
 nsresult
 ServoPageRuleDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
 {
   MOZ_ASSERT(aDecl, "must be non-null");
   ServoPageRule* rule = Rule();
 
   if (aDecl != mDecls) {
     mDecls->SetOwningRule(nullptr);
-    RefPtr<ServoDeclarationBlock> decls = aDecl->AsServo();
+    RefPtr<DeclarationBlock> decls = aDecl;
     Servo_PageRule_SetStyle(rule->Raw(), decls->Raw());
     mDecls = decls.forget();
     mDecls->SetOwningRule(rule);
   }
 
   return NS_OK;
 }
 
--- a/layout/style/ServoPageRule.h
+++ b/layout/style/ServoPageRule.h
@@ -15,17 +15,17 @@
 #include "nsDOMCSSDeclaration.h"
 
 namespace mozilla {
 
 namespace dom {
 class DocGroup;
 } // namespace dom
 
-class ServoDeclarationBlock;
+class DeclarationBlock;
 class ServoPageRule;
 
 class ServoPageRuleDeclaration final : public nsDOMCSSDeclaration
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
   css::Rule* GetParentRule() final;
@@ -44,17 +44,17 @@ private:
 
   explicit ServoPageRuleDeclaration(
     already_AddRefed<RawServoDeclarationBlock> aDecls);
   ~ServoPageRuleDeclaration();
 
   inline ServoPageRule* Rule();
   inline const ServoPageRule* Rule() const;
 
-  RefPtr<ServoDeclarationBlock> mDecls;
+  RefPtr<DeclarationBlock> mDecls;
 };
 
 class ServoPageRule final : public dom::CSSPageRule
 {
 public:
   ServoPageRule(RefPtr<RawServoPageRule> aRawRule,
                 uint32_t aLine, uint32_t aColumn);
 
--- a/layout/style/ServoStyleRule.cpp
+++ b/layout/style/ServoStyleRule.cpp
@@ -3,32 +3,31 @@
 /* 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/. */
 
 /* representation of CSSStyleRule for stylo */
 
 #include "mozilla/ServoStyleRule.h"
 
-#include "mozilla/DeclarationBlockInlines.h"
+#include "mozilla/DeclarationBlock.h"
 #include "mozilla/ServoBindings.h"
-#include "mozilla/ServoDeclarationBlock.h"
 #include "mozilla/dom/CSSStyleRuleBinding.h"
 
 #include "mozAutoDocUpdate.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 
 // -- ServoStyleRuleDeclaration ---------------------------------------
 
 ServoStyleRuleDeclaration::ServoStyleRuleDeclaration(
   already_AddRefed<RawServoDeclarationBlock> aDecls)
-  : mDecls(new ServoDeclarationBlock(Move(aDecls)))
+  : mDecls(new DeclarationBlock(Move(aDecls)))
 {
 }
 
 ServoStyleRuleDeclaration::~ServoStyleRuleDeclaration()
 {
   mDecls->SetOwningRule(nullptr);
 }
 
@@ -69,17 +68,17 @@ ServoStyleRuleDeclaration::GetCSSDeclara
 
 nsresult
 ServoStyleRuleDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
 {
   ServoStyleRule* rule = Rule();
   if (RefPtr<StyleSheet> sheet = rule->GetStyleSheet()) {
     if (aDecl != mDecls) {
       mDecls->SetOwningRule(nullptr);
-      RefPtr<ServoDeclarationBlock> decls = aDecl->AsServo();
+      RefPtr<DeclarationBlock> decls = aDecl;
       Servo_StyleRule_SetStyle(rule->Raw(), decls->Raw());
       mDecls = decls.forget();
       mDecls->SetOwningRule(rule);
     }
     sheet->RuleChanged(rule);
   }
   return NS_OK;
 }
--- a/layout/style/ServoStyleRule.h
+++ b/layout/style/ServoStyleRule.h
@@ -16,17 +16,17 @@
 #include "nsDOMCSSDeclaration.h"
 
 namespace mozilla {
 
 namespace dom {
 class DocGroup;
 } // namespace dom
 
-class ServoDeclarationBlock;
+class DeclarationBlock;
 class ServoStyleRule;
 
 class ServoStyleRuleDeclaration final : public nsDOMCSSDeclaration
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
   css::Rule* GetParentRule() final;
@@ -45,17 +45,17 @@ private:
 
   explicit ServoStyleRuleDeclaration(
     already_AddRefed<RawServoDeclarationBlock> aDecls);
   ~ServoStyleRuleDeclaration();
 
   inline ServoStyleRule* Rule();
   inline const ServoStyleRule* Rule() const;
 
-  RefPtr<ServoDeclarationBlock> mDecls;
+  RefPtr<DeclarationBlock> mDecls;
 };
 
 class ServoStyleRule final : public BindingStyleRule
                            , public SupportsWeakPtr<ServoStyleRule>
 {
 public:
   ServoStyleRule(already_AddRefed<RawServoStyleRule> aRawRule,
                  uint32_t aLine, uint32_t aColumn);
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -469,17 +469,17 @@ private:
   bool ShouldTraverseInParallel() const;
 
   /**
    * Gets the pending snapshots to handle from the restyle manager.
    */
   const SnapshotTable& Snapshots();
 
   /**
-   * Resolve all ServoDeclarationBlocks attached to mapped
+   * Resolve all DeclarationBlocks attached to mapped
    * presentation attributes cached on the document.
    *
    * Call this before jumping into Servo's style system.
    */
   void ResolveMappedAttrDeclarationBlocks();
 
   /**
    * Clear our cached mNonInheritingComputedStyles.
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -64,34 +64,32 @@ EXPORTS.mozilla += [
     'AnimationCollection.h',
     'BindingStyleRule.h',
     'CachedInheritingStyles.h',
     'ComputedStyle.h',
     'ComputedStyleInlines.h',
     'CSSEnabledState.h',
     'CSSPropFlags.h',
     'DeclarationBlock.h',
-    'DeclarationBlockInlines.h',
     'DocumentStyleRootIterator.h',
     'GenericSpecifiedValues.h',
     'GenericSpecifiedValuesInlines.h',
     'LayerAnimationInfo.h',
     'MediaFeatureChange.h',
     'PostTraversalTask.h',
     'PreloadedStyleSheet.h',
     'ServoArcTypeList.h',
     'ServoBindingList.h',
     'ServoBindings.h',
     'ServoBindingTypes.h',
     'ServoComputedData.h',
     'ServoComputedDataInlines.h',
     'ServoCounterStyleRule.h',
     'ServoCSSParser.h',
     'ServoCSSRuleList.h',
-    'ServoDeclarationBlock.h',
     'ServoDocumentRule.h',
     'ServoElementSnapshot.h',
     'ServoElementSnapshotTable.h',
     'ServoFontFaceRule.h',
     'ServoFontFeatureValuesRule.h',
     'ServoImportRule.h',
     'ServoKeyframeRule.h',
     'ServoKeyframesRule.h',
@@ -160,16 +158,17 @@ UNIFIED_SOURCES += [
     'CSSKeyframeRule.cpp',
     'CSSKeyframesRule.cpp',
     'CSSLexer.cpp',
     'CSSMediaRule.cpp',
     'CSSMozDocumentRule.cpp',
     'CSSPageRule.cpp',
     'CSSRuleList.cpp',
     'CSSSupportsRule.cpp',
+    'DeclarationBlock.cpp',
     'DocumentStyleRootIterator.cpp',
     'ErrorReporter.cpp',
     'FontFace.cpp',
     'FontFaceSet.cpp',
     'FontFaceSetIterator.cpp',
     'GroupRule.cpp',
     'ImageLoader.cpp',
     'LayerAnimationInfo.cpp',
@@ -201,17 +200,16 @@ UNIFIED_SOURCES += [
     'nsTransitionManager.cpp',
     'PostTraversalTask.cpp',
     'PreloadedStyleSheet.cpp',
     'Rule.cpp',
     'ServoBindings.cpp',
     'ServoCounterStyleRule.cpp',
     'ServoCSSParser.cpp',
     'ServoCSSRuleList.cpp',
-    'ServoDeclarationBlock.cpp',
     'ServoDocumentRule.cpp',
     'ServoElementSnapshot.cpp',
     'ServoFontFaceRule.cpp',
     'ServoFontFeatureValuesRule.cpp',
     'ServoImportRule.cpp',
     'ServoKeyframeRule.cpp',
     'ServoKeyframesRule.cpp',
     'ServoMediaRule.cpp',
--- a/layout/style/nsDOMCSSAttrDeclaration.cpp
+++ b/layout/style/nsDOMCSSAttrDeclaration.cpp
@@ -4,21 +4,19 @@
  * 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/. */
 
 /* DOM object for element.style */
 
 #include "nsDOMCSSAttrDeclaration.h"
 
 #include "mozilla/DeclarationBlock.h"
-#include "mozilla/DeclarationBlockInlines.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/MutationEventBinding.h"
 #include "mozilla/InternalMutationEvent.h"
-#include "mozilla/ServoDeclarationBlock.h"
 #include "mozAutoDocUpdate.h"
 #include "nsContentUtils.h"
 #include "nsIDocument.h"
 #include "nsIURI.h"
 #include "nsNodeUtils.h"
 #include "nsSMILCSSValueType.h"
 #include "nsWrapperCacheInlines.h"
 #include "nsIFrame.h"
@@ -135,17 +133,17 @@ nsDOMCSSAttributeDeclaration::GetCSSDecl
     return declaration;
   }
 
   if (aOperation != eOperation_Modify) {
     return nullptr;
   }
 
   // cannot fail
-  RefPtr<DeclarationBlock> decl = new ServoDeclarationBlock();
+  RefPtr<DeclarationBlock> decl = new DeclarationBlock();
 
   // this *can* fail (inside SetAttrAndNotify, at least).
   nsresult rv;
   if (mIsSMILOverride) {
     rv = mElement->SetSMILOverrideStyleDeclaration(decl, false);
   } else {
     rv = mElement->SetInlineStyleDeclaration(decl, nullptr, false);
   }
--- a/layout/style/nsDOMCSSDeclaration.cpp
+++ b/layout/style/nsDOMCSSDeclaration.cpp
@@ -3,17 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* base class for DOM objects for element.style and cssStyleRule.style */
 
 #include "nsDOMCSSDeclaration.h"
 
-#include "mozilla/DeclarationBlockInlines.h"
+#include "mozilla/DeclarationBlock.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/css/Rule.h"
 #include "mozilla/dom/CSS2PropertiesBinding.h"
 #include "nsCSSProps.h"
 #include "nsCOMPtr.h"
 #include "mozAutoDocUpdate.h"
 #include "nsIURI.h"
 #include "mozilla/dom/BindingUtils.h"
@@ -121,18 +121,18 @@ nsDOMCSSDeclaration::SetCssText(const ns
   ParsingEnvironment servoEnv =
     GetParsingEnvironment(aSubjectPrincipal);
   if (!servoEnv.mUrlExtraData) {
     aRv.Throw(NS_ERROR_NOT_AVAILABLE);
     return;
   }
 
   RefPtr<DeclarationBlock> newdecl =
-    ServoDeclarationBlock::FromCssText(aCssText, servoEnv.mUrlExtraData,
-                                       servoEnv.mCompatMode, servoEnv.mLoader);
+    DeclarationBlock::FromCssText(aCssText, servoEnv.mUrlExtraData,
+                                  servoEnv.mCompatMode, servoEnv.mLoader);
 
   aRv = SetCSSDeclaration(newdecl);
 }
 
 uint32_t
 nsDOMCSSDeclaration::Length()
 {
   DeclarationBlock* decl = GetCSSDeclaration(eOperation_Read);
@@ -263,17 +263,17 @@ nsDOMCSSDeclaration::ModifyDeclaration(n
 
   bool changed;
   ParsingEnvironment servoEnv =
     GetParsingEnvironment(aSubjectPrincipal);
   if (!servoEnv.mUrlExtraData) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
-  changed = aFunc(decl->AsServo(), servoEnv);
+  changed = aFunc(decl, servoEnv);
 
   if (!changed) {
     // Parsing failed -- but we don't throw an exception for that.
     return NS_OK;
   }
 
   return SetCSSDeclaration(decl);
 }
@@ -281,34 +281,34 @@ nsDOMCSSDeclaration::ModifyDeclaration(n
 nsresult
 nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSPropertyID aPropID,
                                         const nsAString& aPropValue,
                                         bool aIsImportant,
                                         nsIPrincipal* aSubjectPrincipal)
 {
   return ModifyDeclaration(
     aSubjectPrincipal,
-    [&](ServoDeclarationBlock* decl, ParsingEnvironment& env) {
+    [&](DeclarationBlock* decl, ParsingEnvironment& env) {
       NS_ConvertUTF16toUTF8 value(aPropValue);
       return Servo_DeclarationBlock_SetPropertyById(
         decl->Raw(), aPropID, &value, aIsImportant, env.mUrlExtraData,
         ParsingMode::Default, env.mCompatMode, env.mLoader);
     });
 }
 
 nsresult
 nsDOMCSSDeclaration::ParseCustomPropertyValue(const nsAString& aPropertyName,
                                               const nsAString& aPropValue,
                                               bool aIsImportant,
                                               nsIPrincipal* aSubjectPrincipal)
 {
   MOZ_ASSERT(nsCSSProps::IsCustomPropertyName(aPropertyName));
   return ModifyDeclaration(
     aSubjectPrincipal,
-    [&](ServoDeclarationBlock* decl, ParsingEnvironment& env) {
+    [&](DeclarationBlock* decl, ParsingEnvironment& 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
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * style sheet and style rule processor representing style attributes
  */
 
 #include "nsHTMLCSSStyleSheet.h"
 #include "mozilla/MemoryReporting.h"
-#include "mozilla/DeclarationBlockInlines.h"
+#include "mozilla/DeclarationBlock.h"
 #include "nsPresContext.h"
 #include "mozilla/dom/Element.h"
 #include "nsAttrValue.h"
 #include "nsAttrValueInlines.h"
 #include "nsCSSPseudoElements.h"
 #include "mozilla/RestyleManager.h"
 
 using namespace mozilla;
--- a/layout/style/nsHTMLStyleSheet.h
+++ b/layout/style/nsHTMLStyleSheet.h
@@ -50,17 +50,17 @@ public:
     return mServoActiveLinkDecl;
   }
 
   // Mapped Attribute management methods
   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
+  // the attached DeclarationBlock by running the mapping
   // and converting the ruledata to Servo specified values.
   void CalculateMappedServoDeclarations();
 
 private:
   nsHTMLStyleSheet(const nsHTMLStyleSheet& aCopy) = delete;
   nsHTMLStyleSheet& operator=(const nsHTMLStyleSheet& aCopy) = delete;
 
   ~nsHTMLStyleSheet() {}
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -1210,26 +1210,19 @@ impl<'le> TElement for GeckoElement<'le>
 
         unsafe { Gecko_UnsetDirtyStyleAttr(self.0) };
     }
 
     fn smil_override(&self) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>> {
         unsafe {
             let slots = self.extended_slots()?;
 
-            let base_declaration: &structs::DeclarationBlock =
+            let declaration: &structs::DeclarationBlock =
                 slots.mSMILOverrideStyleDeclaration.mRawPtr.as_ref()?;
 
-            let declaration: &structs::ServoDeclarationBlock = mem::transmute(base_declaration);
-
-            debug_assert_eq!(
-                &declaration._base as *const structs::DeclarationBlock,
-                base_declaration as *const structs::DeclarationBlock
-            );
-
             let raw: &structs::RawServoDeclarationBlock = declaration.mRaw.mRawPtr.as_ref()?;
 
             Some(
                 Locked::<PropertyDeclarationBlock>::as_arc(
                     &*(&raw as *const &structs::RawServoDeclarationBlock),
                 ).borrow_arc(),
             )
         }