Bug 1536586 - Simplify a bit our generated bindings by getting rid of FooBorrowed and FooBorrowedMut. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 21 Mar 2019 17:00:27 +0000
changeset 465495 e02bd4f991578e9e6529bf0b63f2a1115a3942a4
parent 465494 8b50a00d1d225ef5aa7eaefa7bc2f7ba0ed91c64
child 465496 01a2fee54f946e58957d61d3c0d6ad1d0a6bd722
push id35741
push userapavel@mozilla.com
push dateFri, 22 Mar 2019 09:56:25 +0000
treeherdermozilla-central@6332e136b825 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1536586, 1534844, 1308234
milestone68.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 1536586 - Simplify a bit our generated bindings by getting rid of FooBorrowed and FooBorrowedMut. r=heycam This reduces a lot the boilerplate that's needed in order to add simple binding functions. This starts using &Foo and Option<&Foo> instead, and as a result we need to remove the servo_function_signatures test, which is a bit unfortunate. I think it's worth though, this causes problems on some platforms (see bug 1534844), and messing up the functions signature is not something that I've ever seen (other than bug 1308234, which already had all the FooBorrowed mess which I'm removing). Also, cbindgen understands references and Option<&Foo>, so it will be the way to go in the future. After this patch we can also remove HasSimpleFFI, but I've kept it for now since I still use it in a few places, and this patch is quite big on its own. Differential Revision: https://phabricator.services.mozilla.com/D24092
Cargo.lock
dom/animation/EffectCompositor.cpp
dom/animation/EffectCompositor.h
dom/animation/KeyframeEffect.cpp
dom/base/DOMMatrix.cpp
js/src/devtools/rootAnalysis/analyzeHeapWrites.js
layout/style/BorrowedTypeList.h
layout/style/GeckoBindings.cpp
layout/style/GeckoBindings.h
layout/style/ServoBindingTypes.h
layout/style/ServoBindings.h
layout/style/ServoBindings.toml
layout/style/ServoCSSParser.cpp
layout/style/ServoCSSParser.h
layout/style/ServoStyleSet.cpp
layout/style/ServoStyleSet.h
layout/style/moz.build
layout/style/nsCSSValue.h
servo/components/style/author_styles.rs
servo/components/style/build_gecko.rs
servo/components/style/gecko/arc_types.rs
servo/components/style/gecko/conversions.rs
servo/components/style/gecko/data.rs
servo/components/style/gecko/restyle_damage.rs
servo/components/style/gecko/wrapper.rs
servo/components/style/gecko_bindings/sugar/refptr.rs
servo/components/style/properties/gecko.mako.rs
servo/ports/geckolib/glue.rs
servo/ports/geckolib/tests/Cargo.toml
servo/ports/geckolib/tests/build.rs
servo/ports/geckolib/tests/lib.rs
servo/ports/geckolib/tests/servo_function_signatures.rs
servo/ports/geckolib/tests/size_of.rs
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2641,17 +2641,16 @@ dependencies = [
  "cssparser 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "geckoservo 0.0.1",
  "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "malloc_size_of 0.0.1",
  "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "selectors 0.21.0",
  "size_of_test 0.0.1",
  "smallvec 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "style 0.0.1",
  "style_traits 0.0.1",
 ]
 
 [[package]]
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -387,18 +387,17 @@ class EffectCompositeOrderComparator {
             b->GetAnimation()->HasLowerCompositeOrderThan(*a->GetAnimation()));
     return a->GetAnimation()->HasLowerCompositeOrderThan(*b->GetAnimation());
   }
 };
 }  // namespace
 
 bool EffectCompositor::GetServoAnimationRule(
     const dom::Element* aElement, PseudoStyleType aPseudoType,
-    CascadeLevel aCascadeLevel,
-    RawServoAnimationValueMapBorrowedMut aAnimationValues) {
+    CascadeLevel aCascadeLevel, RawServoAnimationValueMap* aAnimationValues) {
   MOZ_ASSERT(aAnimationValues);
   MOZ_ASSERT(mPresContext && mPresContext->IsDynamic(),
              "Should not be in print preview");
   // Gecko_GetAnimationRule should have already checked this
   MOZ_ASSERT(nsContentUtils::GetPresShellForContent(aElement),
              "Should not be trying to run animations on elements in documents"
              " without a pres shell (e.g. XMLHttpRequest documents)");
 
--- a/dom/animation/EffectCompositor.h
+++ b/dom/animation/EffectCompositor.h
@@ -20,17 +20,16 @@
 #include "nsTArray.h"
 
 class nsCSSPropertyIDSet;
 class nsAtom;
 class nsIFrame;
 class nsPresContext;
 enum class DisplayItemType : uint32_t;
 struct RawServoAnimationValueMap;
-typedef RawServoAnimationValueMap* RawServoAnimationValueMapBorrowedMut;
 
 namespace mozilla {
 
 class ComputedStyle;
 class EffectSet;
 class RestyleTracker;
 class StyleAnimationValue;
 struct AnimationProperty;
@@ -113,23 +112,23 @@ class EffectCompositor {
   // animation effects (e.g. em-based endpoints used in keyframe effects)
   // can be re-resolved to computed values.
   void UpdateEffectProperties(const ComputedStyle* aStyle,
                               dom::Element* aElement,
                               PseudoStyleType aPseudoType);
 
   // 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|.
+  // The animation rule is stored in |RawServoAnimationValueMap|.
   // We need to be careful while doing any modification because it may cause
   // some thread-safe issues.
-  bool GetServoAnimationRule(
-      const dom::Element* aElement, PseudoStyleType aPseudoType,
-      CascadeLevel aCascadeLevel,
-      RawServoAnimationValueMapBorrowedMut aAnimationValues);
+  bool GetServoAnimationRule(const dom::Element* aElement,
+                             PseudoStyleType aPseudoType,
+                             CascadeLevel aCascadeLevel,
+                             RawServoAnimationValueMap* aAnimationValues);
 
   bool HasPendingStyleUpdates() const;
 
   static bool HasAnimationsForCompositor(const nsIFrame* aFrame,
                                          DisplayItemType aType);
 
   static nsTArray<RefPtr<dom::Animation>> GetAnimationsForCompositor(
       const nsIFrame* aFrame, const nsCSSPropertyIDSet& aPropertySet);
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -506,17 +506,19 @@ void KeyframeEffect::WillComposeStyle() 
   mCurrentIterationOnLastCompose = computedTiming.mCurrentIteration;
 }
 
 void KeyframeEffect::ComposeStyleRule(
     RawServoAnimationValueMap& aAnimationValues,
     const AnimationProperty& aProperty,
     const AnimationPropertySegment& aSegment,
     const ComputedTiming& aComputedTiming) {
-  Servo_AnimationCompose(&aAnimationValues, &mBaseValues, aProperty.mProperty,
+  auto* opaqueTable =
+      reinterpret_cast<RawServoAnimationValueTable*>(&mBaseValues);
+  Servo_AnimationCompose(&aAnimationValues, opaqueTable, aProperty.mProperty,
                          &aSegment, &aProperty.mSegments.LastElement(),
                          &aComputedTiming, mEffectOptions.mIterationComposite);
 }
 
 void KeyframeEffect::ComposeStyle(RawServoAnimationValueMap& aComposeResult,
                                   const nsCSSPropertyIDSet& aPropertiesToSkip) {
   ComputedTiming computedTiming = GetComputedTiming();
 
--- a/dom/base/DOMMatrix.cpp
+++ b/dom/base/DOMMatrix.cpp
@@ -645,17 +645,17 @@ DOMMatrixReadOnly* DOMMatrixReadOnly::Se
   // An empty string is a no-op.
   if (aTransformList.IsEmpty()) {
     return this;
   }
 
   gfx::Matrix4x4 transform;
   bool contains3dTransform = false;
   if (!ServoCSSParser::ParseTransformIntoMatrix(
-          aTransformList, contains3dTransform, transform.components)) {
+          aTransformList, contains3dTransform, transform)) {
     aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
     return nullptr;
   }
 
   if (!contains3dTransform) {
     mMatrix3D = nullptr;
     mMatrix2D = new gfx::Matrix();
 
--- a/js/src/devtools/rootAnalysis/analyzeHeapWrites.js
+++ b/js/src/devtools/rootAnalysis/analyzeHeapWrites.js
@@ -23,17 +23,16 @@ function checkExternalFunction(entry)
         "memcmp",
         "strcmp",
         "fmod",
         "floor",
         "ceil",
         "atof",
         /memchr/,
         "strlen",
-        "Servo_ComputedValues_EqualCustomProperties",
         /Servo_DeclarationBlock_GetCssText/,
         "Servo_GetArcStringData",
         "Servo_IsWorkerThread",
         /nsIFrame::AppendOwnedAnonBoxes/,
         // Assume that atomic accesses are threadsafe.
         /^__atomic_/,
     ];
     if (entry.matches(whitelist))
deleted file mode 100644
--- a/layout/style/BorrowedTypeList.h
+++ /dev/null
@@ -1,54 +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/. */
-
-/* a list of Gecko types used across bindings, for preprocessing */
-
-// There are two macros:
-//
-//   GECKO_BORROWED_TYPE(gecko_type, ffi_type_name)
-//   GECKO_BORROWED_MUT_TYPE(gecko_type, ffi_type_name)
-//
-// GECKO_BORROWED_TYPE will generated Borrowed and BorrowedOrNull types.
-//
-// GECKO_BORROWED_MUT_TYPE will generate those and the BorrowedMut &
-// BorrowedMutOrNull types.
-//
-// The first argument is the Gecko C++ type name.  This must be a type
-// that is in scope in ServoBindingTypes.h; forward declarations may need
-// to be added there.
-//
-// The second argument is the name of a typedef that will be generated,
-// equivalent to the actual C++ type.  This name will be used as the basis
-// for the generated borrowed type names to be used in FFI signatures in
-// C++ and Rust.  The convention for this name is "RawGecko{Type}", where
-// {Type} is the name of the C++ type or something close to it.
-//
-// See the comment at the top of ServoBindingTypes.h for how to use these.
-
-// clang-format off
-// Needs to be a on single line
-GECKO_BORROWED_TYPE(mozilla::dom::Element, RawGeckoElement)
-GECKO_BORROWED_TYPE(mozilla::dom::Document, RawGeckoDocument)
-GECKO_BORROWED_TYPE(nsINode, RawGeckoNode)
-GECKO_BORROWED_TYPE(nsPresContext, RawGeckoPresContext)
-GECKO_BORROWED_TYPE(nsXBLBinding, RawGeckoXBLBinding)
-GECKO_BORROWED_TYPE_MUT(mozilla::AnimationPropertySegment, RawGeckoAnimationPropertySegment)
-GECKO_BORROWED_TYPE_MUT(mozilla::ComputedTiming, RawGeckoComputedTiming)
-GECKO_BORROWED_TYPE_MUT(mozilla::dom::StyleChildrenIterator, RawGeckoStyleChildrenIterator)
-GECKO_BORROWED_TYPE_MUT(mozilla::GfxMatrix4x4, RawGeckoGfxMatrix4x4)
-GECKO_BORROWED_TYPE_MUT(mozilla::URLExtraData, RawGeckoURLExtraData)
-GECKO_BORROWED_TYPE_MUT(nsCSSPropertyIDSet, nsCSSPropertyIDSet)
-GECKO_BORROWED_TYPE_MUT(nsCSSValue, nsCSSValue)
-GECKO_BORROWED_TYPE_MUT(nsStyleAutoArray<mozilla::StyleAnimation>, RawGeckoStyleAnimationList)
-GECKO_BORROWED_TYPE_MUT(nsTArray<const RawServoStyleRule*>, RawGeckoServoStyleRuleList)
-GECKO_BORROWED_TYPE_MUT(nsTArray<mozilla::ComputedKeyframeValues>, RawGeckoComputedKeyframeValuesList)
-GECKO_BORROWED_TYPE_MUT(nsTArray<mozilla::Keyframe>, RawGeckoKeyframeList)
-GECKO_BORROWED_TYPE_MUT(nsTArray<mozilla::PropertyValuePair>, RawGeckoPropertyValuePairList)
-GECKO_BORROWED_TYPE_MUT(nsTArray<nsCSSPropertyID>, RawGeckoCSSPropertyIDList)
-GECKO_BORROWED_TYPE_MUT(nsTArray<nsFontFaceRuleContainer>, RawGeckoFontFaceRuleList)
-GECKO_BORROWED_TYPE_MUT(nsTArray<RefPtr<RawServoAnimationValue>>, RawGeckoServoAnimationValueList)
-GECKO_BORROWED_TYPE_MUT(nsTimingFunction, nsTimingFunction)
-// clang-format on
--- a/layout/style/GeckoBindings.cpp
+++ b/layout/style/GeckoBindings.cpp
@@ -126,64 +126,62 @@ static const nsFont* ThreadSafeGetDefaul
   return retval;
 }
 
 /*
  * Does this child count as significant for selector matching?
  *
  * See nsStyleUtil::IsSignificantChild for details.
  */
-bool Gecko_IsSignificantChild(RawGeckoNodeBorrowed aNode,
+bool Gecko_IsSignificantChild(const nsINode* aNode,
                               bool aWhitespaceIsSignificant) {
   return nsStyleUtil::ThreadSafeIsSignificantChild(aNode->AsContent(),
                                                    aWhitespaceIsSignificant);
 }
 
-RawGeckoNodeBorrowedOrNull Gecko_GetLastChild(RawGeckoNodeBorrowed aNode) {
+const nsINode* Gecko_GetLastChild(const nsINode* aNode) {
   return aNode->GetLastChild();
 }
 
-RawGeckoNodeBorrowedOrNull Gecko_GetPreviousSibling(
-    RawGeckoNodeBorrowed aNode) {
+const nsINode* Gecko_GetPreviousSibling(const nsINode* aNode) {
   return aNode->GetPreviousSibling();
 }
 
-RawGeckoNodeBorrowedOrNull Gecko_GetFlattenedTreeParentNode(
-    RawGeckoNodeBorrowed aNode) {
+const nsINode* Gecko_GetFlattenedTreeParentNode(const nsINode* aNode) {
   return aNode->GetFlattenedTreeParentNodeForStyle();
 }
 
-RawGeckoElementBorrowedOrNull Gecko_GetBeforeOrAfterPseudo(
-    RawGeckoElementBorrowed aElement, bool aIsBefore) {
+const Element* Gecko_GetBeforeOrAfterPseudo(const Element* aElement,
+                                            bool aIsBefore) {
   MOZ_ASSERT(aElement);
   MOZ_ASSERT(aElement->HasProperties());
 
   return aIsBefore ? nsLayoutUtils::GetBeforePseudo(aElement)
                    : nsLayoutUtils::GetAfterPseudo(aElement);
 }
 
 nsTArray<nsIContent*>* Gecko_GetAnonymousContentForElement(
-    RawGeckoElementBorrowed aElement) {
+    const Element* aElement) {
   nsIAnonymousContentCreator* ac = do_QueryFrame(aElement->GetPrimaryFrame());
   if (!ac) {
     return nullptr;
   }
 
   auto* array = new nsTArray<nsIContent*>();
   nsContentUtils::AppendNativeAnonymousChildren(aElement, *array, 0);
   return array;
 }
 
 void Gecko_DestroyAnonymousContentList(nsTArray<nsIContent*>* aAnonContent) {
   MOZ_ASSERT(aAnonContent);
   delete aAnonContent;
 }
 
 const nsTArray<RefPtr<nsINode>>* Gecko_GetAssignedNodes(
-    RawGeckoElementBorrowed aElement) {
+    const Element* aElement) {
   MOZ_ASSERT(HTMLSlotElement::FromNode(aElement));
   return &static_cast<const HTMLSlotElement*>(aElement)->AssignedNodes();
 }
 
 void Gecko_ComputedStyle_Init(ComputedStyle* aStyle,
                               const ServoComputedData* aValues,
                               PseudoStyleType aPseudoType) {
   new (KnownNotNull, aStyle)
@@ -225,33 +223,30 @@ void ServoComputedData::AddSizeOfExcludi
   // - rules
   // - font_computation_data
 }
 
 void Gecko_ComputedStyle_Destroy(ComputedStyle* aStyle) {
   aStyle->~ComputedStyle();
 }
 
-void Gecko_ConstructStyleChildrenIterator(
-    RawGeckoElementBorrowed aElement,
-    RawGeckoStyleChildrenIteratorBorrowedMut aIterator) {
+void Gecko_ConstructStyleChildrenIterator(const Element* aElement,
+                                          StyleChildrenIterator* aIterator) {
   MOZ_ASSERT(aElement);
   MOZ_ASSERT(aIterator);
   new (aIterator) StyleChildrenIterator(aElement);
 }
 
-void Gecko_DestroyStyleChildrenIterator(
-    RawGeckoStyleChildrenIteratorBorrowedMut aIterator) {
+void Gecko_DestroyStyleChildrenIterator(StyleChildrenIterator* aIterator) {
   MOZ_ASSERT(aIterator);
 
   aIterator->~StyleChildrenIterator();
 }
 
-RawGeckoNodeBorrowed Gecko_GetNextStyleChild(
-    RawGeckoStyleChildrenIteratorBorrowedMut aIterator) {
+const nsINode* Gecko_GetNextStyleChild(StyleChildrenIterator* aIterator) {
   MOZ_ASSERT(aIterator);
   return aIterator->GetNextChild();
 }
 
 bool Gecko_VisitedStylesEnabled(const Document* aDoc) {
   MOZ_ASSERT(aDoc);
   MOZ_ASSERT(NS_IsMainThread());
 
@@ -266,60 +261,60 @@ bool Gecko_VisitedStylesEnabled(const Do
   nsILoadContext* loadContext = aDoc->GetLoadContext();
   if (loadContext && loadContext->UsePrivateBrowsing()) {
     return false;
   }
 
   return true;
 }
 
-EventStates::ServoType Gecko_ElementState(RawGeckoElementBorrowed aElement) {
+EventStates::ServoType Gecko_ElementState(const Element* aElement) {
   return aElement->StyleState().ServoValue();
 }
 
-bool Gecko_IsRootElement(RawGeckoElementBorrowed aElement) {
+bool Gecko_IsRootElement(const Element* aElement) {
   return aElement->OwnerDoc()->GetRootElement() == aElement;
 }
 
 // Dirtiness tracking.
-void Gecko_SetNodeFlags(RawGeckoNodeBorrowed aNode, uint32_t aFlags) {
+void Gecko_SetNodeFlags(const nsINode* aNode, uint32_t aFlags) {
   const_cast<nsINode*>(aNode)->SetFlags(aFlags);
 }
 
-void Gecko_UnsetNodeFlags(RawGeckoNodeBorrowed aNode, uint32_t aFlags) {
+void Gecko_UnsetNodeFlags(const nsINode* aNode, uint32_t aFlags) {
   const_cast<nsINode*>(aNode)->UnsetFlags(aFlags);
 }
 
-void Gecko_NoteDirtyElement(RawGeckoElementBorrowed aElement) {
+void Gecko_NoteDirtyElement(const Element* aElement) {
   MOZ_ASSERT(NS_IsMainThread());
   const_cast<Element*>(aElement)->NoteDirtyForServo();
 }
 
-void Gecko_NoteDirtySubtreeForInvalidation(RawGeckoElementBorrowed aElement) {
+void Gecko_NoteDirtySubtreeForInvalidation(const Element* aElement) {
   MOZ_ASSERT(NS_IsMainThread());
   const_cast<Element*>(aElement)->NoteDirtySubtreeForServo();
 }
 
-void Gecko_NoteAnimationOnlyDirtyElement(RawGeckoElementBorrowed aElement) {
+void Gecko_NoteAnimationOnlyDirtyElement(const Element* aElement) {
   MOZ_ASSERT(NS_IsMainThread());
   const_cast<Element*>(aElement)->NoteAnimationOnlyDirtyForServo();
 }
 
 bool Gecko_AnimationNameMayBeReferencedFromStyle(
-    RawGeckoPresContextBorrowed aPresContext, nsAtom* aName) {
+    const nsPresContext* aPresContext, nsAtom* aName) {
   MOZ_ASSERT(aPresContext);
   return aPresContext->AnimationManager()->AnimationMayBeReferenced(aName);
 }
 
-PseudoStyleType Gecko_GetImplementedPseudo(RawGeckoElementBorrowed aElement) {
+PseudoStyleType Gecko_GetImplementedPseudo(const Element* aElement) {
   return aElement->GetPseudoElementType();
 }
 
-uint32_t Gecko_CalcStyleDifference(ComputedStyleBorrowed aOldStyle,
-                                   ComputedStyleBorrowed aNewStyle,
+uint32_t Gecko_CalcStyleDifference(const ComputedStyle* aOldStyle,
+                                   const ComputedStyle* aNewStyle,
                                    bool* aAnyStyleStructChanged,
                                    bool* aOnlyResetStructsChanged) {
   MOZ_ASSERT(aOldStyle);
   MOZ_ASSERT(aNewStyle);
 
   uint32_t equalStructs;
   nsChangeHint result =
       aOldStyle->CalcStyleDifference(*aNewStyle, &equalStructs);
@@ -348,74 +343,73 @@ bool Gecko_HaveSeenPtr(SeenPtrs* aTable,
   MOZ_ASSERT(aTable);
   // Empty Rust allocations are indicated by small values up to the alignment
   // of the relevant type. We shouldn't see anything like that here.
   MOZ_ASSERT(uintptr_t(aPtr) > 16);
 
   return aTable->HaveSeenPtr(aPtr);
 }
 
-RawServoDeclarationBlockStrongBorrowedOrNull Gecko_GetStyleAttrDeclarationBlock(
-    RawGeckoElementBorrowed aElement) {
+const RawServoDeclarationBlockStrong* Gecko_GetStyleAttrDeclarationBlock(
+    const Element* aElement) {
   DeclarationBlock* decl = aElement->GetInlineStyleDeclaration();
   if (!decl) {
     return nullptr;
   }
   return decl->RefRawStrong();
 }
 
-void Gecko_UnsetDirtyStyleAttr(RawGeckoElementBorrowed aElement) {
+void Gecko_UnsetDirtyStyleAttr(const Element* aElement) {
   DeclarationBlock* decl = aElement->GetInlineStyleDeclaration();
   if (!decl) {
     return;
   }
   decl->UnsetDirty();
 }
 
 static const RawServoDeclarationBlockStrong* AsRefRawStrong(
     const RefPtr<RawServoDeclarationBlock>& aDecl) {
   static_assert(sizeof(RefPtr<RawServoDeclarationBlock>) ==
                     sizeof(RawServoDeclarationBlockStrong),
                 "RefPtr should just be a pointer");
   return reinterpret_cast<const RawServoDeclarationBlockStrong*>(&aDecl);
 }
 
-RawServoDeclarationBlockStrongBorrowedOrNull
-Gecko_GetHTMLPresentationAttrDeclarationBlock(
-    RawGeckoElementBorrowed aElement) {
+const RawServoDeclarationBlockStrong*
+Gecko_GetHTMLPresentationAttrDeclarationBlock(const Element* aElement) {
   const nsMappedAttributes* attrs = aElement->GetMappedAttributes();
   if (!attrs) {
     auto* svg = SVGElement::FromNodeOrNull(aElement);
     if (svg) {
       if (auto decl = svg->GetContentDeclarationBlock()) {
         return decl->RefRawStrong();
       }
     }
     return nullptr;
   }
 
   return AsRefRawStrong(attrs->GetServoStyle());
 }
 
-RawServoDeclarationBlockStrongBorrowedOrNull
-Gecko_GetExtraContentStyleDeclarations(RawGeckoElementBorrowed aElement) {
+const RawServoDeclarationBlockStrong* Gecko_GetExtraContentStyleDeclarations(
+    const Element* aElement) {
   if (!aElement->IsAnyOfHTMLElements(nsGkAtoms::td, nsGkAtoms::th)) {
     return nullptr;
   }
   const HTMLTableCellElement* cell =
       static_cast<const HTMLTableCellElement*>(aElement);
   if (nsMappedAttributes* attrs =
           cell->GetMappedAttributesInheritedFromTable()) {
     return AsRefRawStrong(attrs->GetServoStyle());
   }
   return nullptr;
 }
 
-RawServoDeclarationBlockStrongBorrowedOrNull
-Gecko_GetUnvisitedLinkAttrDeclarationBlock(RawGeckoElementBorrowed aElement) {
+const RawServoDeclarationBlockStrong*
+Gecko_GetUnvisitedLinkAttrDeclarationBlock(const Element* aElement) {
   nsHTMLStyleSheet* sheet = aElement->OwnerDoc()->GetAttributeStyleSheet();
   if (!sheet) {
     return nullptr;
   }
 
   return AsRefRawStrong(sheet->GetServoUnvisitedLinkDecl());
 }
 
@@ -442,28 +436,28 @@ void Gecko_StyleSheet_AddRef(const Style
   const_cast<StyleSheet*>(aSheet)->AddRef();
 }
 
 void Gecko_StyleSheet_Release(const StyleSheet* aSheet) {
   MOZ_ASSERT(NS_IsMainThread());
   const_cast<StyleSheet*>(aSheet)->Release();
 }
 
-RawServoDeclarationBlockStrongBorrowedOrNull
-Gecko_GetVisitedLinkAttrDeclarationBlock(RawGeckoElementBorrowed aElement) {
+const RawServoDeclarationBlockStrong* Gecko_GetVisitedLinkAttrDeclarationBlock(
+    const Element* aElement) {
   nsHTMLStyleSheet* sheet = aElement->OwnerDoc()->GetAttributeStyleSheet();
   if (!sheet) {
     return nullptr;
   }
 
   return AsRefRawStrong(sheet->GetServoVisitedLinkDecl());
 }
 
-RawServoDeclarationBlockStrongBorrowedOrNull
-Gecko_GetActiveLinkAttrDeclarationBlock(RawGeckoElementBorrowed aElement) {
+const RawServoDeclarationBlockStrong* Gecko_GetActiveLinkAttrDeclarationBlock(
+    const Element* aElement) {
   nsHTMLStyleSheet* sheet = aElement->OwnerDoc()->GetAttributeStyleSheet();
   if (!sheet) {
     return nullptr;
   }
 
   return AsRefRawStrong(sheet->GetServoActiveLinkDecl());
 }
 
@@ -477,20 +471,19 @@ static PseudoStyleType GetPseudoTypeFrom
   if (aElementOrPseudo->IsGeneratedContentContainerForAfter()) {
     aElementOrPseudo = aElementOrPseudo->GetParent()->AsElement();
     return PseudoStyleType::after;
   }
 
   return PseudoStyleType::NotPseudo;
 }
 
-bool Gecko_GetAnimationRule(
-    RawGeckoElementBorrowed aElement,
-    EffectCompositor::CascadeLevel aCascadeLevel,
-    RawServoAnimationValueMapBorrowedMut aAnimationValues) {
+bool Gecko_GetAnimationRule(const Element* aElement,
+                            EffectCompositor::CascadeLevel aCascadeLevel,
+                            RawServoAnimationValueMap* aAnimationValues) {
   MOZ_ASSERT(aElement);
 
   Document* doc = aElement->GetComposedDoc();
   if (!doc) {
     return false;
   }
   nsPresContext* presContext = doc->GetPresContext();
   if (!presContext || !presContext->IsDynamic()) {
@@ -499,40 +492,39 @@ bool Gecko_GetAnimationRule(
   }
 
   PseudoStyleType pseudoType = GetPseudoTypeFromElementForAnimation(aElement);
 
   return presContext->EffectCompositor()->GetServoAnimationRule(
       aElement, pseudoType, aCascadeLevel, aAnimationValues);
 }
 
-bool Gecko_StyleAnimationsEquals(RawGeckoStyleAnimationListBorrowed aA,
-                                 RawGeckoStyleAnimationListBorrowed aB) {
+bool Gecko_StyleAnimationsEquals(const nsStyleAutoArray<StyleAnimation>* aA,
+                                 const nsStyleAutoArray<StyleAnimation>* aB) {
   return *aA == *aB;
 }
 
-void Gecko_CopyAnimationNames(RawGeckoStyleAnimationListBorrowedMut aDest,
-                              RawGeckoStyleAnimationListBorrowed aSrc) {
+void Gecko_CopyAnimationNames(nsStyleAutoArray<StyleAnimation>* aDest,
+                              const nsStyleAutoArray<StyleAnimation>* aSrc) {
   size_t srcLength = aSrc->Length();
   aDest->EnsureLengthAtLeast(srcLength);
 
   for (size_t index = 0; index < srcLength; index++) {
     (*aDest)[index].SetName((*aSrc)[index].GetName());
   }
 }
 
 void Gecko_SetAnimationName(StyleAnimation* aStyleAnimation, nsAtom* aAtom) {
   MOZ_ASSERT(aStyleAnimation);
-
   aStyleAnimation->SetName(already_AddRefed<nsAtom>(aAtom));
 }
 
-void Gecko_UpdateAnimations(RawGeckoElementBorrowed aElement,
-                            ComputedStyleBorrowedOrNull aOldComputedData,
-                            ComputedStyleBorrowedOrNull aComputedData,
+void Gecko_UpdateAnimations(const Element* aElement,
+                            const ComputedStyle* aOldComputedData,
+                            const ComputedStyle* aComputedData,
                             UpdateAnimationsTasks aTasks) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aElement);
 
   if (!aElement->IsInComposedDoc()) {
     return;
   }
 
@@ -542,39 +534,39 @@ void Gecko_UpdateAnimations(RawGeckoElem
   }
 
   nsAutoAnimationMutationBatch mb(aElement->OwnerDoc());
 
   PseudoStyleType pseudoType = GetPseudoTypeFromElementForAnimation(aElement);
 
   if (aTasks & UpdateAnimationsTasks::CSSAnimations) {
     presContext->AnimationManager()->UpdateAnimations(
-        const_cast<dom::Element*>(aElement), pseudoType, aComputedData);
+        const_cast<Element*>(aElement), pseudoType, aComputedData);
   }
 
   // aComputedData might be nullptr if the target element is now in a
   // display:none subtree. We still call Gecko_UpdateAnimations in this case
   // because we need to stop CSS animations in the display:none subtree.
   // However, we don't need to update transitions since they are stopped by
   // RestyleManager::AnimationsWithDestroyedFrame so we just return early
   // here.
   if (!aComputedData) {
     return;
   }
 
   if (aTasks & UpdateAnimationsTasks::CSSTransitions) {
     MOZ_ASSERT(aOldComputedData);
     presContext->TransitionManager()->UpdateTransitions(
-        const_cast<dom::Element*>(aElement), pseudoType, *aOldComputedData,
+        const_cast<Element*>(aElement), pseudoType, *aOldComputedData,
         *aComputedData);
   }
 
   if (aTasks & UpdateAnimationsTasks::EffectProperties) {
     presContext->EffectCompositor()->UpdateEffectProperties(
-        aComputedData, const_cast<dom::Element*>(aElement), pseudoType);
+        aComputedData, const_cast<Element*>(aElement), pseudoType);
   }
 
   if (aTasks & UpdateAnimationsTasks::CascadeResults) {
     EffectSet* effectSet = EffectSet::GetEffectSet(aElement, pseudoType);
     // CSS animations/transitions might have been destroyed as part of the above
     // steps so before updating cascade results, we check if there are still any
     // animations to update.
     if (effectSet) {
@@ -591,131 +583,130 @@ void Gecko_UpdateAnimations(RawGeckoElem
   if (aTasks & UpdateAnimationsTasks::DisplayChangedFromNone) {
     presContext->EffectCompositor()->RequestRestyle(
         const_cast<Element*>(aElement), pseudoType,
         EffectCompositor::RestyleType::Standard,
         EffectCompositor::CascadeLevel::Animations);
   }
 }
 
-size_t Gecko_GetAnimationEffectCount(RawGeckoElementBorrowed aElementOrPseudo) {
+size_t Gecko_GetAnimationEffectCount(const Element* aElementOrPseudo) {
   PseudoStyleType pseudoType =
       GetPseudoTypeFromElementForAnimation(aElementOrPseudo);
 
   EffectSet* effectSet = EffectSet::GetEffectSet(aElementOrPseudo, pseudoType);
   return effectSet ? effectSet->Count() : 0;
 }
 
-bool Gecko_ElementHasAnimations(RawGeckoElementBorrowed aElement) {
+bool Gecko_ElementHasAnimations(const Element* aElement) {
   PseudoStyleType pseudoType = GetPseudoTypeFromElementForAnimation(aElement);
 
   return !!EffectSet::GetEffectSet(aElement, pseudoType);
 }
 
-bool Gecko_ElementHasCSSAnimations(RawGeckoElementBorrowed aElement) {
+bool Gecko_ElementHasCSSAnimations(const Element* aElement) {
   PseudoStyleType pseudoType = GetPseudoTypeFromElementForAnimation(aElement);
   nsAnimationManager::CSSAnimationCollection* collection =
       nsAnimationManager::CSSAnimationCollection ::GetAnimationCollection(
           aElement, pseudoType);
 
   return collection && !collection->mAnimations.IsEmpty();
 }
 
-bool Gecko_ElementHasCSSTransitions(RawGeckoElementBorrowed aElement) {
+bool Gecko_ElementHasCSSTransitions(const Element* aElement) {
   PseudoStyleType pseudoType = GetPseudoTypeFromElementForAnimation(aElement);
   nsTransitionManager::CSSTransitionCollection* collection =
       nsTransitionManager::CSSTransitionCollection ::GetAnimationCollection(
           aElement, pseudoType);
 
   return collection && !collection->mAnimations.IsEmpty();
 }
 
-size_t Gecko_ElementTransitions_Length(RawGeckoElementBorrowed aElement) {
+size_t Gecko_ElementTransitions_Length(const Element* aElement) {
   PseudoStyleType pseudoType = GetPseudoTypeFromElementForAnimation(aElement);
   nsTransitionManager::CSSTransitionCollection* collection =
       nsTransitionManager::CSSTransitionCollection ::GetAnimationCollection(
           aElement, pseudoType);
 
   return collection ? collection->mAnimations.Length() : 0;
 }
 
-static CSSTransition* GetCurrentTransitionAt(RawGeckoElementBorrowed aElement,
+static CSSTransition* GetCurrentTransitionAt(const Element* aElement,
                                              size_t aIndex) {
   PseudoStyleType pseudoType = GetPseudoTypeFromElementForAnimation(aElement);
   nsTransitionManager::CSSTransitionCollection* collection =
       nsTransitionManager::CSSTransitionCollection ::GetAnimationCollection(
           aElement, pseudoType);
   if (!collection) {
     return nullptr;
   }
   nsTArray<RefPtr<CSSTransition>>& transitions = collection->mAnimations;
   return aIndex < transitions.Length() ? transitions[aIndex].get() : nullptr;
 }
 
-nsCSSPropertyID Gecko_ElementTransitions_PropertyAt(
-    RawGeckoElementBorrowed aElement, size_t aIndex) {
+nsCSSPropertyID Gecko_ElementTransitions_PropertyAt(const Element* aElement,
+                                                    size_t aIndex) {
   CSSTransition* transition = GetCurrentTransitionAt(aElement, aIndex);
   return transition ? transition->TransitionProperty()
                     : nsCSSPropertyID::eCSSProperty_UNKNOWN;
 }
 
-RawServoAnimationValueBorrowedOrNull Gecko_ElementTransitions_EndValueAt(
-    RawGeckoElementBorrowed aElement, size_t aIndex) {
+const RawServoAnimationValue* Gecko_ElementTransitions_EndValueAt(
+    const Element* aElement, size_t aIndex) {
   CSSTransition* transition = GetCurrentTransitionAt(aElement, aIndex);
   return transition ? transition->ToValue().mServo.get() : nullptr;
 }
 
-double Gecko_GetProgressFromComputedTiming(
-    RawGeckoComputedTimingBorrowed aComputedTiming) {
-  return aComputedTiming->mProgress.Value();
+double Gecko_GetProgressFromComputedTiming(const ComputedTiming* aTiming) {
+  return aTiming->mProgress.Value();
 }
 
 double Gecko_GetPositionInSegment(
-    RawGeckoAnimationPropertySegmentBorrowed aSegment, double aProgress,
+    const AnimationPropertySegment* aSegment, double aProgress,
     ComputedTimingFunction::BeforeFlag aBeforeFlag) {
   MOZ_ASSERT(aSegment->mFromKey < aSegment->mToKey,
              "The segment from key should be less than to key");
 
   double positionInSegment = (aProgress - aSegment->mFromKey) /
                              // To avoid floating precision inaccuracies, make
                              // sure we calculate both the numerator and
                              // denominator using double precision.
                              (double(aSegment->mToKey) - aSegment->mFromKey);
 
   return ComputedTimingFunction::GetPortion(aSegment->mTimingFunction,
                                             positionInSegment, aBeforeFlag);
 }
 
-RawServoAnimationValueBorrowedOrNull Gecko_AnimationGetBaseStyle(
-    void* aBaseStyles, nsCSSPropertyID aProperty) {
-  auto base =
-      static_cast<nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>*>(
-          aBaseStyles);
+const RawServoAnimationValue* Gecko_AnimationGetBaseStyle(
+    const RawServoAnimationValueTable* aBaseStyles, nsCSSPropertyID aProperty) {
+  auto base = reinterpret_cast<
+      const nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>*>(
+      aBaseStyles);
   return base->GetWeak(aProperty);
 }
 
 void Gecko_FillAllImageLayers(nsStyleImageLayers* aLayers, uint32_t aMaxLen) {
   aLayers->FillAllLayers(aMaxLen);
 }
 
-bool Gecko_IsDocumentBody(RawGeckoElementBorrowed aElement) {
+bool Gecko_IsDocumentBody(const Element* aElement) {
   Document* doc = aElement->GetUncomposedDoc();
   return doc && doc->GetBodyElement() == aElement;
 }
 
 nscolor Gecko_GetLookAndFeelSystemColor(int32_t aId, const Document* aDoc) {
   bool useStandinsForNativeColors = !nsContentUtils::IsChromeDoc(aDoc);
   nscolor result;
   LookAndFeel::ColorID colorId = static_cast<LookAndFeel::ColorID>(aId);
   AutoWriteLock guard(*sServoFFILock);
   LookAndFeel::GetColor(colorId, useStandinsForNativeColors, &result);
   return result;
 }
 
-bool Gecko_MatchLang(RawGeckoElementBorrowed aElement, nsAtom* aOverrideLang,
+bool Gecko_MatchLang(const Element* aElement, nsAtom* aOverrideLang,
                      bool aHasOverrideLang, const char16_t* aValue) {
   MOZ_ASSERT(!(aOverrideLang && !aHasOverrideLang),
              "aHasOverrideLang should only be set when aOverrideLang is null");
   MOZ_ASSERT(aValue, "null lang parameter");
   if (!aValue || !*aValue) {
     return false;
   }
 
@@ -742,17 +733,17 @@ bool Gecko_MatchLang(RawGeckoElementBorr
     if (nsStyleUtil::DashMatchCompare(
             lang, langString, nsASCIICaseInsensitiveStringComparator())) {
       return true;
     }
   }
   return false;
 }
 
-nsAtom* Gecko_GetXMLLangValue(RawGeckoElementBorrowed aElement) {
+nsAtom* Gecko_GetXMLLangValue(const Element* aElement) {
   const nsAttrValue* attr =
       aElement->GetParsedAttr(nsGkAtoms::lang, kNameSpaceID_XML);
 
   if (!attr) {
     return nullptr;
   }
 
   MOZ_ASSERT(attr->Type() == nsAttrValue::eAtom);
@@ -764,26 +755,26 @@ nsAtom* Gecko_GetXMLLangValue(RawGeckoEl
 Document::DocumentTheme Gecko_GetDocumentLWTheme(const Document* aDocument) {
   return aDocument->ThreadSafeGetDocumentLWTheme();
 }
 
 const PreferenceSheet::Prefs* Gecko_GetPrefSheetPrefs(const Document* aDoc) {
   return &PreferenceSheet::PrefsFor(*aDoc);
 }
 
-bool Gecko_IsTableBorderNonzero(RawGeckoElementBorrowed aElement) {
+bool Gecko_IsTableBorderNonzero(const Element* aElement) {
   if (!aElement->IsHTMLElement(nsGkAtoms::table)) {
     return false;
   }
   const nsAttrValue* val = aElement->GetParsedAttr(nsGkAtoms::border);
   return val &&
          (val->Type() != nsAttrValue::eInteger || val->GetIntegerValue() != 0);
 }
 
-bool Gecko_IsBrowserFrame(RawGeckoElementBorrowed aElement) {
+bool Gecko_IsBrowserFrame(const Element* aElement) {
   nsIMozBrowserFrame* browserFrame =
       const_cast<Element*>(aElement)->GetAsMozBrowserFrame();
   return browserFrame && browserFrame->GetReallyIsBrowser();
 }
 
 template <typename Implementor>
 static nsAtom* LangValue(Implementor* aElement) {
   // TODO(emilio): Deduplicate a bit with nsIContent::GetLang().
@@ -946,17 +937,17 @@ static bool AttrHasSuffix(Implementor* a
                               nsAtom* aName, nsAtom* aStr, bool aIgnoreCase) { \
     return AttrHasPrefix(aElement, aNS, aName, aStr, aIgnoreCase);             \
   }                                                                            \
   bool prefix_##AttrHasSuffix(implementor_ aElement, nsAtom* aNS,              \
                               nsAtom* aName, nsAtom* aStr, bool aIgnoreCase) { \
     return AttrHasSuffix(aElement, aNS, aName, aStr, aIgnoreCase);             \
   }
 
-SERVO_IMPL_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_, RawGeckoElementBorrowed)
+SERVO_IMPL_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_, const Element*)
 SERVO_IMPL_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_Snapshot,
                                            const ServoElementSnapshot*)
 
 #undef SERVO_IMPL_ELEMENT_ATTR_MATCHING_FUNCTIONS
 
 nsAtom* Gecko_Atomize(const char* aString, uint32_t aLength) {
   return NS_Atomize(nsDependentCSubstring(aString, aLength)).take();
 }
@@ -994,17 +985,17 @@ size_t Gecko_SharedFontList_SizeOfInclud
       GeckoSharedFontListMallocSizeOf);
 }
 
 size_t Gecko_SharedFontList_SizeOfIncludingThis(SharedFontList* aFontlist) {
   MOZ_ASSERT(NS_IsMainThread());
   return aFontlist->SizeOfIncludingThis(GeckoSharedFontListMallocSizeOf);
 }
 
-NS_IMPL_THREADSAFE_FFI_REFCOUNTING(mozilla::SharedFontList, SharedFontList);
+NS_IMPL_THREADSAFE_FFI_REFCOUNTING(SharedFontList, SharedFontList);
 
 void Gecko_CopyFontFamilyFrom(nsFont* dst, const nsFont* src) {
   dst->fontlist = src->fontlist;
 }
 
 void Gecko_nsFont_InitSystem(nsFont* aDest, int32_t aFontId,
                              const nsStyleFont* aFont,
                              const Document* aDocument) {
@@ -1023,18 +1014,18 @@ void Gecko_nsFont_InitSystem(nsFont* aDe
   nsLayoutUtils::ComputeSystemFont(aDest, fontID, defaultVariableFont);
 }
 
 void Gecko_nsFont_Destroy(nsFont* aDest) { aDest->~nsFont(); }
 
 FontFamilyType Gecko_nsStyleFont_ComputeDefaultFontType(const Document* aDoc,
                                                         uint8_t aGenericId,
                                                         nsAtom* aLanguage) {
-  const nsFont* defaultFont = ThreadSafeGetDefaultFontHelper(*aDoc, aLanguage,
-                                                             aGenericId);
+  const nsFont* defaultFont =
+      ThreadSafeGetDefaultFontHelper(*aDoc, aLanguage, aGenericId);
   return defaultFont->fontlist.GetDefaultFontType();
 }
 
 gfxFontFeatureValueSet* Gecko_ConstructFontFeatureValueSet() {
   return new gfxFontFeatureValueSet();
 }
 
 nsTArray<unsigned int>* Gecko_AppendFeatureValueHashEntry(
@@ -1042,57 +1033,55 @@ nsTArray<unsigned int>* Gecko_AppendFeat
     uint32_t aAlternate, nsAtom* aName) {
   MOZ_ASSERT(NS_IsMainThread());
   static_assert(sizeof(unsigned int) == sizeof(uint32_t),
                 "sizeof unsigned int and uint32_t must be the same");
   return aFontFeatureValues->AppendFeatureValueHashEntry(
       nsAtomCString(aFamily), nsDependentAtomString(aName), aAlternate);
 }
 
-float Gecko_FontStretch_ToFloat(mozilla::FontStretch aStretch) {
+float Gecko_FontStretch_ToFloat(FontStretch aStretch) {
   // Servo represents percentages with 1. being 100%.
   return aStretch.Percentage() / 100.0f;
 }
 
-void Gecko_FontStretch_SetFloat(mozilla::FontStretch* aStretch, float aFloat) {
+void Gecko_FontStretch_SetFloat(FontStretch* aStretch, float aFloat) {
   // Servo represents percentages with 1. being 100%.
   //
   // Also, the font code assumes a given maximum that style doesn't really need
   // to know about. So clamp here at the boundary.
   *aStretch = FontStretch(std::min(aFloat * 100.0f, float(FontStretch::kMax)));
 }
 
-void Gecko_FontSlantStyle_SetNormal(mozilla::FontSlantStyle* aStyle) {
-  *aStyle = mozilla::FontSlantStyle::Normal();
+void Gecko_FontSlantStyle_SetNormal(FontSlantStyle* aStyle) {
+  *aStyle = FontSlantStyle::Normal();
 }
 
-void Gecko_FontSlantStyle_SetItalic(mozilla::FontSlantStyle* aStyle) {
-  *aStyle = mozilla::FontSlantStyle::Italic();
+void Gecko_FontSlantStyle_SetItalic(FontSlantStyle* aStyle) {
+  *aStyle = FontSlantStyle::Italic();
 }
 
-void Gecko_FontSlantStyle_SetOblique(mozilla::FontSlantStyle* aStyle,
+void Gecko_FontSlantStyle_SetOblique(FontSlantStyle* aStyle,
                                      float aAngleInDegrees) {
-  *aStyle = mozilla::FontSlantStyle::Oblique(aAngleInDegrees);
+  *aStyle = FontSlantStyle::Oblique(aAngleInDegrees);
 }
 
-void Gecko_FontSlantStyle_Get(mozilla::FontSlantStyle aStyle, bool* aNormal,
+void Gecko_FontSlantStyle_Get(FontSlantStyle aStyle, bool* aNormal,
                               bool* aItalic, float* aObliqueAngle) {
   *aNormal = aStyle.IsNormal();
   *aItalic = aStyle.IsItalic();
   if (aStyle.IsOblique()) {
     *aObliqueAngle = aStyle.ObliqueAngle();
   }
 }
 
-float Gecko_FontWeight_ToFloat(mozilla::FontWeight aWeight) {
-  return aWeight.ToFloat();
-}
+float Gecko_FontWeight_ToFloat(FontWeight aWeight) { return aWeight.ToFloat(); }
 
-void Gecko_FontWeight_SetFloat(mozilla::FontWeight* aWeight, float aFloat) {
-  *aWeight = mozilla::FontWeight(aFloat);
+void Gecko_FontWeight_SetFloat(FontWeight* aWeight, float aFloat) {
+  *aWeight = FontWeight(aFloat);
 }
 
 void Gecko_ClearAlternateValues(nsFont* aFont, size_t aLength) {
   aFont->alternateValues.Clear();
   aFont->alternateValues.SetCapacity(aLength);
 }
 
 void Gecko_AppendAlternateValues(nsFont* aFont, uint32_t aAlternateName,
@@ -1532,58 +1521,57 @@ void Gecko_SetStyleCoordCalcValue(nsStyl
   calcRef->mLength = aCalc.mLength;
   calcRef->mPercent = aCalc.mPercent;
   calcRef->mHasPercent = aCalc.mHasPercent;
   *aUnit = nsStyleUnit::eStyleUnit_Calc;
   aValue->mPointer = calcRef;
   calcRef->AddRef();
 }
 
-void Gecko_CopyShapeSourceFrom(mozilla::StyleShapeSource* aDst,
-                               const mozilla::StyleShapeSource* aSrc) {
+void Gecko_CopyShapeSourceFrom(StyleShapeSource* aDst,
+                               const StyleShapeSource* aSrc) {
   MOZ_ASSERT(aDst);
   MOZ_ASSERT(aSrc);
 
   *aDst = *aSrc;
 }
 
-void Gecko_DestroyShapeSource(mozilla::StyleShapeSource* aShape) {
+void Gecko_DestroyShapeSource(StyleShapeSource* aShape) {
   aShape->~StyleShapeSource();
 }
 
 void Gecko_StyleShapeSource_SetURLValue(StyleShapeSource* aShape,
                                         URLValue* aURL) {
   aShape->SetURL(*aURL);
 }
 
-void Gecko_NewBasicShape(mozilla::StyleShapeSource* aShape,
-                         mozilla::StyleBasicShapeType aType) {
-  aShape->SetBasicShape(MakeUnique<mozilla::StyleBasicShape>(aType),
+void Gecko_NewBasicShape(StyleShapeSource* aShape, StyleBasicShapeType aType) {
+  aShape->SetBasicShape(MakeUnique<StyleBasicShape>(aType),
                         StyleGeometryBox::NoBox);
 }
 
-void Gecko_NewShapeImage(mozilla::StyleShapeSource* aShape) {
+void Gecko_NewShapeImage(StyleShapeSource* aShape) {
   aShape->SetShapeImage(MakeUnique<nsStyleImage>());
 }
 
-void Gecko_NewStyleSVGPath(mozilla::StyleShapeSource* aShape) {
+void Gecko_NewStyleSVGPath(StyleShapeSource* aShape) {
   MOZ_ASSERT(aShape);
-  aShape->SetPath(MakeUnique<mozilla::StyleSVGPath>());
+  aShape->SetPath(MakeUnique<StyleSVGPath>());
 }
 
-void Gecko_SetStyleMotion(UniquePtr<mozilla::StyleMotion>* aMotion,
-                          mozilla::StyleMotion* aValue) {
+void Gecko_SetStyleMotion(UniquePtr<StyleMotion>* aMotion,
+                          StyleMotion* aValue) {
   MOZ_ASSERT(aMotion);
   aMotion->reset(aValue);
 }
 
-mozilla::StyleMotion* Gecko_NewStyleMotion() { return new StyleMotion(); }
+StyleMotion* Gecko_NewStyleMotion() { return new StyleMotion(); }
 
-void Gecko_CopyStyleMotions(mozilla::UniquePtr<mozilla::StyleMotion>* aMotion,
-                            const mozilla::StyleMotion* aOther) {
+void Gecko_CopyStyleMotions(UniquePtr<StyleMotion>* aMotion,
+                            const StyleMotion* aOther) {
   MOZ_ASSERT(aMotion);
   *aMotion = aOther ? MakeUnique<StyleMotion>(*aOther) : nullptr;
 }
 
 void Gecko_ResetFilters(nsStyleEffects* effects, size_t new_len) {
   effects->mFilters.Clear();
   effects->mFilters.SetLength(new_len);
 }
@@ -1624,19 +1612,19 @@ void Gecko_nsStyleSVG_SetContextProperti
 }
 
 void Gecko_nsStyleSVG_CopyContextProperties(nsStyleSVG* aDst,
                                             const nsStyleSVG* aSrc) {
   aDst->mContextProps = aSrc->mContextProps;
   aDst->mContextPropsBits = aSrc->mContextPropsBits;
 }
 
-css::URLValue* Gecko_URLValue_Create(RawServoCssUrlDataStrong aCssUrl,
-                                     CORSMode aCORSMode) {
-  RefPtr<css::URLValue> url = new css::URLValue(aCssUrl.Consume(), aCORSMode);
+URLValue* Gecko_URLValue_Create(RawServoCssUrlDataStrong aCssUrl,
+                                CORSMode aCORSMode) {
+  RefPtr<URLValue> url = new URLValue(aCssUrl.Consume(), aCORSMode);
   return url.forget().take();
 }
 
 MOZ_DEFINE_MALLOC_SIZE_OF(GeckoURLValueMallocSizeOf)
 
 size_t Gecko_URLValue_SizeOfIncludingThis(URLValue* aURL) {
   MOZ_ASSERT(NS_IsMainThread());
   return aURL->SizeOfIncludingThis(GeckoURLValueMallocSizeOf);
@@ -1694,27 +1682,27 @@ void DebugListAttributes(const ElementLi
       value.Truncate(kMaxAttributeLength - 3);
       value.AppendLiteral("...");
     }
     aOut.Append(NS_ConvertUTF16toUTF8(value));
     aOut.AppendLiteral("\"");
   }
 }
 
-void Gecko_Element_DebugListAttributes(RawGeckoElementBorrowed aElement,
+void Gecko_Element_DebugListAttributes(const Element* aElement,
                                        nsCString* aOut) {
   DebugListAttributes(*aElement, *aOut);
 }
 
 void Gecko_Snapshot_DebugListAttributes(const ServoElementSnapshot* aSnapshot,
                                         nsCString* aOut) {
   DebugListAttributes(*aSnapshot, *aOut);
 }
 
-NS_IMPL_THREADSAFE_FFI_REFCOUNTING(css::URLValue, CSSURLValue);
+NS_IMPL_THREADSAFE_FFI_REFCOUNTING(URLValue, CSSURLValue);
 
 NS_IMPL_THREADSAFE_FFI_REFCOUNTING(URLExtraData, URLExtraData);
 
 NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc);
 
 nsCSSShadowArray* Gecko_NewCSSShadowArray(uint32_t aLen) {
   RefPtr<nsCSSShadowArray> arr = new (aLen) nsCSSShadowArray(aLen);
   return arr.forget().take();
@@ -1744,152 +1732,141 @@ nsCSSValueSharedList* Gecko_NewNoneTrans
   list->mHead->mValue.SetNoneValue();
   return list.forget().take();
 }
 
 void Gecko_StyleDisplay_GenerateCombinedTransform(nsStyleDisplay* aDisplay) {
   aDisplay->GenerateCombinedIndividualTransform();
 }
 
-void Gecko_CSSValue_SetNumber(nsCSSValueBorrowedMut aCSSValue, float aNumber) {
+void Gecko_CSSValue_SetNumber(nsCSSValue* aCSSValue, float aNumber) {
   aCSSValue->SetFloatValue(aNumber, eCSSUnit_Number);
 }
 
-float Gecko_CSSValue_GetNumber(nsCSSValueBorrowed aCSSValue) {
+float Gecko_CSSValue_GetNumber(const nsCSSValue* aCSSValue) {
   return aCSSValue->GetFloatValue();
 }
 
-void Gecko_CSSValue_SetKeyword(nsCSSValueBorrowedMut aCSSValue,
-                               nsCSSKeyword aKeyword) {
+void Gecko_CSSValue_SetKeyword(nsCSSValue* aCSSValue, nsCSSKeyword aKeyword) {
   aCSSValue->SetEnumValue(aKeyword);
 }
 
-nsCSSKeyword Gecko_CSSValue_GetKeyword(nsCSSValueBorrowed aCSSValue) {
+nsCSSKeyword Gecko_CSSValue_GetKeyword(const nsCSSValue* aCSSValue) {
   return aCSSValue->GetKeywordValue();
 }
 
-void Gecko_CSSValue_SetPercentage(nsCSSValueBorrowedMut aCSSValue,
-                                  float aPercent) {
+void Gecko_CSSValue_SetPercentage(nsCSSValue* aCSSValue, float aPercent) {
   aCSSValue->SetPercentValue(aPercent);
 }
 
-float Gecko_CSSValue_GetPercentage(nsCSSValueBorrowed aCSSValue) {
+float Gecko_CSSValue_GetPercentage(const nsCSSValue* aCSSValue) {
   return aCSSValue->GetPercentValue();
 }
 
-void Gecko_CSSValue_SetPixelLength(nsCSSValueBorrowedMut aCSSValue,
-                                   float aLen) {
+void Gecko_CSSValue_SetPixelLength(nsCSSValue* aCSSValue, float aLen) {
   MOZ_ASSERT(aCSSValue->GetUnit() == eCSSUnit_Null ||
              aCSSValue->GetUnit() == eCSSUnit_Pixel);
   aCSSValue->SetFloatValue(aLen, eCSSUnit_Pixel);
 }
 
-void Gecko_CSSValue_SetCalc(nsCSSValueBorrowedMut aCSSValue,
+void Gecko_CSSValue_SetCalc(nsCSSValue* aCSSValue,
                             nsStyleCoord::CalcValue aCalc) {
   aCSSValue->SetCalcValue(aCalc);
 }
 
-nsStyleCoord::CalcValue Gecko_CSSValue_GetCalc(nsCSSValueBorrowed aCSSValue) {
+nsStyleCoord::CalcValue Gecko_CSSValue_GetCalc(const nsCSSValue* aCSSValue) {
   return aCSSValue->GetCalcValue();
 }
 
-void Gecko_CSSValue_SetFunction(nsCSSValueBorrowedMut aCSSValue, int32_t aLen) {
+void Gecko_CSSValue_SetFunction(nsCSSValue* aCSSValue, int32_t aLen) {
   nsCSSValue::Array* arr = nsCSSValue::Array::Create(aLen);
   aCSSValue->SetArrayValue(arr, eCSSUnit_Function);
 }
 
-void Gecko_CSSValue_SetString(nsCSSValueBorrowedMut aCSSValue,
-                              const uint8_t* aString, uint32_t aLength,
-                              nsCSSUnit aUnit) {
+void Gecko_CSSValue_SetString(nsCSSValue* aCSSValue, const uint8_t* aString,
+                              uint32_t aLength, nsCSSUnit aUnit) {
   MOZ_ASSERT(aCSSValue->GetUnit() == eCSSUnit_Null);
   nsString string;
   nsDependentCSubstring slice(reinterpret_cast<const char*>(aString), aLength);
   AppendUTF8toUTF16(slice, string);
   aCSSValue->SetStringValue(string, aUnit);
 }
 
-void Gecko_CSSValue_SetStringFromAtom(nsCSSValueBorrowedMut aCSSValue,
-                                      nsAtom* aAtom, nsCSSUnit aUnit) {
+void Gecko_CSSValue_SetStringFromAtom(nsCSSValue* aCSSValue, nsAtom* aAtom,
+                                      nsCSSUnit aUnit) {
   aCSSValue->SetStringValue(nsDependentAtomString(aAtom), aUnit);
 }
 
-void Gecko_CSSValue_SetAtomIdent(nsCSSValueBorrowedMut aCSSValue,
-                                 nsAtom* aAtom) {
+void Gecko_CSSValue_SetAtomIdent(nsCSSValue* aCSSValue, nsAtom* aAtom) {
   aCSSValue->SetAtomIdentValue(already_AddRefed<nsAtom>(aAtom));
 }
 
-void Gecko_CSSValue_SetArray(nsCSSValueBorrowedMut aCSSValue, int32_t aLength) {
+void Gecko_CSSValue_SetArray(nsCSSValue* aCSSValue, int32_t aLength) {
   MOZ_ASSERT(aCSSValue->GetUnit() == eCSSUnit_Null);
   RefPtr<nsCSSValue::Array> array = nsCSSValue::Array::Create(aLength);
   aCSSValue->SetArrayValue(array, eCSSUnit_Array);
 }
 
-void Gecko_CSSValue_SetInt(nsCSSValueBorrowedMut aCSSValue, int32_t aInteger,
+void Gecko_CSSValue_SetInt(nsCSSValue* aCSSValue, int32_t aInteger,
                            nsCSSUnit aUnit) {
   aCSSValue->SetIntValue(aInteger, aUnit);
 }
 
-void Gecko_CSSValue_SetFloat(nsCSSValueBorrowedMut aCSSValue, float aValue,
+void Gecko_CSSValue_SetFloat(nsCSSValue* aCSSValue, float aValue,
                              nsCSSUnit aUnit) {
   aCSSValue->SetFloatValue(aValue, aUnit);
 }
 
-nsCSSValueBorrowedMut Gecko_CSSValue_GetArrayItem(
-    nsCSSValueBorrowedMut aCSSValue, int32_t aIndex) {
+nsCSSValue* Gecko_CSSValue_GetArrayItem(nsCSSValue* aCSSValue, int32_t aIndex) {
   return &aCSSValue->GetArrayValue()->Item(aIndex);
 }
 
-nsCSSValueBorrowed Gecko_CSSValue_GetArrayItemConst(
-    nsCSSValueBorrowed aCSSValue, int32_t aIndex) {
+const nsCSSValue* Gecko_CSSValue_GetArrayItemConst(const nsCSSValue* aCSSValue,
+                                                   int32_t aIndex) {
   return &aCSSValue->GetArrayValue()->Item(aIndex);
 }
 
-void Gecko_CSSValue_SetPair(nsCSSValueBorrowedMut aCSSValue,
-                            nsCSSValueBorrowed aXValue,
-                            nsCSSValueBorrowed aYValue) {
+void Gecko_CSSValue_SetPair(nsCSSValue* aCSSValue, const nsCSSValue* aXValue,
+                            const nsCSSValue* aYValue) {
   MOZ_ASSERT(NS_IsMainThread());
   aCSSValue->SetPairValue(*aXValue, *aYValue);
 }
 
-void Gecko_CSSValue_SetList(nsCSSValueBorrowedMut aCSSValue, uint32_t aLen) {
+void Gecko_CSSValue_SetList(nsCSSValue* aCSSValue, uint32_t aLen) {
   MOZ_ASSERT(NS_IsMainThread());
   nsCSSValueList* item = aCSSValue->SetListValue();
   for (uint32_t i = 1; i < aLen; ++i) {
     item->mNext = new nsCSSValueList;
     item = item->mNext;
   }
 }
 
-void Gecko_CSSValue_SetPairList(nsCSSValueBorrowedMut aCSSValue,
-                                uint32_t aLen) {
+void Gecko_CSSValue_SetPairList(nsCSSValue* aCSSValue, uint32_t aLen) {
   MOZ_ASSERT(NS_IsMainThread());
   nsCSSValuePairList* item = aCSSValue->SetPairListValue();
   for (uint32_t i = 1; i < aLen; ++i) {
     item->mNext = new nsCSSValuePairList;
     item = item->mNext;
   }
 }
 
-void Gecko_CSSValue_InitSharedList(nsCSSValueBorrowedMut aCSSValue,
-                                   uint32_t aLen) {
+void Gecko_CSSValue_InitSharedList(nsCSSValue* aCSSValue, uint32_t aLen) {
   MOZ_ASSERT(aLen > 0, "Must create at least one nsCSSValueList (mHead)");
 
   nsCSSValueSharedList* list = new nsCSSValueSharedList;
   aCSSValue->SetSharedListValue(list);
   list->mHead = new nsCSSValueList;
   nsCSSValueList* cur = list->mHead;
   for (uint32_t i = 1; i < aLen; ++i) {
     cur->mNext = new nsCSSValueList;
     cur = cur->mNext;
   }
 }
 
-void Gecko_CSSValue_Drop(nsCSSValueBorrowedMut aCSSValue) {
-  aCSSValue->~nsCSSValue();
-}
+void Gecko_CSSValue_Drop(nsCSSValue* aCSSValue) { aCSSValue->~nsCSSValue(); }
 
 void Gecko_nsStyleFont_SetLang(nsStyleFont* aFont, nsAtom* aAtom) {
   aFont->mLanguage = dont_AddRef(aAtom);
   aFont->mExplicitLanguage = true;
 }
 
 void Gecko_nsStyleFont_CopyLangFrom(nsStyleFont* aFont,
                                     const nsStyleFont* aSource) {
@@ -1970,28 +1947,27 @@ FontSizePrefs Gecko_GetBaseSize(nsAtom* 
   nsStaticAtom* langGroupAtom =
       StaticPresData::Get()->GetUncachedLangGroup(aLanguage);
   prefs.Initialize(langGroupAtom);
   FontSizePrefs sizes;
   sizes.CopyFrom(prefs);
   return sizes;
 }
 
-RawGeckoElementBorrowedOrNull Gecko_GetBindingParent(
-    RawGeckoElementBorrowed aElement) {
+const Element* Gecko_GetBindingParent(const Element* aElement) {
   nsIContent* parent = aElement->GetBindingParent();
   return parent ? parent->AsElement() : nullptr;
 }
 
-RawServoAuthorStylesBorrowedOrNull Gecko_XBLBinding_GetRawServoStyles(
-    RawGeckoXBLBindingBorrowed aXBLBinding) {
+const RawServoAuthorStyles* Gecko_XBLBinding_GetRawServoStyles(
+    const nsXBLBinding* aXBLBinding) {
   return aXBLBinding->GetServoStyles();
 }
 
-bool Gecko_XBLBinding_InheritsStyle(RawGeckoXBLBindingBorrowed aXBLBinding) {
+bool Gecko_XBLBinding_InheritsStyle(const nsXBLBinding* aXBLBinding) {
   return aXBLBinding->InheritsStyle();
 }
 
 static StaticRefPtr<UACacheReporter> gUACacheReporter;
 
 namespace mozilla {
 
 void InitializeServo() {
@@ -2018,17 +1994,17 @@ void AssertIsMainThreadOrServoFontMetric
   if (!NS_IsMainThread()) {
     MOZ_ASSERT(sServoFFILock &&
                sServoFFILock->LockedForWritingByCurrentThread());
   }
 }
 
 }  // namespace mozilla
 
-GeckoFontMetrics Gecko_GetFontMetrics(RawGeckoPresContextBorrowed aPresContext,
+GeckoFontMetrics Gecko_GetFontMetrics(const nsPresContext* aPresContext,
                                       bool aIsVertical,
                                       const nsStyleFont* aFont,
                                       nscoord aFontSize, bool aUseUserFontSet) {
   AutoWriteLock guard(*sServoFFILock);
   GeckoFontMetrics ret;
 
   // Getting font metrics can require some main thread only work to be
   // done, such as work that needs to touch non-threadsafe refcounted
@@ -2076,25 +2052,25 @@ void Gecko_StyleSheet_FinishAsyncParse(
             Servo_UseCounters_Merge(docCounters, counters.get());
           }
         }
         data->mSheet->FinishAsyncParse(contents.forget());
       }));
 }
 
 static already_AddRefed<StyleSheet> LoadImportSheet(
-    css::Loader* aLoader, StyleSheet* aParent, SheetLoadData* aParentLoadData,
-    css::LoaderReusableStyleSheets* aReusableSheets, css::URLValue* aURL,
+    Loader* aLoader, StyleSheet* aParent, SheetLoadData* aParentLoadData,
+    LoaderReusableStyleSheets* aReusableSheets, URLValue* aURL,
     already_AddRefed<RawServoMediaList> aMediaList) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aLoader, "Should've catched this before");
   MOZ_ASSERT(aParent, "Only used for @import, so parent should exist!");
   MOZ_ASSERT(aURL, "Invalid URLs shouldn't be loaded!");
 
-  RefPtr<dom::MediaList> media = new MediaList(std::move(aMediaList));
+  RefPtr<MediaList> media = new MediaList(std::move(aMediaList));
   nsCOMPtr<nsIURI> uri = aURL->GetURI();
   nsresult rv = uri ? NS_OK : NS_ERROR_FAILURE;
 
   StyleSheet* previousFirstChild = aParent->GetFirstChild();
   if (NS_SUCCEEDED(rv)) {
     rv = aLoader->LoadChildSheet(aParent, aParentLoadData, uri, media,
                                  aReusableSheets);
   }
@@ -2120,39 +2096,39 @@ static already_AddRefed<StyleSheet> Load
     aParent->PrependStyleSheet(emptySheet);
     return emptySheet.forget();
   }
 
   RefPtr<StyleSheet> sheet = static_cast<StyleSheet*>(aParent->GetFirstChild());
   return sheet.forget();
 }
 
-StyleSheet* Gecko_LoadStyleSheet(
-    css::Loader* aLoader, StyleSheet* aParent, SheetLoadData* aParentLoadData,
-    css::LoaderReusableStyleSheets* aReusableSheets,
-    RawServoCssUrlDataStrong aCssUrl, RawServoMediaListStrong aMediaList) {
+StyleSheet* Gecko_LoadStyleSheet(Loader* aLoader, StyleSheet* aParent,
+                                 SheetLoadData* aParentLoadData,
+                                 LoaderReusableStyleSheets* aReusableSheets,
+                                 RawServoCssUrlDataStrong aCssUrl,
+                                 RawServoMediaListStrong aMediaList) {
   MOZ_ASSERT(NS_IsMainThread());
 
   // The CORS mode in the URLValue is irrelevant here.
   // (CORS_NONE is used for all imported sheets in Load::LoadChildSheet.)
-  RefPtr<css::URLValue> url = new css::URLValue(aCssUrl.Consume(), CORS_NONE);
+  RefPtr<URLValue> url = new URLValue(aCssUrl.Consume(), CORS_NONE);
   return LoadImportSheet(aLoader, aParent, aParentLoadData, aReusableSheets,
                          url, aMediaList.Consume())
       .take();
 }
 
-void Gecko_LoadStyleSheetAsync(css::SheetLoadDataHolder* aParentData,
+void Gecko_LoadStyleSheetAsync(SheetLoadDataHolder* aParentData,
                                RawServoCssUrlDataStrong aCssUrl,
                                RawServoMediaListStrong aMediaList,
                                RawServoImportRuleStrong aImportRule) {
   RefPtr<SheetLoadDataHolder> loadData = aParentData;
   // The CORS mode in the URLValue is irrelevant here.
   // (CORS_NONE is used for all imported sheets in Load::LoadChildSheet.)
-  RefPtr<css::URLValue> urlVal =
-      new css::URLValue(aCssUrl.Consume(), CORS_NONE);
+  RefPtr<URLValue> urlVal = new URLValue(aCssUrl.Consume(), CORS_NONE);
   RefPtr<RawServoMediaList> mediaList = aMediaList.Consume();
   RefPtr<RawServoImportRule> importRule = aImportRule.Consume();
   NS_DispatchToMainThread(NS_NewRunnableFunction(
       __func__,
       [data = std::move(loadData), url = std::move(urlVal),
        media = std::move(mediaList), import = std::move(importRule)]() mutable {
         MOZ_ASSERT(NS_IsMainThread());
         SheetLoadData* d = data->get();
@@ -2171,17 +2147,17 @@ nsCSSKeyword Gecko_LookupCSSKeyword(cons
 const char* Gecko_CSSKeywordString(nsCSSKeyword aKeyword, uint32_t* aLength) {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aLength);
   const nsCString& value = nsCSSKeywords::GetStringValue(aKeyword);
   *aLength = value.Length();
   return value.get();
 }
 
-void Gecko_AddPropertyToSet(nsCSSPropertyIDSetBorrowedMut aPropertySet,
+void Gecko_AddPropertyToSet(nsCSSPropertyIDSet* aPropertySet,
                             nsCSSPropertyID aProperty) {
   aPropertySet->AddProperty(aProperty);
 }
 
 NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsCSSValueSharedList, CSSValueSharedList);
 
 #define STYLE_STRUCT(name)                                             \
                                                                        \
@@ -2202,17 +2178,17 @@ NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsCSS
 void Gecko_RegisterProfilerThread(const char* name) {
   PROFILER_REGISTER_THREAD(name);
 }
 
 void Gecko_UnregisterProfilerThread() { PROFILER_UNREGISTER_THREAD(); }
 
 bool Gecko_DocumentRule_UseForPresentation(
     const Document* aDocument, const nsACString* aPattern,
-    css::DocumentMatchingFunction aMatchingFunction) {
+    DocumentMatchingFunction aMatchingFunction) {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsIURI* docURI = aDocument->GetDocumentURI();
   nsAutoCString docURISpec;
   if (docURI) {
     // If GetSpec fails (due to OOM) just skip these URI-specific CSS rules.
     nsresult rv = docURI->GetSpec(docURISpec);
     NS_ENSURE_SUCCESS(rv, false);
@@ -2308,17 +2284,17 @@ bool Gecko_GetBoolPrefValue(const char* 
   MOZ_ASSERT(NS_IsMainThread());
   return Preferences::GetBool(aPrefName);
 }
 
 bool Gecko_IsInServoTraversal() { return ServoStyleSet::IsInServoTraversal(); }
 
 bool Gecko_IsMainThread() { return NS_IsMainThread(); }
 
-const nsAttrValue* Gecko_GetSVGAnimatedClass(RawGeckoElementBorrowed aElement) {
+const nsAttrValue* Gecko_GetSVGAnimatedClass(const Element* aElement) {
   MOZ_ASSERT(aElement->IsSVGElement());
   return static_cast<const SVGElement*>(aElement)->GetAnimatedClassName();
 }
 
 bool Gecko_AssertClassAttrValueIsSane(const nsAttrValue* aValue) {
   MOZ_ASSERT(aValue->Type() == nsAttrValue::eAtom ||
              aValue->Type() == nsAttrValue::eString ||
              aValue->Type() == nsAttrValue::eAtomArray);
--- a/layout/style/GeckoBindings.h
+++ b/layout/style/GeckoBindings.h
@@ -58,97 +58,91 @@ const bool GECKO_IS_NIGHTLY = false;
                 "NS_DECL_THREADSAFE_FFI_REFCOUNTING can only be used with "    \
                 "classes that have thread-safe refcounting");                  \
   void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr) { NS_ADDREF(aPtr); } \
   void Gecko_Release##name_##ArbitraryThread(class_* aPtr) { NS_RELEASE(aPtr); }
 
 extern "C" {
 
 // Debugging stuff.
-void Gecko_Element_DebugListAttributes(RawGeckoElementBorrowed, nsCString*);
+void Gecko_Element_DebugListAttributes(const mozilla::dom::Element*,
+                                       nsCString*);
 
 void Gecko_Snapshot_DebugListAttributes(const mozilla::ServoElementSnapshot*,
                                         nsCString*);
 
-bool Gecko_IsSignificantChild(RawGeckoNodeBorrowed node,
-                              bool whitespace_is_significant);
-
-RawGeckoNodeBorrowedOrNull Gecko_GetLastChild(RawGeckoNodeBorrowed node);
-RawGeckoNodeBorrowedOrNull Gecko_GetPreviousSibling(RawGeckoNodeBorrowed node);
+bool Gecko_IsSignificantChild(const nsINode*, bool whitespace_is_significant);
 
-RawGeckoNodeBorrowedOrNull Gecko_GetFlattenedTreeParentNode(
-    RawGeckoNodeBorrowed node);
+const nsINode* Gecko_GetLastChild(const nsINode*);
+const nsINode* Gecko_GetPreviousSibling(const nsINode*);
 
-RawGeckoElementBorrowedOrNull Gecko_GetBeforeOrAfterPseudo(
-    RawGeckoElementBorrowed element, bool is_before);
+const nsINode* Gecko_GetFlattenedTreeParentNode(const nsINode*);
+const mozilla::dom::Element* Gecko_GetBeforeOrAfterPseudo(
+    const mozilla::dom::Element*, bool is_before);
 
 nsTArray<nsIContent*>* Gecko_GetAnonymousContentForElement(
-    RawGeckoElementBorrowed element);
+    const mozilla::dom::Element*);
+void Gecko_DestroyAnonymousContentList(nsTArray<nsIContent*>* anon_content);
 
 const nsTArray<RefPtr<nsINode>>* Gecko_GetAssignedNodes(
-    RawGeckoElementBorrowed element);
-
-void Gecko_DestroyAnonymousContentList(nsTArray<nsIContent*>* anon_content);
+    const mozilla::dom::Element*);
 
 void Gecko_ComputedStyle_Init(mozilla::ComputedStyle* context,
-                              ServoComputedDataBorrowed values,
+                              const ServoComputedData* values,
                               mozilla::PseudoStyleType pseudo_type);
 
 void Gecko_ComputedStyle_Destroy(mozilla::ComputedStyle* context);
 
 // By default, Servo walks the DOM by traversing the siblings of the DOM-view
 // first child. This generally works, but misses anonymous children, which we
 // want to traverse during styling. To support these cases, we create an
 // optional stack-allocated iterator in aIterator for nodes that need it.
-void Gecko_ConstructStyleChildrenIterator(
-    RawGeckoElementBorrowed aElement,
-    RawGeckoStyleChildrenIteratorBorrowedMut aIterator);
+void Gecko_ConstructStyleChildrenIterator(const mozilla::dom::Element*,
+                                          mozilla::dom::StyleChildrenIterator*);
 
-void Gecko_DestroyStyleChildrenIterator(
-    RawGeckoStyleChildrenIteratorBorrowedMut aIterator);
+void Gecko_DestroyStyleChildrenIterator(mozilla::dom::StyleChildrenIterator*);
 
-RawGeckoNodeBorrowedOrNull Gecko_GetNextStyleChild(
-    RawGeckoStyleChildrenIteratorBorrowedMut it);
+const nsINode* Gecko_GetNextStyleChild(mozilla::dom::StyleChildrenIterator*);
 
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::SheetLoadDataHolder,
                                    SheetLoadDataHolder);
 
 void Gecko_StyleSheet_FinishAsyncParse(
     mozilla::css::SheetLoadDataHolder* data,
     RawServoStyleSheetContentsStrong sheet_contents,
     StyleUseCountersOwnedOrNull use_counters);
 
 mozilla::StyleSheet* Gecko_LoadStyleSheet(
     mozilla::css::Loader* loader, mozilla::StyleSheet* parent,
     mozilla::css::SheetLoadData* parent_load_data,
     mozilla::css::LoaderReusableStyleSheets* reusable_sheets,
     RawServoCssUrlDataStrong url, RawServoMediaListStrong media_list);
 
 void Gecko_LoadStyleSheetAsync(mozilla::css::SheetLoadDataHolder* parent_data,
-                               RawServoCssUrlDataStrong url,
-                               RawServoMediaListStrong media_list,
-                               RawServoImportRuleStrong import_rule);
+                               RawServoCssUrlDataStrong,
+                               RawServoMediaListStrong,
+                               RawServoImportRuleStrong);
 
 // Selector Matching.
-uint64_t Gecko_ElementState(RawGeckoElementBorrowed element);
-bool Gecko_IsRootElement(RawGeckoElementBorrowed element);
+uint64_t Gecko_ElementState(const mozilla::dom::Element*);
+bool Gecko_IsRootElement(const mozilla::dom::Element*);
 
-bool Gecko_MatchLang(RawGeckoElementBorrowed element, nsAtom* override_lang,
+bool Gecko_MatchLang(const mozilla::dom::Element*, nsAtom* override_lang,
                      bool has_override_lang, const char16_t* value);
 
-nsAtom* Gecko_GetXMLLangValue(RawGeckoElementBorrowed element);
+nsAtom* Gecko_GetXMLLangValue(const mozilla::dom::Element*);
 
 mozilla::dom::Document::DocumentTheme Gecko_GetDocumentLWTheme(
     const mozilla::dom::Document*);
 
 const mozilla::PreferenceSheet::Prefs* Gecko_GetPrefSheetPrefs(
     const mozilla::dom::Document*);
 
-bool Gecko_IsTableBorderNonzero(RawGeckoElementBorrowed element);
-bool Gecko_IsBrowserFrame(RawGeckoElementBorrowed element);
+bool Gecko_IsTableBorderNonzero(const mozilla::dom::Element* element);
+bool Gecko_IsBrowserFrame(const mozilla::dom::Element* element);
 
 // Attributes.
 #define SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(prefix_, implementor_)   \
   nsAtom* prefix_##LangValue(implementor_ element);                            \
   bool prefix_##HasAttr(implementor_ element, nsAtom* ns, nsAtom* name);       \
   bool prefix_##AttrEquals(implementor_ element, nsAtom* ns, nsAtom* name,     \
                            nsAtom* str, bool ignoreCase);                      \
   bool prefix_##AttrDashEquals(implementor_ element, nsAtom* ns, nsAtom* name, \
@@ -158,100 +152,108 @@ bool Gecko_IsBrowserFrame(RawGeckoElemen
   bool prefix_##AttrHasSubstring(implementor_ element, nsAtom* ns,             \
                                  nsAtom* name, nsAtom* str, bool ignore_case); \
   bool prefix_##AttrHasPrefix(implementor_ element, nsAtom* ns, nsAtom* name,  \
                               nsAtom* str, bool ignore_case);                  \
   bool prefix_##AttrHasSuffix(implementor_ element, nsAtom* ns, nsAtom* name,  \
                               nsAtom* str, bool ignore_case);
 
 bool Gecko_AssertClassAttrValueIsSane(const nsAttrValue*);
-const nsAttrValue* Gecko_GetSVGAnimatedClass(RawGeckoElementBorrowed);
+const nsAttrValue* Gecko_GetSVGAnimatedClass(const mozilla::dom::Element*);
 
-SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_, RawGeckoElementBorrowed)
+SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_,
+                                              const mozilla::dom::Element*)
 
 SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(
     Gecko_Snapshot, const mozilla::ServoElementSnapshot*)
 
 #undef SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS
 
 // Style attributes.
-RawServoDeclarationBlockStrongBorrowedOrNull Gecko_GetStyleAttrDeclarationBlock(
-    RawGeckoElementBorrowed element);
+const RawServoDeclarationBlockStrong* Gecko_GetStyleAttrDeclarationBlock(
+    const mozilla::dom::Element* element);
 
-void Gecko_UnsetDirtyStyleAttr(RawGeckoElementBorrowed element);
+void Gecko_UnsetDirtyStyleAttr(const mozilla::dom::Element* element);
 
-RawServoDeclarationBlockStrongBorrowedOrNull
-Gecko_GetHTMLPresentationAttrDeclarationBlock(RawGeckoElementBorrowed element);
+const RawServoDeclarationBlockStrong*
+Gecko_GetHTMLPresentationAttrDeclarationBlock(
+    const mozilla::dom::Element* element);
 
-RawServoDeclarationBlockStrongBorrowedOrNull
-Gecko_GetExtraContentStyleDeclarations(RawGeckoElementBorrowed element);
-
-RawServoDeclarationBlockStrongBorrowedOrNull
-Gecko_GetUnvisitedLinkAttrDeclarationBlock(RawGeckoElementBorrowed element);
+const RawServoDeclarationBlockStrong* Gecko_GetExtraContentStyleDeclarations(
+    const mozilla::dom::Element* element);
 
-RawServoDeclarationBlockStrongBorrowedOrNull
-Gecko_GetVisitedLinkAttrDeclarationBlock(RawGeckoElementBorrowed element);
+const RawServoDeclarationBlockStrong*
+Gecko_GetUnvisitedLinkAttrDeclarationBlock(
+    const mozilla::dom::Element* element);
 
-RawServoDeclarationBlockStrongBorrowedOrNull
-Gecko_GetActiveLinkAttrDeclarationBlock(RawGeckoElementBorrowed element);
+const RawServoDeclarationBlockStrong* Gecko_GetVisitedLinkAttrDeclarationBlock(
+    const mozilla::dom::Element* element);
+
+const RawServoDeclarationBlockStrong* Gecko_GetActiveLinkAttrDeclarationBlock(
+    const mozilla::dom::Element* element);
 
 // Visited handling.
 
 // Returns whether visited styles are enabled for a given document.
 bool Gecko_VisitedStylesEnabled(const mozilla::dom::Document*);
 
 // Animations
 bool Gecko_GetAnimationRule(
-    RawGeckoElementBorrowed aElementOrPseudo,
+    const mozilla::dom::Element* aElementOrPseudo,
     mozilla::EffectCompositor::CascadeLevel aCascadeLevel,
-    RawServoAnimationValueMapBorrowedMut aAnimationValues);
+    RawServoAnimationValueMap* aAnimationValues);
 
-bool Gecko_StyleAnimationsEquals(RawGeckoStyleAnimationListBorrowed,
-                                 RawGeckoStyleAnimationListBorrowed);
+bool Gecko_StyleAnimationsEquals(
+    const nsStyleAutoArray<mozilla::StyleAnimation>*,
+    const nsStyleAutoArray<mozilla::StyleAnimation>*);
 
-void Gecko_CopyAnimationNames(RawGeckoStyleAnimationListBorrowedMut aDest,
-                              RawGeckoStyleAnimationListBorrowed aSrc);
+void Gecko_CopyAnimationNames(
+    nsStyleAutoArray<mozilla::StyleAnimation>* aDest,
+    const nsStyleAutoArray<mozilla::StyleAnimation>* aSrc);
 
 // This function takes an already addrefed nsAtom
 void Gecko_SetAnimationName(mozilla::StyleAnimation* aStyleAnimation,
                             nsAtom* aAtom);
 
-void Gecko_UpdateAnimations(RawGeckoElementBorrowed aElementOrPseudo,
-                            ComputedStyleBorrowedOrNull aOldComputedValues,
-                            ComputedStyleBorrowedOrNull aComputedValues,
+void Gecko_UpdateAnimations(const mozilla::dom::Element* aElementOrPseudo,
+                            const mozilla::ComputedStyle* aOldComputedValues,
+                            const mozilla::ComputedStyle* aComputedValues,
                             mozilla::UpdateAnimationsTasks aTasks);
 
-size_t Gecko_GetAnimationEffectCount(RawGeckoElementBorrowed aElementOrPseudo);
-bool Gecko_ElementHasAnimations(RawGeckoElementBorrowed aElementOrPseudo);
-bool Gecko_ElementHasCSSAnimations(RawGeckoElementBorrowed aElementOrPseudo);
-bool Gecko_ElementHasCSSTransitions(RawGeckoElementBorrowed aElementOrPseudo);
-bool Gecko_ElementHasWebAnimations(RawGeckoElementBorrowed aElementOrPseudo);
+size_t Gecko_GetAnimationEffectCount(
+    const mozilla::dom::Element* aElementOrPseudo);
+bool Gecko_ElementHasAnimations(const mozilla::dom::Element* aElementOrPseudo);
+bool Gecko_ElementHasCSSAnimations(
+    const mozilla::dom::Element* aElementOrPseudo);
+bool Gecko_ElementHasCSSTransitions(
+    const mozilla::dom::Element* aElementOrPseudo);
+bool Gecko_ElementHasWebAnimations(
+    const mozilla::dom::Element* aElementOrPseudo);
 size_t Gecko_ElementTransitions_Length(
-    RawGeckoElementBorrowed aElementOrPseudo);
+    const mozilla::dom::Element* aElementOrPseudo);
 
 nsCSSPropertyID Gecko_ElementTransitions_PropertyAt(
-    RawGeckoElementBorrowed aElementOrPseudo, size_t aIndex);
+    const mozilla::dom::Element* aElementOrPseudo, size_t aIndex);
 
-RawServoAnimationValueBorrowedOrNull Gecko_ElementTransitions_EndValueAt(
-    RawGeckoElementBorrowed aElementOrPseudo, size_t aIndex);
+const RawServoAnimationValue* Gecko_ElementTransitions_EndValueAt(
+    const mozilla::dom::Element* aElementOrPseudo, size_t aIndex);
 
-double Gecko_GetProgressFromComputedTiming(
-    RawGeckoComputedTimingBorrowed aComputedTiming);
+double Gecko_GetProgressFromComputedTiming(const mozilla::ComputedTiming*);
 
 double Gecko_GetPositionInSegment(
-    RawGeckoAnimationPropertySegmentBorrowed aSegment, double aProgress,
+    const mozilla::AnimationPropertySegment*, double aProgress,
     mozilla::ComputedTimingFunction::BeforeFlag aBeforeFlag);
 
 // Get servo's AnimationValue for |aProperty| from the cached base style
 // |aBaseStyles|.
 // |aBaseStyles| is nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>.
 // We use RawServoAnimationValueTableBorrowed to avoid exposing
 // nsRefPtrHashtable in FFI.
-RawServoAnimationValueBorrowedOrNull Gecko_AnimationGetBaseStyle(
-    RawServoAnimationValueTableBorrowed aBaseStyles, nsCSSPropertyID aProperty);
+const RawServoAnimationValue* Gecko_AnimationGetBaseStyle(
+    const RawServoAnimationValueTable* aBaseStyles, nsCSSPropertyID aProperty);
 
 void Gecko_StyleTransition_SetUnsupportedProperty(
     mozilla::StyleTransition* aTransition, nsAtom* aAtom);
 
 // Atoms.
 nsAtom* Gecko_Atomize(const char* aString, uint32_t aLength);
 nsAtom* Gecko_Atomize16(const nsAString* aString);
 void Gecko_AddRefAtom(nsAtom* aAtom);
@@ -367,41 +369,41 @@ void Gecko_CopyCursorArrayFrom(nsStyleUI
 
 void Gecko_SetContentDataImageValue(nsStyleContentData* aList,
                                     mozilla::css::URLValue* aImageValue);
 
 nsStyleContentData::CounterFunction* Gecko_SetCounterFunction(
     nsStyleContentData* content_data, mozilla::StyleContentType);
 
 // Dirtiness tracking.
-void Gecko_SetNodeFlags(RawGeckoNodeBorrowed node, uint32_t flags);
-void Gecko_UnsetNodeFlags(RawGeckoNodeBorrowed node, uint32_t flags);
-void Gecko_NoteDirtyElement(RawGeckoElementBorrowed element);
-void Gecko_NoteDirtySubtreeForInvalidation(RawGeckoElementBorrowed element);
-void Gecko_NoteAnimationOnlyDirtyElement(RawGeckoElementBorrowed element);
+void Gecko_SetNodeFlags(const nsINode* node, uint32_t flags);
+void Gecko_UnsetNodeFlags(const nsINode* node, uint32_t flags);
+void Gecko_NoteDirtyElement(const mozilla::dom::Element*);
+void Gecko_NoteDirtySubtreeForInvalidation(const mozilla::dom::Element*);
+void Gecko_NoteAnimationOnlyDirtyElement(const mozilla::dom::Element*);
 
-bool Gecko_AnimationNameMayBeReferencedFromStyle(
-    RawGeckoPresContextBorrowed pres_context, nsAtom* name);
+bool Gecko_AnimationNameMayBeReferencedFromStyle(const nsPresContext*,
+                                                 nsAtom* name);
 
 // Incremental restyle.
 mozilla::PseudoStyleType Gecko_GetImplementedPseudo(
-    RawGeckoElementBorrowed element);
+    const mozilla::dom::Element*);
 
 // We'd like to return `nsChangeHint` here, but bindgen bitfield enums don't
 // work as return values with the Linux 32-bit ABI at the moment because
 // they wrap the value in a struct.
-uint32_t Gecko_CalcStyleDifference(ComputedStyleBorrowed old_style,
-                                   ComputedStyleBorrowed new_style,
+uint32_t Gecko_CalcStyleDifference(const mozilla::ComputedStyle* old_style,
+                                   const mozilla::ComputedStyle* new_style,
                                    bool* any_style_struct_changed,
                                    bool* reset_only_changed);
 
 // Get an element snapshot for a given element from the table.
 const mozilla::ServoElementSnapshot* Gecko_GetElementSnapshot(
     const mozilla::ServoElementSnapshotTable* table,
-    RawGeckoElementBorrowed element);
+    const mozilla::dom::Element*);
 
 // Have we seen this pointer before?
 bool Gecko_HaveSeenPtr(mozilla::SeenPtrs* table, const void* ptr);
 
 // `array` must be an nsTArray
 // If changing this signature, please update the
 // friend function declaration in nsTArray.h
 void Gecko_EnsureTArrayCapacity(void* array, size_t capacity, size_t elem_size);
@@ -472,42 +474,41 @@ void Gecko_CopyWillChangeFrom(nsStyleDis
 // @param offset  The offset to search for, or, if no suitable Keyframe is
 //                found, the offset to use for the created Keyframe.
 //                Must be a floating point number in the range [0.0, 1.0].
 // @param timingFunction  The timing function to match, or, if no suitable
 //                        Keyframe is found, to set on the created Keyframe.
 //
 // @returns  The matching or created Keyframe.
 mozilla::Keyframe* Gecko_GetOrCreateKeyframeAtStart(
-    RawGeckoKeyframeListBorrowedMut keyframes, float offset,
+    nsTArray<mozilla::Keyframe>* keyframes, float offset,
     const nsTimingFunction* timingFunction);
 
 // As with Gecko_GetOrCreateKeyframeAtStart except that this method will search
 // from the beginning of |keyframes| for a Keyframe with matching timing
 // function and an offset of 0.0.
 // Furthermore, if a matching Keyframe is not found, a new Keyframe will be
 // inserted after the *last* Keyframe in |keyframes| with offset 0.0.
 mozilla::Keyframe* Gecko_GetOrCreateInitialKeyframe(
-    RawGeckoKeyframeListBorrowedMut keyframes,
+    nsTArray<mozilla::Keyframe>* keyframes,
     const nsTimingFunction* timingFunction);
 
 // As with Gecko_GetOrCreateKeyframeAtStart except that this method will search
 // from the *end* of |keyframes| for a Keyframe with matching timing function
 // and an offset of 1.0. If a matching Keyframe is not found, a new Keyframe
 // will be appended to the end of |keyframes|.
 mozilla::Keyframe* Gecko_GetOrCreateFinalKeyframe(
-    RawGeckoKeyframeListBorrowedMut keyframes,
+    nsTArray<mozilla::Keyframe>* keyframes,
     const nsTimingFunction* timingFunction);
 
 // Appends and returns a new PropertyValuePair to |aProperties| initialized with
 // its mProperty member set to |aProperty| and all other members initialized to
 // their default values.
 mozilla::PropertyValuePair* Gecko_AppendPropertyValuePair(
-    RawGeckoPropertyValuePairListBorrowedMut aProperties,
-    nsCSSPropertyID aProperty);
+    nsTArray<mozilla::PropertyValuePair>*, nsCSSPropertyID aProperty);
 
 // Clean up pointer-based coordinates
 void Gecko_ResetStyleCoord(nsStyleUnit* unit, nsStyleUnion* value);
 
 // Set an nsStyleCoord to a computed `calc()` value
 void Gecko_SetStyleCoordCalcValue(nsStyleUnit* unit, nsStyleUnion* value,
                                   nsStyleCoord::CalcValue calc);
 
@@ -567,85 +568,79 @@ void Gecko_GetComputedURLSpec(const mozi
                               nsCString* spec);
 
 void Gecko_GetComputedImageURLSpec(const mozilla::css::URLValue* url,
                                    nsCString* spec);
 
 void Gecko_nsIURI_Debug(nsIURI*, nsCString* spec);
 
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::URLValue, CSSURLValue);
-NS_DECL_THREADSAFE_FFI_REFCOUNTING(RawGeckoURLExtraData, URLExtraData);
+NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::URLExtraData, URLExtraData);
 
 void Gecko_FillAllImageLayers(nsStyleImageLayers* layers, uint32_t max_len);
 
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc);
 
 nsCSSShadowArray* Gecko_NewCSSShadowArray(uint32_t len);
 
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsCSSShadowArray, CSSShadowArray);
 
 nsCSSValueSharedList* Gecko_NewCSSValueSharedList(uint32_t len);
 nsCSSValueSharedList* Gecko_NewNoneTransform();
 void Gecko_StyleDisplay_GenerateCombinedTransform(nsStyleDisplay*);
 
 // Getter for nsCSSValue
-nsCSSValueBorrowedMut Gecko_CSSValue_GetArrayItem(
-    nsCSSValueBorrowedMut css_value, int32_t index);
+nsCSSValue* Gecko_CSSValue_GetArrayItem(nsCSSValue*, int32_t index);
 
 // const version of the above function.
-nsCSSValueBorrowed Gecko_CSSValue_GetArrayItemConst(
-    nsCSSValueBorrowed css_value, int32_t index);
-
-nsCSSKeyword Gecko_CSSValue_GetKeyword(nsCSSValueBorrowed aCSSValue);
-float Gecko_CSSValue_GetNumber(nsCSSValueBorrowed css_value);
-float Gecko_CSSValue_GetPercentage(nsCSSValueBorrowed css_value);
-nsStyleCoord::CalcValue Gecko_CSSValue_GetCalc(nsCSSValueBorrowed aCSSValue);
-void Gecko_CSSValue_SetNumber(nsCSSValueBorrowedMut css_value, float number);
+const nsCSSValue* Gecko_CSSValue_GetArrayItemConst(const nsCSSValue*,
+                                                   int32_t index);
 
-void Gecko_CSSValue_SetKeyword(nsCSSValueBorrowedMut css_value,
-                               nsCSSKeyword keyword);
+nsCSSKeyword Gecko_CSSValue_GetKeyword(const nsCSSValue*);
+float Gecko_CSSValue_GetNumber(const nsCSSValue* css_value);
+float Gecko_CSSValue_GetPercentage(const nsCSSValue* css_value);
+nsStyleCoord::CalcValue Gecko_CSSValue_GetCalc(const nsCSSValue* aCSSValue);
+void Gecko_CSSValue_SetNumber(nsCSSValue* css_value, float number);
 
-void Gecko_CSSValue_SetPercentage(nsCSSValueBorrowedMut css_value,
-                                  float percent);
+void Gecko_CSSValue_SetKeyword(nsCSSValue* css_value, nsCSSKeyword keyword);
+
+void Gecko_CSSValue_SetPercentage(nsCSSValue* css_value, float percent);
 
-void Gecko_CSSValue_SetPixelLength(nsCSSValueBorrowedMut aCSSValue, float aLen);
+void Gecko_CSSValue_SetPixelLength(nsCSSValue* aCSSValue, float aLen);
 
-void Gecko_CSSValue_SetCalc(nsCSSValueBorrowedMut css_value,
+void Gecko_CSSValue_SetCalc(nsCSSValue* css_value,
                             nsStyleCoord::CalcValue calc);
 
-void Gecko_CSSValue_SetFunction(nsCSSValueBorrowedMut css_value, int32_t len);
+void Gecko_CSSValue_SetFunction(nsCSSValue* css_value, int32_t len);
 
-void Gecko_CSSValue_SetString(nsCSSValueBorrowedMut css_value,
-                              const uint8_t* string, uint32_t len,
-                              nsCSSUnit unit);
+void Gecko_CSSValue_SetString(nsCSSValue* css_value, const uint8_t* string,
+                              uint32_t len, nsCSSUnit unit);
 
-void Gecko_CSSValue_SetStringFromAtom(nsCSSValueBorrowedMut css_value,
-                                      nsAtom* atom, nsCSSUnit unit);
+void Gecko_CSSValue_SetStringFromAtom(nsCSSValue* css_value, nsAtom* atom,
+                                      nsCSSUnit unit);
 
 // Take an addrefed nsAtom and set it to the nsCSSValue
-void Gecko_CSSValue_SetAtomIdent(nsCSSValueBorrowedMut css_value, nsAtom* atom);
-void Gecko_CSSValue_SetArray(nsCSSValueBorrowedMut css_value, int32_t len);
+void Gecko_CSSValue_SetAtomIdent(nsCSSValue* css_value, nsAtom* atom);
+void Gecko_CSSValue_SetArray(nsCSSValue* css_value, int32_t len);
 
-void Gecko_CSSValue_SetInt(nsCSSValueBorrowedMut css_value, int32_t integer,
+void Gecko_CSSValue_SetInt(nsCSSValue* css_value, int32_t integer,
                            nsCSSUnit unit);
 
-void Gecko_CSSValue_SetFloat(nsCSSValueBorrowedMut css_value, float value,
+void Gecko_CSSValue_SetFloat(nsCSSValue* css_value, float value,
                              nsCSSUnit unit);
 
-void Gecko_CSSValue_SetPair(nsCSSValueBorrowedMut css_value,
-                            nsCSSValueBorrowed xvalue,
-                            nsCSSValueBorrowed yvalue);
+void Gecko_CSSValue_SetPair(nsCSSValue* css_value, const nsCSSValue* xvalue,
+                            const nsCSSValue* yvalue);
 
-void Gecko_CSSValue_SetList(nsCSSValueBorrowedMut css_value, uint32_t len);
-void Gecko_CSSValue_SetPairList(nsCSSValueBorrowedMut css_value, uint32_t len);
+void Gecko_CSSValue_SetList(nsCSSValue* css_value, uint32_t len);
+void Gecko_CSSValue_SetPairList(nsCSSValue* css_value, uint32_t len);
 
-void Gecko_CSSValue_InitSharedList(nsCSSValueBorrowedMut css_value,
-                                   uint32_t len);
+void Gecko_CSSValue_InitSharedList(nsCSSValue* css_value, uint32_t len);
 
-void Gecko_CSSValue_Drop(nsCSSValueBorrowedMut css_value);
+void Gecko_CSSValue_Drop(nsCSSValue* css_value);
 
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsCSSValueSharedList, CSSValueSharedList);
 
 float Gecko_FontStretch_ToFloat(mozilla::FontStretch aStretch);
 
 void Gecko_FontStretch_SetFloat(mozilla::FontStretch* aStretch,
                                 float aFloatValue);
 
@@ -675,57 +670,54 @@ void Gecko_nsStyleFont_PrefillDefaultFor
                                                 const mozilla::dom::Document*,
                                                 uint8_t generic_id);
 
 nscoord Gecko_nsStyleFont_ComputeMinSize(const nsStyleFont*,
                                          const mozilla::dom::Document*);
 
 // Computes the default generic font for a generic family and language.
 mozilla::FontFamilyType Gecko_nsStyleFont_ComputeDefaultFontType(
-    const mozilla::dom::Document*,
-    uint8_t generic_family,
-    nsAtom* language);
+    const mozilla::dom::Document*, uint8_t generic_family, nsAtom* language);
 
 mozilla::FontSizePrefs Gecko_GetBaseSize(nsAtom* lang);
 
 // XBL related functions.
-RawGeckoElementBorrowedOrNull Gecko_GetBindingParent(
-    RawGeckoElementBorrowed aElement);
+const mozilla::dom::Element* Gecko_GetBindingParent(
+    const mozilla::dom::Element*);
 
-RawServoAuthorStylesBorrowedOrNull Gecko_XBLBinding_GetRawServoStyles(
-    RawGeckoXBLBindingBorrowed aXBLBinding);
-
-bool Gecko_XBLBinding_InheritsStyle(RawGeckoXBLBindingBorrowed aXBLBinding);
+const RawServoAuthorStyles* Gecko_XBLBinding_GetRawServoStyles(
+    const nsXBLBinding*);
+bool Gecko_XBLBinding_InheritsStyle(const nsXBLBinding* aXBLBinding);
 
 struct GeckoFontMetrics {
   nscoord mChSize;  // -1.0 indicates not found
   nscoord mXSize;
 };
 
-GeckoFontMetrics Gecko_GetFontMetrics(RawGeckoPresContextBorrowed pres_context,
-                                      bool is_vertical, const nsStyleFont* font,
+GeckoFontMetrics Gecko_GetFontMetrics(const nsPresContext*, bool is_vertical,
+                                      const nsStyleFont* font,
                                       nscoord font_size,
                                       bool use_user_font_set);
 
 mozilla::StyleSheet* Gecko_StyleSheet_Clone(
     const mozilla::StyleSheet* aSheet,
     const mozilla::StyleSheet* aNewParentSheet);
 
 void Gecko_StyleSheet_AddRef(const mozilla::StyleSheet* aSheet);
 void Gecko_StyleSheet_Release(const mozilla::StyleSheet* aSheet);
 nsCSSKeyword Gecko_LookupCSSKeyword(const uint8_t* string, uint32_t len);
 const char* Gecko_CSSKeywordString(nsCSSKeyword keyword, uint32_t* len);
-bool Gecko_IsDocumentBody(RawGeckoElementBorrowed element);
+bool Gecko_IsDocumentBody(const mozilla::dom::Element* element);
 
 // We use an int32_t here instead of a LookAndFeel::ColorID
 // because forward-declaring a nested enum/struct is impossible
 nscolor Gecko_GetLookAndFeelSystemColor(int32_t color_id,
                                         const mozilla::dom::Document*);
 
-void Gecko_AddPropertyToSet(nsCSSPropertyIDSetBorrowedMut, nsCSSPropertyID);
+void Gecko_AddPropertyToSet(nsCSSPropertyIDSet*, nsCSSPropertyID);
 
 // Style-struct management.
 #define STYLE_STRUCT(name)                                                   \
   void Gecko_Construct_Default_nsStyle##name(nsStyle##name* ptr,             \
                                              const mozilla::dom::Document*); \
   void Gecko_CopyConstruct_nsStyle##name(nsStyle##name* ptr,                 \
                                          const nsStyle##name* other);        \
   void Gecko_Destroy_nsStyle##name(nsStyle##name* ptr);
@@ -757,17 +749,17 @@ void Gecko_ReportUnexpectedCSSError(cons
                                     const char* param, uint32_t paramLen,
                                     const char* prefix, const char* prefixParam,
                                     uint32_t prefixParamLen, const char* suffix,
                                     const char* source, uint32_t sourceLen,
                                     uint32_t lineNumber, uint32_t colNumber);
 
 // DOM APIs.
 void Gecko_ContentList_AppendAll(nsSimpleContentList* aContentList,
-                                 const RawGeckoElement** aElements,
+                                 const mozilla::dom::Element** aElements,
                                  size_t aLength);
 
 // FIXME(emilio): These two below should be a single function that takes a
 // `const DocumentOrShadowRoot*`, but that doesn't make MSVC builds happy for a
 // reason I haven't really dug into.
 const nsTArray<mozilla::dom::Element*>* Gecko_Document_GetElementsWithId(
     const mozilla::dom::Document*, nsAtom* aId);
 
--- a/layout/style/ServoBindingTypes.h
+++ b/layout/style/ServoBindingTypes.h
@@ -2,127 +2,93 @@
 /* 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/. */
 
 /* C++ types corresponding to Servo and Gecko types used across bindings,
    with some annotations to indicate ownership expectations */
 
-// This file defines a number of C++ types used to represent borrowed,
-// strong, and owning references to Servo and Gecko objects that might
-// be used across bindings and FFI.
+// This file defines a number of C++ types used to represent strong, and owning
+// references to Servo and Gecko objects that might be used across bindings and
+// FFI.
 //
 // By convention, the types defined here are named "RawServo{Type}" and
 // "RawGecko{Type}".  The {Type} should be something close to the real Rust or
 // C++ name of the type, but need not be.  The "Raw" is really just used to
 // avoid clashing with other names.
 //
 // For Servo types, each "RawServo{ServoTypeName}" is generated as an opaque,
 // declared but not defined struct.
 //
 // For Gecko types, each "RawGecko{GeckoTypeName}" is a typedef that aliases
 // the actual C++ type.
 //
 // Each of these types can have a number of different typedefs generated for
 // them, representing different notions of ownership when passing or receiving
 // these values across bindings and FFI:
 //
-//   Raw{Gecko,Servo}{Type}Borrowed
-//   Raw{Gecko,Servo}{Type}BorrowedOrNull
-//     immutable, borrowed reference (or null)
-//
-//   Raw{Gecko,Servo}{Type}BorrowedMut
-//   Raw{Gecko,Servo}{Type}BorrowedMutOrNull
-//     mutable, borrowed reference (or null)
-//
 //   RawServo{Type}Strong
 //     strong reference to an Arc-managed value
 //
 //   RawServo{Type}Owned
 //   RawServo{Type}OwnedOrNull
 //     owned reference to a Box-managed value (or null)
 //
-// All of these borrowed, strong, and owned types are generated by adding
+// All of these strong, and owned types are generated by adding
 // entries to one of these files:
 //
-//   BorrowedTypeList.h
-//     generates some or all of the Borrowed types
-//
 //   ServoArcTypeList.h
-//     generates all of the Borrowed types and the Strong type
+//     generates the Strong type
 //
 //   ServoBoxedTypeList.h
-//     generates all of the Borrowed types and the Owned & OwnedNull types
+//     generates the Owned & OwnedOrNull types
 //
-// The borrowed, strong, and owned reference types should be used in FFI
-// function signatures where possible, to help indicate the ownership properties
-// that both sides of the function call must adhere to.
+// The strong, and owned reference types should be used in FFI function
+// signatures where possible, to help indicate the ownership properties that
+// both sides of the function call must adhere to.
 //
 // There are some special cases defined at the bottom of this file that don't
 // fit neatly into these three categories.
 //
 //
-// Using these types in C++
-// ========================
+// Using these types in C++ ========================
 //
-// All of the Borrowed types are C++ typedefs for raw pointers, and can be used
-// directly.  Since the types they point to are opaque, there isn't much that
-// can be done with these apart from passing them around, holding on to them,
-// checking them for equality, etc.  If they are Arc-managed or Box-managed
-// Servo types, they can be assigned to a RefPtr<> or UniquePtr<>.
-//
-// The Strong types are a C++ struct that wraps a raw pointer.  When receiving
-// a Strong value from a Servo_* FFI function, you must call Consume() on it
-// to convert it into an already_AddRefed<RawServo{Type}>, otherwise it will
-// leak.
+// The Strong types are a C++ struct that wraps a raw pointer.  When receiving a
+// Strong value from a Servo_* FFI function, you must call Consume() on it to
+// convert it into an already_AddRefed<RawServo{Type}>, otherwise it will leak.
 //
 // We don't currently have any cases where we pass a Strong value to Servo; this
 // could be done by creating a RawServo{Type}Strong struct value whose mPtr is
 // initialized to the result of calling `.forget().take()` on a
-// RefPtr<RawServo{Type}>, but it's probably easier just to pass a Borrowed
-// value and let the Rust code turn it into an Arc.
+// RefPtr<RawServo{Type}>, but it's probably easier just to pass a raw pointer
+// and let the Rust code turn it into an Arc.
 //
 // The Owned types are C++ typedefs for raw pointers.  When receiving an Owned
 // value from a Servo_* FFI function, it should be assigned to a UniquePtr<>,
 // otherwise it will leak.
 //
 // To pass an Owned value to Servo, call `release()` on the UniquePtr<> it's
 // living in (to take ownership of it), and pass that pointer in directly.
 //
-// TODO(heycam): We should perhaps have a similar struct for Owned types with
-// a Consume() method to convert them into a UniquePtr.  The struct for Strong
+// TODO(heycam): We should perhaps have a similar struct for Owned types with a
+// Consume() method to convert them into a UniquePtr.  The struct for Strong
 // types at least have MOZ_MUST_USE_TYPE on them.
 //
 //
-// Using these types in Rust
-// =========================
+// Using these types in Rust =========================
 //
 // The FFI type names are available in Rust in the gecko_bindings::bindings mod,
 // which is generated by servo/components/style/build_gecko.rs.
 //
-// The Borrowed types are defined as Rust reference types.
-//
-// Borrowed types for Gecko values are references to the bindgened versions of
-// the C++ types, so when receiving references over FFI into a Servo_* function,
-// they can be used directly, and when returning them back to Gecko, the
-// reference can be returned directly.
-//
-// Borrowed types for Servo values are references to an opaque type, which must
-// be converted to or from the appropriate Rust type:
+// Borrowed types in rust are represented by &T, Option<&T>, &mut T, and
+// Option<&mut T>.
 //
-//   For an Arc-owned value, a RawServoFooBorrowed received from FFI can be
-//   converted into a `&Arc<Foo>` by calling `Foo::as_arc(&raw_servo_foo)`.
-//   Returning a RawServoFooBorrowed over FFI back to Gecko can be done by
-//   calling `as_borrowed()` on the `Arc<Foo>`.
-//
-//   For a Box-owned value, a RawServoFooBorrowed received from FFI can be
-//   converted into a `&Foo` by calling `Foo::from_ffi(&raw_servo_foo)`.
-//   Returning a RawServoFooBorrowed over FFI back to Gecko can be done by
-//   calling `as_ffi()` on the `Foo`.
+// In C++ you should write them as const pointers (for &T and Option<&T>) or
+// non-const pointers (for &mut T and Option<&mut T>).
 //
 // The Strong types are defined as gecko_bindings::sugar::ownership::Strong<T>.
 //
 // This is an FFI safe type that represents the value with a strong reference
 // already added to it.  Dropping a Strong<T> will leak the strong reference.
 //
 // A RawServoFooStrong received from FFI can be converted into a
 // `RawOffsetArc<Foo>` by calling `into_arc()` or `into_arc_opt()` on it.
@@ -189,56 +155,29 @@ using GfxMatrix4x4 = mozilla::gfx::Float
 
 namespace dom {
 class StyleChildrenIterator;
 class Document;
 class Element;
 }  // namespace dom
 }  // namespace mozilla
 
-#define DECL_BORROWED_REF_TYPE_FOR(type_) typedef type_ const* type_##Borrowed;
-#define DECL_NULLABLE_BORROWED_REF_TYPE_FOR(type_) \
-  typedef type_ const* type_##BorrowedOrNull;
-#define DECL_BORROWED_MUT_REF_TYPE_FOR(type_) typedef type_* type_##BorrowedMut;
-#define DECL_NULLABLE_BORROWED_MUT_REF_TYPE_FOR(type_) \
-  typedef type_* type_##BorrowedMutOrNull;
-
-#define DECL_OWNED_REF_TYPE_FOR(type_) \
-  typedef type_* type_##Owned;         \
-  DECL_BORROWED_REF_TYPE_FOR(type_)    \
-  DECL_BORROWED_MUT_REF_TYPE_FOR(type_)
+#define DECL_OWNED_REF_TYPE_FOR(type_) typedef type_* type_##Owned;
 
 #define DECL_NULLABLE_OWNED_REF_TYPE_FOR(type_) \
-  typedef type_* type_##OwnedOrNull;            \
-  DECL_NULLABLE_BORROWED_REF_TYPE_FOR(type_)    \
-  DECL_NULLABLE_BORROWED_MUT_REF_TYPE_FOR(type_)
-
-#define GECKO_BORROWED_TYPE(geckotype_, ffitype_) \
-  using ffitype_ = geckotype_;                    \
-  using ffitype_##Borrowed = const ffitype_*;     \
-  using ffitype_##BorrowedOrNull = const ffitype_*;
-#define GECKO_BORROWED_TYPE_MUT(geckotype_, ffitype_) \
-  GECKO_BORROWED_TYPE(geckotype_, ffitype_)           \
-  using ffitype_##BorrowedMut = ffitype_*;            \
-  using ffitype_##BorrowedMutOrNull = ffitype_*;
-#include "mozilla/BorrowedTypeList.h"
-#undef GECKO_BORROWED_TYPE_MUT
-#undef GECKO_BORROWED_TYPE
+  typedef type_* type_##OwnedOrNull;
 
 #define SERVO_ARC_TYPE(name_, type_)                                    \
-  DECL_NULLABLE_BORROWED_REF_TYPE_FOR(type_)                            \
-  DECL_BORROWED_REF_TYPE_FOR(type_)                                     \
-  DECL_BORROWED_MUT_REF_TYPE_FOR(type_)                                 \
   struct MOZ_MUST_USE_TYPE type_##Strong {                              \
     type_* mPtr;                                                        \
     already_AddRefed<type_> Consume();                                  \
   };                                                                    \
   extern "C" {                                                          \
-  void Servo_##name_##_AddRef(type_##Borrowed ptr);                     \
-  void Servo_##name_##_Release(type_##Borrowed ptr);                    \
+  void Servo_##name_##_AddRef(const type_*);                            \
+  void Servo_##name_##_Release(const type_*);                           \
   }                                                                     \
   namespace mozilla {                                                   \
   template <>                                                           \
   struct RefPtrTraits<type_> {                                          \
     static void AddRef(type_* aPtr) { Servo_##name_##_AddRef(aPtr); }   \
     static void Release(type_* aPtr) { Servo_##name_##_Release(aPtr); } \
   };                                                                    \
   }
@@ -254,49 +193,24 @@ class Element;
   class DefaultDelete<type_> {                                         \
    public:                                                             \
     void operator()(type_* aPtr) const { Servo_##name_##_Drop(aPtr); } \
   };                                                                   \
   }
 #include "mozilla/ServoBoxedTypeList.h"
 #undef SERVO_BOXED_TYPE
 
-#define DEFINE_ARRAY_TYPE_FOR(type_)                               \
-  struct nsTArrayBorrowed_##type_ {                                \
-    nsTArray<type_>* mArray;                                       \
-    MOZ_IMPLICIT nsTArrayBorrowed_##type_(nsTArray<type_>* aArray) \
-        : mArray(aArray) {}                                        \
-  }
-DEFINE_ARRAY_TYPE_FOR(uintptr_t);
-#undef DEFINE_ARRAY_TYPE_FOR
-
 // Other special cases.
 
-typedef void* RawServoAnimationValueTableBorrowed;
-
 // TODO(heycam): Handle these elsewhere.
+struct RawServoAnimationValueTable;
 struct RawServoAnimationValueMap;
-DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawServoAnimationValueMap)
-DECL_BORROWED_REF_TYPE_FOR(RawServoAnimationValueMap)
-DECL_BORROWED_MUT_REF_TYPE_FOR(RawServoAnimationValueMap)
-
-typedef mozilla::ComputedStyle const* ComputedStyleBorrowed;
-typedef mozilla::ComputedStyle const* ComputedStyleBorrowedOrNull;
-typedef ServoComputedData const* ServoComputedDataBorrowed;
 
 struct MOZ_MUST_USE_TYPE ComputedStyleStrong {
   mozilla::ComputedStyle* mPtr;
   already_AddRefed<mozilla::ComputedStyle> Consume();
 };
 
-// This is a reference to a reference of RawServoDeclarationBlock, which
-// corresponds to Option<&Arc<Locked<RawServoDeclarationBlock>>> in Servo side.
-DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawServoDeclarationBlockStrong)
-
 #undef DECL_ARC_REF_TYPE_FOR
 #undef DECL_OWNED_REF_TYPE_FOR
 #undef DECL_NULLABLE_OWNED_REF_TYPE_FOR
-#undef DECL_BORROWED_REF_TYPE_FOR
-#undef DECL_NULLABLE_BORROWED_REF_TYPE_FOR
-#undef DECL_BORROWED_MUT_REF_TYPE_FOR
-#undef DECL_NULLABLE_BORROWED_MUT_REF_TYPE_FOR
 
 #endif  // mozilla_ServoBindingTypes_h
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -48,256 +48,248 @@ enum class IterationCompositeOperation :
 
 namespace nsStyleTransformMatrix {
 enum class MatrixTransformOperator : uint8_t;
 }
 
 extern "C" {
 
 // Element data
-void Servo_Element_ClearData(RawGeckoElementBorrowed node);
+void Servo_Element_ClearData(const mozilla::dom::Element* node);
 
 size_t Servo_Element_SizeOfExcludingThisAndCVs(
     mozilla::MallocSizeOf malloc_size_of,
     mozilla::MallocSizeOf malloc_enclosing_size_of,
-    mozilla::SeenPtrs* seen_ptrs, RawGeckoElementBorrowed node);
+    mozilla::SeenPtrs* seen_ptrs, const mozilla::dom::Element* node);
 
-bool Servo_Element_HasPrimaryComputedValues(RawGeckoElementBorrowed node);
+bool Servo_Element_HasPrimaryComputedValues(const mozilla::dom::Element* node);
 
 ComputedStyleStrong Servo_Element_GetPrimaryComputedValues(
-    RawGeckoElementBorrowed node);
+    const mozilla::dom::Element* node);
 
-bool Servo_Element_HasPseudoComputedValues(RawGeckoElementBorrowed node,
+bool Servo_Element_HasPseudoComputedValues(const mozilla::dom::Element* node,
                                            size_t index);
 
 ComputedStyleStrong Servo_Element_GetPseudoComputedValues(
-    RawGeckoElementBorrowed node, size_t index);
+    const mozilla::dom::Element* node, size_t index);
 
-bool Servo_Element_IsDisplayNone(RawGeckoElementBorrowed element);
-bool Servo_Element_IsDisplayContents(RawGeckoElementBorrowed element);
+bool Servo_Element_IsDisplayNone(const mozilla::dom::Element* element);
+bool Servo_Element_IsDisplayContents(const mozilla::dom::Element* element);
 
 bool Servo_Element_IsPrimaryStyleReusedViaRuleNode(
-    RawGeckoElementBorrowed element);
+    const mozilla::dom::Element* element);
 
 void Servo_InvalidateStyleForDocStateChanges(
-    RawGeckoElementBorrowed root, RawServoStyleSetBorrowed doc_styles,
-    const nsTArray<RawServoAuthorStylesBorrowed>* non_document_styles,
+    const mozilla::dom::Element* root, const RawServoStyleSet* doc_styles,
+    const nsTArray<const RawServoAuthorStyles*>* non_document_styles,
     uint64_t aStatesChanged);
 
 // Styleset and Stylesheet management
 
 RawServoStyleSheetContentsStrong Servo_StyleSheet_FromUTF8Bytes(
     mozilla::css::Loader* loader, mozilla::StyleSheet* gecko_stylesheet,
     mozilla::css::SheetLoadData* load_data, const nsACString* bytes,
     mozilla::css::SheetParsingMode parsing_mode,
-    RawGeckoURLExtraData* extra_data, uint32_t line_number_offset,
+    mozilla::URLExtraData* extra_data, uint32_t line_number_offset,
     nsCompatibility quirks_mode,
     mozilla::css::LoaderReusableStyleSheets* reusable_sheets,
-    StyleUseCountersBorrowedOrNull use_counters);
+    const StyleUseCounters* use_counters);
 
 void Servo_StyleSheet_FromUTF8BytesAsync(
     mozilla::css::SheetLoadDataHolder* load_data,
-    RawGeckoURLExtraData* extra_data, const nsACString* bytes,
+    mozilla::URLExtraData* extra_data, const nsACString* bytes,
     mozilla::css::SheetParsingMode parsing_mode, uint32_t line_number_offset,
     nsCompatibility quirks_mode, bool should_record_use_counters);
 
 RawServoStyleSheetContentsStrong Servo_StyleSheet_Empty(
     mozilla::css::SheetParsingMode parsing_mode);
 
-bool Servo_StyleSheet_HasRules(RawServoStyleSheetContentsBorrowed sheet);
+bool Servo_StyleSheet_HasRules(const RawServoStyleSheetContents* sheet);
 
 ServoCssRulesStrong Servo_StyleSheet_GetRules(
-    RawServoStyleSheetContentsBorrowed sheet);
+    const RawServoStyleSheetContents* sheet);
 
 RawServoStyleSheetContentsStrong Servo_StyleSheet_Clone(
-    RawServoStyleSheetContentsBorrowed sheet,
+    const RawServoStyleSheetContents* sheet,
     const mozilla::StyleSheet* reference_sheet);
 
 size_t Servo_StyleSheet_SizeOfIncludingThis(
     mozilla::MallocSizeOf malloc_size_of,
     mozilla::MallocSizeOf malloc_enclosing_size_of,
-    RawServoStyleSheetContentsBorrowed sheet);
+    const RawServoStyleSheetContents* sheet);
 
-void Servo_StyleSheet_GetSourceMapURL(RawServoStyleSheetContentsBorrowed sheet,
+void Servo_StyleSheet_GetSourceMapURL(const RawServoStyleSheetContents* sheet,
                                       nsAString* result);
 
-void Servo_StyleSheet_GetSourceURL(RawServoStyleSheetContentsBorrowed sheet,
+void Servo_StyleSheet_GetSourceURL(const RawServoStyleSheetContents* sheet,
                                    nsAString* result);
 
 // We'd like to return `OriginFlags` here, but bindgen bitfield enums don't
 // work as return values with the Linux 32-bit ABI at the moment because
 // they wrap the value in a struct.
-uint8_t Servo_StyleSheet_GetOrigin(RawServoStyleSheetContentsBorrowed sheet);
+uint8_t Servo_StyleSheet_GetOrigin(const RawServoStyleSheetContents* sheet);
 
-RawServoStyleSet* Servo_StyleSet_Init(RawGeckoPresContextBorrowed pres_context);
-void Servo_StyleSet_RebuildCachedData(RawServoStyleSetBorrowed set);
+RawServoStyleSet* Servo_StyleSet_Init(const nsPresContext* pres_context);
+void Servo_StyleSet_RebuildCachedData(const RawServoStyleSet* set);
 
 // We'd like to return `OriginFlags` here, but bindgen bitfield enums don't
 // work as return values with the Linux 32-bit ABI at the moment because
 // they wrap the value in a struct.
 mozilla::MediumFeaturesChangedResult Servo_StyleSet_MediumFeaturesChanged(
-    RawServoStyleSetBorrowed document_set,
-    nsTArray<RawServoAuthorStylesBorrowedMut>* non_document_sets,
+    const RawServoStyleSet* document_set,
+    nsTArray<RawServoAuthorStyles*>* non_document_sets,
     bool may_affect_default_style);
 
 void Servo_StyleSet_Drop(RawServoStyleSetOwned set);
-void Servo_StyleSet_CompatModeChanged(RawServoStyleSetBorrowed raw_data);
+void Servo_StyleSet_CompatModeChanged(const RawServoStyleSet* raw_data);
 
-void Servo_StyleSet_AppendStyleSheet(RawServoStyleSetBorrowed set,
+void Servo_StyleSet_AppendStyleSheet(const RawServoStyleSet* set,
                                      const mozilla::StyleSheet* gecko_sheet);
 
-void Servo_StyleSet_RemoveStyleSheet(RawServoStyleSetBorrowed set,
+void Servo_StyleSet_RemoveStyleSheet(const RawServoStyleSet* set,
                                      const mozilla::StyleSheet* gecko_sheet);
 
 void Servo_StyleSet_InsertStyleSheetBefore(
-    RawServoStyleSetBorrowed set, const mozilla::StyleSheet* gecko_sheet,
+    const RawServoStyleSet* set, const mozilla::StyleSheet* gecko_sheet,
     const mozilla::StyleSheet* before);
 
 void Servo_StyleSet_FlushStyleSheets(
-    RawServoStyleSetBorrowed set, RawGeckoElementBorrowedOrNull doc_elem,
+    const RawServoStyleSet* set, const mozilla::dom::Element* doc_elem,
     const mozilla::ServoElementSnapshotTable* snapshots);
 
-void Servo_StyleSet_SetAuthorStyleDisabled(RawServoStyleSetBorrowed set,
+void Servo_StyleSet_SetAuthorStyleDisabled(const RawServoStyleSet* set,
                                            bool author_style_disabled);
 
 void Servo_StyleSet_NoteStyleSheetsChanged(
-    RawServoStyleSetBorrowed set, mozilla::OriginFlags changed_origins);
+    const RawServoStyleSet* set, mozilla::OriginFlags changed_origins);
 
 bool Servo_StyleSet_GetKeyframesForName(
-    RawServoStyleSetBorrowed set, RawGeckoElementBorrowed element,
-    ComputedStyleBorrowed style, nsAtom* name,
-    nsTimingFunctionBorrowed timing_function,
-    RawGeckoKeyframeListBorrowedMut keyframe_list);
+    const RawServoStyleSet* set, const mozilla::dom::Element* element,
+    const mozilla::ComputedStyle* style, nsAtom* name,
+    const nsTimingFunction* timing_function,
+    nsTArray<mozilla::Keyframe>* keyframe_list);
 
-void Servo_StyleSet_GetFontFaceRules(RawServoStyleSetBorrowed set,
-                                     RawGeckoFontFaceRuleListBorrowedMut list);
+void Servo_StyleSet_GetFontFaceRules(const RawServoStyleSet* set,
+                                     nsTArray<nsFontFaceRuleContainer>*);
 
 const RawServoCounterStyleRule* Servo_StyleSet_GetCounterStyleRule(
-    RawServoStyleSetBorrowed set, nsAtom* name);
+    const RawServoStyleSet* set, nsAtom* name);
 
 // This function may return nullptr or gfxFontFeatureValueSet with zero
 // references.
 gfxFontFeatureValueSet* Servo_StyleSet_BuildFontFeatureValueSet(
-    RawServoStyleSetBorrowed set);
+    const RawServoStyleSet* set);
 
 ComputedStyleStrong Servo_StyleSet_ResolveForDeclarations(
-    RawServoStyleSetBorrowed set, ComputedStyleBorrowedOrNull parent_style,
-    RawServoDeclarationBlockBorrowed declarations);
+    const RawServoStyleSet* set, const mozilla::ComputedStyle* parent_style,
+    const RawServoDeclarationBlock* declarations);
 
-void Servo_SelectorList_Drop(RawServoSelectorListOwned selector_list);
+void Servo_SelectorList_Drop(RawServoSelectorList*);
 RawServoSelectorList* Servo_SelectorList_Parse(const nsACString* selector_list);
 RawServoSourceSizeList* Servo_SourceSizeList_Parse(const nsACString* value);
 
-int32_t Servo_SourceSizeList_Evaluate(RawServoStyleSetBorrowed set,
-                                      RawServoSourceSizeListBorrowedOrNull);
+int32_t Servo_SourceSizeList_Evaluate(const RawServoStyleSet* set,
+                                      const RawServoSourceSizeList*);
 
-void Servo_SourceSizeList_Drop(RawServoSourceSizeListOwned);
+void Servo_SourceSizeList_Drop(RawServoSourceSizeList*);
 
-bool Servo_SelectorList_Matches(RawGeckoElementBorrowed,
-                                RawServoSelectorListBorrowed);
+bool Servo_SelectorList_Matches(const mozilla::dom::Element*,
+                                const RawServoSelectorList*);
 
-const RawGeckoElement* Servo_SelectorList_Closest(RawGeckoElementBorrowed,
-                                                  RawServoSelectorListBorrowed);
+const mozilla::dom::Element* Servo_SelectorList_Closest(
+    const mozilla::dom::Element*, const RawServoSelectorList*);
 
-const RawGeckoElement* Servo_SelectorList_QueryFirst(
-    RawGeckoNodeBorrowed, RawServoSelectorListBorrowed,
-    bool may_use_invalidation);
+const mozilla::dom::Element* Servo_SelectorList_QueryFirst(
+    const nsINode*, const RawServoSelectorList*, bool may_use_invalidation);
 
-void Servo_SelectorList_QueryAll(RawGeckoNodeBorrowed,
-                                 RawServoSelectorListBorrowed,
+void Servo_SelectorList_QueryAll(const nsINode*, const RawServoSelectorList*,
                                  nsSimpleContentList* content_list,
                                  bool may_use_invalidation);
 
 void Servo_StyleSet_AddSizeOfExcludingThis(
     mozilla::MallocSizeOf malloc_size_of,
     mozilla::MallocSizeOf malloc_enclosing_size_of,
-    mozilla::ServoStyleSetSizes* sizes, RawServoStyleSetBorrowed set);
+    mozilla::ServoStyleSetSizes* sizes, const RawServoStyleSet* set);
 
 void Servo_UACache_AddSizeOf(mozilla::MallocSizeOf malloc_size_of,
                              mozilla::MallocSizeOf malloc_enclosing_size_of,
                              mozilla::ServoStyleSetSizes* sizes);
 
 // AuthorStyles
 
 RawServoAuthorStyles* Servo_AuthorStyles_Create();
-void Servo_AuthorStyles_Drop(RawServoAuthorStylesOwned self);
+void Servo_AuthorStyles_Drop(RawServoAuthorStyles*);
 
-// TODO(emilio): These will need to take a master style set to implement
-// invalidation for Shadow DOM.
-void Servo_AuthorStyles_AppendStyleSheet(
-    RawServoAuthorStylesBorrowedMut self,
-    const mozilla::StyleSheet* gecko_sheet);
+void Servo_AuthorStyles_AppendStyleSheet(RawServoAuthorStyles*,
+                                         const mozilla::StyleSheet*);
 
-void Servo_AuthorStyles_RemoveStyleSheet(
-    RawServoAuthorStylesBorrowedMut self,
-    const mozilla::StyleSheet* gecko_sheet);
+void Servo_AuthorStyles_RemoveStyleSheet(RawServoAuthorStyles*,
+                                         const mozilla::StyleSheet*);
 
 void Servo_AuthorStyles_InsertStyleSheetBefore(
-    RawServoAuthorStylesBorrowedMut self,
-    const mozilla::StyleSheet* gecko_sheet, const mozilla::StyleSheet* before);
+    RawServoAuthorStyles*, const mozilla::StyleSheet* sheet,
+    const mozilla::StyleSheet* before);
 
-void Servo_AuthorStyles_ForceDirty(RawServoAuthorStylesBorrowedMut self);
+void Servo_AuthorStyles_ForceDirty(RawServoAuthorStyles*);
 
 // TODO(emilio): This will need to take an element and a master style set to
 // implement invalidation for Shadow DOM.
-void Servo_AuthorStyles_Flush(RawServoAuthorStylesBorrowedMut self,
-                              RawServoStyleSetBorrowed document_styles);
+void Servo_AuthorStyles_Flush(RawServoAuthorStyles*,
+                              const RawServoStyleSet* document_styles);
 
 size_t Servo_AuthorStyles_SizeOfIncludingThis(
     mozilla::MallocSizeOf malloc_size_of,
     mozilla::MallocSizeOf malloc_enclosing_size_of,
-    RawServoAuthorStylesBorrowed self);
+    const RawServoAuthorStyles* self);
 
-void Servo_ComputedStyle_AddRef(ComputedStyleBorrowed ctx);
+void Servo_ComputedStyle_AddRef(const mozilla::ComputedStyle* ctx);
 
-void Servo_ComputedStyle_Release(ComputedStyleBorrowed ctx);
+void Servo_ComputedStyle_Release(const mozilla::ComputedStyle* ctx);
 
 bool Servo_StyleSet_MightHaveAttributeDependency(
-    RawServoStyleSetBorrowed set, RawGeckoElementBorrowed element,
+    const RawServoStyleSet* set, const mozilla::dom::Element* element,
     nsAtom* local_name);
 
-bool Servo_StyleSet_HasStateDependency(RawServoStyleSetBorrowed set,
-                                       RawGeckoElementBorrowed element,
+bool Servo_StyleSet_HasStateDependency(const RawServoStyleSet* set,
+                                       const mozilla::dom::Element* element,
                                        uint64_t state);
 
-bool Servo_StyleSet_HasDocumentStateDependency(RawServoStyleSetBorrowed set,
+bool Servo_StyleSet_HasDocumentStateDependency(const RawServoStyleSet* set,
                                                uint64_t state);
 
 // CSSRuleList
 
-void Servo_CssRules_ListTypes(ServoCssRulesBorrowed rules,
-                              nsTArrayBorrowed_uintptr_t result);
+void Servo_CssRules_ListTypes(const ServoCssRules*,
+                              const nsTArray<uintptr_t>* result);
 
-nsresult Servo_CssRules_InsertRule(ServoCssRulesBorrowed rules,
-                                   RawServoStyleSheetContentsBorrowed sheet,
+nsresult Servo_CssRules_InsertRule(const ServoCssRules*,
+                                   const RawServoStyleSheetContents* sheet,
                                    const nsACString* rule, uint32_t index,
                                    bool nested, mozilla::css::Loader* loader,
                                    mozilla::StyleSheet* gecko_stylesheet,
                                    uint16_t* rule_type);
 
-nsresult Servo_CssRules_DeleteRule(ServoCssRulesBorrowed rules, uint32_t index);
+nsresult Servo_CssRules_DeleteRule(const ServoCssRules* rules, uint32_t index);
 
 // CSS Rules
 
-#define BASIC_RULE_FUNCS_WITHOUT_GETTER(type_)                    \
-  void Servo_##type_##_Debug(RawServo##type_##Borrowed rule,      \
-                             nsACString* result);                 \
-  void Servo_##type_##_GetCssText(RawServo##type_##Borrowed rule, \
-                                  nsAString* result);
+#define BASIC_RULE_FUNCS_WITHOUT_GETTER(type_)                            \
+  void Servo_##type_##_Debug(const RawServo##type_*, nsACString* result); \
+  void Servo_##type_##_GetCssText(const RawServo##type_*, nsAString* result);
 
-#define BASIC_RULE_FUNCS(type_)                                    \
-  RawServo##type_##RuleStrong Servo_CssRules_Get##type_##RuleAt(   \
-      ServoCssRulesBorrowed rules, uint32_t index, uint32_t* line, \
-      uint32_t* column);                                           \
+#define BASIC_RULE_FUNCS(type_)                                   \
+  RawServo##type_##RuleStrong Servo_CssRules_Get##type_##RuleAt(  \
+      const ServoCssRules* rules, uint32_t index, uint32_t* line, \
+      uint32_t* column);                                          \
   BASIC_RULE_FUNCS_WITHOUT_GETTER(type_##Rule)
 
 #define GROUP_RULE_FUNCS(type_)                     \
   BASIC_RULE_FUNCS(type_)                           \
   ServoCssRulesStrong Servo_##type_##Rule_GetRules( \
-      RawServo##type_##RuleBorrowed rule);
+      const RawServo##type_##Rule* rule);
 
 BASIC_RULE_FUNCS(Style)
 BASIC_RULE_FUNCS(Import)
 BASIC_RULE_FUNCS_WITHOUT_GETTER(Keyframe)
 BASIC_RULE_FUNCS(Keyframes)
 GROUP_RULE_FUNCS(Media)
 GROUP_RULE_FUNCS(MozDocument)
 BASIC_RULE_FUNCS(Namespace)
@@ -306,660 +298,660 @@ GROUP_RULE_FUNCS(Supports)
 BASIC_RULE_FUNCS(FontFeatureValues)
 BASIC_RULE_FUNCS(FontFace)
 BASIC_RULE_FUNCS(CounterStyle)
 
 #undef GROUP_RULE_FUNCS
 #undef BASIC_RULE_FUNCS
 #undef BASIC_RULE_FUNCS_WITHOUT_GETTER
 
+using Matrix4x4Components = float[16];
+
 RawServoDeclarationBlockStrong Servo_StyleRule_GetStyle(
-    RawServoStyleRuleBorrowed rule);
+    const RawServoStyleRule*);
 
-void Servo_StyleRule_SetStyle(RawServoStyleRuleBorrowed rule,
-                              RawServoDeclarationBlockBorrowed declarations);
+void Servo_StyleRule_SetStyle(const RawServoStyleRule* rule,
+                              const RawServoDeclarationBlock* declarations);
 
-void Servo_StyleRule_GetSelectorText(RawServoStyleRuleBorrowed rule,
+void Servo_StyleRule_GetSelectorText(const RawServoStyleRule* rule,
                                      nsAString* result);
 
-void Servo_StyleRule_GetSelectorTextAtIndex(RawServoStyleRuleBorrowed rule,
+void Servo_StyleRule_GetSelectorTextAtIndex(const RawServoStyleRule* rule,
                                             uint32_t index, nsAString* result);
 
-void Servo_StyleRule_GetSpecificityAtIndex(RawServoStyleRuleBorrowed rule,
+void Servo_StyleRule_GetSpecificityAtIndex(const RawServoStyleRule* rule,
                                            uint32_t index,
                                            uint64_t* specificity);
 
-void Servo_StyleRule_GetSelectorCount(RawServoStyleRuleBorrowed rule,
+void Servo_StyleRule_GetSelectorCount(const RawServoStyleRule* rule,
                                       uint32_t* count);
 
 bool Servo_StyleRule_SelectorMatchesElement(
-    RawServoStyleRuleBorrowed, RawGeckoElementBorrowed, uint32_t index,
+    const RawServoStyleRule*, const mozilla::dom::Element*, uint32_t index,
     mozilla::PseudoStyleType pseudo_type);
 
-bool Servo_StyleRule_SetSelectorText(RawServoStyleSheetContentsBorrowed sheet,
-                                     RawServoStyleRuleBorrowed rule,
+bool Servo_StyleRule_SetSelectorText(const RawServoStyleSheetContents* sheet,
+                                     const RawServoStyleRule* rule,
                                      const nsAString* text);
 
-void Servo_ImportRule_GetHref(RawServoImportRuleBorrowed rule,
+void Servo_ImportRule_GetHref(const RawServoImportRule* rule,
                               nsAString* result);
 
 const mozilla::StyleSheet* Servo_ImportRule_GetSheet(
-    RawServoImportRuleBorrowed rule);
+    const RawServoImportRule* rule);
 
-void Servo_ImportRule_SetSheet(RawServoImportRuleBorrowed rule,
+void Servo_ImportRule_SetSheet(const RawServoImportRule* rule,
                                mozilla::StyleSheet* sheet);
 
-void Servo_Keyframe_GetKeyText(RawServoKeyframeBorrowed keyframe,
+void Servo_Keyframe_GetKeyText(const RawServoKeyframe* keyframe,
                                nsAString* result);
 
 // Returns whether it successfully changes the key text.
-bool Servo_Keyframe_SetKeyText(RawServoKeyframeBorrowed keyframe,
+bool Servo_Keyframe_SetKeyText(const RawServoKeyframe* keyframe,
                                const nsACString* text);
 
 RawServoDeclarationBlockStrong Servo_Keyframe_GetStyle(
-    RawServoKeyframeBorrowed keyframe);
+    const RawServoKeyframe* keyframe);
 
-void Servo_Keyframe_SetStyle(RawServoKeyframeBorrowed keyframe,
-                             RawServoDeclarationBlockBorrowed declarations);
+void Servo_Keyframe_SetStyle(const RawServoKeyframe* keyframe,
+                             const RawServoDeclarationBlock* declarations);
 
-nsAtom* Servo_KeyframesRule_GetName(RawServoKeyframesRuleBorrowed rule);
+nsAtom* Servo_KeyframesRule_GetName(const RawServoKeyframesRule* rule);
 
 // This method takes an addrefed nsAtom.
-void Servo_KeyframesRule_SetName(RawServoKeyframesRuleBorrowed rule,
+void Servo_KeyframesRule_SetName(const RawServoKeyframesRule* rule,
                                  nsAtom* name);
 
-uint32_t Servo_KeyframesRule_GetCount(RawServoKeyframesRuleBorrowed rule);
+uint32_t Servo_KeyframesRule_GetCount(const RawServoKeyframesRule* rule);
 
 RawServoKeyframeStrong Servo_KeyframesRule_GetKeyframeAt(
-    RawServoKeyframesRuleBorrowed rule, uint32_t index, uint32_t* line,
+    const RawServoKeyframesRule* rule, uint32_t index, uint32_t* line,
     uint32_t* column);
 
 // Returns the index of the rule, max value of uint32_t if nothing found.
-uint32_t Servo_KeyframesRule_FindRule(RawServoKeyframesRuleBorrowed rule,
+uint32_t Servo_KeyframesRule_FindRule(const RawServoKeyframesRule* rule,
                                       const nsACString* key);
 
 // Returns whether it successfully appends the rule.
-bool Servo_KeyframesRule_AppendRule(RawServoKeyframesRuleBorrowed rule,
-                                    RawServoStyleSheetContentsBorrowed sheet,
+bool Servo_KeyframesRule_AppendRule(const RawServoKeyframesRule* rule,
+                                    const RawServoStyleSheetContents* sheet,
                                     const nsACString* css);
 
-void Servo_KeyframesRule_DeleteRule(RawServoKeyframesRuleBorrowed rule,
+void Servo_KeyframesRule_DeleteRule(const RawServoKeyframesRule* rule,
                                     uint32_t index);
 
-RawServoMediaListStrong Servo_MediaRule_GetMedia(
-    RawServoMediaRuleBorrowed rule);
+RawServoMediaListStrong Servo_MediaRule_GetMedia(const RawServoMediaRule* rule);
 
-nsAtom* Servo_NamespaceRule_GetPrefix(RawServoNamespaceRuleBorrowed rule);
-nsAtom* Servo_NamespaceRule_GetURI(RawServoNamespaceRuleBorrowed rule);
+nsAtom* Servo_NamespaceRule_GetPrefix(const RawServoNamespaceRule* rule);
+nsAtom* Servo_NamespaceRule_GetURI(const RawServoNamespaceRule* rule);
 
 RawServoDeclarationBlockStrong Servo_PageRule_GetStyle(
-    RawServoPageRuleBorrowed rule);
+    const RawServoPageRule* rule);
 
-void Servo_PageRule_SetStyle(RawServoPageRuleBorrowed rule,
-                             RawServoDeclarationBlockBorrowed declarations);
+void Servo_PageRule_SetStyle(const RawServoPageRule* rule,
+                             const RawServoDeclarationBlock* declarations);
 
-void Servo_SupportsRule_GetConditionText(RawServoSupportsRuleBorrowed rule,
+void Servo_SupportsRule_GetConditionText(const RawServoSupportsRule* rule,
                                          nsAString* result);
 
-void Servo_MozDocumentRule_GetConditionText(
-    RawServoMozDocumentRuleBorrowed rule, nsAString* result);
+void Servo_MozDocumentRule_GetConditionText(const RawServoMozDocumentRule* rule,
+                                            nsAString* result);
 
 void Servo_FontFeatureValuesRule_GetFontFamily(
-    RawServoFontFeatureValuesRuleBorrowed rule, nsAString* result);
+    const RawServoFontFeatureValuesRule* rule, nsAString* result);
 
 void Servo_FontFeatureValuesRule_GetValueText(
-    RawServoFontFeatureValuesRuleBorrowed rule, nsAString* result);
+    const RawServoFontFeatureValuesRule* rule, nsAString* result);
 
 RawServoFontFaceRuleStrong Servo_FontFaceRule_CreateEmpty();
 
 RawServoFontFaceRuleStrong Servo_FontFaceRule_Clone(
-    RawServoFontFaceRuleBorrowed rule);
+    const RawServoFontFaceRule* rule);
 
-void Servo_FontFaceRule_GetSourceLocation(RawServoFontFaceRuleBorrowed rule,
+void Servo_FontFaceRule_GetSourceLocation(const RawServoFontFaceRule* rule,
                                           uint32_t* line, uint32_t* column);
 
-uint32_t Servo_FontFaceRule_Length(RawServoFontFaceRuleBorrowed rule);
+uint32_t Servo_FontFaceRule_Length(const RawServoFontFaceRule* rule);
 
-nsCSSFontDesc Servo_FontFaceRule_IndexGetter(RawServoFontFaceRuleBorrowed rule,
+nsCSSFontDesc Servo_FontFaceRule_IndexGetter(const RawServoFontFaceRule* rule,
                                              uint32_t index);
 
-void Servo_FontFaceRule_GetDeclCssText(RawServoFontFaceRuleBorrowed rule,
+void Servo_FontFaceRule_GetDeclCssText(const RawServoFontFaceRule* rule,
                                        nsAString* result);
 
 bool Servo_FontFaceRule_GetFontWeight(
-    RawServoFontFaceRuleBorrowed rule,
+    const RawServoFontFaceRule* rule,
     mozilla::StyleComputedFontWeightRange* out);
 
-bool Servo_FontFaceRule_GetFontDisplay(RawServoFontFaceRuleBorrowed rule,
+bool Servo_FontFaceRule_GetFontDisplay(const RawServoFontFaceRule* rule,
                                        mozilla::StyleFontDisplay* out);
 
 bool Servo_FontFaceRule_GetFontStyle(
-    RawServoFontFaceRuleBorrowed rule,
+    const RawServoFontFaceRule* rule,
     mozilla::StyleComputedFontStyleDescriptor* out);
 
 bool Servo_FontFaceRule_GetFontStretch(
-    RawServoFontFaceRuleBorrowed rule,
+    const RawServoFontFaceRule* rule,
     mozilla::StyleComputedFontStretchRange* out);
 
 bool Servo_FontFaceRule_GetFontLanguageOverride(
-    RawServoFontFaceRuleBorrowed rule, mozilla::StyleFontLanguageOverride* out);
+    const RawServoFontFaceRule* rule, mozilla::StyleFontLanguageOverride* out);
 
-nsAtom* Servo_FontFaceRule_GetFamilyName(RawServoFontFaceRuleBorrowed rule);
+nsAtom* Servo_FontFaceRule_GetFamilyName(const RawServoFontFaceRule* rule);
 
 const mozilla::StyleUnicodeRange* Servo_FontFaceRule_GetUnicodeRanges(
-    RawServoFontFaceRuleBorrowed rule, size_t* out_len);
+    const RawServoFontFaceRule* rule, size_t* out_len);
 
 void Servo_FontFaceRule_GetSources(
-    RawServoFontFaceRuleBorrowed rule,
+    const RawServoFontFaceRule* rule,
     nsTArray<mozilla::StyleFontFaceSourceListComponent>* components);
 
 void Servo_FontFaceRule_GetVariationSettings(
-    RawServoFontFaceRuleBorrowed rule,
+    const RawServoFontFaceRule* rule,
     nsTArray<mozilla::gfx::FontVariation>* out);
 
-void Servo_FontFaceRule_GetFeatureSettings(RawServoFontFaceRuleBorrowed rule,
+void Servo_FontFaceRule_GetFeatureSettings(const RawServoFontFaceRule* rule,
                                            nsTArray<gfxFontFeature>* out);
 
-void Servo_FontFaceRule_GetDescriptorCssText(RawServoFontFaceRuleBorrowed rule,
+void Servo_FontFaceRule_GetDescriptorCssText(const RawServoFontFaceRule* rule,
                                              nsCSSFontDesc desc,
                                              nsAString* result);
 
-bool Servo_FontFaceRule_SetDescriptor(RawServoFontFaceRuleBorrowed rule,
+bool Servo_FontFaceRule_SetDescriptor(const RawServoFontFaceRule* rule,
                                       nsCSSFontDesc desc,
                                       const nsACString* value,
-                                      RawGeckoURLExtraData* data);
+                                      mozilla::URLExtraData* data);
 
-void Servo_FontFaceRule_ResetDescriptor(RawServoFontFaceRuleBorrowed rule,
+void Servo_FontFaceRule_ResetDescriptor(const RawServoFontFaceRule* rule,
                                         nsCSSFontDesc desc);
 
-nsAtom* Servo_CounterStyleRule_GetName(RawServoCounterStyleRuleBorrowed rule);
+nsAtom* Servo_CounterStyleRule_GetName(const RawServoCounterStyleRule* rule);
 
-bool Servo_CounterStyleRule_SetName(RawServoCounterStyleRuleBorrowed rule,
+bool Servo_CounterStyleRule_SetName(const RawServoCounterStyleRule* rule,
                                     const nsACString* name);
 
 uint32_t Servo_CounterStyleRule_GetGeneration(
-    RawServoCounterStyleRuleBorrowed rule);
+    const RawServoCounterStyleRule* rule);
 
-uint8_t Servo_CounterStyleRule_GetSystem(RawServoCounterStyleRuleBorrowed rule);
+uint8_t Servo_CounterStyleRule_GetSystem(const RawServoCounterStyleRule* rule);
 
 nsAtom* Servo_CounterStyleRule_GetExtended(
-    RawServoCounterStyleRuleBorrowed rule);
+    const RawServoCounterStyleRule* rule);
 
 int32_t Servo_CounterStyleRule_GetFixedFirstValue(
-    RawServoCounterStyleRuleBorrowed rule);
+    const RawServoCounterStyleRule* rule);
 
 nsAtom* Servo_CounterStyleRule_GetFallback(
-    RawServoCounterStyleRuleBorrowed rule);
+    const RawServoCounterStyleRule* rule);
 
-void Servo_CounterStyleRule_GetDescriptor(RawServoCounterStyleRuleBorrowed rule,
+void Servo_CounterStyleRule_GetDescriptor(const RawServoCounterStyleRule* rule,
                                           nsCSSCounterDesc desc,
-                                          nsCSSValueBorrowedMut result);
+                                          nsCSSValue* result);
 
 void Servo_CounterStyleRule_GetDescriptorCssText(
-    RawServoCounterStyleRuleBorrowed rule, nsCSSCounterDesc desc,
+    const RawServoCounterStyleRule* rule, nsCSSCounterDesc desc,
     nsAString* result);
 
-bool Servo_CounterStyleRule_SetDescriptor(RawServoCounterStyleRuleBorrowed rule,
+bool Servo_CounterStyleRule_SetDescriptor(const RawServoCounterStyleRule* rule,
                                           nsCSSCounterDesc desc,
                                           const nsACString* value);
 
 // Animations API
 
 RawServoDeclarationBlockStrong Servo_ParseProperty(
     nsCSSPropertyID property, const nsACString* value,
-    RawGeckoURLExtraData* data, mozilla::ParsingMode parsing_mode,
+    mozilla::URLExtraData* data, mozilla::ParsingMode parsing_mode,
     nsCompatibility quirks_mode, mozilla::css::Loader* loader);
 
-bool Servo_ParseEasing(const nsAString* easing, RawGeckoURLExtraData* data,
-                       nsTimingFunctionBorrowedMut output);
+bool Servo_ParseEasing(const nsAString* easing, mozilla::URLExtraData* data,
+                       nsTimingFunction* output);
 
-void Servo_SerializeEasing(nsTimingFunctionBorrowed easing, nsAString* output);
+void Servo_SerializeEasing(const nsTimingFunction* easing, nsAString* output);
 
 void Servo_SerializeBorderRadius(const mozilla::StyleBorderRadius*, nsAString*);
 
 void Servo_GetComputedKeyframeValues(
-    RawGeckoKeyframeListBorrowed keyframes, RawGeckoElementBorrowed element,
-    ComputedStyleBorrowed style, RawServoStyleSetBorrowed set,
-    RawGeckoComputedKeyframeValuesListBorrowedMut result);
+    const nsTArray<mozilla::Keyframe>* keyframes,
+    const mozilla::dom::Element* element, const mozilla::ComputedStyle* style,
+    const RawServoStyleSet* set,
+    nsTArray<mozilla::ComputedKeyframeValues>* result);
 
 RawServoAnimationValueStrong Servo_ComputedValues_ExtractAnimationValue(
-    ComputedStyleBorrowed computed_values, nsCSSPropertyID property);
+    const mozilla::ComputedStyle* computed_values, nsCSSPropertyID property);
 
 bool Servo_ComputedValues_SpecifiesAnimationsOrTransitions(
-    ComputedStyleBorrowed computed_values);
+    const mozilla::ComputedStyle* computed_values);
 
 bool Servo_Property_IsAnimatable(nsCSSPropertyID property);
 bool Servo_Property_IsTransitionable(nsCSSPropertyID property);
 bool Servo_Property_IsDiscreteAnimatable(nsCSSPropertyID property);
 
-void Servo_GetProperties_Overriding_Animation(RawGeckoElementBorrowed,
-                                              RawGeckoCSSPropertyIDListBorrowed,
-                                              nsCSSPropertyIDSetBorrowedMut);
+void Servo_GetProperties_Overriding_Animation(const mozilla::dom::Element*,
+                                              const nsTArray<nsCSSPropertyID>*,
+                                              nsCSSPropertyIDSet*);
 
 void Servo_MatrixTransform_Operate(
     nsStyleTransformMatrix::MatrixTransformOperator matrix_operator,
-    const RawGeckoGfxMatrix4x4* from, const RawGeckoGfxMatrix4x4* to,
-    double progress, RawGeckoGfxMatrix4x4* result);
+    const Matrix4x4Components* from, const Matrix4x4Components* to,
+    double progress, Matrix4x4Components* result);
 
 void Servo_GetAnimationValues(
-    RawServoDeclarationBlockBorrowed declarations,
-    RawGeckoElementBorrowed element, ComputedStyleBorrowed style,
-    RawServoStyleSetBorrowed style_set,
-    RawGeckoServoAnimationValueListBorrowedMut animation_values);
+    const RawServoDeclarationBlock* declarations,
+    const mozilla::dom::Element* element, const mozilla::ComputedStyle* style,
+    const RawServoStyleSet* style_set,
+    nsTArray<RefPtr<RawServoAnimationValue>>* animation_values);
 
 // AnimationValues handling
 
 RawServoAnimationValueStrong Servo_AnimationValues_Interpolate(
-    RawServoAnimationValueBorrowed from, RawServoAnimationValueBorrowed to,
+    const RawServoAnimationValue* from, const RawServoAnimationValue* to,
     double progress);
 
-bool Servo_AnimationValues_IsInterpolable(RawServoAnimationValueBorrowed from,
-                                          RawServoAnimationValueBorrowed to);
+bool Servo_AnimationValues_IsInterpolable(const RawServoAnimationValue* from,
+                                          const RawServoAnimationValue* to);
 
 RawServoAnimationValueStrong Servo_AnimationValues_Add(
-    RawServoAnimationValueBorrowed a, RawServoAnimationValueBorrowed b);
+    const RawServoAnimationValue* a, const RawServoAnimationValue* b);
 
 RawServoAnimationValueStrong Servo_AnimationValues_Accumulate(
-    RawServoAnimationValueBorrowed a, RawServoAnimationValueBorrowed b,
+    const RawServoAnimationValue* a, const RawServoAnimationValue* b,
     uint64_t count);
 
 RawServoAnimationValueStrong Servo_AnimationValues_GetZeroValue(
-    RawServoAnimationValueBorrowed value_to_match);
+    const RawServoAnimationValue* value_to_match);
 
-double Servo_AnimationValues_ComputeDistance(
-    RawServoAnimationValueBorrowed from, RawServoAnimationValueBorrowed to);
+double Servo_AnimationValues_ComputeDistance(const RawServoAnimationValue* from,
+                                             const RawServoAnimationValue* to);
 
-void Servo_AnimationValue_Serialize(RawServoAnimationValueBorrowed value,
+void Servo_AnimationValue_Serialize(const RawServoAnimationValue* value,
                                     nsCSSPropertyID property,
                                     nsAString* buffer);
 
-nscolor Servo_AnimationValue_GetColor(RawServoAnimationValueBorrowed value,
+nscolor Servo_AnimationValue_GetColor(const RawServoAnimationValue* value,
                                       nscolor foregroundColor);
 RawServoAnimationValueStrong Servo_AnimationValue_Color(nsCSSPropertyID,
                                                         nscolor);
 
-float Servo_AnimationValue_GetOpacity(RawServoAnimationValueBorrowed value);
+float Servo_AnimationValue_GetOpacity(const RawServoAnimationValue* value);
 RawServoAnimationValueStrong Servo_AnimationValue_Opacity(float);
 
 nsCSSPropertyID Servo_AnimationValue_GetTransform(
-    RawServoAnimationValueBorrowed value, RefPtr<nsCSSValueSharedList>* list);
+    const RawServoAnimationValue* value, RefPtr<nsCSSValueSharedList>* list);
 
 RawServoAnimationValueStrong Servo_AnimationValue_Transform(
     nsCSSPropertyID property, const nsCSSValueSharedList& list);
 
-bool Servo_AnimationValue_DeepEqual(RawServoAnimationValueBorrowed,
-                                    RawServoAnimationValueBorrowed);
+bool Servo_AnimationValue_DeepEqual(const RawServoAnimationValue*,
+                                    const RawServoAnimationValue*);
 
 RawServoDeclarationBlockStrong Servo_AnimationValue_Uncompute(
-    RawServoAnimationValueBorrowed value);
+    const RawServoAnimationValue* value);
 
 RawServoAnimationValueStrong Servo_AnimationValue_Compute(
-    RawGeckoElementBorrowed element,
-    RawServoDeclarationBlockBorrowed declarations, ComputedStyleBorrowed style,
-    RawServoStyleSetBorrowed raw_data);
+    const mozilla::dom::Element* element,
+    const RawServoDeclarationBlock* declarations,
+    const mozilla::ComputedStyle* style, const RawServoStyleSet* raw_data);
 
 // Style attribute
 
 RawServoDeclarationBlockStrong Servo_ParseStyleAttribute(
-    const nsACString* data, RawGeckoURLExtraData* extra_data,
+    const nsACString* data, mozilla::URLExtraData* extra_data,
     nsCompatibility quirks_mode, mozilla::css::Loader* loader);
 
 RawServoDeclarationBlockStrong Servo_DeclarationBlock_CreateEmpty();
 
 RawServoDeclarationBlockStrong Servo_DeclarationBlock_Clone(
-    RawServoDeclarationBlockBorrowed declarations);
+    const RawServoDeclarationBlock* declarations);
 
-bool Servo_DeclarationBlock_Equals(RawServoDeclarationBlockBorrowed a,
-                                   RawServoDeclarationBlockBorrowed b);
+bool Servo_DeclarationBlock_Equals(const RawServoDeclarationBlock* a,
+                                   const RawServoDeclarationBlock* b);
 
 void Servo_DeclarationBlock_GetCssText(
-    RawServoDeclarationBlockBorrowed declarations, nsAString* result);
+    const RawServoDeclarationBlock* declarations, nsAString* result);
 
 void Servo_DeclarationBlock_SerializeOneValue(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property,
-    nsAString* buffer, ComputedStyleBorrowedOrNull computed_values,
-    RawServoDeclarationBlockBorrowedOrNull custom_properties);
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property,
+    nsAString* buffer, const mozilla::ComputedStyle* computed_values,
+    const RawServoDeclarationBlock* custom_properties);
 
 uint32_t Servo_DeclarationBlock_Count(
-    RawServoDeclarationBlockBorrowed declarations);
+    const RawServoDeclarationBlock* declarations);
 
 bool Servo_DeclarationBlock_GetNthProperty(
-    RawServoDeclarationBlockBorrowed declarations, uint32_t index,
+    const RawServoDeclarationBlock* declarations, uint32_t index,
     nsAString* result);
 
 void Servo_DeclarationBlock_GetPropertyValue(
-    RawServoDeclarationBlockBorrowed declarations, const nsACString* property,
+    const RawServoDeclarationBlock* declarations, const nsACString* property,
     nsAString* value);
 
 void Servo_DeclarationBlock_GetPropertyValueById(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property,
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property,
     nsAString* value);
 
 bool Servo_DeclarationBlock_GetPropertyIsImportant(
-    RawServoDeclarationBlockBorrowed declarations, const nsACString* property);
+    const RawServoDeclarationBlock* declarations, const nsACString* property);
 
 bool Servo_DeclarationBlock_SetProperty(
-    RawServoDeclarationBlockBorrowed declarations, const nsACString* property,
-    const nsACString* value, bool is_important, RawGeckoURLExtraData* data,
+    const RawServoDeclarationBlock* declarations, const nsACString* property,
+    const nsACString* value, bool is_important, mozilla::URLExtraData* data,
     mozilla::ParsingMode parsing_mode, nsCompatibility quirks_mode,
     mozilla::css::Loader* loader, mozilla::DeclarationBlockMutationClosure);
 
 bool Servo_DeclarationBlock_SetPropertyToAnimationValue(
-    RawServoDeclarationBlockBorrowed declarations,
-    RawServoAnimationValueBorrowed animation_value);
+    const RawServoDeclarationBlock* declarations,
+    const RawServoAnimationValue* animation_value);
 
 bool Servo_DeclarationBlock_SetPropertyById(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property,
-    const nsACString* value, bool is_important, RawGeckoURLExtraData* data,
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property,
+    const nsACString* value, bool is_important, mozilla::URLExtraData* data,
     mozilla::ParsingMode parsing_mode, nsCompatibility quirks_mode,
     mozilla::css::Loader* loader, mozilla::DeclarationBlockMutationClosure);
 
 bool Servo_DeclarationBlock_RemoveProperty(
-    RawServoDeclarationBlockBorrowed declarations, const nsACString* property,
+    const RawServoDeclarationBlock* declarations, const nsACString* property,
     mozilla::DeclarationBlockMutationClosure);
 
 bool Servo_DeclarationBlock_RemovePropertyById(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property,
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property,
     mozilla::DeclarationBlockMutationClosure);
 
 bool Servo_DeclarationBlock_HasCSSWideKeyword(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property);
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property);
 
 // Compose animation value for a given property.
 // |base_values| is nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>.
-// We use RawServoAnimationValueTableBorrowed to avoid exposing
+// We use const RawServoAnimationValueTable* to avoid exposing
 // nsRefPtrHashtable in FFI.
 void Servo_AnimationCompose(
-    RawServoAnimationValueMapBorrowedMut animation_values,
-    RawServoAnimationValueTableBorrowed base_values, nsCSSPropertyID property,
-    RawGeckoAnimationPropertySegmentBorrowed animation_segment,
-    RawGeckoAnimationPropertySegmentBorrowed last_segment,
-    RawGeckoComputedTimingBorrowed computed_timing,
+    RawServoAnimationValueMap* animation_values,
+    const RawServoAnimationValueTable* base_values, nsCSSPropertyID property,
+    const mozilla::AnimationPropertySegment* animation_segment,
+    const mozilla::AnimationPropertySegment* last_segment,
+    const mozilla::ComputedTiming* computed_timing,
     mozilla::dom::IterationCompositeOperation iter_composite);
 
 // Calculate the result of interpolating given animation segment at the given
 // progress and current iteration.
 // This includes combining the segment endpoints with the underlying value
 // and/or last value depending the composite modes specified on the
 // segment endpoints and the supplied iteration composite mode.
 // The caller is responsible for providing an underlying value and
 // last value in all situations where there are needed.
 RawServoAnimationValueStrong Servo_ComposeAnimationSegment(
-    RawGeckoAnimationPropertySegmentBorrowed animation_segment,
-    RawServoAnimationValueBorrowedOrNull underlying_value,
-    RawServoAnimationValueBorrowedOrNull last_value,
+    const mozilla::AnimationPropertySegment* animation_segment,
+    const RawServoAnimationValue* underlying_value,
+    const RawServoAnimationValue* last_value,
     mozilla::dom::IterationCompositeOperation iter_composite, double progress,
     uint64_t current_iteration);
 
 // presentation attributes
 
 bool Servo_DeclarationBlock_PropertyIsSet(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property);
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property);
 
 void Servo_DeclarationBlock_SetIdentStringValue(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property,
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property,
     nsAtom* value);
 
 void Servo_DeclarationBlock_SetKeywordValue(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property,
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property,
     int32_t value);
 
 void Servo_DeclarationBlock_SetIntValue(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property,
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property,
     int32_t value);
 
 void Servo_DeclarationBlock_SetPixelValue(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property,
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property,
     float value);
 
 void Servo_DeclarationBlock_SetLengthValue(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property,
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property,
     float value, nsCSSUnit unit);
 
 void Servo_DeclarationBlock_SetNumberValue(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property,
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property,
     float value);
 
 void Servo_DeclarationBlock_SetPercentValue(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property,
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property,
     float value);
 
 void Servo_DeclarationBlock_SetAutoValue(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property);
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property);
 
 void Servo_DeclarationBlock_SetCurrentColor(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property);
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property);
 
 void Servo_DeclarationBlock_SetColorValue(
-    RawServoDeclarationBlockBorrowed declarations, nsCSSPropertyID property,
+    const RawServoDeclarationBlock* declarations, nsCSSPropertyID property,
     nscolor value);
 
 void Servo_DeclarationBlock_SetFontFamily(
-    RawServoDeclarationBlockBorrowed declarations, const nsAString& value);
+    const RawServoDeclarationBlock* declarations, const nsAString& value);
 
 void Servo_DeclarationBlock_SetTextDecorationColorOverride(
-    RawServoDeclarationBlockBorrowed declarations);
+    const RawServoDeclarationBlock* declarations);
 
 void Servo_DeclarationBlock_SetBackgroundImage(
-    RawServoDeclarationBlockBorrowed declarations, const nsAString& value,
-    RawGeckoURLExtraData* extra_data);
+    const RawServoDeclarationBlock* declarations, const nsAString& value,
+    mozilla::URLExtraData* extra_data);
 
 // MediaList
 
 RawServoMediaListStrong Servo_MediaList_Create();
 
 RawServoMediaListStrong Servo_MediaList_DeepClone(
-    RawServoMediaListBorrowed list);
+    const RawServoMediaList* list);
 
-bool Servo_MediaList_Matches(RawServoMediaListBorrowed list,
-                             RawServoStyleSetBorrowed set);
+bool Servo_MediaList_Matches(const RawServoMediaList* list,
+                             const RawServoStyleSet* set);
 
-void Servo_MediaList_GetText(RawServoMediaListBorrowed list, nsAString* result);
+void Servo_MediaList_GetText(const RawServoMediaList* list, nsAString* result);
 
-void Servo_MediaList_SetText(RawServoMediaListBorrowed list,
+void Servo_MediaList_SetText(const RawServoMediaList* list,
                              const nsACString* text,
                              mozilla::dom::CallerType aCallerType);
 
-uint32_t Servo_MediaList_GetLength(RawServoMediaListBorrowed list);
+uint32_t Servo_MediaList_GetLength(const RawServoMediaList* list);
 
-bool Servo_MediaList_GetMediumAt(RawServoMediaListBorrowed list, uint32_t index,
+bool Servo_MediaList_GetMediumAt(const RawServoMediaList* list, uint32_t index,
                                  nsAString* result);
 
-void Servo_MediaList_AppendMedium(RawServoMediaListBorrowed list,
+void Servo_MediaList_AppendMedium(const RawServoMediaList* list,
                                   const nsACString* new_medium);
 
-bool Servo_MediaList_DeleteMedium(RawServoMediaListBorrowed list,
+bool Servo_MediaList_DeleteMedium(const RawServoMediaList* list,
                                   const nsACString* old_medium);
 
 size_t Servo_MediaList_SizeOfIncludingThis(
     mozilla::MallocSizeOf malloc_size_of,
     mozilla::MallocSizeOf malloc_enclosing_size_of,
-    RawServoMediaListBorrowed list);
+    const RawServoMediaList* list);
 
 // CSS supports();
 
 bool Servo_CSSSupports2(const nsACString* name, const nsACString* value);
 bool Servo_CSSSupports(const nsACString* cond);
 
 // Computed style data
 
 ComputedStyleStrong Servo_ComputedValues_GetForAnonymousBox(
-    ComputedStyleBorrowedOrNull parent_style_or_null, mozilla::PseudoStyleType,
-    RawServoStyleSetBorrowed set);
+    const mozilla::ComputedStyle* parent_style_or_null,
+    mozilla::PseudoStyleType, const RawServoStyleSet* set);
 
 ComputedStyleStrong Servo_ComputedValues_Inherit(
-    RawServoStyleSetBorrowed, mozilla::PseudoStyleType,
-    ComputedStyleBorrowedOrNull parent_style, mozilla::InheritTarget);
-
-bool Servo_ComputedValues_EqualCustomProperties(
-    ServoComputedDataBorrowed first, ServoComputedDataBorrowed second);
+    const RawServoStyleSet*, mozilla::PseudoStyleType,
+    const mozilla::ComputedStyle* parent_style, mozilla::InheritTarget);
 
 // Gets the source style rules for the computed values. This returns
 // the result via rules, which would include a list of unowned pointers
 // to RawServoStyleRule.
 void Servo_ComputedValues_GetStyleRuleList(
-    ComputedStyleBorrowed values, RawGeckoServoStyleRuleListBorrowedMut rules);
+    const mozilla::ComputedStyle* values,
+    nsTArray<const RawServoStyleRule*>* rules);
 
 // Initialize Servo components. Should be called exactly once at startup.
-void Servo_Initialize(RawGeckoURLExtraData* dummy_url_data);
+void Servo_Initialize(mozilla::URLExtraData* dummy_url_data);
 
 // Initialize Servo on a cooperative Quantum DOM thread.
 void Servo_InitializeCooperativeThread();
 
 // Shut down Servo components. Should be called exactly once at shutdown.
 void Servo_Shutdown();
 
 // Restyle and change hints.
-void Servo_NoteExplicitHints(RawGeckoElementBorrowed, mozilla::RestyleHint,
+void Servo_NoteExplicitHints(const mozilla::dom::Element*, mozilla::RestyleHint,
                              nsChangeHint);
 
 // We'd like to return `nsChangeHint` here, but bindgen bitfield enums don't
 // work as return values with the Linux 32-bit ABI at the moment because
 // they wrap the value in a struct.
-uint32_t Servo_TakeChangeHint(RawGeckoElementBorrowed element,
+uint32_t Servo_TakeChangeHint(const mozilla::dom::Element* element,
                               bool* was_restyled);
 
-ComputedStyleStrong Servo_ResolveStyle(RawGeckoElementBorrowed element,
-                                       RawServoStyleSetBorrowed set);
+ComputedStyleStrong Servo_ResolveStyle(const mozilla::dom::Element* element,
+                                       const RawServoStyleSet* set);
 
 ComputedStyleStrong Servo_ResolvePseudoStyle(
-    RawGeckoElementBorrowed element, mozilla::PseudoStyleType pseudo_type,
-    bool is_probe, ComputedStyleBorrowedOrNull inherited_style,
-    RawServoStyleSetBorrowed set);
+    const mozilla::dom::Element* element, mozilla::PseudoStyleType pseudo_type,
+    bool is_probe, const mozilla::ComputedStyle* inherited_style,
+    const RawServoStyleSet* set);
 
 ComputedStyleStrong Servo_ComputedValues_ResolveXULTreePseudoStyle(
-    RawGeckoElementBorrowed element, nsAtom* pseudo_tag,
-    ComputedStyleBorrowed inherited_style, const mozilla::AtomArray* input_word,
-    RawServoStyleSetBorrowed set);
+    const mozilla::dom::Element* element, nsAtom* pseudo_tag,
+    const mozilla::ComputedStyle* inherited_style,
+    const mozilla::AtomArray* input_word, const RawServoStyleSet* set);
 
-void Servo_SetExplicitStyle(RawGeckoElementBorrowed element,
-                            ComputedStyleBorrowed primary_style);
+void Servo_SetExplicitStyle(const mozilla::dom::Element* element,
+                            const mozilla::ComputedStyle* primary_style);
 
-bool Servo_HasAuthorSpecifiedRules(RawServoStyleSetBorrowed set,
-                                   ComputedStyleBorrowed style,
-                                   RawGeckoElementBorrowed element,
+bool Servo_HasAuthorSpecifiedRules(const RawServoStyleSet* set,
+                                   const mozilla::ComputedStyle* style,
+                                   const mozilla::dom::Element* element,
                                    uint32_t rule_type_mask);
 
 // Resolves style for an element or pseudo-element without processing pending
 // restyles first. The Element and its ancestors may be unstyled, have pending
 // restyles, or be in a display:none subtree. Styles are cached when possible,
 // though caching is not possible within display:none subtrees, and the styles
 // may be invalidated by already-scheduled restyles.
 //
 // The tree must be in a consistent state such that a normal traversal could be
 // performed, and this function maintains that invariant.
 
 ComputedStyleStrong Servo_ResolveStyleLazily(
-    RawGeckoElementBorrowed element, mozilla::PseudoStyleType pseudo_type,
+    const mozilla::dom::Element* element, mozilla::PseudoStyleType pseudo_type,
     mozilla::StyleRuleInclusion rule_inclusion,
     const mozilla::ServoElementSnapshotTable* snapshots,
-    RawServoStyleSetBorrowed set);
+    const RawServoStyleSet* set);
 
 // Reparents style to the new parents.
 ComputedStyleStrong Servo_ReparentStyle(
-    ComputedStyleBorrowed style_to_reparent, ComputedStyleBorrowed parent_style,
-    ComputedStyleBorrowed parent_style_ignoring_first_line,
-    ComputedStyleBorrowed layout_parent_style,
+    const mozilla::ComputedStyle* style_to_reparent,
+    const mozilla::ComputedStyle* parent_style,
+    const mozilla::ComputedStyle* parent_style_ignoring_first_line,
+    const mozilla::ComputedStyle* layout_parent_style,
     // element is null if there is no content node involved, or if it's not an
     // element.
-    RawGeckoElementBorrowedOrNull element, RawServoStyleSetBorrowed set);
+    const mozilla::dom::Element* element, const RawServoStyleSet* set);
 
 // Use ServoStyleSet::PrepareAndTraverseSubtree instead of calling this
 // directly
-bool Servo_TraverseSubtree(RawGeckoElementBorrowed root,
-                           RawServoStyleSetBorrowed set,
+bool Servo_TraverseSubtree(const mozilla::dom::Element* root,
+                           const RawServoStyleSet* set,
                            const mozilla::ServoElementSnapshotTable* snapshots,
                            mozilla::ServoTraversalFlags flags);
 
 // Assert that the tree has no pending or unconsumed restyles.
-void Servo_AssertTreeIsClean(RawGeckoElementBorrowed root);
+void Servo_AssertTreeIsClean(const mozilla::dom::Element* root);
 
 // Returns true if the current thread is a Servo parallel worker thread.
 bool Servo_IsWorkerThread();
 
 // Checks whether the rule tree has crossed its threshold for unused rule nodes,
 // and if so, frees them.
-void Servo_MaybeGCRuleTree(RawServoStyleSetBorrowed set);
+void Servo_MaybeGCRuleTree(const RawServoStyleSet* set);
 
 // Returns computed values for the given element without any animations rules.
 ComputedStyleStrong Servo_StyleSet_GetBaseComputedValuesForElement(
-    RawServoStyleSetBorrowed set, RawGeckoElementBorrowed element,
-    ComputedStyleBorrowed existing_style,
+    const RawServoStyleSet* set, const mozilla::dom::Element* element,
+    const mozilla::ComputedStyle* existing_style,
     const mozilla::ServoElementSnapshotTable* snapshots);
 
 // Returns computed values for the given element by adding an animation value.
 ComputedStyleStrong Servo_StyleSet_GetComputedValuesByAddingAnimation(
-    RawServoStyleSetBorrowed set, RawGeckoElementBorrowed element,
-    ComputedStyleBorrowed existing_style,
+    const RawServoStyleSet* set, const mozilla::dom::Element* element,
+    const mozilla::ComputedStyle* existing_style,
     const mozilla::ServoElementSnapshotTable* snapshots,
-    RawServoAnimationValueBorrowed animation);
+    const RawServoAnimationValue* animation);
 
 // For canvas font.
 void Servo_SerializeFontValueForCanvas(
-    RawServoDeclarationBlockBorrowed declarations, nsAString* buffer);
+    const RawServoDeclarationBlock* declarations, nsAString* buffer);
 
 // GetComputedStyle APIs.
-bool Servo_GetCustomPropertyValue(ComputedStyleBorrowed computed_values,
+bool Servo_GetCustomPropertyValue(const mozilla::ComputedStyle* computed_values,
                                   const nsAString* name, nsAString* value);
 
-uint32_t Servo_GetCustomPropertiesCount(ComputedStyleBorrowed computed_values);
+uint32_t Servo_GetCustomPropertiesCount(
+    const mozilla::ComputedStyle* computed_values);
 
-bool Servo_GetCustomPropertyNameAt(ComputedStyleBorrowed, uint32_t index,
-                                   nsAString* name);
+bool Servo_GetCustomPropertyNameAt(const mozilla::ComputedStyle*,
+                                   uint32_t index, nsAString* name);
 
-void Servo_GetPropertyValue(ComputedStyleBorrowed computed_values,
+void Servo_GetPropertyValue(const mozilla::ComputedStyle* computed_values,
                             nsCSSPropertyID property, nsAString* value);
 
 void Servo_ProcessInvalidations(
-    RawServoStyleSetBorrowed set, RawGeckoElementBorrowed element,
+    const RawServoStyleSet* set, const mozilla::dom::Element* element,
     const mozilla::ServoElementSnapshotTable* snapshots);
 
-bool Servo_HasPendingRestyleAncestor(RawGeckoElementBorrowed element);
+bool Servo_HasPendingRestyleAncestor(const mozilla::dom::Element* element);
 
-void Servo_CssUrlData_GetSerialization(RawServoCssUrlDataBorrowed url,
+void Servo_CssUrlData_GetSerialization(RawServoCssUrlData* url,
                                        uint8_t const** chars, uint32_t* len);
 
-RawGeckoURLExtraDataBorrowedMut Servo_CssUrlData_GetExtraData(
-    RawServoCssUrlDataBorrowed url);
+mozilla::URLExtraData* Servo_CssUrlData_GetExtraData(const RawServoCssUrlData*);
 
-bool Servo_CssUrlData_IsLocalRef(RawServoCssUrlDataBorrowed url);
+bool Servo_CssUrlData_IsLocalRef(const RawServoCssUrlData* url);
 
 // CSS parsing utility functions.
 
 bool Servo_IsValidCSSColor(const nsAString* value);
 
-bool Servo_ComputeColor(RawServoStyleSetBorrowedOrNull set,
-                        nscolor current_color, const nsAString* value,
-                        nscolor* result_color, bool* was_current_color,
-                        mozilla::css::Loader* loader);
+bool Servo_ComputeColor(const RawServoStyleSet* set, nscolor current_color,
+                        const nsAString* value, nscolor* result_color,
+                        bool* was_current_color, mozilla::css::Loader* loader);
 
 bool Servo_IntersectionObserverRootMargin_Parse(
     const nsAString* value,
     mozilla::StyleIntersectionObserverRootMargin* result);
 
 void Servo_IntersectionObserverRootMargin_ToString(
     const mozilla::StyleIntersectionObserverRootMargin*, nsAString* result);
 
 // Returning false means the parsed transform contains relative lengths or
 // percentage value, so we cannot compute the matrix. In this case, we keep
 // |result| and |contains_3d_transform| as-is.
 bool Servo_ParseTransformIntoMatrix(const nsAString* value,
                                     bool* contains_3d_transform,
-                                    RawGeckoGfxMatrix4x4* result);
+                                    Matrix4x4Components* aResult);
 
 bool Servo_ParseFontShorthandForMatching(
-    const nsAString* value, RawGeckoURLExtraData* data,
+    const nsAString* value, mozilla::URLExtraData* data,
     RefPtr<mozilla::SharedFontList>* family,
     // We use ComputedFontStyleDescriptor just for convenience,
     // but the two values of Oblique are the same.
     mozilla::StyleComputedFontStyleDescriptor* style, float* stretch,
     float* weight);
 
 nsCSSPropertyID Servo_ResolveLogicalProperty(nsCSSPropertyID,
-                                             ComputedStyleBorrowed);
+                                             const mozilla::ComputedStyle*);
 
 nsCSSPropertyID Servo_Property_LookupEnabledForAllContent(
     const nsACString* name);
 
 const uint8_t* Servo_Property_GetName(nsCSSPropertyID, uint32_t* out_length);
 bool Servo_Property_IsShorthand(const nsACString* name, bool* found);
 bool Servo_Property_IsInherited(const nsACString* name);
 
@@ -969,32 +961,32 @@ bool Servo_Property_SupportsType(const n
 void Servo_Property_GetCSSValuesForProperty(const nsACString* name, bool* found,
                                             nsTArray<nsString>* result);
 
 uint64_t Servo_PseudoClass_GetStates(const nsACString* name);
 
 StyleUseCounters* Servo_UseCounters_Create();
 void Servo_UseCounters_Drop(StyleUseCountersOwned);
 
-void Servo_UseCounters_Merge(StyleUseCountersBorrowed doc_counters,
-                             StyleUseCountersBorrowed sheet_counters);
+void Servo_UseCounters_Merge(const StyleUseCounters* doc_counters,
+                             const StyleUseCounters* sheet_counters);
 
-bool Servo_IsCssPropertyRecordedInUseCounter(StyleUseCountersBorrowed,
+bool Servo_IsCssPropertyRecordedInUseCounter(const StyleUseCounters*,
                                              const nsACString* property,
                                              bool* out_known_prop);
 
 RawServoQuotesStrong Servo_Quotes_GetInitialValue();
-bool Servo_Quotes_Equal(RawServoQuotesBorrowed a, RawServoQuotesBorrowed b);
+bool Servo_Quotes_Equal(const RawServoQuotes* a, RawServoQuotes* b);
 
-void Servo_Quotes_GetQuote(RawServoQuotesBorrowed quotes, int32_t depth,
+void Servo_Quotes_GetQuote(const RawServoQuotes* quotes, int32_t depth,
                            mozilla::StyleContentType quote_type,
                            nsAString* result);
 
 // AddRef / Release functions
-#define SERVO_ARC_TYPE(name_, type_)            \
-  void Servo_##name_##_AddRef(type_##Borrowed); \
-  void Servo_##name_##_Release(type_##Borrowed);
+#define SERVO_ARC_TYPE(name_, type_)         \
+  void Servo_##name_##_AddRef(const type_*); \
+  void Servo_##name_##_Release(const type_*);
 #include "mozilla/ServoArcTypeList.h"
 #undef SERVO_ARC_TYPE
 
 }  // extern "C"
 
 #endif  // mozilla_ServoBindings_h
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -156,19 +156,27 @@ whitelist-vars = [
     "kNameSpaceID_.*",
     "kGenericFont_.*",
     "kPresContext_.*",
     "nsContentUtils_.*",
     "GECKO_IS_NIGHTLY",
     "mozilla::detail::gGkAtoms",
     "mozilla::detail::kGkAtomsArrayOffset",
 ]
+# TODO(emilio): A bunch of types here can go away once we generate bindings and
+# structs together.
 whitelist-types = [
     "RawGecko.*",
-    "RawServoAnimationValueMap",  # TODO(heycam): Handle this elsewhere.
+    "RawServo.*",
+    "ServoCssRules",
+    "nsFontFaceRuleContainer",
+    "Matrix4x4Components",
+    "mozilla::ComputedKeyframeValues",
+    "mozilla::Keyframe",
+    "mozilla::PropertyValuePair",
     "mozilla::DeclarationBlockMutationClosure",
     "mozilla::AnimationPropertySegment",
     "mozilla::AnonymousCounterStyle",
     "mozilla::AtomArray",
     "mozilla::ComputedTiming",
     "mozilla::ComputedTimingFunction",
     "mozilla::ComputedTimingFunction::BeforeFlag",
     "mozilla::PreferenceSheet",
@@ -468,209 +476,24 @@ headers = [
     "mozilla/GeckoBindings.h",
     # We include ServoBindings.h so we can type check the C function declarations
     # in there against the function definitions in servo/ports/gecko/glue.rs.
     "mozilla/ServoBindings.h",
 ]
 hide-types = [
     "nsACString_internal",
     "nsAString_internal",
-    "ComputedStyleBorrowed",
-    "ComputedStyleBorrowedOrNull",
 ]
 raw-lines = [
     "pub use nsstring::{nsACString, nsAString, nsCString, nsString, nsStringRepr};",
-    "use gecko_bindings::structs::nsStyleTransformMatrix;",
-    "use gecko_bindings::structs::nsTArray;",
+    "use gecko_bindings::structs::*;",
+    "use gecko_bindings::structs::mozilla::gfx::*;",
+    "use gecko_bindings::structs::nsStyleTransformMatrix::*;",
     "type nsACString_internal = nsACString;",
     "type nsAString_internal = nsAString;",
-    "pub type ComputedStyleBorrowed<'a> = &'a ::properties::ComputedValues;",
-    "pub type ComputedStyleBorrowedOrNull<'a> = Option<&'a ::properties::ComputedValues>;",
-    "pub type ServoComputedDataBorrowed<'a> = &'a ServoComputedData;",
-    "pub type RawServoAnimationValueTableBorrowed<'a> = &'a ();"
 ]
 whitelist-functions = ["Servo_.*", "Gecko_.*"]
-structs-types = [
-    "mozilla::css::GridTemplateAreasValue",
-    "mozilla::css::URLValue",
-    "mozilla::dom::CallerType",
-    "mozilla::dom::ShadowRoot",
-    "mozilla::AnonymousCounterStyle",
-    "mozilla::AtomArray",
-    "mozilla::CORSMode",
-    "mozilla::FontStretch",
-    "mozilla::FontSlantStyle",
-    "mozilla::FontWeight",
-    "mozilla::MallocSizeOf",
-    "mozilla::OriginFlags",
-    "mozilla::StyleMotion",
-    "mozilla::UniquePtr",
-    "mozilla::StyleBorderRadius",
-    "mozilla::StyleDisplayMode",
-    "mozilla::StylePrefersColorScheme",
-    "mozilla::StyleIntersectionObserverRootMargin",
-    "mozilla::StyleComputedFontStretchRange",
-    "mozilla::StyleComputedFontStyleDescriptor",
-    "mozilla::StyleComputedFontWeightRange",
-    "mozilla::StyleFontDisplay",
-    "mozilla::StyleUnicodeRange",
-    "mozilla::StyleFontLanguageOverride",
-    "mozilla::StyleFontFaceSourceListComponent",
-    "mozilla::RestyleHint",
-    "gfxFontFeature",
-    "mozilla::gfx::FontVariation",
-    "mozilla::DeclarationBlockMutationClosure",
-    "nsAttrValue",
-    "nsIContent",
-    "nsINode",
-    "Document",
-    "Document_DocumentTheme",
-    "mozilla::PreferenceSheet_Prefs",
-    "nsSimpleContentList",
-    "mozilla::MediumFeaturesChangedResult",
-    "RawGeckoAnimationPropertySegment",
-    "RawGeckoComputedTiming",
-    "RawGeckoCSSPropertyIDList",
-    "RawGeckoDocument",
-    "RawGeckoElement",
-    "Element",
-    "RawGeckoKeyframeList",
-    "RawGeckoPropertyValuePairList",
-    "RawGeckoComputedKeyframeValuesList",
-    "RawGeckoFontFaceRuleList",
-    "RawGeckoNode",
-    "RawServoAnimationValue",
-    "RawServoFontFaceRule",
-    "RawGeckoServoAnimationValueList",
-    "RawServoMediaList",
-    "RawServoStyleSheetContents",
-    "RawServoDeclarationBlock",
-    "RawServoStyleRule",
-    "RawGeckoPresContext",
-    "RawGeckoStyleAnimationList",
-    "RawGeckoStyleChildrenIterator",
-    "RawGeckoServoStyleRuleList",
-    "RawGeckoURLExtraData",
-    "RawGeckoXBLBinding",
-    "RawServoSelectorList",
-    "RawServoSourceSizeList",
-    "RefPtr",
-    "StyleUseCounters",
-    "PseudoStyleType",
-    "ServoTraversalFlags",
-    "ComputedTimingFunction_BeforeFlag",
-    "CounterStylePtr",
-    "FontFamilyType",
-    "mozilla::FontSizePrefs",
-    "GeckoFontMetrics",
-    "IterationCompositeOperation",
-    "Keyframe",
-    "PropertyValuePair",
-    "SeenPtrs",
-    "ServoElementSnapshot",
-    "ServoElementSnapshotTable",
-    "ServoStyleSetSizes",
-    "SheetParsingMode",
-    "StyleBasicShapeType",
-    "StyleShapeSource",
-    "StyleTransition",
-    "gfxFontFeatureValueSet",
-    "nsCSSCounterDesc",
-    "nsCSSFontDesc",
-    "nsCSSKeyword",
-    "nsCSSPropertyID",
-    "nsCSSPropertyIDSet",
-    "nsCSSShadowArray",
-    "nsCSSUnit",
-    "nsCSSValue",
-    "nsCSSValueSharedList",
-    "nsChangeHint",
-    "nsCursorImage",
-    "nsFont",
-    "nsAtom",
-    "nsIURI",
-    "nsCompatibility",
-    "nsStyleBackground",
-    "nsStyleBorder",
-    "nsStyleColor",
-    "nsStyleColumn",
-    "nsStyleContent",
-    "nsStyleContentData",
-    "nsStyleContentData_CounterFunction",
-    "mozilla::StyleContentType",
-    "ComputedStyle",
-    "nsStyleCoord",
-    "nsStyleCoord_Calc",
-    "nsStyleCoord_CalcValue",
-    "nsStyleDisplay",
-    "nsStyleEffects",
-    "nsStyleFilter",
-    "nsStyleFont",
-    "nsStyleGradient",
-    "nsStyleGradientStop",
-    "nsStyleGridTemplate",
-    "nsStyleImage",
-    "nsStyleImageLayers",
-    "nsStyleImageLayers_Layer",
-    "nsStyleImageLayers_LayerType",
-    "nsStyleImageRequest",
-    "nsStyleList",
-    "nsStyleMargin",
-    "nsStyleOutline",
-    "nsStylePadding",
-    "nsStylePosition",
-    "nsStyleSVG",
-    "nsStyleSVGOpacitySource",
-    "nsStyleSVGPaint",
-    "nsStyleSVGReset",
-    "nsStyleSides",
-    "nsStyleTable",
-    "nsStyleTableBorder",
-    "nsStyleText",
-    "nsStyleTextReset",
-    "nsStyleUIReset",
-    "nsStyleUnion",
-    "nsStyleUnit",
-    "nsStyleUI",
-    "nsStyleVisibility",
-    "nsStyleXUL",
-    "nsTimingFunction",
-    "nscolor",
-    "nscoord",
-    "nsresult",
-    "Loader",
-    "LoaderReusableStyleSheets",
-    "SheetLoadData",
-    "SheetLoadDataHolder",
-    "StyleSheet",
-    "ServoComputedData",
-    "ComputedStyleStrong",
-    "EffectCompositor_CascadeLevel",
-    "UpdateAnimationsTasks",
-    "PointerCapabilities",
-    "ParsingMode",
-    "InheritTarget",
-    "DocumentMatchingFunction",
-    "StyleAnimation",
-    "StyleRuleInclusion",
-    "nsStyleTransformMatrix::MatrixTransformOperator",
-    "RawGeckoGfxMatrix4x4",
-    "FontFamilyName",
-    "mozilla::SharedFontList",
-    "RawServoAnimationValueMap",
-    "RawServoCssUrlData",
-    "RawServoQuotes",
-]
-array-types = [
-    { cpp-type = "uintptr_t", rust-type = "usize" },
-]
-servo-immutable-borrow-types = [
-    "RawServoDeclarationBlockStrong",
-]
-servo-borrow-types = [
-    "RawServoAnimationValueMap",  # FIXME(heycam): Try to get rid of this.
-]
 fixups = [
     # Remap the templated string type to the helper type
     { pat = "\\bnsTString\\s*<\\s*u16\\s*>", rep = "nsString" },
     # hack for gecko-owned string
     { pat = "<\\s*nsString\\s*", rep = "<nsStringRepr" },
 ]
--- a/layout/style/ServoCSSParser.cpp
+++ b/layout/style/ServoCSSParser.cpp
@@ -46,19 +46,19 @@ already_AddRefed<RawServoDeclarationBloc
 bool ServoCSSParser::ParseEasing(const nsAString& aValue, URLExtraData* aUrl,
                                  nsTimingFunction& aResult) {
   return Servo_ParseEasing(&aValue, aUrl, &aResult);
 }
 
 /* static */
 bool ServoCSSParser::ParseTransformIntoMatrix(const nsAString& aValue,
                                               bool& aContains3DTransform,
-                                              RawGeckoGfxMatrix4x4& aResult) {
+                                              gfx::Matrix4x4& aResult) {
   return Servo_ParseTransformIntoMatrix(&aValue, &aContains3DTransform,
-                                        &aResult);
+                                        &aResult.components);
 }
 
 /* static */
 bool ServoCSSParser::ParseFontShorthandForMatching(
     const nsAString& aValue, URLExtraData* aUrl, RefPtr<SharedFontList>& aList,
     StyleComputedFontStyleDescriptor& aStyle, float& aStretch, float& aWeight) {
   return Servo_ParseFontShorthandForMatching(&aValue, aUrl, &aList, &aStyle,
                                              &aStretch, &aWeight);
--- a/layout/style/ServoCSSParser.h
+++ b/layout/style/ServoCSSParser.h
@@ -18,18 +18,16 @@
 #include "nsDOMCSSDeclaration.h"
 #include "nsStringFwd.h"
 
 class nsCSSValue;
 struct nsCSSRect;
 struct nsTimingFunction;
 struct RawServoDeclarationBlock;
 
-using RawGeckoGfxMatrix4x4 = mozilla::gfx::Float[16];
-
 namespace mozilla {
 
 class ServoStyleSet;
 class SharedFontList;
 struct URLExtraData;
 
 namespace css {
 class Loader;
@@ -105,17 +103,17 @@ class ServoCSSParser {
    * @param aValue The specified value.
    * @param aContains3DTransform The output flag indicates whether this is any
    *   3d transform function. (output)
    * @param aResult The output matrix. (output)
    * @return Whether the value was successfully parsed.
    */
   static bool ParseTransformIntoMatrix(const nsAString& aValue,
                                        bool& aContains3DTransform,
-                                       RawGeckoGfxMatrix4x4& aResult);
+                                       gfx::Matrix4x4& aResult);
 
   /**
    * Parse a font shorthand for FontFaceSet matching, so we only care about
    * FontFamily, FontStyle, FontStretch, and FontWeight.
    *
    * @param aValue The specified value.
    * @param aUrl The parser url extra data.
    * @param aList The parsed FontFamily list. (output)
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -198,17 +198,17 @@ void ServoStyleSet::InvalidateStyleForDo
   if (!root) {
     return;
   }
 
   // TODO(emilio): It may be nicer to just invalidate stuff in a given subtree
   // for XBL sheets / Shadow DOM. Consider just enumerating bound content
   // instead and run invalidation individually, passing mRawSet for the UA /
   // User sheets.
-  AutoTArray<RawServoAuthorStylesBorrowed, 20> nonDocumentStyles;
+  AutoTArray<const RawServoAuthorStyles*, 20> nonDocumentStyles;
 
   EnumerateShadowRoots(*mDocument, [&](ShadowRoot& aShadowRoot) {
     if (auto* authorStyles = aShadowRoot.GetServoStyles()) {
       nonDocumentStyles.AppendElement(authorStyles);
     }
   });
 
   mDocument->BindingManager()->EnumerateBoundContentProtoBindings(
@@ -229,17 +229,17 @@ static const MediaFeatureChangeReason kM
     // A resolution change changes the app-units-per-dev-pixels ratio, which
     // some structs (Border, Outline, Column) store for clamping. We should
     // arguably not do that, maybe doing it on layout directly, to try to avoid
     // relying on the pres context (bug 1418159).
     MediaFeatureChangeReason::ResolutionChange;
 
 RestyleHint ServoStyleSet::MediumFeaturesChanged(
     MediaFeatureChangeReason aReason) {
-  AutoTArray<RawServoAuthorStylesBorrowedMut, 20> nonDocumentStyles;
+  AutoTArray<RawServoAuthorStyles*, 20> nonDocumentStyles;
 
   EnumerateShadowRoots(*mDocument, [&](ShadowRoot& aShadowRoot) {
     if (auto* authorStyles = aShadowRoot.GetServoStyles()) {
       nonDocumentStyles.AppendElement(authorStyles);
     }
   });
 
   // FIXME(emilio): This is broken for XBL. See bug 1406875.
@@ -426,17 +426,17 @@ void ServoStyleSet::PreTraverse(ServoTra
     GetPresContext()->EffectCompositor()->PreTraverse(aFlags);
     if (smilController) {
       smilController->PreTraverse();
     }
   }
 }
 
 static inline already_AddRefed<ComputedStyle>
-ResolveStyleForTextOrFirstLetterContinuation(RawServoStyleSetBorrowed aStyleSet,
+ResolveStyleForTextOrFirstLetterContinuation(const RawServoStyleSet* aStyleSet,
                                              ComputedStyle& aParent,
                                              PseudoStyleType aType) {
   MOZ_ASSERT(aType == PseudoStyleType::mozText ||
              aType == PseudoStyleType::firstLetterContinuation);
   auto inheritTarget = aType == PseudoStyleType::mozText
                            ? InheritTarget::Text
                            : InheritTarget::FirstLetterContinuation;
 
@@ -1256,17 +1256,17 @@ ServoStyleSet::BuildFontFeatureValueSet(
   MOZ_ASSERT(!StylistNeedsUpdate());
   RefPtr<gfxFontFeatureValueSet> set =
       Servo_StyleSet_BuildFontFeatureValueSet(mRawSet.get());
   return set.forget();
 }
 
 already_AddRefed<ComputedStyle> ServoStyleSet::ResolveForDeclarations(
     const ComputedStyle* aParentOrNull,
-    RawServoDeclarationBlockBorrowed aDeclarations) {
+    const RawServoDeclarationBlock* aDeclarations) {
   // No need to update the stylist, we're only cascading aDeclarations.
   return Servo_StyleSet_ResolveForDeclarations(mRawSet.get(), aParentOrNull,
                                                aDeclarations)
       .Consume();
 }
 
 void ServoStyleSet::UpdateStylist() {
   MOZ_ASSERT(StylistNeedsUpdate());
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -40,17 +40,16 @@ class ComputedStyle;
 class ServoStyleRuleMap;
 class StyleSheet;
 }  // namespace mozilla
 class gfxFontFeatureValueSet;
 class nsIContent;
 
 class nsPresContext;
 struct nsTimingFunction;
-struct RawServoRuleNode;
 struct TreeMatchContext;
 
 namespace mozilla {
 
 // A few flags used to track which kind of stylist state we may need to
 // update.
 enum class StylistState : uint8_t {
   // The stylist is not dirty, we should do nothing.
@@ -351,17 +350,17 @@ class ServoStyleSet {
       RawServoAnimationValue* aAnimationValue);
   /**
    * Resolve style for a given declaration block with/without the parent style.
    * If the parent style is not specified, the document default computed values
    * is used.
    */
   already_AddRefed<ComputedStyle> ResolveForDeclarations(
       const ComputedStyle* aParentOrNull,
-      RawServoDeclarationBlockBorrowed aDeclarations);
+      const RawServoDeclarationBlock* aDeclarations);
 
   already_AddRefed<RawServoAnimationValue> ComputeAnimationValue(
       dom::Element* aElement, RawServoDeclarationBlock* aDeclaration,
       const mozilla::ComputedStyle* aStyle);
 
   void AppendTask(PostTraversalTask aTask) {
     MOZ_ASSERT(IsInServoTraversal());
 
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -69,17 +69,16 @@ EXPORTS += [
     'nsStyleUtil.h',
     'nsTimingFunction.h',
 ]
 
 EXPORTS.mozilla += [
     '!ServoCSSPropList.h',
     'AnimationCollection.h',
     'BindingStyleRule.h',
-    'BorrowedTypeList.h',
     'CachedInheritingStyles.h',
     'ComputedStyle.h',
     'ComputedStyleInlines.h',
     'CSSEnabledState.h',
     'CSSPropFlags.h',
     'DeclarationBlock.h',
     'DocumentStyleRootIterator.h',
     'GeckoBindings.h',
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -87,20 +87,18 @@ class CSSStyleSheet;
       }                                                                  \
       dest->member_ = clm_clone;                                         \
       dest = clm_clone;                                                  \
     }                                                                    \
   }
 
 // Forward declaration copied here since ServoBindings.h #includes nsCSSValue.h.
 extern "C" {
-RawGeckoURLExtraDataBorrowedMut Servo_CssUrlData_GetExtraData(
-    RawServoCssUrlDataBorrowed url);
-
-bool Servo_CssUrlData_IsLocalRef(RawServoCssUrlDataBorrowed url);
+mozilla::URLExtraData* Servo_CssUrlData_GetExtraData(const RawServoCssUrlData*);
+bool Servo_CssUrlData_IsLocalRef(const RawServoCssUrlData* url);
 }
 
 namespace mozilla {
 namespace css {
 
 struct URLValue final {
  public:
   // aCssUrl must not be null.
--- a/servo/components/style/author_styles.rs
+++ b/servo/components/style/author_styles.rs
@@ -72,14 +72,14 @@ where
         let _ = self
             .data
             .rebuild(device, quirks_mode, flusher.sheets, guard);
     }
 }
 
 #[cfg(feature = "gecko")]
 unsafe impl HasFFI for AuthorStyles<crate::gecko::data::GeckoStyleSheet> {
-    type FFIType = crate::gecko_bindings::bindings::RawServoAuthorStyles;
+    type FFIType = crate::gecko_bindings::structs::RawServoAuthorStyles;
 }
 #[cfg(feature = "gecko")]
 unsafe impl HasSimpleFFI for AuthorStyles<crate::gecko::data::GeckoStyleSheet> {}
 #[cfg(feature = "gecko")]
 unsafe impl HasBoxFFI for AuthorStyles<crate::gecko::data::GeckoStyleSheet> {}
--- a/servo/components/style/build_gecko.rs
+++ b/servo/components/style/build_gecko.rs
@@ -123,19 +123,16 @@ mod bindings {
         let result = String::from(file.to_str().unwrap());
         add_headers_recursively(file, &mut *added_paths);
         result
     }
 
     trait BuilderExt {
         fn get_initial_builder() -> Builder;
         fn include<T: Into<String>>(self, file: T) -> Builder;
-        fn zero_size_type(self, ty: &str, structs_list: &HashSet<&str>) -> Builder;
-        fn borrowed_type(self, ty: &str) -> Builder;
-        fn mutable_borrowed_type(self, ty: &str) -> Builder;
     }
 
     impl BuilderExt for Builder {
         fn get_initial_builder() -> Builder {
             use bindgen::RustTarget;
 
             // Disable rust unions, because we replace some types inside of
             // them.
@@ -176,52 +173,16 @@ mod bindings {
                 builder = builder.clang_arg(item.as_str().expect("Expect string in list"));
             }
 
             builder
         }
         fn include<T: Into<String>>(self, file: T) -> Builder {
             self.clang_arg("-include").clang_arg(file)
         }
-        // This makes an FFI-safe void type that can't be matched on
-        // &VoidType is UB to have, because you can match on it
-        // to produce a reachable unreachable. If it's wrapped in
-        // a struct as a private field it becomes okay again
-        //
-        // Not 100% sure of how safe this is, but it's what we're using
-        // in the XPCOM ffi too
-        // https://github.com/nikomatsakis/rust-memory-model/issues/2
-        fn zero_size_type(self, ty: &str, structs_list: &HashSet<&str>) -> Builder {
-            if !structs_list.contains(ty) {
-                self.blacklist_type(ty)
-                    .raw_line(format!("enum {}Void {{ }}", ty))
-                    .raw_line(format!("pub struct {0}({0}Void);", ty))
-            } else {
-                self
-            }
-        }
-        fn borrowed_type(self, ty: &str) -> Builder {
-            self.blacklist_type(format!("{}Borrowed", ty))
-                .raw_line(format!("pub type {0}Borrowed<'a> = &'a {0};", ty))
-                .blacklist_type(format!("{}BorrowedOrNull", ty))
-                .raw_line(format!(
-                    "pub type {0}BorrowedOrNull<'a> = Option<&'a {0}>;",
-                    ty
-                ))
-        }
-        fn mutable_borrowed_type(self, ty: &str) -> Builder {
-            self.borrowed_type(ty)
-                .blacklist_type(format!("{}BorrowedMut", ty))
-                .raw_line(format!("pub type {0}BorrowedMut<'a> = &'a mut {0};", ty))
-                .blacklist_type(format!("{}BorrowedMutOrNull", ty))
-                .raw_line(format!(
-                    "pub type {0}BorrowedMutOrNull<'a> = Option<&'a mut {0}>;",
-                    ty
-                ))
-        }
     }
 
     struct Fixup {
         pat: String,
         rep: String,
     }
 
     fn write_binding_file(builder: Builder, file: &str, fixups: &[Fixup]) {
@@ -285,23 +246,16 @@ mod bindings {
                     .expect(&format!("Unrecognized line in {}: '{}'", filename, line));
                 let macro_name = captures.get(1).unwrap().as_str().to_string();
                 let type_name = captures.get(2).unwrap().as_str().to_string();
                 (macro_name, type_name)
             })
             .collect()
     }
 
-    fn get_borrowed_types() -> Vec<(bool, String)> {
-        get_types("BorrowedTypeList.h", "GECKO_BORROWED_TYPE(?:_MUT)?")
-            .into_iter()
-            .map(|(macro_name, type_name)| (macro_name.ends_with("MUT"), type_name))
-            .collect()
-    }
-
     fn get_arc_types() -> Vec<String> {
         get_types("ServoArcTypeList.h", "SERVO_ARC_TYPE")
             .into_iter()
             .map(|(_, type_name)| type_name)
             .collect()
     }
 
     fn get_boxed_types() -> Vec<String> {
@@ -475,95 +429,50 @@ mod bindings {
             .expect("Failed to set logger.");
 
             true
         } else {
             false
         }
     }
 
+    // FIXME(emilio): Avoid this altogether.
     fn generate_bindings() {
         let builder = Builder::get_initial_builder()
             .disable_name_namespacing()
             .with_codegen_config(CodegenConfig::FUNCTIONS);
         let config = CONFIG["bindings"].as_table().unwrap();
-        let mut structs_types = HashSet::new();
         let mut fixups = vec![];
         let mut builder = BuilderWithConfig::new(builder, config)
             .handle_common(&mut fixups)
             .handle_str_items("whitelist-functions", |b, item| b.whitelist_function(item))
-            .handle_str_items("structs-types", |mut builder, ty| {
-                builder = builder
-                    .blacklist_type(ty)
-                    .raw_line(format!("use gecko_bindings::structs::{};", ty));
-                structs_types.insert(ty);
-                // TODO this is hacky, figure out a better way to do it without
-                // hardcoding everything...
-                if ty.starts_with("nsStyle") {
-                    builder = builder
-                        .raw_line(format!("unsafe impl Send for {} {{}}", ty))
-                        .raw_line(format!("unsafe impl Sync for {} {{}}", ty));
-                }
-                builder
-            })
-            // TODO This was added due to servo/rust-bindgen#75, but
-            // that has been fixed in clang 4.0+. When we switch people
-            // to libclang 4.0, we can remove this.
-            .handle_table_items("array-types", |builder, item| {
-                let cpp_type = item["cpp-type"].as_str().unwrap();
-                let rust_type = item["rust-type"].as_str().unwrap();
-                builder.raw_line(format!(
-                    concat!(
-                        "pub type nsTArrayBorrowed_{}<'a> = ",
-                        "&'a mut ::gecko_bindings::structs::nsTArray<{}>;"
-                    ),
-                    cpp_type, rust_type
-                ))
-            })
-            .handle_str_items("servo-immutable-borrow-types", |b, ty| b.borrowed_type(ty))
-            // Right now the only immutable borrow types are ones which we import
-            // from the |structs| module. As such, we don't need to create an opaque
-            // type with zero_size_type. If we ever introduce immutable borrow types
-            // which _do_ need to be opaque, we'll need a separate mode.
-            .handle_str_items("servo-borrow-types", |b, ty| b.mutable_borrowed_type(ty))
             .get_builder();
-        for (is_mut, ty) in get_borrowed_types().iter() {
-            if *is_mut {
-                builder = builder.mutable_borrowed_type(ty);
-            } else {
-                builder = builder.borrowed_type(ty);
-            }
-        }
         for ty in get_arc_types().iter() {
             builder = builder
                 .blacklist_type(format!("{}Strong", ty))
                 .raw_line(format!(
                     "pub type {0}Strong = ::gecko_bindings::sugar::ownership::Strong<{0}>;",
                     ty
-                ))
-                .borrowed_type(ty)
-                .zero_size_type(ty, &structs_types);
+                ));
         }
         for ty in get_boxed_types().iter() {
             builder = builder
                 .blacklist_type(format!("{}Owned", ty))
                 .raw_line(format!(
                     "pub type {0}Owned = ::gecko_bindings::sugar::ownership::Owned<{0}>;",
                     ty
                 ))
                 .blacklist_type(format!("{}OwnedOrNull", ty))
                 .raw_line(format!(
                     concat!(
                         "pub type {0}OwnedOrNull = ",
                         "::gecko_bindings::sugar::ownership::OwnedOrNull<{0}>;"
                     ),
                     ty
-                ))
-                .mutable_borrowed_type(ty)
-                .zero_size_type(ty, &structs_types);
+                ));
         }
         write_binding_file(builder, BINDINGS_FILE, &fixups);
     }
 
     fn generate_atoms() {
         let script = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap())
             .join("gecko")
             .join("regen_atoms.py");
--- a/servo/components/style/gecko/arc_types.rs
+++ b/servo/components/style/gecko/arc_types.rs
@@ -4,29 +4,29 @@
 
 //! This file lists all arc FFI types and defines corresponding addref
 //! and release functions. This list corresponds to ServoArcTypeList.h
 //! file in Gecko.
 
 #![allow(non_snake_case, missing_docs)]
 
 use crate::gecko::url::CssUrlData;
-use crate::gecko_bindings::bindings::RawServoCounterStyleRule;
-use crate::gecko_bindings::bindings::RawServoFontFeatureValuesRule;
-use crate::gecko_bindings::bindings::RawServoImportRule;
-use crate::gecko_bindings::bindings::RawServoKeyframe;
-use crate::gecko_bindings::bindings::RawServoKeyframesRule;
-use crate::gecko_bindings::bindings::RawServoMediaRule;
-use crate::gecko_bindings::bindings::RawServoMozDocumentRule;
-use crate::gecko_bindings::bindings::RawServoNamespaceRule;
-use crate::gecko_bindings::bindings::RawServoPageRule;
-use crate::gecko_bindings::bindings::RawServoRuleNode;
-use crate::gecko_bindings::bindings::RawServoRuleNodeStrong;
-use crate::gecko_bindings::bindings::RawServoSupportsRule;
-use crate::gecko_bindings::bindings::ServoCssRules;
+use crate::gecko_bindings::structs::RawServoCounterStyleRule;
+use crate::gecko_bindings::structs::RawServoFontFeatureValuesRule;
+use crate::gecko_bindings::structs::RawServoImportRule;
+use crate::gecko_bindings::structs::RawServoKeyframe;
+use crate::gecko_bindings::structs::RawServoKeyframesRule;
+use crate::gecko_bindings::structs::RawServoMediaRule;
+use crate::gecko_bindings::structs::RawServoMozDocumentRule;
+use crate::gecko_bindings::structs::RawServoNamespaceRule;
+use crate::gecko_bindings::structs::RawServoPageRule;
+use crate::gecko_bindings::structs::RawServoRuleNode;
+use crate::gecko_bindings::structs::RawServoRuleNodeStrong;
+use crate::gecko_bindings::structs::RawServoSupportsRule;
+use crate::gecko_bindings::structs::ServoCssRules;
 use crate::gecko_bindings::structs::RawServoAnimationValue;
 use crate::gecko_bindings::structs::RawServoCssUrlData;
 use crate::gecko_bindings::structs::RawServoDeclarationBlock;
 use crate::gecko_bindings::structs::RawServoFontFaceRule;
 use crate::gecko_bindings::structs::RawServoMediaList;
 use crate::gecko_bindings::structs::RawServoQuotes;
 use crate::gecko_bindings::structs::RawServoStyleRule;
 use crate::gecko_bindings::structs::RawServoStyleSheetContents;
--- a/servo/components/style/gecko/conversions.rs
+++ b/servo/components/style/gecko/conversions.rs
@@ -7,18 +7,17 @@
 //! forces us to keep the traits and implementations here
 //!
 //! FIXME(emilio): This file should generally just die.
 
 #![allow(unsafe_code)]
 
 use crate::gecko::values::GeckoStyleCoordConvertible;
 use crate::gecko_bindings::bindings;
-use crate::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
-use crate::gecko_bindings::structs::{self, nsStyleCoord_CalcValue};
+use crate::gecko_bindings::structs::{self, nsStyleCoord_CalcValue, Matrix4x4Components};
 use crate::gecko_bindings::structs::{nsStyleImage, nsresult, SheetType};
 use crate::gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
 use crate::stylesheets::{Origin, RulesMutateError};
 use crate::values::computed::image::LineDirection;
 use crate::values::computed::transform::Matrix3D;
 use crate::values::computed::url::ComputedImageUrl;
 use crate::values::computed::{Angle, Gradient, Image};
 use crate::values::computed::{Integer, LengthPercentage};
@@ -981,18 +980,18 @@ pub unsafe fn string_from_chars_pointer(
     while *iter != 0 {
         length += 1;
         iter = iter.offset(1);
     }
     let char_vec = slice::from_raw_parts(p, length as usize);
     String::from_utf16_lossy(char_vec)
 }
 
-impl<'a> From<&'a RawGeckoGfxMatrix4x4> for Matrix3D {
-    fn from(m: &'a RawGeckoGfxMatrix4x4) -> Matrix3D {
+impl<'a> From<&'a Matrix4x4Components> for Matrix3D {
+    fn from(m: &'a Matrix4x4Components) -> Matrix3D {
         Matrix3D {
             m11: m[0],
             m12: m[1],
             m13: m[2],
             m14: m[3],
             m21: m[4],
             m22: m[5],
             m23: m[6],
@@ -1004,17 +1003,18 @@ impl<'a> From<&'a RawGeckoGfxMatrix4x4> 
             m41: m[12],
             m42: m[13],
             m43: m[14],
             m44: m[15],
         }
     }
 }
 
-impl From<Matrix3D> for RawGeckoGfxMatrix4x4 {
-    fn from(matrix: Matrix3D) -> RawGeckoGfxMatrix4x4 {
+impl From<Matrix3D> for Matrix4x4Components {
+    fn from(matrix: Matrix3D) -> Self {
         [
-            matrix.m11, matrix.m12, matrix.m13, matrix.m14, matrix.m21, matrix.m22, matrix.m23,
-            matrix.m24, matrix.m31, matrix.m32, matrix.m33, matrix.m34, matrix.m41, matrix.m42,
-            matrix.m43, matrix.m44,
+            matrix.m11, matrix.m12, matrix.m13, matrix.m14, matrix.m21,
+            matrix.m22, matrix.m23, matrix.m24, matrix.m31, matrix.m32,
+            matrix.m33, matrix.m34, matrix.m41, matrix.m42, matrix.m43,
+            matrix.m44,
         ]
     }
 }
--- a/servo/components/style/gecko/data.rs
+++ b/servo/components/style/gecko/data.rs
@@ -1,18 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
 
 //! Data needed to style a Gecko document.
 
 use crate::context::QuirksMode;
 use crate::dom::TElement;
-use crate::gecko_bindings::bindings::{self, RawServoStyleSet};
-use crate::gecko_bindings::structs::{self, ServoStyleSetSizes};
+use crate::gecko_bindings::bindings;
+use crate::gecko_bindings::structs::{self, RawServoStyleSet, ServoStyleSetSizes};
 use crate::gecko_bindings::structs::{StyleSheet as DomStyleSheet, StyleSheetInfo};
 use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFFI};
 use crate::invalidation::media_queries::{MediaListKey, ToMediaListKey};
 use crate::media_queries::{Device, MediaList};
 use crate::properties::ComputedValues;
 use crate::selector_parser::SnapshotMap;
 use crate::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
 use crate::stylesheets::{CssRule, Origin, StylesheetContents, StylesheetInDocument};
--- a/servo/components/style/gecko/restyle_damage.rs
+++ b/servo/components/style/gecko/restyle_damage.rs
@@ -46,18 +46,18 @@ impl GeckoRestyleDamage {
     pub fn compute_style_difference(
         old_style: &ComputedValues,
         new_style: &ComputedValues,
     ) -> StyleDifference {
         let mut any_style_changed = false;
         let mut reset_only = false;
         let hint = unsafe {
             bindings::Gecko_CalcStyleDifference(
-                old_style,
-                new_style,
+                old_style.as_gecko_computed_style(),
+                new_style.as_gecko_computed_style(),
                 &mut any_style_changed,
                 &mut reset_only,
             )
         };
         if reset_only && old_style.custom_properties() != new_style.custom_properties() {
             // The Gecko_CalcStyleDifference call only checks the non-custom
             // property structs, so we check the custom properties here. Since
             // they generate no damage themselves, we can skip this check if we
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -48,17 +48,17 @@ use crate::gecko_bindings::structs::Docu
 use crate::gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel;
 use crate::gecko_bindings::structs::ELEMENT_HANDLED_SNAPSHOT;
 use crate::gecko_bindings::structs::ELEMENT_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO;
 use crate::gecko_bindings::structs::ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO;
 use crate::gecko_bindings::structs::ELEMENT_HAS_SNAPSHOT;
 use crate::gecko_bindings::structs::NODE_DESCENDANTS_NEED_FRAMES;
 use crate::gecko_bindings::structs::NODE_NEEDS_FRAME;
 use crate::gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag};
-use crate::gecko_bindings::structs::{RawGeckoElement, RawGeckoNode, RawGeckoXBLBinding};
+use crate::gecko_bindings::structs::{Element as RawGeckoElement, nsINode as RawGeckoNode, nsXBLBinding as RawGeckoXBLBinding};
 use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI};
 use crate::global_style_data::GLOBAL_STYLE_DATA;
 use crate::hash::FxHashMap;
 use crate::invalidation::element::restyle_hints::RestyleHint;
 use crate::media_queries::Device;
 use crate::properties::animated_properties::{AnimationValue, AnimationValueMap};
 use crate::properties::{ComputedValues, LonghandId};
 use crate::properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock};
@@ -163,21 +163,17 @@ impl<'lr> TShadowRoot for GeckoShadowRoo
         GeckoElement(unsafe { &*self.0._base.mHost.mRawPtr })
     }
 
     #[inline]
     fn style_data<'a>(&self) -> Option<&'a CascadeData>
     where
         Self: 'a,
     {
-        let author_styles = unsafe {
-            (self.0.mServoStyles.mPtr as *const structs::RawServoAuthorStyles
-                as *const bindings::RawServoAuthorStyles)
-                .as_ref()?
-        };
+        let author_styles = unsafe { self.0.mServoStyles.mPtr.as_ref()? };
 
         let author_styles = AuthorStyles::<GeckoStyleSheet>::from_ffi(author_styles);
 
         debug_assert!(
             author_styles.quirks_mode == self.as_node().owner_doc().quirks_mode() ||
                 author_styles.stylesheets.is_empty() ||
                 author_styles.stylesheets.dirty()
         );
@@ -320,27 +316,27 @@ impl<'ln> GeckoNode<'ln> {
     #[inline]
     fn flattened_tree_parent(&self) -> Option<Self> {
         // TODO(emilio): Measure and consider not doing this fast-path and take
         // always the common path, it's only a function call and from profiles
         // it seems that keeping this fast path makes the compiler not inline
         // `flattened_tree_parent`.
         if self.flattened_tree_parent_is_parent() {
             debug_assert_eq!(
-                unsafe { bindings::Gecko_GetFlattenedTreeParentNode(self.0).map(GeckoNode) },
+                unsafe { bindings::Gecko_GetFlattenedTreeParentNode(self.0).as_ref().map(GeckoNode) },
                 self.parent_node(),
                 "Fast path stopped holding!"
             );
 
             return self.parent_node();
         }
 
         // NOTE(emilio): If this call is too expensive, we could manually
         // inline more aggressively.
-        unsafe { bindings::Gecko_GetFlattenedTreeParentNode(self.0).map(GeckoNode) }
+        unsafe { bindings::Gecko_GetFlattenedTreeParentNode(self.0).as_ref().map(GeckoNode) }
     }
 
     #[inline]
     fn contains_non_whitespace_content(&self) -> bool {
         unsafe { Gecko_IsSignificantChild(self.0, false) }
     }
 }
 
@@ -375,22 +371,22 @@ impl<'ln> TNode for GeckoNode<'ln> {
                 .raw::<nsIContent>()
                 .as_ref()
                 .map(GeckoNode::from_content)
         }
     }
 
     #[inline]
     fn last_child(&self) -> Option<Self> {
-        unsafe { bindings::Gecko_GetLastChild(self.0).map(GeckoNode) }
+        unsafe { bindings::Gecko_GetLastChild(self.0).as_ref().map(GeckoNode) }
     }
 
     #[inline]
     fn prev_sibling(&self) -> Option<Self> {
-        unsafe { bindings::Gecko_GetPreviousSibling(self.0).map(GeckoNode) }
+        unsafe { bindings::Gecko_GetPreviousSibling(self.0).as_ref().map(GeckoNode) }
     }
 
     #[inline]
     fn next_sibling(&self) -> Option<Self> {
         unsafe {
             self.0
                 .mNextSibling
                 .raw::<nsIContent>()
@@ -497,17 +493,17 @@ impl<'a> Iterator for GeckoChildrenItera
                 curr
             },
             GeckoChildrenIterator::GeckoIterator(ref mut it) => unsafe {
                 // We do this unsafe lengthening of the lifetime here because
                 // structs::StyleChildrenIterator is actually StyleChildrenIterator<'a>,
                 // however we can't express this easily with bindgen, and it would
                 // introduce functions with two input lifetimes into bindgen,
                 // which would be out of scope for elision.
-                bindings::Gecko_GetNextStyleChild(&mut *(it as *mut _)).map(GeckoNode)
+                bindings::Gecko_GetNextStyleChild(&mut *(it as *mut _)).as_ref().map(GeckoNode)
             },
         }
     }
 }
 
 /// A Simple wrapper over a non-null Gecko `nsXBLBinding` pointer.
 #[derive(Clone, Copy)]
 pub struct GeckoXBLBinding<'lb>(pub &'lb RawGeckoXBLBinding);
@@ -543,17 +539,17 @@ impl<'lb> GeckoXBLBinding<'lb> {
     fn each_xbl_cascade_data<F>(&self, f: &mut F)
     where
         F: FnMut(&'lb CascadeData, QuirksMode),
     {
         if let Some(base) = self.base_binding() {
             base.each_xbl_cascade_data(f);
         }
 
-        let data = unsafe { bindings::Gecko_XBLBinding_GetRawServoStyles(self.0) };
+        let data = unsafe { bindings::Gecko_XBLBinding_GetRawServoStyles(self.0).as_ref() };
 
         if let Some(data) = data {
             let data: &'lb _ = AuthorStyles::<GeckoStyleSheet>::from_ffi(data);
             f(&data.data, data.quirks_mode)
         }
     }
 }
 
@@ -704,25 +700,25 @@ impl<'le> GeckoElement<'le> {
     /// one for other elements.
     ///
     /// We just hard code in our knowledge of those two implementations here.
     fn xbl_binding_parent(&self) -> Option<Self> {
         if self.is_xul_element() {
             // FIXME(heycam): Having trouble with bindgen on nsXULElement,
             // where the binding parent is stored in a member variable
             // rather than in slots.  So just get it through FFI for now.
-            unsafe { bindings::Gecko_GetBindingParent(self.0).map(GeckoElement) }
+            unsafe { bindings::Gecko_GetBindingParent(self.0).as_ref().map(GeckoElement) }
         } else {
             let binding_parent = unsafe { self.non_xul_xbl_binding_parent_raw_content().as_ref() }
                 .map(GeckoNode::from_content)
                 .and_then(|n| n.as_element());
 
             debug_assert!(
                 binding_parent ==
-                    unsafe { bindings::Gecko_GetBindingParent(self.0).map(GeckoElement) }
+                    unsafe { bindings::Gecko_GetBindingParent(self.0).as_ref().map(GeckoElement) }
             );
             binding_parent
         }
     }
 
     #[inline]
     fn non_xul_xbl_binding_parent_raw_content(&self) -> *mut nsIContent {
         debug_assert!(!self.is_xul_element());
@@ -772,17 +768,17 @@ impl<'le> GeckoElement<'le> {
     }
 
     #[inline]
     fn before_or_after_pseudo(&self, is_before: bool) -> Option<Self> {
         if !self.has_properties() {
             return None;
         }
 
-        unsafe { bindings::Gecko_GetBeforeOrAfterPseudo(self.0, is_before).map(GeckoElement) }
+        unsafe { bindings::Gecko_GetBeforeOrAfterPseudo(self.0, is_before).as_ref().map(GeckoElement) }
     }
 
     #[inline]
     fn may_have_style_attribute(&self) -> bool {
         self.as_node()
             .get_bool_flag(nsINode_BooleanFlag::ElementMayHaveStyle)
     }
 
@@ -882,17 +878,17 @@ impl<'le> GeckoElement<'le> {
     fn css_transitions_info(&self) -> FxHashMap<LonghandId, Arc<AnimationValue>> {
         use crate::gecko_bindings::bindings::Gecko_ElementTransitions_EndValueAt;
         use crate::gecko_bindings::bindings::Gecko_ElementTransitions_Length;
 
         let collection_length = unsafe { Gecko_ElementTransitions_Length(self.0) } as usize;
         let mut map = FxHashMap::with_capacity_and_hasher(collection_length, Default::default());
 
         for i in 0..collection_length {
-            let raw_end_value = unsafe { Gecko_ElementTransitions_EndValueAt(self.0, i) };
+            let raw_end_value = unsafe { Gecko_ElementTransitions_EndValueAt(self.0, i).as_ref() };
 
             let end_value = AnimationValue::arc_from_borrowed(&raw_end_value)
                 .expect("AnimationValue not found in ElementTransitions");
 
             let property = end_value.id();
             debug_assert!(!property.is_logical());
             map.insert(property, end_value.clone_arc());
         }
@@ -1265,17 +1261,17 @@ impl<'le> TElement for GeckoElement<'le>
         self.as_node().owner_doc().0 as *const structs::Document == device.document() as *const _
     }
 
     fn style_attribute(&self) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>> {
         if !self.may_have_style_attribute() {
             return None;
         }
 
-        let declarations = unsafe { Gecko_GetStyleAttrDeclarationBlock(self.0) };
+        let declarations = unsafe { Gecko_GetStyleAttrDeclarationBlock(self.0).as_ref() };
         let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
             declarations.and_then(|s| s.as_arc_opt());
         declarations.map(|s| s.borrow_arc())
     }
 
     fn unset_dirty_style_attribute(&self) {
         if !self.may_have_style_attribute() {
             return;
@@ -1546,18 +1542,20 @@ impl<'le> TElement for GeckoElement<'le>
         before_change_style: Option<Arc<ComputedValues>>,
         tasks: UpdateAnimationsTasks,
     ) {
         // We have to update animations even if the element has no computed
         // style since it means the element is in a display:none subtree, we
         // should destroy all CSS animations in display:none subtree.
         let computed_data = self.borrow_data();
         let computed_values = computed_data.as_ref().map(|d| d.styles.primary());
-        let before_change_values = before_change_style.as_ref().map(|x| &**x);
-        let computed_values_opt = computed_values.as_ref().map(|x| &***x);
+        let before_change_values =
+            before_change_style.as_ref().map_or(ptr::null(), |x| x.as_gecko_computed_style());
+        let computed_values_opt =
+            computed_values.as_ref().map_or(ptr::null(), |x| x.as_gecko_computed_style());
         unsafe {
             Gecko_UpdateAnimations(
                 self.0,
                 before_change_values,
                 computed_values_opt,
                 tasks.bits(),
             );
         }
@@ -1823,26 +1821,26 @@ impl<'le> TElement for GeckoElement<'le>
                 hints.push(TABLE_COLOR_RULE.clone());
             }
         }
         if ns == structs::kNameSpaceID_SVG as i32 {
             if self.local_name().as_ptr() == atom!("text").as_ptr() {
                 hints.push(SVG_TEXT_DISABLE_ZOOM_RULE.clone());
             }
         }
-        let declarations = unsafe { Gecko_GetHTMLPresentationAttrDeclarationBlock(self.0) };
+        let declarations = unsafe { Gecko_GetHTMLPresentationAttrDeclarationBlock(self.0).as_ref() };
         let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
             declarations.and_then(|s| s.as_arc_opt());
         if let Some(decl) = declarations {
             hints.push(ApplicableDeclarationBlock::from_declarations(
                 decl.clone_arc(),
                 ServoCascadeLevel::PresHints,
             ));
         }
-        let declarations = unsafe { Gecko_GetExtraContentStyleDeclarations(self.0) };
+        let declarations = unsafe { Gecko_GetExtraContentStyleDeclarations(self.0).as_ref() };
         let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
             declarations.and_then(|s| s.as_arc_opt());
         if let Some(decl) = declarations {
             hints.push(ApplicableDeclarationBlock::from_declarations(
                 decl.clone_arc(),
                 ServoCascadeLevel::PresHints,
             ));
         }
@@ -1854,36 +1852,36 @@ impl<'le> TElement for GeckoElement<'le>
             let declarations = match visited_handling {
                 VisitedHandlingMode::AllLinksVisitedAndUnvisited => {
                     unreachable!(
                         "We should never try to selector match with \
                          AllLinksVisitedAndUnvisited"
                     );
                 },
                 VisitedHandlingMode::AllLinksUnvisited => unsafe {
-                    Gecko_GetUnvisitedLinkAttrDeclarationBlock(self.0)
+                    Gecko_GetUnvisitedLinkAttrDeclarationBlock(self.0).as_ref()
                 },
                 VisitedHandlingMode::RelevantLinkVisited => unsafe {
-                    Gecko_GetVisitedLinkAttrDeclarationBlock(self.0)
+                    Gecko_GetVisitedLinkAttrDeclarationBlock(self.0).as_ref()
                 },
             };
             let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
                 declarations.and_then(|s| s.as_arc_opt());
             if let Some(decl) = declarations {
                 hints.push(ApplicableDeclarationBlock::from_declarations(
                     decl.clone_arc(),
                     ServoCascadeLevel::PresHints,
                 ));
             }
 
             let active = self
                 .state()
                 .intersects(NonTSPseudoClass::Active.state_flag());
             if active {
-                let declarations = unsafe { Gecko_GetActiveLinkAttrDeclarationBlock(self.0) };
+                let declarations = unsafe { Gecko_GetActiveLinkAttrDeclarationBlock(self.0).as_ref() };
                 let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
                     declarations.and_then(|s| s.as_arc_opt());
                 if let Some(decl) = declarations {
                     hints.push(ApplicableDeclarationBlock::from_declarations(
                         decl.clone_arc(),
                         ServoCascadeLevel::PresHints,
                     ));
                 }
--- a/servo/components/style/gecko_bindings/sugar/refptr.rs
+++ b/servo/components/style/gecko_bindings/sugar/refptr.rs
@@ -280,17 +280,17 @@ macro_rules! impl_refcount {
 macro_rules! impl_threadsafe_refcount {
     ($t:ty, $addref:path, $release:path) => {
         impl_refcount!($t, $addref, $release);
         unsafe impl ThreadSafeRefCounted for $t {}
     };
 }
 
 impl_threadsafe_refcount!(
-    structs::RawGeckoURLExtraData,
+    structs::mozilla::URLExtraData,
     bindings::Gecko_AddRefURLExtraDataArbitraryThread,
     bindings::Gecko_ReleaseURLExtraDataArbitraryThread
 );
 impl_threadsafe_refcount!(
     structs::nsCSSValueSharedList,
     bindings::Gecko_AddRefCSSValueSharedListArbitraryThread,
     bindings::Gecko_ReleaseCSSValueSharedListArbitraryThread
 );
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -61,26 +61,35 @@ use crate::values::computed::font::FontS
 use crate::values::computed::effects::{BoxShadow, Filter, SimpleShadow};
 use crate::values::generics::column::ColumnCount;
 use crate::values::generics::transform::TransformStyle;
 use crate::values::generics::url::UrlOrNone;
 
 pub mod style_structs {
     % for style_struct in data.style_structs:
     pub use super::${style_struct.gecko_struct_name} as ${style_struct.name};
+
+    unsafe impl Send for ${style_struct.name} {}
+    unsafe impl Sync for ${style_struct.name} {}
     % endfor
+
 }
 
 /// FIXME(emilio): This is completely duplicated with the other properties code.
-pub type ComputedValuesInner = crate::gecko_bindings::structs::ServoComputedData;
+pub type ComputedValuesInner = structs::ServoComputedData;
 
 #[repr(C)]
-pub struct ComputedValues(crate::gecko_bindings::structs::mozilla::ComputedStyle);
+pub struct ComputedValues(structs::mozilla::ComputedStyle);
 
 impl ComputedValues {
+    #[inline]
+    pub (crate) fn as_gecko_computed_style(&self) -> &structs::ComputedStyle {
+        &self.0
+    }
+
     pub fn new(
         pseudo: Option<<&PseudoElement>,
         custom_properties: Option<Arc<CustomPropertiesMap>>,
         writing_mode: WritingMode,
         flags: ComputedValueFlags,
         rules: Option<StrongRuleNode>,
         visited_style: Option<Arc<ComputedValues>>,
         % for style_struct in data.style_structs:
@@ -924,17 +933,17 @@ transform_functions = [
             bindings::Gecko_CSSValue_GetArrayItem(gecko_value, 0),
             structs::nsCSSKeyword::eCSSKeyword_${keyword}
         );
         % for index, item in enumerate(items):
             % if item == "list":
                 debug_assert!(!${item}${index + 1}.0.is_empty());
             % endif
             ${css_value_setters[item] % (
-                "bindings::Gecko_CSSValue_GetArrayItem(gecko_value, %d)" % (index + 1),
+                "(&mut *bindings::Gecko_CSSValue_GetArrayItem(gecko_value, %d))" % (index + 1),
                 item + str(index + 1)
             )};
         % endfor
     }
 </%def>
 
 <%def name="computed_operation_arm(name, keyword, items)">
     <%
@@ -975,25 +984,26 @@ transform_functions = [
                 m${index / 4 + 1}${index % 4 + 1}:
             % elif keyword == "matrix":
                 ${chr(ord('a') + index)}:
             % elif keyword == "interpolatematrix" or keyword == "accumulatematrix":
                 ${field_names[index]}:
             % endif
             <%
                 getter = css_value_getters[item] % (
-                    "bindings::Gecko_CSSValue_GetArrayItemConst(gecko_value, %d)" % (index + 1)
+                    "(&*bindings::Gecko_CSSValue_GetArrayItemConst(gecko_value, %d))" % (index + 1)
                 )
             %>
             ${getter},
         % endfor
         ${post_symbols}
     },
 </%def>
 
+#[allow(unused_parens)]
 fn set_single_transform_function(
     servo_value: &values::computed::TransformOperation,
     gecko_value: &mut structs::nsCSSValue /* output */
 ) {
     use crate::values::computed::TransformOperation;
     use crate::values::generics::transform::{Matrix, Matrix3D};
 
     let convert_to_ns_css_value = |item: &TransformOperation| -> structs::nsCSSValue {
@@ -1026,16 +1036,17 @@ pub fn convert_transform(
     if let Some(value_list) = value_list {
         for (gecko, servo) in value_list.into_iter().zip(input.into_iter()) {
             set_single_transform_function(servo, gecko);
         }
     }
     output.set_move(list);
 }
 
+#[allow(unused_parens)]
 fn clone_single_transform_function(
     gecko_value: &structs::nsCSSValue
 ) -> values::computed::TransformOperation {
     use crate::values::computed::{Length, Percentage, TransformOperation};
     use crate::values::generics::transform::{Matrix, Matrix3D};
     use crate::values::generics::transform::Transform;
 
     let convert_shared_list_to_operations = |value: &structs::nsCSSValue|
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -33,100 +33,35 @@ use style::gecko::data::{GeckoStyleSheet
 use style::gecko::restyle_damage::GeckoRestyleDamage;
 use style::gecko::selector_parser::{NonTSPseudoClass, PseudoElement};
 use style::gecko::traversal::RecalcStyleOnly;
 use style::gecko::url::CssUrlData;
 use style::gecko::wrapper::{GeckoElement, GeckoNode};
 use style::gecko_bindings::bindings;
 use style::gecko_bindings::bindings::nsACString;
 use style::gecko_bindings::bindings::nsAString;
-use style::gecko_bindings::bindings::nsCSSPropertyIDSetBorrowedMut;
-use style::gecko_bindings::bindings::nsCSSValueBorrowedMut;
-use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t;
-use style::gecko_bindings::bindings::nsTimingFunctionBorrowed;
-use style::gecko_bindings::bindings::nsTimingFunctionBorrowedMut;
-use style::gecko_bindings::bindings::ComputedStyleBorrowed;
-use style::gecko_bindings::bindings::ComputedStyleBorrowedOrNull;
 use style::gecko_bindings::bindings::Gecko_AddPropertyToSet;
 use style::gecko_bindings::bindings::Gecko_AppendPropertyValuePair;
 use style::gecko_bindings::bindings::Gecko_ConstructFontFeatureValueSet;
 use style::gecko_bindings::bindings::Gecko_GetOrCreateFinalKeyframe;
 use style::gecko_bindings::bindings::Gecko_GetOrCreateInitialKeyframe;
 use style::gecko_bindings::bindings::Gecko_GetOrCreateKeyframeAtStart;
 use style::gecko_bindings::bindings::Gecko_HaveSeenPtr;
 use style::gecko_bindings::bindings::Gecko_NewNoneTransform;
-use style::gecko_bindings::bindings::RawGeckoAnimationPropertySegmentBorrowed;
-use style::gecko_bindings::bindings::RawGeckoCSSPropertyIDListBorrowed;
-use style::gecko_bindings::bindings::RawGeckoComputedKeyframeValuesListBorrowedMut;
-use style::gecko_bindings::bindings::RawGeckoComputedTimingBorrowed;
-use style::gecko_bindings::bindings::RawGeckoElementBorrowed;
-use style::gecko_bindings::bindings::RawGeckoElementBorrowedOrNull;
-use style::gecko_bindings::bindings::RawGeckoFontFaceRuleListBorrowedMut;
-use style::gecko_bindings::bindings::RawGeckoKeyframeListBorrowed;
-use style::gecko_bindings::bindings::RawGeckoKeyframeListBorrowedMut;
-use style::gecko_bindings::bindings::RawGeckoNodeBorrowed;
-use style::gecko_bindings::bindings::RawGeckoPresContextBorrowed;
-use style::gecko_bindings::bindings::RawGeckoServoAnimationValueListBorrowedMut;
-use style::gecko_bindings::bindings::RawGeckoServoStyleRuleListBorrowedMut;
-use style::gecko_bindings::bindings::RawGeckoURLExtraDataBorrowedMut;
-use style::gecko_bindings::bindings::RawServoAnimationValueBorrowed;
-use style::gecko_bindings::bindings::RawServoAnimationValueBorrowedOrNull;
-use style::gecko_bindings::bindings::RawServoAnimationValueMapBorrowedMut;
-use style::gecko_bindings::bindings::RawServoAnimationValueStrong;
-use style::gecko_bindings::bindings::RawServoAnimationValueTableBorrowed;
-use style::gecko_bindings::bindings::RawServoAuthorStyles;
-use style::gecko_bindings::bindings::RawServoAuthorStylesBorrowed;
-use style::gecko_bindings::bindings::RawServoAuthorStylesBorrowedMut;
-use style::gecko_bindings::bindings::RawServoAuthorStylesOwned;
-use style::gecko_bindings::bindings::RawServoCounterStyleRule;
-use style::gecko_bindings::bindings::RawServoCounterStyleRuleBorrowed;
-use style::gecko_bindings::bindings::RawServoCssUrlDataBorrowed;
-use style::gecko_bindings::bindings::RawServoDeclarationBlockBorrowed;
-use style::gecko_bindings::bindings::RawServoDeclarationBlockBorrowedOrNull;
-use style::gecko_bindings::bindings::RawServoDeclarationBlockStrong;
-use style::gecko_bindings::bindings::RawServoFontFaceRuleBorrowed;
-use style::gecko_bindings::bindings::RawServoFontFaceRuleStrong;
-use style::gecko_bindings::bindings::RawServoFontFeatureValuesRule;
-use style::gecko_bindings::bindings::RawServoFontFeatureValuesRuleBorrowed;
-use style::gecko_bindings::bindings::RawServoImportRule;
-use style::gecko_bindings::bindings::RawServoImportRuleBorrowed;
-use style::gecko_bindings::bindings::RawServoKeyframe;
-use style::gecko_bindings::bindings::RawServoKeyframeBorrowed;
-use style::gecko_bindings::bindings::RawServoKeyframeStrong;
-use style::gecko_bindings::bindings::RawServoKeyframesRule;
-use style::gecko_bindings::bindings::RawServoKeyframesRuleBorrowed;
-use style::gecko_bindings::bindings::RawServoMediaListBorrowed;
-use style::gecko_bindings::bindings::RawServoMediaListStrong;
-use style::gecko_bindings::bindings::RawServoMediaRule;
-use style::gecko_bindings::bindings::RawServoMediaRuleBorrowed;
-use style::gecko_bindings::bindings::RawServoMozDocumentRule;
-use style::gecko_bindings::bindings::RawServoMozDocumentRuleBorrowed;
-use style::gecko_bindings::bindings::RawServoNamespaceRule;
-use style::gecko_bindings::bindings::RawServoNamespaceRuleBorrowed;
-use style::gecko_bindings::bindings::RawServoPageRule;
-use style::gecko_bindings::bindings::RawServoPageRuleBorrowed;
-use style::gecko_bindings::bindings::RawServoQuotesBorrowed;
-use style::gecko_bindings::bindings::RawServoQuotesStrong;
-use style::gecko_bindings::bindings::RawServoSelectorListBorrowed;
-use style::gecko_bindings::bindings::RawServoSelectorListOwned;
-use style::gecko_bindings::bindings::RawServoSourceSizeListBorrowedOrNull;
-use style::gecko_bindings::bindings::RawServoSourceSizeListOwned;
-use style::gecko_bindings::bindings::RawServoStyleRuleBorrowed;
-use style::gecko_bindings::bindings::RawServoStyleSet;
-use style::gecko_bindings::bindings::RawServoStyleSetBorrowed;
-use style::gecko_bindings::bindings::RawServoStyleSetBorrowedOrNull;
-use style::gecko_bindings::bindings::RawServoStyleSetOwned;
-use style::gecko_bindings::bindings::RawServoStyleSheetContentsBorrowed;
-use style::gecko_bindings::bindings::RawServoStyleSheetContentsStrong;
-use style::gecko_bindings::bindings::RawServoSupportsRule;
-use style::gecko_bindings::bindings::RawServoSupportsRuleBorrowed;
-use style::gecko_bindings::bindings::ServoComputedDataBorrowed;
-use style::gecko_bindings::bindings::ServoCssRulesBorrowed;
-use style::gecko_bindings::bindings::ServoCssRulesStrong;
 use style::gecko_bindings::structs;
+use style::gecko_bindings::structs::{Element as RawGeckoElement, nsINode as RawGeckoNode};
+use style::gecko_bindings::structs::{
+    RawServoQuotes, RawServoStyleSet, RawServoAuthorStyles,
+    RawServoCssUrlData, RawServoDeclarationBlock, RawServoMediaList,
+    RawServoCounterStyleRule, RawServoAnimationValue, RawServoSupportsRule,
+    RawServoKeyframesRule, ServoCssRules, RawServoStyleSheetContents,
+    RawServoPageRule, RawServoNamespaceRule, RawServoMozDocumentRule,
+    RawServoKeyframe, RawServoMediaRule, RawServoImportRule,
+    RawServoFontFaceRule, RawServoFontFeatureValuesRule
+};
 use style::gecko_bindings::structs::gfxFontFeatureValueSet;
 use style::gecko_bindings::structs::nsAtom;
 use style::gecko_bindings::structs::nsCSSCounterDesc;
 use style::gecko_bindings::structs::nsCSSFontDesc;
 use style::gecko_bindings::structs::nsCSSPropertyID;
 use style::gecko_bindings::structs::nsCSSValueSharedList;
 use style::gecko_bindings::structs::nsChangeHint;
 use style::gecko_bindings::structs::nsCompatibility;
@@ -141,18 +76,16 @@ use style::gecko_bindings::structs::Comp
 use style::gecko_bindings::structs::ComputedStyleStrong;
 use style::gecko_bindings::structs::DeclarationBlockMutationClosure;
 use style::gecko_bindings::structs::IterationCompositeOperation;
 use style::gecko_bindings::structs::Loader;
 use style::gecko_bindings::structs::LoaderReusableStyleSheets;
 use style::gecko_bindings::structs::MallocSizeOf as GeckoMallocSizeOf;
 use style::gecko_bindings::structs::OriginFlags;
 use style::gecko_bindings::structs::PropertyValuePair;
-use style::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
-use style::gecko_bindings::structs::RawServoFontFaceRule;
 use style::gecko_bindings::structs::RawServoSelectorList;
 use style::gecko_bindings::structs::RawServoSourceSizeList;
 use style::gecko_bindings::structs::RawServoStyleRule;
 use style::gecko_bindings::structs::SeenPtrs;
 use style::gecko_bindings::structs::ServoElementSnapshotTable;
 use style::gecko_bindings::structs::ServoStyleSetSizes;
 use style::gecko_bindings::structs::ServoTraversalFlags;
 use style::gecko_bindings::structs::SheetLoadData;
@@ -331,18 +264,18 @@ fn traverse_subtree(
 }
 
 /// Traverses the subtree rooted at `root` for restyling.
 ///
 /// Returns whether the root was restyled. Whether anything else was restyled or
 /// not can be inferred from the dirty bits in the rest of the tree.
 #[no_mangle]
 pub extern "C" fn Servo_TraverseSubtree(
-    root: RawGeckoElementBorrowed,
-    raw_data: RawServoStyleSetBorrowed,
+    root: &RawGeckoElement,
+    raw_data: &RawServoStyleSet,
     snapshots: *const ServoElementSnapshotTable,
     raw_flags: ServoTraversalFlags,
 ) -> bool {
     let traversal_flags = TraversalFlags::from_bits_truncate(raw_flags);
     debug_assert!(!snapshots.is_null());
 
     let element = GeckoElement(root);
 
@@ -412,95 +345,95 @@ pub extern "C" fn Servo_TraverseSubtree(
         let element_was_restyled = element.borrow_data().unwrap().contains_restyle_data();
         element_was_restyled
     }
 }
 
 /// Checks whether the rule tree has crossed its threshold for unused nodes, and
 /// if so, frees them.
 #[no_mangle]
-pub extern "C" fn Servo_MaybeGCRuleTree(raw_data: RawServoStyleSetBorrowed) {
+pub extern "C" fn Servo_MaybeGCRuleTree(raw_data: &RawServoStyleSet) {
     let per_doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     unsafe {
         per_doc_data.stylist.rule_tree().maybe_gc();
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValues_Interpolate(
-    from: RawServoAnimationValueBorrowed,
-    to: RawServoAnimationValueBorrowed,
+    from: &RawServoAnimationValue,
+    to: &RawServoAnimationValue,
     progress: f64,
-) -> RawServoAnimationValueStrong {
+) -> bindings::RawServoAnimationValueStrong {
     let from_value = AnimationValue::as_arc(&from);
     let to_value = AnimationValue::as_arc(&to);
     if let Ok(value) = from_value.animate(to_value, Procedure::Interpolate { progress }) {
         Arc::new(value).into_strong()
     } else {
-        RawServoAnimationValueStrong::null()
+        Strong::null()
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValues_IsInterpolable(
-    from: RawServoAnimationValueBorrowed,
-    to: RawServoAnimationValueBorrowed,
+    from: &RawServoAnimationValue,
+    to: &RawServoAnimationValue,
 ) -> bool {
     let from_value = AnimationValue::as_arc(&from);
     let to_value = AnimationValue::as_arc(&to);
     from_value
         .animate(to_value, Procedure::Interpolate { progress: 0.5 })
         .is_ok()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValues_Add(
-    a: RawServoAnimationValueBorrowed,
-    b: RawServoAnimationValueBorrowed,
-) -> RawServoAnimationValueStrong {
+    a: &RawServoAnimationValue,
+    b: &RawServoAnimationValue,
+) -> bindings::RawServoAnimationValueStrong {
     let a_value = AnimationValue::as_arc(&a);
     let b_value = AnimationValue::as_arc(&b);
     if let Ok(value) = a_value.animate(b_value, Procedure::Add) {
         Arc::new(value).into_strong()
     } else {
-        RawServoAnimationValueStrong::null()
+        Strong::null()
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValues_Accumulate(
-    a: RawServoAnimationValueBorrowed,
-    b: RawServoAnimationValueBorrowed,
+    a: &RawServoAnimationValue,
+    b: &RawServoAnimationValue,
     count: u64,
-) -> RawServoAnimationValueStrong {
+) -> bindings::RawServoAnimationValueStrong {
     let a_value = AnimationValue::as_arc(&a);
     let b_value = AnimationValue::as_arc(&b);
     if let Ok(value) = a_value.animate(b_value, Procedure::Accumulate { count }) {
         Arc::new(value).into_strong()
     } else {
-        RawServoAnimationValueStrong::null()
+        Strong::null()
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValues_GetZeroValue(
-    value_to_match: RawServoAnimationValueBorrowed,
-) -> RawServoAnimationValueStrong {
+    value_to_match: &RawServoAnimationValue,
+) -> bindings::RawServoAnimationValueStrong {
     let value_to_match = AnimationValue::as_arc(&value_to_match);
     if let Ok(zero_value) = value_to_match.to_animated_zero() {
         Arc::new(zero_value).into_strong()
     } else {
-        RawServoAnimationValueStrong::null()
+        Strong::null()
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValues_ComputeDistance(
-    from: RawServoAnimationValueBorrowed,
-    to: RawServoAnimationValueBorrowed,
+    from: &RawServoAnimationValue,
+    to: &RawServoAnimationValue,
 ) -> f64 {
     let from_value = AnimationValue::as_arc(&from);
     let to_value = AnimationValue::as_arc(&to);
     // If compute_squared_distance() failed, this function will return negative value
     // in order to check whether we support the specified paced animation values.
     from_value
         .compute_squared_distance(to_value)
         .map(|d| d.sqrt())
@@ -558,17 +491,17 @@ fn accumulate_endpoint(
     }
 }
 
 /// Compose the animation segment. We composite it with the underlying_value and last_value if
 /// needed.
 /// The caller is responsible for providing an underlying value and last value
 /// in all situations where there are needed.
 fn compose_animation_segment(
-    segment: RawGeckoAnimationPropertySegmentBorrowed,
+    segment: &structs::AnimationPropertySegment,
     underlying_value: Option<&AnimationValue>,
     last_value: Option<&AnimationValue>,
     iteration_composite: IterationCompositeOperation,
     current_iteration: u64,
     total_progress: f64,
     segment_progress: f64,
 ) -> AnimationValue {
     // Extract keyframe values.
@@ -654,45 +587,45 @@ fn compose_animation_segment(
                 to.clone()
             }
         },
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ComposeAnimationSegment(
-    segment: RawGeckoAnimationPropertySegmentBorrowed,
-    underlying_value: RawServoAnimationValueBorrowedOrNull,
-    last_value: RawServoAnimationValueBorrowedOrNull,
+    segment: &structs::AnimationPropertySegment,
+    underlying_value: Option<&RawServoAnimationValue>,
+    last_value: Option<&RawServoAnimationValue>,
     iteration_composite: IterationCompositeOperation,
     progress: f64,
     current_iteration: u64,
-) -> RawServoAnimationValueStrong {
+) -> bindings::RawServoAnimationValueStrong {
     let underlying_value = AnimationValue::arc_from_borrowed(&underlying_value).map(|v| &**v);
     let last_value = AnimationValue::arc_from_borrowed(&last_value).map(|v| &**v);
     let result = compose_animation_segment(
         segment,
         underlying_value,
         last_value,
         iteration_composite,
         current_iteration,
         progress,
         progress,
     );
     Arc::new(result).into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationCompose(
-    raw_value_map: RawServoAnimationValueMapBorrowedMut,
-    base_values: RawServoAnimationValueTableBorrowed,
+    raw_value_map: &mut structs::RawServoAnimationValueMap,
+    base_values: &structs::RawServoAnimationValueTable,
     css_property: nsCSSPropertyID,
-    segment: RawGeckoAnimationPropertySegmentBorrowed,
-    last_segment: RawGeckoAnimationPropertySegmentBorrowed,
-    computed_timing: RawGeckoComputedTimingBorrowed,
+    segment: &structs::AnimationPropertySegment,
+    last_segment: &structs::AnimationPropertySegment,
+    computed_timing: &structs::ComputedTiming,
     iteration_composite: IterationCompositeOperation,
 ) {
     use style::gecko_bindings::bindings::Gecko_AnimationGetBaseStyle;
     use style::gecko_bindings::bindings::Gecko_GetPositionInSegment;
     use style::gecko_bindings::bindings::Gecko_GetProgressFromComputedTiming;
     use style::properties::animated_properties::AnimationValueMap;
 
     let property = match LonghandId::from_nscsspropertyid(css_property) {
@@ -714,17 +647,17 @@ pub extern "C" fn Servo_AnimationCompose
 
     // If either of the segment endpoints are null, get the underlying value to
     // use from the current value in the values map (set by a lower-priority
     // effect), or, if there is no current value, look up the cached base value
     // for this property.
     let underlying_value = if need_underlying_value {
         let previous_composed_value = value_map.get(&property).cloned();
         previous_composed_value.or_else(|| {
-            let raw_base_style = unsafe { Gecko_AnimationGetBaseStyle(base_values, css_property) };
+            let raw_base_style = unsafe { Gecko_AnimationGetBaseStyle(base_values, css_property).as_ref() };
             AnimationValue::arc_from_borrowed(&raw_base_style)
                 .map(|v| &**v)
                 .cloned()
         })
     } else {
         None
     };
 
@@ -770,17 +703,17 @@ macro_rules! get_property_id_from_nscssp
                 return $ret;
             },
         }
     }};
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_Serialize(
-    value: RawServoAnimationValueBorrowed,
+    value: &RawServoAnimationValue,
     property: nsCSSPropertyID,
     buffer: *mut nsAString,
 ) {
     let uncomputed_value = AnimationValue::as_arc(&value).uncompute();
     let buffer = unsafe { buffer.as_mut().unwrap() };
     let rv = PropertyDeclarationBlock::with_one(uncomputed_value, Importance::Normal)
         .single_value_to_css(
             &get_property_id_from_nscsspropertyid!(property, ()),
@@ -788,17 +721,17 @@ pub extern "C" fn Servo_AnimationValue_S
             None,
             None, /* No extra custom properties */
         );
     debug_assert!(rv.is_ok());
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_GetColor(
-    value: RawServoAnimationValueBorrowed,
+    value: &RawServoAnimationValue,
     foreground_color: structs::nscolor,
 ) -> structs::nscolor {
     use style::gecko::values::convert_nscolor_to_rgba;
     use style::gecko::values::convert_rgba_to_nscolor;
     use style::values::animated::ToAnimatedValue;
     use style::values::computed::color::Color as ComputedColor;
 
     let value = AnimationValue::as_arc(&value);
@@ -808,35 +741,35 @@ pub extern "C" fn Servo_AnimationValue_G
             let foreground_color = convert_nscolor_to_rgba(foreground_color);
             convert_rgba_to_nscolor(&computed.to_rgba(foreground_color))
         },
         _ => panic!("Other color properties are not supported yet"),
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_AnimationValue_GetOpacity(value: RawServoAnimationValueBorrowed) -> f32 {
+pub extern "C" fn Servo_AnimationValue_GetOpacity(value: &RawServoAnimationValue) -> f32 {
     let value = AnimationValue::as_arc(&value);
     if let AnimationValue::Opacity(opacity) = **value {
         opacity
     } else {
         panic!("The AnimationValue should be Opacity");
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_AnimationValue_Opacity(opacity: f32) -> RawServoAnimationValueStrong {
+pub extern "C" fn Servo_AnimationValue_Opacity(opacity: f32) -> bindings::RawServoAnimationValueStrong {
     Arc::new(AnimationValue::Opacity(opacity)).into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_Color(
     color_property: nsCSSPropertyID,
     color: structs::nscolor,
-) -> RawServoAnimationValueStrong {
+) -> bindings::RawServoAnimationValueStrong {
     use style::gecko::values::convert_nscolor_to_rgba;
     use style::values::animated::color::RGBA as AnimatedRGBA;
 
     let property = LonghandId::from_nscsspropertyid(color_property)
         .expect("We don't have shorthand property animation value");
 
     let rgba = convert_nscolor_to_rgba(color);
 
@@ -851,17 +784,17 @@ pub extern "C" fn Servo_AnimationValue_C
             Arc::new(AnimationValue::BackgroundColor(animatedRGBA.into())).into_strong()
         },
         _ => panic!("Should be background-color property"),
     }
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AnimationValue_GetTransform(
-    value: RawServoAnimationValueBorrowed,
+    value: &RawServoAnimationValue,
     list: *mut structs::RefPtr<nsCSSValueSharedList>,
 ) -> nsCSSPropertyID {
     let list = &mut *list;
     let value = AnimationValue::as_arc(&value);
     match **value {
         AnimationValue::Transform(ref servo_list) => {
             if servo_list.0.is_empty() {
                 list.set_move(RefPtr::from_addrefed(Gecko_NewNoneTransform()));
@@ -897,22 +830,23 @@ pub unsafe extern "C" fn Servo_Animation
         _ => unreachable!("Unsupported transform-like animation value"),
     }
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AnimationValue_Transform(
     property: nsCSSPropertyID,
     list: *const nsCSSValueSharedList,
-) -> RawServoAnimationValueStrong {
+) -> bindings::RawServoAnimationValueStrong {
     use style::values::computed::transform::{Rotate, Scale, Translate};
 
+    let list = (&*list).mHead.as_ref();
+
     let property = LonghandId::from_nscsspropertyid(property)
         .expect("We don't have shorthand property animation value");
-    let list = (&*list).mHead.as_ref();
     let transform = gecko_properties::clone_transform_from_list(list);
     match property {
         LonghandId::Rotate => {
             let rotate = if transform.0.is_empty() {
                 style::values::generics::transform::Rotate::None
             } else {
                 debug_assert_eq!(transform.0.len(), 1);
                 Rotate::from_transform_operation(&(transform.0)[0])
@@ -922,40 +856,40 @@ pub unsafe extern "C" fn Servo_Animation
         LonghandId::Scale => {
             debug_assert_eq!(transform.0.len(), 1);
             Arc::new(AnimationValue::Scale(Scale::from_transform_operation(&(transform.0)[0])))
                 .into_strong()
         },
         LonghandId::Translate => {
             debug_assert_eq!(transform.0.len(), 1);
             Arc::new(AnimationValue::Translate(
-                    Translate::from_transform_operation(&(transform.0)[0])))
-                .into_strong()
+                Translate::from_transform_operation(&(transform.0)[0])
+            )).into_strong()
         },
         LonghandId::Transform => {
             Arc::new(AnimationValue::Transform(transform)).into_strong()
         },
         _ => unreachable!("Unsupported transform-like animation value"),
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_DeepEqual(
-    this: RawServoAnimationValueBorrowed,
-    other: RawServoAnimationValueBorrowed,
+    this: &RawServoAnimationValue,
+    other: &RawServoAnimationValue,
 ) -> bool {
     let this_value = AnimationValue::as_arc(&this);
     let other_value = AnimationValue::as_arc(&other);
     this_value == other_value
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_Uncompute(
-    value: RawServoAnimationValueBorrowed,
-) -> RawServoDeclarationBlockStrong {
+    value: &RawServoAnimationValue,
+) -> bindings::RawServoDeclarationBlockStrong {
     let value = AnimationValue::as_arc(&value);
     let global_style_data = &*GLOBAL_STYLE_DATA;
     Arc::new(
         global_style_data
             .shared_lock
             .wrap(PropertyDeclarationBlock::with_one(
                 value.uncompute(),
                 Importance::Normal,
@@ -988,19 +922,19 @@ fn resolve_rules_for_element_with_contex
     );
     resolver
         .cascade_style_and_visited_with_default_parents(inputs)
         .0
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_GetBaseComputedValuesForElement(
-    raw_style_set: RawServoStyleSetBorrowed,
-    element: RawGeckoElementBorrowed,
-    computed_values: ComputedStyleBorrowed,
+    raw_style_set: &RawServoStyleSet,
+    element: &RawGeckoElement,
+    computed_values: &ComputedValues,
     snapshots: *const ServoElementSnapshotTable,
 ) -> ComputedStyleStrong {
     debug_assert!(!snapshots.is_null());
     let computed_values = unsafe { ArcBorrow::from_ref(computed_values) };
 
     let rules = match computed_values.rules {
         None => return computed_values.clone_arc().into(),
         Some(ref rules) => rules,
@@ -1029,24 +963,23 @@ pub extern "C" fn Servo_StyleSet_GetBase
         thread_local: &mut tlc,
     };
 
     resolve_rules_for_element_with_context(element, context, without_animations_rules).into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_GetComputedValuesByAddingAnimation(
-    raw_style_set: RawServoStyleSetBorrowed,
-    element: RawGeckoElementBorrowed,
-    computed_values: ComputedStyleBorrowed,
+    raw_style_set: &RawServoStyleSet,
+    element: &RawGeckoElement,
+    computed_values: &ComputedValues,
     snapshots: *const ServoElementSnapshotTable,
-    animation_value: RawServoAnimationValueBorrowed,
+    animation_value: &RawServoAnimationValue,
 ) -> ComputedStyleStrong {
     debug_assert!(!snapshots.is_null());
-    let computed_values = unsafe { ArcBorrow::from_ref(computed_values) };
     let rules = match computed_values.rules {
         None => return ComputedStyleStrong::null(),
         Some(ref rules) => rules,
     };
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let uncomputed_value = AnimationValue::as_arc(&animation_value).uncompute();
@@ -1081,33 +1014,33 @@ pub extern "C" fn Servo_StyleSet_GetComp
         thread_local: &mut tlc,
     };
 
     resolve_rules_for_element_with_context(element, context, with_animations_rules).into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ComputedValues_ExtractAnimationValue(
-    computed_values: ComputedStyleBorrowed,
+    computed_values: &ComputedValues,
     property_id: nsCSSPropertyID,
-) -> RawServoAnimationValueStrong {
+) -> bindings::RawServoAnimationValueStrong {
     let property = match LonghandId::from_nscsspropertyid(property_id) {
         Ok(longhand) => longhand,
         Err(()) => return Strong::null(),
     };
     match AnimationValue::from_computed_values(property, &computed_values) {
         Some(v) => Arc::new(v).into_strong(),
         None => Strong::null(),
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ResolveLogicalProperty(
     property_id: nsCSSPropertyID,
-    style: ComputedStyleBorrowed,
+    style: &ComputedValues,
 ) -> nsCSSPropertyID {
     let longhand = LonghandId::from_nscsspropertyid(property_id)
         .expect("We shouldn't need to care about shorthands");
 
     longhand
         .to_physical(style.writing_mode)
         .to_nscsspropertyid()
 }
@@ -1241,26 +1174,26 @@ pub extern "C" fn Servo_Property_IsDiscr
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleWorkerThreadCount() -> u32 {
     STYLE_THREAD_POOL.num_threads as u32
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_Element_ClearData(element: RawGeckoElementBorrowed) {
+pub extern "C" fn Servo_Element_ClearData(element: &RawGeckoElement) {
     unsafe { GeckoElement(element).clear_data() };
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Element_SizeOfExcludingThisAndCVs(
     malloc_size_of: GeckoMallocSizeOf,
     malloc_enclosing_size_of: GeckoMallocSizeOf,
     seen_ptrs: *mut SeenPtrs,
-    element: RawGeckoElementBorrowed,
+    element: &RawGeckoElement,
 ) -> usize {
     let element = GeckoElement(element);
     let borrow = element.borrow_data();
     if let Some(data) = borrow {
         let have_seen_ptr = move |ptr| unsafe { Gecko_HaveSeenPtr(seen_ptrs, ptr) };
         let mut ops = MallocSizeOfOps::new(
             malloc_size_of.unwrap(),
             Some(malloc_enclosing_size_of.unwrap()),
@@ -1268,98 +1201,98 @@ pub extern "C" fn Servo_Element_SizeOfEx
         );
         (*data).size_of_excluding_cvs(&mut ops)
     } else {
         0
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_Element_HasPrimaryComputedValues(element: RawGeckoElementBorrowed) -> bool {
+pub extern "C" fn Servo_Element_HasPrimaryComputedValues(element: &RawGeckoElement) -> bool {
     let element = GeckoElement(element);
     let data = element
         .borrow_data()
         .expect("Looking for CVs on unstyled element");
     data.has_styles()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Element_GetPrimaryComputedValues(
-    element: RawGeckoElementBorrowed,
+    element: &RawGeckoElement,
 ) -> ComputedStyleStrong {
     let element = GeckoElement(element);
     let data = element
         .borrow_data()
         .expect("Getting CVs on unstyled element");
     data.styles.primary().clone().into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Element_HasPseudoComputedValues(
-    element: RawGeckoElementBorrowed,
+    element: &RawGeckoElement,
     index: usize,
 ) -> bool {
     let element = GeckoElement(element);
     let data = element
         .borrow_data()
         .expect("Looking for CVs on unstyled element");
     data.styles.pseudos.as_array()[index].is_some()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Element_GetPseudoComputedValues(
-    element: RawGeckoElementBorrowed,
+    element: &RawGeckoElement,
     index: usize,
 ) -> ComputedStyleStrong {
     let element = GeckoElement(element);
     let data = element
         .borrow_data()
         .expect("Getting CVs that aren't present");
     data.styles.pseudos.as_array()[index]
         .as_ref()
         .expect("Getting CVs that aren't present")
         .clone()
         .into()
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_Element_IsDisplayNone(element: RawGeckoElementBorrowed) -> bool {
+pub extern "C" fn Servo_Element_IsDisplayNone(element: &RawGeckoElement) -> bool {
     let element = GeckoElement(element);
     let data = element
         .get_data()
         .expect("Invoking Servo_Element_IsDisplayNone on unstyled element");
 
     // This function is hot, so we bypass the AtomicRefCell.
     //
     // It would be nice to also assert that we're not in the servo traversal,
     // but this function is called at various intermediate checkpoints when
     // managing the traversal on the Gecko side.
     debug_assert!(is_main_thread());
     unsafe { &*data.as_ptr() }.styles.is_display_none()
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_Element_IsDisplayContents(element: RawGeckoElementBorrowed) -> bool {
+pub extern "C" fn Servo_Element_IsDisplayContents(element: &RawGeckoElement) -> bool {
     let element = GeckoElement(element);
     let data = element
         .get_data()
         .expect("Invoking Servo_Element_IsDisplayContents on unstyled element");
 
     debug_assert!(is_main_thread());
     unsafe { &*data.as_ptr() }
         .styles
         .primary()
         .get_box()
         .clone_display()
         .is_contents()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Element_IsPrimaryStyleReusedViaRuleNode(
-    element: RawGeckoElementBorrowed,
+    element: &RawGeckoElement,
 ) -> bool {
     let element = GeckoElement(element);
     let data = element
         .borrow_data()
         .expect("Invoking Servo_Element_IsPrimaryStyleReusedViaRuleNode on unstyled element");
     data.flags
         .contains(data::ElementDataFlags::PRIMARY_STYLE_REUSED_VIA_RULE_NODE)
 }
@@ -1370,17 +1303,17 @@ fn mode_to_origin(mode: SheetParsingMode
         SheetParsingMode::eUserSheetFeatures => Origin::User,
         SheetParsingMode::eAgentSheetFeatures => Origin::UserAgent,
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_Empty(
     mode: SheetParsingMode,
-) -> RawServoStyleSheetContentsStrong {
+) -> bindings::RawServoStyleSheetContentsStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let origin = mode_to_origin(mode);
     let shared_lock = &global_style_data.shared_lock;
     Arc::new(StylesheetContents::from_str(
         "",
         unsafe { dummy_url_data() }.clone(),
         origin,
         shared_lock,
@@ -1402,18 +1335,18 @@ pub extern "C" fn Servo_StyleSheet_FromU
     stylesheet: *mut DomStyleSheet,
     load_data: *mut SheetLoadData,
     bytes: *const nsACString,
     mode: SheetParsingMode,
     extra_data: *mut URLExtraData,
     line_number_offset: u32,
     quirks_mode: nsCompatibility,
     reusable_sheets: *mut LoaderReusableStyleSheets,
-    use_counters: bindings::StyleUseCountersBorrowedOrNull,
-) -> RawServoStyleSheetContentsStrong {
+    use_counters: Option<&UseCounters>,
+) -> bindings::RawServoStyleSheetContentsStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let input: &str = unsafe { (*bytes).as_str_unchecked() };
 
     let reporter = ErrorReporter::new(stylesheet, loader, extra_data);
     let url_data = unsafe { UrlExtraData::from_ptr_ref(&extra_data) };
     let loader = if loader.is_null() {
         None
     } else {
@@ -1435,17 +1368,17 @@ pub extern "C" fn Servo_StyleSheet_FromU
         input,
         url_data.clone(),
         mode_to_origin(mode),
         &global_style_data.shared_lock,
         loader,
         reporter.as_ref().map(|r| r as &ParseErrorReporter),
         quirks_mode.into(),
         line_number_offset,
-        use_counters.map(UseCounters::from_ffi),
+        use_counters,
     ))
     .into_strong()
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_StyleSheet_FromUTF8BytesAsync(
     load_data: *mut SheetLoadDataHolder,
     extra_data: *mut URLExtraData,
@@ -1477,53 +1410,53 @@ pub unsafe extern "C" fn Servo_StyleShee
         });
     } else {
         async_parser.parse();
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_AppendStyleSheet(
-    raw_data: RawServoStyleSetBorrowed,
+    raw_data: &RawServoStyleSet,
     sheet: *const DomStyleSheet,
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let data = &mut *data;
     let guard = global_style_data.shared_lock.read();
     let sheet = unsafe { GeckoStyleSheet::new(sheet) };
     data.stylist.append_stylesheet(sheet, &guard);
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AuthorStyles_Create() -> *mut RawServoAuthorStyles {
     Box::into_raw(Box::new(AuthorStyles::<GeckoStyleSheet>::new())) as *mut _
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_AuthorStyles_Drop(styles: RawServoAuthorStylesOwned) {
+pub extern "C" fn Servo_AuthorStyles_Drop(styles: bindings::RawServoAuthorStylesOwned) {
     let _ = styles.into_box::<AuthorStyles<_>>();
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AuthorStyles_AppendStyleSheet(
-    styles: RawServoAuthorStylesBorrowedMut,
+    styles: &mut RawServoAuthorStyles,
     sheet: *const DomStyleSheet,
 ) {
     let styles = AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(styles);
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let sheet = GeckoStyleSheet::new(sheet);
     styles.stylesheets.append_stylesheet(None, sheet, &guard);
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AuthorStyles_InsertStyleSheetBefore(
-    styles: RawServoAuthorStylesBorrowedMut,
+    styles: &mut RawServoAuthorStyles,
     sheet: *const DomStyleSheet,
     before_sheet: *const DomStyleSheet,
 ) {
     let styles = AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(styles);
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     styles.stylesheets.insert_stylesheet_before(
@@ -1531,38 +1464,38 @@ pub unsafe extern "C" fn Servo_AuthorSty
         GeckoStyleSheet::new(sheet),
         GeckoStyleSheet::new(before_sheet),
         &guard,
     );
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AuthorStyles_RemoveStyleSheet(
-    styles: RawServoAuthorStylesBorrowedMut,
+    styles: &mut RawServoAuthorStyles,
     sheet: *const DomStyleSheet,
 ) {
     let styles = AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(styles);
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     styles
         .stylesheets
         .remove_stylesheet(None, GeckoStyleSheet::new(sheet), &guard);
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn Servo_AuthorStyles_ForceDirty(styles: RawServoAuthorStylesBorrowedMut) {
+pub unsafe extern "C" fn Servo_AuthorStyles_ForceDirty(styles: &mut RawServoAuthorStyles) {
     let styles = AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(styles);
     styles.stylesheets.force_dirty();
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AuthorStyles_Flush(
-    styles: RawServoAuthorStylesBorrowedMut,
-    document_set: RawServoStyleSetBorrowed,
+    styles: &mut RawServoAuthorStyles,
+    document_set: &RawServoStyleSet,
 ) {
     let styles = AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(styles);
     // Try to avoid the atomic borrow below if possible.
     if !styles.stylesheets.dirty() {
         return;
     }
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
@@ -1576,17 +1509,17 @@ pub unsafe extern "C" fn Servo_AuthorSty
     // invalidation in Shadow roots.
     styles.flush::<GeckoElement>(stylist.device(), stylist.quirks_mode(), &guard);
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AuthorStyles_SizeOfIncludingThis(
     malloc_size_of: GeckoMallocSizeOf,
     malloc_enclosing_size_of: GeckoMallocSizeOf,
-    styles: RawServoAuthorStylesBorrowed,
+    styles: &RawServoAuthorStyles,
 ) -> usize {
     // We cannot `use` MallocSizeOf at the top level, otherwise the compiler
     // would complain in `Servo_StyleSheet_SizeOfIncludingThis` for `size_of`
     // there.
     use malloc_size_of::MallocSizeOf;
     let malloc_size_of = malloc_size_of.unwrap();
     let malloc_size_of_this =
         malloc_size_of(styles as *const RawServoAuthorStyles as *const c_void);
@@ -1597,18 +1530,18 @@ pub unsafe extern "C" fn Servo_AuthorSty
         Some(malloc_enclosing_size_of.unwrap()),
         None,
     );
     malloc_size_of_this + styles.size_of(&mut ops)
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_StyleSet_MediumFeaturesChanged(
-    document_set: RawServoStyleSetBorrowed,
-    non_document_styles: *mut nsTArray<RawServoAuthorStylesBorrowedMut>,
+    document_set: &RawServoStyleSet,
+    non_document_styles: *mut nsTArray<&mut RawServoAuthorStyles>,
     may_affect_default_style: bool,
 ) -> structs::MediumFeaturesChangedResult {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
 
     // NOTE(emilio): We don't actually need to flush the stylist here and ensure
     // it's up to date.
     //
@@ -1657,17 +1590,17 @@ pub unsafe extern "C" fn Servo_StyleSet_
         mAffectsDocumentRules: affects_document_rules,
         mAffectsNonDocumentRules: affects_non_document_rules,
         mUsesViewportUnits: uses_viewport_units,
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_InsertStyleSheetBefore(
-    raw_data: RawServoStyleSetBorrowed,
+    raw_data: &RawServoStyleSet,
     sheet: *const DomStyleSheet,
     before_sheet: *const DomStyleSheet,
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let data = &mut *data;
     let guard = global_style_data.shared_lock.read();
     let sheet = unsafe { GeckoStyleSheet::new(sheet) };
@@ -1675,31 +1608,31 @@ pub extern "C" fn Servo_StyleSet_InsertS
         sheet,
         unsafe { GeckoStyleSheet::new(before_sheet) },
         &guard,
     );
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_RemoveStyleSheet(
-    raw_data: RawServoStyleSetBorrowed,
+    raw_data: &RawServoStyleSet,
     sheet: *const DomStyleSheet,
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let data = &mut *data;
     let guard = global_style_data.shared_lock.read();
     let sheet = unsafe { GeckoStyleSheet::new(sheet) };
     data.stylist.remove_stylesheet(sheet, &guard);
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_StyleSet_FlushStyleSheets(
-    raw_data: RawServoStyleSetBorrowed,
-    doc_element: RawGeckoElementBorrowedOrNull,
+    raw_data: &RawServoStyleSet,
+    doc_element: Option<&RawGeckoElement>,
     snapshots: *const ServoElementSnapshotTable,
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let doc_element = doc_element.map(GeckoElement);
 
     let have_invalidations = data.flush_stylesheets(&guard, doc_element, snapshots.as_ref());
@@ -1708,123 +1641,123 @@ pub unsafe extern "C" fn Servo_StyleSet_
         // The invalidation machinery propagates the bits up, but we still need
         // to tell the Gecko restyle root machinery about it.
         bindings::Gecko_NoteDirtySubtreeForInvalidation(doc_element.unwrap().0);
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_NoteStyleSheetsChanged(
-    raw_data: RawServoStyleSetBorrowed,
+    raw_data: &RawServoStyleSet,
     changed_origins: OriginFlags,
 ) {
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     data.stylist
         .force_stylesheet_origins_dirty(OriginSet::from(changed_origins));
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_SetAuthorStyleDisabled(
-    raw_data: RawServoStyleSetBorrowed,
+    raw_data: &RawServoStyleSet,
     author_style_disabled: bool,
 ) {
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let enabled = if author_style_disabled {
         AuthorStylesEnabled::No
     } else {
         AuthorStylesEnabled::Yes
     };
     data.stylist.set_author_styles_enabled(enabled);
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_HasRules(
-    raw_contents: RawServoStyleSheetContentsBorrowed,
+    raw_contents: &RawServoStyleSheetContents,
 ) -> bool {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     !StylesheetContents::as_arc(&raw_contents)
         .rules
         .read_with(&guard)
         .0
         .is_empty()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_GetRules(
-    sheet: RawServoStyleSheetContentsBorrowed,
-) -> ServoCssRulesStrong {
+    sheet: &RawServoStyleSheetContents,
+) -> bindings::ServoCssRulesStrong {
     StylesheetContents::as_arc(&sheet)
         .rules
         .clone()
         .into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_Clone(
-    raw_sheet: RawServoStyleSheetContentsBorrowed,
+    raw_sheet: &RawServoStyleSheetContents,
     reference_sheet: *const DomStyleSheet,
-) -> RawServoStyleSheetContentsStrong {
+) -> bindings::RawServoStyleSheetContentsStrong {
     use style::shared_lock::{DeepCloneParams, DeepCloneWithLock};
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let contents = StylesheetContents::as_arc(&raw_sheet);
     let params = DeepCloneParams { reference_sheet };
 
     Arc::new(contents.deep_clone_with_lock(&global_style_data.shared_lock, &guard, &params))
         .into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_SizeOfIncludingThis(
     malloc_size_of: GeckoMallocSizeOf,
     malloc_enclosing_size_of: GeckoMallocSizeOf,
-    sheet: RawServoStyleSheetContentsBorrowed,
+    sheet: &RawServoStyleSheetContents,
 ) -> usize {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let mut ops = MallocSizeOfOps::new(
         malloc_size_of.unwrap(),
         Some(malloc_enclosing_size_of.unwrap()),
         None,
     );
     StylesheetContents::as_arc(&sheet).size_of(&guard, &mut ops)
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_StyleSheet_GetOrigin(sheet: RawServoStyleSheetContentsBorrowed) -> u8 {
+pub extern "C" fn Servo_StyleSheet_GetOrigin(sheet: &RawServoStyleSheetContents) -> u8 {
     let origin = match StylesheetContents::as_arc(&sheet).origin {
         Origin::UserAgent => OriginFlags::UserAgent,
         Origin::User => OriginFlags::User,
         Origin::Author => OriginFlags::Author,
     };
     // We'd like to return `OriginFlags` here, but bindgen bitfield enums don't
     // work as return values with the Linux 32-bit ABI at the moment because
     // they wrap the value in a struct (and bindgen doesn't have support for
     // repr(transparent), so for now just unwrap it.
     //
     // See https://github.com/rust-lang/rust-bindgen/issues/1474
     origin.0
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_GetSourceMapURL(
-    sheet: RawServoStyleSheetContentsBorrowed,
+    sheet: &RawServoStyleSheetContents,
     result: *mut nsAString,
 ) {
     let contents = StylesheetContents::as_arc(&sheet);
     let url_opt = contents.source_map_url.read();
     if let Some(ref url) = *url_opt {
         write!(unsafe { &mut *result }, "{}", url).unwrap();
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_GetSourceURL(
-    sheet: RawServoStyleSheetContentsBorrowed,
+    sheet: &RawServoStyleSheetContents,
     result: *mut nsAString,
 ) {
     let contents = StylesheetContents::as_arc(&sheet);
     let url_opt = contents.source_url.read();
     if let Some(ref url) = *url_opt {
         write!(unsafe { &mut *result }, "{}", url).unwrap();
     }
 }
@@ -1865,28 +1798,28 @@ where
 {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut guard = global_style_data.shared_lock.write();
     func(Locked::<T>::as_arc(&raw).write_with(&mut guard))
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_CssRules_ListTypes(
-    rules: ServoCssRulesBorrowed,
-    result: nsTArrayBorrowed_uintptr_t,
+    rules: &ServoCssRules,
+    result: &mut nsTArray<usize>,
 ) {
     read_locked_arc(rules, |rules: &CssRules| {
         result.assign_from_iter_pod(rules.0.iter().map(|rule| rule.rule_type() as usize));
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_CssRules_InsertRule(
-    rules: ServoCssRulesBorrowed,
-    contents: RawServoStyleSheetContentsBorrowed,
+    rules: &ServoCssRules,
+    contents: &RawServoStyleSheetContents,
     rule: *const nsACString,
     index: u32,
     nested: bool,
     loader: *mut Loader,
     gecko_stylesheet: *mut DomStyleSheet,
     rule_type: *mut u16,
 ) -> nsresult {
     let loader = if loader.is_null() {
@@ -1920,17 +1853,17 @@ pub extern "C" fn Servo_CssRules_InsertR
             *unsafe { rule_type.as_mut().unwrap() } = new_rule.rule_type() as u16;
             nsresult::NS_OK
         },
         Err(err) => err.into(),
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_CssRules_DeleteRule(rules: ServoCssRulesBorrowed, index: u32) -> nsresult {
+pub extern "C" fn Servo_CssRules_DeleteRule(rules: &ServoCssRules, index: u32) -> nsresult {
     write_locked_arc(rules, |rules: &mut CssRules| {
         match rules.remove_rule(index as usize) {
             Ok(_) => nsresult::NS_OK,
             Err(err) => err.into(),
         }
     })
 }
 
@@ -1966,17 +1899,17 @@ macro_rules! impl_basic_rule_funcs_witho
 macro_rules! impl_basic_rule_funcs {
     { ($name:ident, $rule_type:ty, $raw_type:ty),
         getter: $getter:ident,
         debug: $debug:ident,
         to_css: $to_css:ident,
     } => {
         #[no_mangle]
         pub extern "C" fn $getter(
-            rules: ServoCssRulesBorrowed,
+            rules: &ServoCssRules,
             index: u32,
             line: *mut u32,
             column: *mut u32,
         ) -> Strong<$raw_type> {
             let global_style_data = &*GLOBAL_STYLE_DATA;
             let guard = global_style_data.shared_lock.read();
             let rules = Locked::<CssRules>::as_arc(&rules).read_with(&guard);
             let index = index as usize;
@@ -2008,17 +1941,17 @@ macro_rules! impl_basic_rule_funcs {
 macro_rules! impl_group_rule_funcs {
     { ($name:ident, $rule_type:ty, $raw_type:ty),
       get_rules: $get_rules:ident,
       $($basic:tt)+
     } => {
         impl_basic_rule_funcs! { ($name, $rule_type, $raw_type), $($basic)+ }
 
         #[no_mangle]
-        pub extern "C" fn $get_rules(rule: &$raw_type) -> ServoCssRulesStrong {
+        pub extern "C" fn $get_rules(rule: &$raw_type) -> bindings::ServoCssRulesStrong {
             read_locked_arc(rule, |rule: &$rule_type| {
                 rule.rules.clone().into_strong()
             })
         }
     }
 }
 
 impl_basic_rule_funcs! { (Style, StyleRule, RawServoStyleRule),
@@ -2092,92 +2025,92 @@ impl_basic_rule_funcs! { (FontFace, Font
 impl_basic_rule_funcs! { (CounterStyle, CounterStyleRule, RawServoCounterStyleRule),
     getter: Servo_CssRules_GetCounterStyleRuleAt,
     debug: Servo_CounterStyleRule_Debug,
     to_css: Servo_CounterStyleRule_GetCssText,
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleRule_GetStyle(
-    rule: RawServoStyleRuleBorrowed,
-) -> RawServoDeclarationBlockStrong {
+    rule: &RawServoStyleRule,
+) -> bindings::RawServoDeclarationBlockStrong {
     read_locked_arc(rule, |rule: &StyleRule| rule.block.clone().into_strong())
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleRule_SetStyle(
-    rule: RawServoStyleRuleBorrowed,
-    declarations: RawServoDeclarationBlockBorrowed,
+    rule: &RawServoStyleRule,
+    declarations: &RawServoDeclarationBlock,
 ) {
     let declarations = Locked::<PropertyDeclarationBlock>::as_arc(&declarations);
     write_locked_arc(rule, |rule: &mut StyleRule| {
         rule.block = declarations.clone_arc();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleRule_GetSelectorText(
-    rule: RawServoStyleRuleBorrowed,
+    rule: &RawServoStyleRule,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &StyleRule| {
         rule.selectors
             .to_css(unsafe { result.as_mut().unwrap() })
             .unwrap();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleRule_GetSelectorTextAtIndex(
-    rule: RawServoStyleRuleBorrowed,
+    rule: &RawServoStyleRule,
     index: u32,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &StyleRule| {
         let index = index as usize;
         if index >= rule.selectors.0.len() {
             return;
         }
         rule.selectors.0[index]
             .to_css(unsafe { result.as_mut().unwrap() })
             .unwrap();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleRule_GetSelectorCount(
-    rule: RawServoStyleRuleBorrowed,
+    rule: &RawServoStyleRule,
     count: *mut u32,
 ) {
     read_locked_arc(rule, |rule: &StyleRule| {
         *unsafe { count.as_mut().unwrap() } = rule.selectors.0.len() as u32;
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleRule_GetSpecificityAtIndex(
-    rule: RawServoStyleRuleBorrowed,
+    rule: &RawServoStyleRule,
     index: u32,
     specificity: *mut u64,
 ) {
     read_locked_arc(rule, |rule: &StyleRule| {
         let specificity = unsafe { specificity.as_mut().unwrap() };
         let index = index as usize;
         if index >= rule.selectors.0.len() {
             *specificity = 0;
             return;
         }
         *specificity = rule.selectors.0[index].specificity() as u64;
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleRule_SelectorMatchesElement(
-    rule: RawServoStyleRuleBorrowed,
-    element: RawGeckoElementBorrowed,
+    rule: &RawServoStyleRule,
+    element: &RawGeckoElement,
     index: u32,
     pseudo_type: PseudoStyleType,
 ) -> bool {
     read_locked_arc(rule, |rule: &StyleRule| {
         let index = index as usize;
         if index >= rule.selectors.0.len() {
             return false;
         }
@@ -2209,18 +2142,18 @@ pub extern "C" fn Servo_StyleRule_Select
         let quirks_mode = element.as_node().owner_doc().quirks_mode();
         let mut ctx = MatchingContext::new(matching_mode, None, None, quirks_mode);
         matches_selector(selector, 0, None, &element, &mut ctx, &mut |_, _| {})
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_StyleRule_SetSelectorText(
-    sheet: RawServoStyleSheetContentsBorrowed,
-    rule: RawServoStyleRuleBorrowed,
+    sheet: &RawServoStyleSheetContents,
+    rule: &RawServoStyleRule,
     text: *const nsAString,
 ) -> bool {
     let value_str = (*text).to_string();
 
     write_locked_arc(rule, |rule: &mut StyleRule| {
         use style::selector_parser::SelectorParser;
 
         let contents = StylesheetContents::as_arc(&sheet);
@@ -2240,49 +2173,49 @@ pub unsafe extern "C" fn Servo_StyleRule
             },
             Err(_) => false,
         }
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SelectorList_Closest(
-    element: RawGeckoElementBorrowed,
-    selectors: RawServoSelectorListBorrowed,
-) -> *const structs::RawGeckoElement {
+    element: &RawGeckoElement,
+    selectors: &RawServoSelectorList,
+) -> *const RawGeckoElement {
     use std::borrow::Borrow;
     use style::dom_apis;
 
     let element = GeckoElement(element);
     let quirks_mode = element.as_node().owner_doc().quirks_mode();
     let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
 
     dom_apis::element_closest(element, &selectors, quirks_mode).map_or(ptr::null(), |e| e.0)
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SelectorList_Matches(
-    element: RawGeckoElementBorrowed,
-    selectors: RawServoSelectorListBorrowed,
+    element: &RawGeckoElement,
+    selectors: &RawServoSelectorList,
 ) -> bool {
     use std::borrow::Borrow;
     use style::dom_apis;
 
     let element = GeckoElement(element);
     let quirks_mode = element.as_node().owner_doc().quirks_mode();
     let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
     dom_apis::element_matches(&element, &selectors, quirks_mode)
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SelectorList_QueryFirst(
-    node: RawGeckoNodeBorrowed,
-    selectors: RawServoSelectorListBorrowed,
+    node: &RawGeckoNode,
+    selectors: &RawServoSelectorList,
     may_use_invalidation: bool,
-) -> *const structs::RawGeckoElement {
+) -> *const RawGeckoElement {
     use std::borrow::Borrow;
     use style::dom_apis::{self, MayUseInvalidation, QueryFirst};
 
     let node = GeckoNode(node);
     let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
     let mut result = None;
 
     let may_use_invalidation = if may_use_invalidation {
@@ -2298,18 +2231,18 @@ pub unsafe extern "C" fn Servo_SelectorL
         may_use_invalidation,
     );
 
     result.map_or(ptr::null(), |e| e.0)
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SelectorList_QueryAll(
-    node: RawGeckoNodeBorrowed,
-    selectors: RawServoSelectorListBorrowed,
+    node: &RawGeckoNode,
+    selectors: &RawServoSelectorList,
     content_list: *mut structs::nsSimpleContentList,
     may_use_invalidation: bool,
 ) {
     use std::borrow::Borrow;
     use style::dom_apis::{self, MayUseInvalidation, QueryAll};
 
     let node = GeckoNode(node);
     let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
@@ -2336,152 +2269,152 @@ pub unsafe extern "C" fn Servo_SelectorL
             result.as_ptr() as *mut *const _,
             result.len(),
         )
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ImportRule_GetHref(
-    rule: RawServoImportRuleBorrowed,
+    rule: &RawServoImportRule,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &ImportRule| {
         write!(unsafe { &mut *result }, "{}", rule.url.as_str()).unwrap();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ImportRule_GetSheet(
-    rule: RawServoImportRuleBorrowed,
+    rule: &RawServoImportRule,
 ) -> *const DomStyleSheet {
     read_locked_arc(rule, |rule: &ImportRule| {
         rule.stylesheet.as_sheet().unwrap().raw() as *const DomStyleSheet
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ImportRule_SetSheet(
-    rule: RawServoImportRuleBorrowed,
+    rule: &RawServoImportRule,
     sheet: *mut DomStyleSheet,
 ) {
     write_locked_arc(rule, |rule: &mut ImportRule| {
         let sheet = unsafe { GeckoStyleSheet::new(sheet) };
         rule.stylesheet = ImportSheet::new(sheet);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Keyframe_GetKeyText(
-    keyframe: RawServoKeyframeBorrowed,
+    keyframe: &RawServoKeyframe,
     result: *mut nsAString,
 ) {
     read_locked_arc(keyframe, |keyframe: &Keyframe| {
         keyframe
             .selector
             .to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
             .unwrap()
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Keyframe_SetKeyText(
-    keyframe: RawServoKeyframeBorrowed,
+    keyframe: &RawServoKeyframe,
     text: *const nsACString,
 ) -> bool {
     let text = unsafe { text.as_ref().unwrap().as_str_unchecked() };
     let mut input = ParserInput::new(&text);
     if let Ok(selector) = Parser::new(&mut input).parse_entirely(KeyframeSelector::parse) {
         write_locked_arc(keyframe, |keyframe: &mut Keyframe| {
             keyframe.selector = selector;
         });
         true
     } else {
         false
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Keyframe_GetStyle(
-    keyframe: RawServoKeyframeBorrowed,
-) -> RawServoDeclarationBlockStrong {
+    keyframe: &RawServoKeyframe,
+) -> bindings::RawServoDeclarationBlockStrong {
     read_locked_arc(keyframe, |keyframe: &Keyframe| {
         keyframe.block.clone().into_strong()
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Keyframe_SetStyle(
-    keyframe: RawServoKeyframeBorrowed,
-    declarations: RawServoDeclarationBlockBorrowed,
+    keyframe: &RawServoKeyframe,
+    declarations: &RawServoDeclarationBlock,
 ) {
     let declarations = Locked::<PropertyDeclarationBlock>::as_arc(&declarations);
     write_locked_arc(keyframe, |keyframe: &mut Keyframe| {
         keyframe.block = declarations.clone_arc();
     })
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_KeyframesRule_GetName(rule: RawServoKeyframesRuleBorrowed) -> *mut nsAtom {
+pub extern "C" fn Servo_KeyframesRule_GetName(rule: &RawServoKeyframesRule) -> *mut nsAtom {
     read_locked_arc(rule, |rule: &KeyframesRule| rule.name.as_atom().as_ptr())
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_KeyframesRule_SetName(
-    rule: RawServoKeyframesRuleBorrowed,
+    rule: &RawServoKeyframesRule,
     name: *mut nsAtom,
 ) {
     write_locked_arc(rule, |rule: &mut KeyframesRule| {
         rule.name = KeyframesName::Ident(CustomIdent(Atom::from_addrefed(name)));
     })
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_KeyframesRule_GetCount(rule: RawServoKeyframesRuleBorrowed) -> u32 {
+pub extern "C" fn Servo_KeyframesRule_GetCount(rule: &RawServoKeyframesRule) -> u32 {
     read_locked_arc(rule, |rule: &KeyframesRule| rule.keyframes.len() as u32)
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_KeyframesRule_GetKeyframeAt(
-    rule: RawServoKeyframesRuleBorrowed,
+    rule: &RawServoKeyframesRule,
     index: u32,
     line: *mut u32,
     column: *mut u32,
-) -> RawServoKeyframeStrong {
+) -> bindings::RawServoKeyframeStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let key = Locked::<KeyframesRule>::as_arc(&rule)
         .read_with(&guard)
         .keyframes[index as usize]
         .clone();
     let location = key.read_with(&guard).source_location;
     *unsafe { line.as_mut().unwrap() } = location.line as u32;
     *unsafe { column.as_mut().unwrap() } = location.column as u32;
     key.into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_KeyframesRule_FindRule(
-    rule: RawServoKeyframesRuleBorrowed,
+    rule: &RawServoKeyframesRule,
     key: *const nsACString,
 ) -> u32 {
     let key = unsafe { key.as_ref().unwrap().as_str_unchecked() };
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     Locked::<KeyframesRule>::as_arc(&rule)
         .read_with(&guard)
         .find_rule(&guard, key)
         .map(|index| index as u32)
         .unwrap_or(u32::max_value())
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_KeyframesRule_AppendRule(
-    rule: RawServoKeyframesRuleBorrowed,
-    contents: RawServoStyleSheetContentsBorrowed,
+    rule: &RawServoKeyframesRule,
+    contents: &RawServoStyleSheetContents,
     css: *const nsACString,
 ) -> bool {
     let css = unsafe { css.as_ref().unwrap().as_str_unchecked() };
     let contents = StylesheetContents::as_arc(&contents);
     let global_style_data = &*GLOBAL_STYLE_DATA;
 
     match Keyframe::parse(css, &contents, &global_style_data.shared_lock) {
         Ok(keyframe) => {
@@ -2490,136 +2423,136 @@ pub extern "C" fn Servo_KeyframesRule_Ap
             });
             true
         },
         Err(..) => false,
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_KeyframesRule_DeleteRule(rule: RawServoKeyframesRuleBorrowed, index: u32) {
+pub extern "C" fn Servo_KeyframesRule_DeleteRule(rule: &RawServoKeyframesRule, index: u32) {
     write_locked_arc(rule, |rule: &mut KeyframesRule| {
         rule.keyframes.remove(index as usize);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MediaRule_GetMedia(
-    rule: RawServoMediaRuleBorrowed,
-) -> RawServoMediaListStrong {
+    rule: &RawServoMediaRule,
+) -> bindings::RawServoMediaListStrong {
     read_locked_arc(rule, |rule: &MediaRule| {
         rule.media_queries.clone().into_strong()
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_NamespaceRule_GetPrefix(
-    rule: RawServoNamespaceRuleBorrowed,
+    rule: &RawServoNamespaceRule,
 ) -> *mut nsAtom {
     read_locked_arc(rule, |rule: &NamespaceRule| {
         rule.prefix.as_ref().unwrap_or(&atom!("")).as_ptr()
     })
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_NamespaceRule_GetURI(rule: RawServoNamespaceRuleBorrowed) -> *mut nsAtom {
+pub extern "C" fn Servo_NamespaceRule_GetURI(rule: &RawServoNamespaceRule) -> *mut nsAtom {
     read_locked_arc(rule, |rule: &NamespaceRule| rule.url.0.as_ptr())
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_PageRule_GetStyle(
-    rule: RawServoPageRuleBorrowed,
-) -> RawServoDeclarationBlockStrong {
+    rule: &RawServoPageRule,
+) -> bindings::RawServoDeclarationBlockStrong {
     read_locked_arc(rule, |rule: &PageRule| rule.block.clone().into_strong())
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_PageRule_SetStyle(
-    rule: RawServoPageRuleBorrowed,
-    declarations: RawServoDeclarationBlockBorrowed,
+    rule: &RawServoPageRule,
+    declarations: &RawServoDeclarationBlock,
 ) {
     let declarations = Locked::<PropertyDeclarationBlock>::as_arc(&declarations);
     write_locked_arc(rule, |rule: &mut PageRule| {
         rule.block = declarations.clone_arc();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_SupportsRule_GetConditionText(
-    rule: RawServoSupportsRuleBorrowed,
+    rule: &RawServoSupportsRule,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &SupportsRule| {
         rule.condition
             .to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
             .unwrap();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MozDocumentRule_GetConditionText(
-    rule: RawServoMozDocumentRuleBorrowed,
+    rule: &RawServoMozDocumentRule,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &DocumentRule| {
         rule.condition
             .to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
             .unwrap();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_FontFeatureValuesRule_GetFontFamily(
-    rule: RawServoFontFeatureValuesRuleBorrowed,
+    rule: &RawServoFontFeatureValuesRule,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &FontFeatureValuesRule| {
         rule.font_family_to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
             .unwrap();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_FontFeatureValuesRule_GetValueText(
-    rule: RawServoFontFeatureValuesRuleBorrowed,
+    rule: &RawServoFontFeatureValuesRule,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &FontFeatureValuesRule| {
         rule.value_to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
             .unwrap();
     })
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_FontFaceRule_CreateEmpty() -> RawServoFontFaceRuleStrong {
+pub extern "C" fn Servo_FontFaceRule_CreateEmpty() -> bindings::RawServoFontFaceRuleStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     // XXX This is not great. We should split FontFace descriptor data
     // from the rule, so that we don't need to create the rule like this
     // and the descriptor data itself can be hold in UniquePtr from the
     // Gecko side. See bug 1450904.
     Arc::new(
         global_style_data
             .shared_lock
             .wrap(FontFaceRule::empty(SourceLocation { line: 0, column: 0 })),
     )
     .into_strong()
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_Clone(
-    rule: RawServoFontFaceRuleBorrowed,
-) -> RawServoFontFaceRuleStrong {
+    rule: &RawServoFontFaceRule,
+) -> bindings::RawServoFontFaceRuleStrong {
     let clone = read_locked_arc(rule, |rule: &FontFaceRule| rule.clone());
     let global_style_data = &*GLOBAL_STYLE_DATA;
     Arc::new(global_style_data.shared_lock.wrap(clone)).into_strong()
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_GetSourceLocation(
-    rule: RawServoFontFaceRuleBorrowed,
+    rule: &RawServoFontFaceRule,
     line: *mut u32,
     column: *mut u32,
 ) {
     read_locked_arc(rule, |rule: &FontFaceRule| {
         let location = rule.source_location;
         *line.as_mut().unwrap() = location.line as u32;
         *column.as_mut().unwrap() = location.column as u32;
     });
@@ -2644,17 +2577,17 @@ macro_rules! apply_font_desc_list {
                 eCSSFontDesc_UNKNOWN,
                 eCSSFontDesc_COUNT,
             ]
         }
     };
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn Servo_FontFaceRule_Length(rule: RawServoFontFaceRuleBorrowed) -> u32 {
+pub unsafe extern "C" fn Servo_FontFaceRule_Length(rule: &RawServoFontFaceRule) -> u32 {
     read_locked_arc(rule, |rule: &FontFaceRule| {
         let mut result = 0;
         macro_rules! count_values {
             (
                 valid: [$($v_enum_name:ident => $field:ident,)*]
                 invalid: [$($i_enum_name:ident,)*]
             ) => {
                 $(if rule.$field.is_some() {
@@ -2664,17 +2597,17 @@ pub unsafe extern "C" fn Servo_FontFaceR
         }
         apply_font_desc_list!(count_values);
         result
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_IndexGetter(
-    rule: RawServoFontFaceRuleBorrowed,
+    rule: &RawServoFontFaceRule,
     index: u32,
 ) -> nsCSSFontDesc {
     read_locked_arc(rule, |rule: &FontFaceRule| {
         let mut count = 0;
         macro_rules! lookup_index {
             (
                 valid: [$($v_enum_name:ident => $field:ident,)*]
                 invalid: [$($i_enum_name:ident,)*]
@@ -2689,29 +2622,29 @@ pub unsafe extern "C" fn Servo_FontFaceR
         }
         apply_font_desc_list!(lookup_index);
         return nsCSSFontDesc::eCSSFontDesc_UNKNOWN;
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_GetDeclCssText(
-    rule: RawServoFontFaceRuleBorrowed,
+    rule: &RawServoFontFaceRule,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &FontFaceRule| {
         rule.decl_to_css(result.as_mut().unwrap()).unwrap();
     })
 }
 
 macro_rules! simple_font_descriptor_getter {
     ($function_name:ident, $gecko_type:ident, $field:ident, $compute:ident) => {
         #[no_mangle]
         pub unsafe extern "C" fn $function_name(
-            rule: RawServoFontFaceRuleBorrowed,
+            rule: &RawServoFontFaceRule,
             out: *mut structs::$gecko_type,
         ) -> bool {
             read_locked_arc(rule, |rule: &FontFaceRule| {
                 match rule.$field {
                     None => return false,
                     Some(ref f) => *out = f.$compute(),
                 }
                 true
@@ -2748,46 +2681,46 @@ simple_font_descriptor_getter!(
     Servo_FontFaceRule_GetFontLanguageOverride,
     StyleFontLanguageOverride,
     language_override,
     compute_non_system
 );
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_GetFamilyName(
-    rule: RawServoFontFaceRuleBorrowed,
+    rule: &RawServoFontFaceRule,
 ) -> *mut nsAtom {
     read_locked_arc(rule, |rule: &FontFaceRule| {
         // TODO(emilio): font-family is a mandatory descriptor, can't we unwrap
         // here, and remove the null-checks in Gecko?
         rule.family
             .as_ref()
             .map_or(ptr::null_mut(), |f| f.name.as_ptr())
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_GetUnicodeRanges(
-    rule: RawServoFontFaceRuleBorrowed,
+    rule: &RawServoFontFaceRule,
     out_len: *mut usize,
 ) -> *const structs::StyleUnicodeRange {
     *out_len = 0;
     read_locked_arc(rule, |rule: &FontFaceRule| {
         let ranges = match rule.unicode_range {
             Some(ref ranges) => ranges,
             None => return ptr::null(),
         };
         *out_len = ranges.len();
         ranges.as_ptr() as *const _
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_GetSources(
-    rule: RawServoFontFaceRuleBorrowed,
+    rule: &RawServoFontFaceRule,
     out: *mut nsTArray<structs::StyleFontFaceSourceListComponent>,
 ) {
     use style::font_face::{FontFaceSourceListComponent, Source};
     let out = &mut *out;
     read_locked_arc(rule, |rule: &FontFaceRule| {
         let sources = match rule.sources {
             Some(ref s) => s,
             None => return,
@@ -2828,17 +2761,17 @@ pub unsafe extern "C" fn Servo_FontFaceR
         }
 
         assert!(iter.next().is_none(), "miscalculated");
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_GetVariationSettings(
-    rule: RawServoFontFaceRuleBorrowed,
+    rule: &RawServoFontFaceRule,
     variations: *mut nsTArray<structs::gfxFontVariation>,
 ) {
     read_locked_arc(rule, |rule: &FontFaceRule| {
         let source_variations = match rule.variation_settings {
             Some(ref v) => v,
             None => return,
         };
 
@@ -2849,17 +2782,17 @@ pub unsafe extern "C" fn Servo_FontFaceR
                 mValue: source.value.get(),
             };
         }
     });
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_GetFeatureSettings(
-    rule: RawServoFontFaceRuleBorrowed,
+    rule: &RawServoFontFaceRule,
     features: *mut nsTArray<structs::gfxFontFeature>,
 ) {
     read_locked_arc(rule, |rule: &FontFaceRule| {
         let source_features = match rule.feature_settings {
             Some(ref v) => v,
             None => return,
         };
 
@@ -2870,17 +2803,17 @@ pub unsafe extern "C" fn Servo_FontFaceR
                 mValue: source.value.value() as u32,
             };
         }
     });
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_GetDescriptorCssText(
-    rule: RawServoFontFaceRuleBorrowed,
+    rule: &RawServoFontFaceRule,
     desc: nsCSSFontDesc,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &FontFaceRule| {
         let mut writer = CssWriter::new(result.as_mut().unwrap());
         macro_rules! to_css_text {
             (
                 valid: [$($v_enum_name:ident => $field:ident,)*]
@@ -2903,17 +2836,17 @@ pub unsafe extern "C" fn Servo_FontFaceR
             }
         }
         apply_font_desc_list!(to_css_text)
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_SetDescriptor(
-    rule: RawServoFontFaceRuleBorrowed,
+    rule: &RawServoFontFaceRule,
     desc: nsCSSFontDesc,
     value: *const nsACString,
     data: *mut URLExtraData,
 ) -> bool {
     let value = value.as_ref().unwrap().as_str_unchecked();
     let mut input = ParserInput::new(&value);
     let mut parser = Parser::new(&mut input);
     let url_data = UrlExtraData::from_ptr_ref(&data);
@@ -2954,17 +2887,17 @@ pub unsafe extern "C" fn Servo_FontFaceR
             }
         }
         apply_font_desc_list!(to_css_text)
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_ResetDescriptor(
-    rule: RawServoFontFaceRuleBorrowed,
+    rule: &RawServoFontFaceRule,
     desc: nsCSSFontDesc,
 ) {
     write_locked_arc(rule, |rule: &mut FontFaceRule| {
         macro_rules! reset_desc {
             (
                 valid: [$($v_enum_name:ident => $field:ident,)*]
                 invalid: [$($i_enum_name:ident,)*]
             ) => {
@@ -2975,48 +2908,48 @@ pub unsafe extern "C" fn Servo_FontFaceR
             }
         }
         apply_font_desc_list!(reset_desc)
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_GetName(
-    rule: RawServoCounterStyleRuleBorrowed,
+    rule: &RawServoCounterStyleRule,
 ) -> *mut nsAtom {
     read_locked_arc(rule, |rule: &CounterStyleRule| rule.name().0.as_ptr())
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_SetName(
-    rule: RawServoCounterStyleRuleBorrowed,
+    rule: &RawServoCounterStyleRule,
     value: *const nsACString,
 ) -> bool {
     let value = value.as_ref().unwrap().as_str_unchecked();
     let mut input = ParserInput::new(&value);
     let mut parser = Parser::new(&mut input);
     match parser.parse_entirely(counter_style::parse_counter_style_name_definition) {
         Ok(name) => {
             write_locked_arc(rule, |rule: &mut CounterStyleRule| rule.set_name(name));
             true
         },
         Err(_) => false,
     }
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_GetGeneration(
-    rule: RawServoCounterStyleRuleBorrowed,
+    rule: &RawServoCounterStyleRule,
 ) -> u32 {
     read_locked_arc(rule, |rule: &CounterStyleRule| rule.generation())
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_GetSystem(
-    rule: RawServoCounterStyleRuleBorrowed,
+    rule: &RawServoCounterStyleRule,
 ) -> u8 {
     use style::counter_style::System;
     read_locked_arc(rule, |rule: &CounterStyleRule| {
         match *rule.resolved_system() {
             System::Cyclic => structs::NS_STYLE_COUNTER_SYSTEM_CYCLIC,
             System::Numeric => structs::NS_STYLE_COUNTER_SYSTEM_NUMERIC,
             System::Alphabetic => structs::NS_STYLE_COUNTER_SYSTEM_ALPHABETIC,
             System::Symbolic => structs::NS_STYLE_COUNTER_SYSTEM_SYMBOLIC,
@@ -3024,49 +2957,49 @@ pub unsafe extern "C" fn Servo_CounterSt
             System::Fixed { .. } => structs::NS_STYLE_COUNTER_SYSTEM_FIXED,
             System::Extends(_) => structs::NS_STYLE_COUNTER_SYSTEM_EXTENDS,
         }
     }) as u8
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_GetExtended(
-    rule: RawServoCounterStyleRuleBorrowed,
+    rule: &RawServoCounterStyleRule,
 ) -> *mut nsAtom {
     read_locked_arc(rule, |rule: &CounterStyleRule| {
         match *rule.resolved_system() {
             counter_style::System::Extends(ref name) => name.0.as_ptr(),
             _ => {
                 debug_assert!(false, "Not extends system");
                 ptr::null_mut()
             },
         }
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_GetFixedFirstValue(
-    rule: RawServoCounterStyleRuleBorrowed,
+    rule: &RawServoCounterStyleRule,
 ) -> i32 {
     read_locked_arc(rule, |rule: &CounterStyleRule| {
         match *rule.resolved_system() {
             counter_style::System::Fixed { first_symbol_value } => {
                 first_symbol_value.map_or(1, |v| v.value())
             },
             _ => {
                 debug_assert!(false, "Not fixed system");
                 0
             },
         }
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_GetFallback(
-    rule: RawServoCounterStyleRuleBorrowed,
+    rule: &RawServoCounterStyleRule,
 ) -> *mut nsAtom {
     read_locked_arc(rule, |rule: &CounterStyleRule| {
         rule.fallback().map_or(ptr::null_mut(), |i| i.0 .0.as_ptr())
     })
 }
 
 macro_rules! counter_style_descriptors {
     {
@@ -3074,35 +3007,35 @@ macro_rules! counter_style_descriptors {
             $($desc:ident => $getter:ident / $setter:ident,)+
         ]
         invalid: [
             $($i_desc:ident,)+
         ]
     } => {
         #[no_mangle]
         pub unsafe extern "C" fn Servo_CounterStyleRule_GetDescriptor(
-            rule: RawServoCounterStyleRuleBorrowed,
+            rule: &RawServoCounterStyleRule,
             desc: nsCSSCounterDesc,
-            result: nsCSSValueBorrowedMut,
+            result: &mut structs::nsCSSValue,
         ) {
             read_locked_arc(rule, |rule: &CounterStyleRule| {
                 match desc {
                     $(nsCSSCounterDesc::$desc => {
                         if let Some(value) = rule.$getter() {
                             result.set_from(value);
                         }
                     })+
                     $(nsCSSCounterDesc::$i_desc => unreachable!(),)+
                 }
             });
         }
 
         #[no_mangle]
         pub unsafe extern "C" fn Servo_CounterStyleRule_GetDescriptorCssText(
-            rule: RawServoCounterStyleRuleBorrowed,
+            rule: &RawServoCounterStyleRule,
             desc: nsCSSCounterDesc,
             result: *mut nsAString,
         ) {
             let mut writer = CssWriter::new(result.as_mut().unwrap());
             read_locked_arc(rule, |rule: &CounterStyleRule| {
                 match desc {
                     $(nsCSSCounterDesc::$desc => {
                         if let Some(value) = rule.$getter() {
@@ -3111,17 +3044,17 @@ macro_rules! counter_style_descriptors {
                     })+
                     $(nsCSSCounterDesc::$i_desc => unreachable!(),)+
                 }
             });
         }
 
         #[no_mangle]
         pub unsafe extern "C" fn Servo_CounterStyleRule_SetDescriptor(
-            rule: RawServoCounterStyleRuleBorrowed,
+            rule: &RawServoCounterStyleRule,
             desc: nsCSSCounterDesc,
             value: *const nsACString,
         ) -> bool {
             let value = value.as_ref().unwrap().as_str_unchecked();
             let mut input = ParserInput::new(&value);
             let mut parser = Parser::new(&mut input);
             let url_data = dummy_url_data();
             let context = ParserContext::new(
@@ -3165,19 +3098,19 @@ counter_style_descriptors! {
     invalid: [
         eCSSCounterDesc_UNKNOWN,
         eCSSCounterDesc_COUNT,
     ]
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_ComputedValues_GetForAnonymousBox(
-    parent_style_or_null: ComputedStyleBorrowedOrNull,
+    parent_style_or_null: Option<&ComputedValues>,
     pseudo: PseudoStyleType,
-    raw_data: RawServoStyleSetBorrowed,
+    raw_data: &RawServoStyleSet,
 ) -> ComputedStyleStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let guards = StylesheetGuards::same(&guard);
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let pseudo = PseudoElement::from_pseudo_type(pseudo).unwrap();
     debug_assert!(pseudo.is_anon_box());
 
@@ -3219,21 +3152,21 @@ pub unsafe extern "C" fn Servo_ComputedV
             &metrics,
             rule_node,
         )
         .into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ResolvePseudoStyle(
-    element: RawGeckoElementBorrowed,
+    element: &RawGeckoElement,
     pseudo_type: PseudoStyleType,
     is_probe: bool,
-    inherited_style: ComputedStyleBorrowedOrNull,
-    raw_data: RawServoStyleSetBorrowed,
+    inherited_style: Option<&ComputedValues>,
+    raw_data: &RawServoStyleSet,
 ) -> ComputedStyleStrong {
     let element = GeckoElement(element);
     let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
 
     debug!(
         "Servo_ResolvePseudoStyle: {:?} {:?}, is_probe: {}",
         element,
         PseudoElement::from_pseudo_type(pseudo_type),
@@ -3298,21 +3231,21 @@ fn debug_atom_array(atoms: &AtomArray) -
         }
     }
     result.push(']');
     result
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ComputedValues_ResolveXULTreePseudoStyle(
-    element: RawGeckoElementBorrowed,
+    element: &RawGeckoElement,
     pseudo_tag: *mut nsAtom,
-    inherited_style: ComputedStyleBorrowed,
+    inherited_style: &ComputedValues,
     input_word: *const AtomArray,
-    raw_data: RawServoStyleSetBorrowed,
+    raw_data: &RawServoStyleSet,
 ) -> ComputedStyleStrong {
     let element = GeckoElement(element);
     let data = element
         .borrow_data()
         .expect("Calling ResolveXULTreePseudoStyle on unstyled element?");
 
     let pseudo = unsafe {
         Atom::with(pseudo_tag, |atom| {
@@ -3353,33 +3286,33 @@ pub extern "C" fn Servo_ComputedValues_R
         Some(&matching_fn),
     )
     .unwrap()
     .into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_SetExplicitStyle(
-    element: RawGeckoElementBorrowed,
-    style: ComputedStyleBorrowed,
+    element: &RawGeckoElement,
+    style: &ComputedValues,
 ) {
     let element = GeckoElement(element);
     debug!("Servo_SetExplicitStyle: {:?}", element);
     // We only support this API for initial styling. There's no reason it couldn't
     // work for other things, we just haven't had a reason to do so.
     debug_assert!(element.get_data().is_none());
     let mut data = unsafe { element.ensure_data() };
     data.styles.primary = Some(unsafe { ArcBorrow::from_ref(style) }.clone_arc());
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_HasAuthorSpecifiedRules(
-    raw_data: RawServoStyleSetBorrowed,
-    style: ComputedStyleBorrowed,
-    element: RawGeckoElementBorrowed,
+    raw_data: &RawServoStyleSet,
+    style: &ComputedValues,
+    element: &RawGeckoElement,
     rule_type_mask: u32,
 ) -> bool {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let element = GeckoElement(element);
 
     let guard = (*GLOBAL_STYLE_DATA).shared_lock.read();
     let guards = StylesheetGuards::same(&guard);
 
@@ -3493,19 +3426,19 @@ fn get_pseudo_style(
             Some(pseudo),
         )
         .build()
     }))
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_ComputedValues_Inherit(
-    raw_data: RawServoStyleSetBorrowed,
+    raw_data: &RawServoStyleSet,
     pseudo: PseudoStyleType,
-    parent_style_context: ComputedStyleBorrowedOrNull,
+    parent_style_context: Option<&ComputedValues>,
     target: structs::InheritTarget,
 ) -> ComputedStyleStrong {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
 
     let for_text = target == structs::InheritTarget::Text;
     let pseudo = PseudoElement::from_pseudo_type(pseudo).unwrap();
     debug_assert!(pseudo.is_anon_box());
 
@@ -3516,34 +3449,26 @@ pub unsafe extern "C" fn Servo_ComputedV
         StyleAdjuster::new(&mut style).adjust_for_text();
     }
 
     style.build().into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ComputedValues_SpecifiesAnimationsOrTransitions(
-    values: ComputedStyleBorrowed,
+    values: &ComputedValues,
 ) -> bool {
     let b = values.get_box();
     b.specifies_animations() || b.specifies_transitions()
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_ComputedValues_EqualCustomProperties(
-    first: ServoComputedDataBorrowed,
-    second: ServoComputedDataBorrowed,
-) -> bool {
-    first.custom_properties == second.custom_properties
-}
-
-#[no_mangle]
 pub extern "C" fn Servo_ComputedValues_GetStyleRuleList(
-    values: ComputedStyleBorrowed,
-    rules: RawGeckoServoStyleRuleListBorrowedMut,
+    values: &ComputedValues,
+    rules: &mut nsTArray<*const RawServoStyleRule>,
 ) {
     let rule_node = match values.rules {
         Some(ref r) => r,
         None => return,
     };
 
     let mut result = SmallVec::<[_; 10]>::new();
     for node in rule_node.self_and_ancestors() {
@@ -3570,36 +3495,36 @@ pub extern "C" fn Servo_ComputedValues_G
     }))
 }
 
 /// See the comment in `Device` to see why it's ok to pass an owned reference to
 /// the pres context (hint: the context outlives the StyleSet, that holds the
 /// device alive).
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_Init(
-    pres_context: RawGeckoPresContextBorrowed,
+    pres_context: &structs::nsPresContext,
 ) -> *mut RawServoStyleSet {
     let doc = pres_context.mDocument.mRawPtr;
     let data = Box::new(PerDocumentStyleData::new(doc));
     Box::into_raw(data) as *mut RawServoStyleSet
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_StyleSet_RebuildCachedData(raw_data: RawServoStyleSetBorrowed) {
+pub extern "C" fn Servo_StyleSet_RebuildCachedData(raw_data: &RawServoStyleSet) {
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     data.stylist.device_mut().rebuild_cached_data();
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_StyleSet_Drop(data: RawServoStyleSetOwned) {
+pub extern "C" fn Servo_StyleSet_Drop(data: bindings::RawServoStyleSetOwned) {
     let _ = data.into_box::<PerDocumentStyleData>();
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn Servo_StyleSet_CompatModeChanged(raw_data: RawServoStyleSetBorrowed) {
+pub unsafe extern "C" fn Servo_StyleSet_CompatModeChanged(raw_data: &RawServoStyleSet) {
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let quirks_mode = data.stylist.device().document().mCompatMode;
     data.stylist.set_quirks_mode(quirks_mode.into());
 }
 
 fn parse_property_into(
     declarations: &mut SourcePropertyDeclaration,
     property_id: PropertyId,
@@ -3628,19 +3553,19 @@ fn parse_property_into(
 #[no_mangle]
 pub extern "C" fn Servo_ParseProperty(
     property: nsCSSPropertyID,
     value: *const nsACString,
     data: *mut URLExtraData,
     parsing_mode: structs::ParsingMode,
     quirks_mode: nsCompatibility,
     loader: *mut Loader,
-) -> RawServoDeclarationBlockStrong {
+) -> bindings::RawServoDeclarationBlockStrong {
     let id =
-        get_property_id_from_nscsspropertyid!(property, RawServoDeclarationBlockStrong::null());
+        get_property_id_from_nscsspropertyid!(property, Strong::null());
     let mut declarations = SourcePropertyDeclaration::new();
     let reporter = ErrorReporter::new(ptr::null_mut(), loader, data);
     let result = parse_property_into(
         &mut declarations,
         id,
         value,
         data,
         parsing_mode,
@@ -3650,25 +3575,25 @@ pub extern "C" fn Servo_ParseProperty(
 
     match result {
         Ok(()) => {
             let global_style_data = &*GLOBAL_STYLE_DATA;
             let mut block = PropertyDeclarationBlock::new();
             block.extend(declarations.drain(), Importance::Normal);
             Arc::new(global_style_data.shared_lock.wrap(block)).into_strong()
         },
-        Err(_) => RawServoDeclarationBlockStrong::null(),
+        Err(_) => Strong::null(),
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ParseEasing(
     easing: *const nsAString,
     data: *mut URLExtraData,
-    output: nsTimingFunctionBorrowedMut,
+    output: &mut nsTimingFunction,
 ) -> bool {
     use style::properties::longhands::transition_timing_function;
 
     // FIXME Dummy URL data would work fine here.
     let url_data = unsafe { UrlExtraData::from_ptr_ref(&data) };
     let context = ParserContext::new(
         Origin::Author,
         url_data,
@@ -3690,17 +3615,17 @@ pub extern "C" fn Servo_ParseEasing(
             true
         },
         Err(_) => false,
     }
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SerializeEasing(
-    easing: nsTimingFunctionBorrowed,
+    easing: &nsTimingFunction,
     output: *mut nsAString,
 ) {
     easing
         .mTiming
         .to_css(&mut CssWriter::new(&mut *output))
         .unwrap();
 }
 
@@ -3710,19 +3635,19 @@ pub unsafe extern "C" fn Servo_Serialize
     radius: *const computed::BorderRadius,
     output: *mut nsAString,
 ) {
     (*radius).to_css(&mut CssWriter::new(&mut *output)).unwrap();
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_GetProperties_Overriding_Animation(
-    element: RawGeckoElementBorrowed,
-    list: RawGeckoCSSPropertyIDListBorrowed,
-    set: nsCSSPropertyIDSetBorrowedMut,
+    element: &RawGeckoElement,
+    list: &nsTArray<nsCSSPropertyID>,
+    set: &mut structs::nsCSSPropertyIDSet,
 ) {
     let element = GeckoElement(element);
     let element_data = match element.borrow_data() {
         Some(data) => data,
         None => return,
     };
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
@@ -3748,20 +3673,20 @@ pub extern "C" fn Servo_GetProperties_Ov
             },
         }
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MatrixTransform_Operate(
     matrix_operator: MatrixTransformOperator,
-    from: *const RawGeckoGfxMatrix4x4,
-    to: *const RawGeckoGfxMatrix4x4,
+    from: *const structs::Matrix4x4Components,
+    to: *const structs::Matrix4x4Components,
     progress: f64,
-    output: *mut RawGeckoGfxMatrix4x4,
+    output: *mut structs::Matrix4x4Components,
 ) {
     use self::MatrixTransformOperator::{Accumulate, Interpolate};
     use style::values::computed::transform::Matrix3D;
 
     let from = Matrix3D::from(unsafe { from.as_ref() }.expect("not a valid 'from' matrix"));
     let to = Matrix3D::from(unsafe { to.as_ref() }.expect("not a valid 'to' matrix"));
     let result = match matrix_operator {
         Interpolate => from.animate(&to, Procedure::Interpolate { progress }),
@@ -3784,88 +3709,88 @@ pub extern "C" fn Servo_MatrixTransform_
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_ParseStyleAttribute(
     data: *const nsACString,
     raw_extra_data: *mut URLExtraData,
     quirks_mode: nsCompatibility,
     loader: *mut Loader,
-) -> RawServoDeclarationBlockStrong {
+) -> bindings::RawServoDeclarationBlockStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let value = (*data).as_str_unchecked();
     let reporter = ErrorReporter::new(ptr::null_mut(), loader, raw_extra_data);
     let url_data = UrlExtraData::from_ptr_ref(&raw_extra_data);
     Arc::new(global_style_data.shared_lock.wrap(parse_style_attribute(
         value,
         url_data,
         reporter.as_ref().map(|r| r as &ParseErrorReporter),
         quirks_mode.into(),
     )))
     .into_strong()
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_DeclarationBlock_CreateEmpty() -> RawServoDeclarationBlockStrong {
+pub extern "C" fn Servo_DeclarationBlock_CreateEmpty() -> bindings::RawServoDeclarationBlockStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     Arc::new(
         global_style_data
             .shared_lock
             .wrap(PropertyDeclarationBlock::new()),
     )
     .into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_Clone(
-    declarations: RawServoDeclarationBlockBorrowed,
-) -> RawServoDeclarationBlockStrong {
+    declarations: &RawServoDeclarationBlock,
+) -> bindings::RawServoDeclarationBlockStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let declarations = Locked::<PropertyDeclarationBlock>::as_arc(&declarations);
     Arc::new(
         global_style_data
             .shared_lock
             .wrap(declarations.read_with(&guard).clone()),
     )
     .into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_Equals(
-    a: RawServoDeclarationBlockBorrowed,
-    b: RawServoDeclarationBlockBorrowed,
+    a: &RawServoDeclarationBlock,
+    b: &RawServoDeclarationBlock,
 ) -> bool {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     *Locked::<PropertyDeclarationBlock>::as_arc(&a)
         .read_with(&guard)
         .declarations() ==
         *Locked::<PropertyDeclarationBlock>::as_arc(&b)
             .read_with(&guard)
             .declarations()
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_GetCssText(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     result: *mut nsAString,
 ) {
     read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
         decls.to_css(&mut *result).unwrap()
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SerializeOneValue(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property_id: nsCSSPropertyID,
     buffer: *mut nsAString,
-    computed_values: ComputedStyleBorrowedOrNull,
-    custom_properties: RawServoDeclarationBlockBorrowedOrNull,
+    computed_values: Option<&ComputedValues>,
+    custom_properties: Option<&RawServoDeclarationBlock>,
 ) {
     let property_id = get_property_id_from_nscsspropertyid!(property_id, ());
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let decls = Locked::<PropertyDeclarationBlock>::as_arc(&declarations).read_with(&guard);
 
     let custom_properties =
@@ -3873,17 +3798,17 @@ pub extern "C" fn Servo_DeclarationBlock
     let custom_properties = custom_properties.map(|block| block.read_with(&guard));
     let buffer = unsafe { buffer.as_mut().unwrap() };
     let rv = decls.single_value_to_css(&property_id, buffer, computed_values, custom_properties);
     debug_assert!(rv.is_ok());
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SerializeFontValueForCanvas(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     buffer: *mut nsAString,
 ) {
     use style::properties::shorthands::font;
     read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
         let longhands = match font::LonghandsToSerialize::from_iter(decls.declarations().iter()) {
             Ok(l) => l,
             Err(()) => {
                 warn!("Unexpected property!");
@@ -3893,26 +3818,26 @@ pub unsafe extern "C" fn Servo_Serialize
 
         let rv = longhands.to_css(&mut CssWriter::new(&mut *buffer));
         debug_assert!(rv.is_ok());
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_Count(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
 ) -> u32 {
     read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
         decls.declarations().len() as u32
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_GetNthProperty(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     index: u32,
     result: *mut nsAString,
 ) -> bool {
     read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
         if let Some(decl) = decls.declarations().get(index as usize) {
             let result = unsafe { result.as_mut().unwrap() };
             result.assign_str(&decl.id().name());
             true
@@ -3928,69 +3853,69 @@ macro_rules! get_property_id_from_proper
         match PropertyId::parse_enabled_for_all_content(property) {
             Ok(property_id) => property_id,
             Err(_) => return $ret,
         }
     }};
 }
 
 unsafe fn get_property_value(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property_id: PropertyId,
     value: *mut nsAString,
 ) {
     // This callsite is hot enough that the lock acquisition shows up in profiles.
     // Using an unchecked read here improves our performance by ~10% on the
     // microbenchmark in bug 1355599.
     read_locked_arc_unchecked(declarations, |decls: &PropertyDeclarationBlock| {
         decls
             .property_value_to_css(&property_id, value.as_mut().unwrap())
             .unwrap();
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_GetPropertyValue(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: *const nsACString,
     value: *mut nsAString,
 ) {
     get_property_value(
         declarations,
         get_property_id_from_property!(property, ()),
         value,
     )
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_GetPropertyValueById(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
     value: *mut nsAString,
 ) {
     get_property_value(
         declarations,
         get_property_id_from_nscsspropertyid!(property, ()),
         value,
     )
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_GetPropertyIsImportant(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: *const nsACString,
 ) -> bool {
     let property_id = get_property_id_from_property!(property, false);
     read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
         decls.property_priority(&property_id).important()
     })
 }
 
 fn set_property(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property_id: PropertyId,
     value: *const nsACString,
     is_important: bool,
     data: *mut URLExtraData,
     parsing_mode: structs::ParsingMode,
     quirks_mode: QuirksMode,
     loader: *mut Loader,
     before_change_closure: DeclarationBlockMutationClosure,
@@ -4028,17 +3953,17 @@ fn set_property(
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.update(source_declarations.drain(), importance, &mut updates)
     });
     true
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_SetProperty(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: *const nsACString,
     value: *const nsACString,
     is_important: bool,
     data: *mut URLExtraData,
     parsing_mode: structs::ParsingMode,
     quirks_mode: nsCompatibility,
     loader: *mut Loader,
     before_change_closure: DeclarationBlockMutationClosure,
@@ -4053,30 +3978,30 @@ pub unsafe extern "C" fn Servo_Declarati
         quirks_mode.into(),
         loader,
         before_change_closure,
     )
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_SetPropertyToAnimationValue(
-    declarations: RawServoDeclarationBlockBorrowed,
-    animation_value: RawServoAnimationValueBorrowed,
+    declarations: &RawServoDeclarationBlock,
+    animation_value: &RawServoAnimationValue,
 ) -> bool {
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(
             AnimationValue::as_arc(&animation_value).uncompute(),
             Importance::Normal,
         )
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_SetPropertyById(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
     value: *const nsACString,
     is_important: bool,
     data: *mut URLExtraData,
     parsing_mode: structs::ParsingMode,
     quirks_mode: nsCompatibility,
     loader: *mut Loader,
     before_change_closure: DeclarationBlockMutationClosure,
@@ -4090,17 +4015,17 @@ pub unsafe extern "C" fn Servo_Declarati
         parsing_mode,
         quirks_mode.into(),
         loader,
         before_change_closure,
     )
 }
 
 fn remove_property(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property_id: PropertyId,
     before_change_closure: DeclarationBlockMutationClosure,
 ) -> bool {
     let first_declaration = read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
         decls.first_declaration_to_remove(&property_id)
     });
 
     let first_declaration = match first_declaration {
@@ -4113,92 +4038,92 @@ fn remove_property(
         decls.remove_property(&property_id, first_declaration)
     });
 
     true
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_RemoveProperty(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: *const nsACString,
     before_change_closure: DeclarationBlockMutationClosure,
 ) -> bool {
     remove_property(
         declarations,
         get_property_id_from_property!(property, false),
         before_change_closure,
     )
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_RemovePropertyById(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
     before_change_closure: DeclarationBlockMutationClosure,
 ) -> bool {
     remove_property(
         declarations,
         get_property_id_from_nscsspropertyid!(property, false),
         before_change_closure,
     )
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_MediaList_Create() -> RawServoMediaListStrong {
+pub extern "C" fn Servo_MediaList_Create() -> bindings::RawServoMediaListStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     Arc::new(global_style_data.shared_lock.wrap(MediaList::empty())).into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MediaList_DeepClone(
-    list: RawServoMediaListBorrowed,
-) -> RawServoMediaListStrong {
+    list: &RawServoMediaList,
+) -> bindings::RawServoMediaListStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     read_locked_arc(list, |list: &MediaList| {
         Arc::new(global_style_data.shared_lock.wrap(list.clone())).into_strong()
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MediaList_Matches(
-    list: RawServoMediaListBorrowed,
-    raw_data: RawServoStyleSetBorrowed,
+    list: &RawServoMediaList,
+    raw_data: &RawServoStyleSet,
 ) -> bool {
     let per_doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     read_locked_arc(list, |list: &MediaList| {
         list.evaluate(
             per_doc_data.stylist.device(),
             per_doc_data.stylist.quirks_mode(),
         )
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_HasCSSWideKeyword(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
 ) -> bool {
     let property_id = get_property_id_from_nscsspropertyid!(property, false);
     read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
         decls.has_css_wide_keyword(&property_id)
     })
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_MediaList_GetText(list: RawServoMediaListBorrowed, result: *mut nsAString) {
+pub extern "C" fn Servo_MediaList_GetText(list: &RawServoMediaList, result: *mut nsAString) {
     read_locked_arc(list, |list: &MediaList| {
         list.to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
             .unwrap();
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_MediaList_SetText(
-    list: RawServoMediaListBorrowed,
+    list: &RawServoMediaList,
     text: *const nsACString,
     caller_type: CallerType,
 ) {
     let text = (*text).as_str_unchecked();
 
     let mut input = ParserInput::new(&text);
     let mut parser = Parser::new(&mut input);
     let url_data = dummy_url_data();
@@ -4225,23 +4150,23 @@ pub unsafe extern "C" fn Servo_MediaList
     );
 
     write_locked_arc(list, |list: &mut MediaList| {
         *list = MediaList::parse(&context, &mut parser);
     })
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_MediaList_GetLength(list: RawServoMediaListBorrowed) -> u32 {
+pub extern "C" fn Servo_MediaList_GetLength(list: &RawServoMediaList) -> u32 {
     read_locked_arc(list, |list: &MediaList| list.media_queries.len() as u32)
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MediaList_GetMediumAt(
-    list: RawServoMediaListBorrowed,
+    list: &RawServoMediaList,
     index: u32,
     result: *mut nsAString,
 ) -> bool {
     read_locked_arc(list, |list: &MediaList| {
         if let Some(media_query) = list.media_queries.get(index as usize) {
             media_query
                 .to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
                 .unwrap();
@@ -4249,17 +4174,17 @@ pub extern "C" fn Servo_MediaList_GetMed
         } else {
             false
         }
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MediaList_AppendMedium(
-    list: RawServoMediaListBorrowed,
+    list: &RawServoMediaList,
     new_medium: *const nsACString,
 ) {
     let new_medium = unsafe { new_medium.as_ref().unwrap().as_str_unchecked() };
     let url_data = unsafe { dummy_url_data() };
     let context = ParserContext::new_for_cssom(
         url_data,
         Some(CssRuleType::Media),
         ParsingMode::DEFAULT,
@@ -4269,17 +4194,17 @@ pub extern "C" fn Servo_MediaList_Append
     );
     write_locked_arc(list, |list: &mut MediaList| {
         list.append_medium(&context, new_medium);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MediaList_DeleteMedium(
-    list: RawServoMediaListBorrowed,
+    list: &RawServoMediaList,
     old_medium: *const nsACString,
 ) -> bool {
     let old_medium = unsafe { old_medium.as_ref().unwrap().as_str_unchecked() };
     let url_data = unsafe { dummy_url_data() };
     let context = ParserContext::new_for_cssom(
         url_data,
         Some(CssRuleType::Media),
         ParsingMode::DEFAULT,
@@ -4291,17 +4216,17 @@ pub extern "C" fn Servo_MediaList_Delete
         list.delete_medium(&context, old_medium)
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MediaList_SizeOfIncludingThis(
     malloc_size_of: GeckoMallocSizeOf,
     malloc_enclosing_size_of: GeckoMallocSizeOf,
-    list: RawServoMediaListBorrowed,
+    list: &RawServoMediaList,
 ) -> usize {
     use malloc_size_of::MallocSizeOf;
     use malloc_size_of::MallocUnconditionalShallowSizeOf;
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
 
     let mut ops = MallocSizeOfOps::new(
@@ -4339,27 +4264,27 @@ macro_rules! match_wrap_declared {
                 panic!("stylo: Don't know how to handle presentation property");
             }
         }
     )
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_PropertyIsSet(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
 ) -> bool {
     read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
         decls.contains(get_longhand_from_id!(property))
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_SetIdentStringValue(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
     value: *mut nsAtom,
 ) {
     use style::properties::longhands::_x_lang::computed_value::T as Lang;
     use style::properties::{LonghandId, PropertyDeclaration};
 
     let long = get_longhand_from_id!(property);
     let prop = match_wrap_declared! { long,
@@ -4368,17 +4293,17 @@ pub unsafe extern "C" fn Servo_Declarati
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(prop, Importance::Normal);
     })
 }
 
 #[no_mangle]
 #[allow(unreachable_code)]
 pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
     value: i32,
 ) {
     use num_traits::FromPrimitive;
     use style::properties::longhands;
     use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::generics::font::FontStyle;
     use style::values::specified::BorderStyle;
@@ -4432,17 +4357,17 @@ pub extern "C" fn Servo_DeclarationBlock
     };
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(prop, Importance::Normal);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetIntValue(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
     value: i32,
 ) {
     use style::properties::longhands::_moz_script_level::SpecifiedValue as MozScriptLevel;
     use style::properties::longhands::_x_span::computed_value::T as Span;
     use style::properties::{LonghandId, PropertyDeclaration};
 
     let long = get_longhand_from_id!(property);
@@ -4453,17 +4378,17 @@ pub extern "C" fn Servo_DeclarationBlock
     };
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(prop, Importance::Normal);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetPixelValue(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
     value: f32,
 ) {
     use style::properties::longhands::border_spacing::SpecifiedValue as BorderSpacing;
     use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::generics::length::Size;
     use style::values::generics::NonNegative;
     use style::values::generics::length::LengthPercentageOrAuto;
@@ -4514,17 +4439,17 @@ pub extern "C" fn Servo_DeclarationBlock
     };
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(prop, Importance::Normal);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetLengthValue(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
     value: f32,
     unit: structs::nsCSSUnit,
 ) {
     use style::properties::longhands::_moz_script_min_size::SpecifiedValue as MozScriptMinSize;
     use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::generics::NonNegative;
     use style::values::generics::length::Size;
@@ -4561,17 +4486,17 @@ pub extern "C" fn Servo_DeclarationBlock
     };
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(prop, Importance::Normal);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetNumberValue(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
     value: f32,
 ) {
     use style::properties::longhands::_moz_script_level::SpecifiedValue as MozScriptLevel;
     use style::properties::longhands::_moz_script_size_multiplier::SpecifiedValue as MozScriptSizeMultiplier;
     use style::properties::{LonghandId, PropertyDeclaration};
 
     let long = get_longhand_from_id!(property);
@@ -4583,17 +4508,17 @@ pub extern "C" fn Servo_DeclarationBlock
     };
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(prop, Importance::Normal);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetPercentValue(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
     value: f32,
 ) {
     use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::computed::Percentage;
     use style::values::generics::NonNegative;
     use style::values::generics::length::{Size, LengthPercentageOrAuto};
     use style::values::specified::length::LengthPercentage;
@@ -4614,17 +4539,17 @@ pub extern "C" fn Servo_DeclarationBlock
     };
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(prop, Importance::Normal);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetAutoValue(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
 ) {
     use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::generics::length::{LengthPercentageOrAuto, Size};
 
     let long = get_longhand_from_id!(property);
     let auto = LengthPercentageOrAuto::Auto;
 
@@ -4638,17 +4563,17 @@ pub extern "C" fn Servo_DeclarationBlock
     };
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(prop, Importance::Normal);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetCurrentColor(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
 ) {
     use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::specified::Color;
 
     let long = get_longhand_from_id!(property);
     let cc = Color::currentcolor();
 
@@ -4660,17 +4585,17 @@ pub extern "C" fn Servo_DeclarationBlock
     };
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(prop, Importance::Normal);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetColorValue(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     property: nsCSSPropertyID,
     value: structs::nscolor,
 ) {
     use style::gecko::values::convert_nscolor_to_rgba;
     use style::properties::longhands;
     use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::specified::Color;
 
@@ -4688,17 +4613,17 @@ pub extern "C" fn Servo_DeclarationBlock
     };
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(prop, Importance::Normal);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetFontFamily(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     value: *const nsAString,
 ) {
     use cssparser::{Parser, ParserInput};
     use style::properties::longhands::font_family::SpecifiedValue as FontFamily;
     use style::properties::PropertyDeclaration;
 
     let string = unsafe { (*value).to_string() };
     let mut input = ParserInput::new(&string);
@@ -4711,17 +4636,17 @@ pub extern "C" fn Servo_DeclarationBlock
                 decls.push(decl, Importance::Normal);
             })
         }
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetBackgroundImage(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
     value: *const nsAString,
     raw_extra_data: *mut URLExtraData,
 ) {
     use style::properties::longhands::background_image::SpecifiedValue as BackgroundImage;
     use style::properties::PropertyDeclaration;
     use style::values::generics::image::Image;
     use style::values::specified::url::SpecifiedImageUrl;
     use style::values::Either;
@@ -4743,17 +4668,17 @@ pub extern "C" fn Servo_DeclarationBlock
     )]));
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(decl, Importance::Normal);
     });
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetTextDecorationColorOverride(
-    declarations: RawServoDeclarationBlockBorrowed,
+    declarations: &RawServoDeclarationBlock,
 ) {
     use style::properties::PropertyDeclaration;
     use style::values::specified::text::TextDecorationLine;
 
     let decoration = TextDecorationLine::COLOR_OVERRIDE;
     let decl = PropertyDeclaration::TextDecorationLine(decoration);
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(decl, Importance::Normal);
@@ -4804,26 +4729,26 @@ pub extern "C" fn Servo_CSSSupports(cond
     );
 
     let namespaces = Default::default();
     cond.eval(&context, &namespaces)
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_NoteExplicitHints(
-    element: RawGeckoElementBorrowed,
+    element: &RawGeckoElement,
     restyle_hint: RestyleHint,
     change_hint: nsChangeHint,
 ) {
     GeckoElement(element).note_explicit_hints(restyle_hint, change_hint);
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_TakeChangeHint(
-    element: RawGeckoElementBorrowed,
+    element: &RawGeckoElement,
     was_restyled: *mut bool,
 ) -> u32 {
     let was_restyled = unsafe { was_restyled.as_mut().unwrap() };
     let element = GeckoElement(element);
 
     let damage = match element.mutate_data() {
         Some(mut data) => {
             *was_restyled = data.is_restyle();
@@ -4843,18 +4768,18 @@ pub extern "C" fn Servo_TakeChangeHint(
     // We'd like to return `nsChangeHint` here, but bindgen bitfield enums don't
     // work as return values with the Linux 32-bit ABI at the moment because
     // they wrap the value in a struct, so for now just unwrap it.
     damage.as_change_hint().0
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ResolveStyle(
-    element: RawGeckoElementBorrowed,
-    _raw_data: RawServoStyleSetBorrowed,
+    element: &RawGeckoElement,
+    _raw_data: &RawServoStyleSet,
 ) -> ComputedStyleStrong {
     let element = GeckoElement(element);
     debug!("Servo_ResolveStyle: {:?}", element);
     let data = element
         .borrow_data()
         .expect("Resolving style on unstyled element");
 
     debug_assert!(
@@ -4863,21 +4788,21 @@ pub extern "C" fn Servo_ResolveStyle(
         element,
         data
     );
     data.styles.primary().clone().into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ResolveStyleLazily(
-    element: RawGeckoElementBorrowed,
+    element: &RawGeckoElement,
     pseudo_type: PseudoStyleType,
     rule_inclusion: StyleRuleInclusion,
     snapshots: *const ServoElementSnapshotTable,
-    raw_data: RawServoStyleSetBorrowed,
+    raw_data: &RawServoStyleSet,
 ) -> ComputedStyleStrong {
     debug_assert!(!snapshots.is_null());
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let element = GeckoElement(element);
     let doc_data = PerDocumentStyleData::from_ffi(raw_data);
     let data = doc_data.borrow();
     let rule_inclusion = RuleInclusion::from(rule_inclusion);
@@ -4940,22 +4865,22 @@ pub extern "C" fn Servo_ResolveStyleLazi
 
     finish(&styles, /* is_probe = */ false)
         .expect("We're not probing, so we should always get a style back")
         .into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ReparentStyle(
-    style_to_reparent: ComputedStyleBorrowed,
-    parent_style: ComputedStyleBorrowed,
-    parent_style_ignoring_first_line: ComputedStyleBorrowed,
-    layout_parent_style: ComputedStyleBorrowed,
-    element: RawGeckoElementBorrowedOrNull,
-    raw_data: RawServoStyleSetBorrowed,
+    style_to_reparent: &ComputedValues,
+    parent_style: &ComputedValues,
+    parent_style_ignoring_first_line: &ComputedValues,
+    layout_parent_style: &ComputedValues,
+    element: Option<&RawGeckoElement>,
+    raw_data: &RawServoStyleSet,
 ) -> ComputedStyleStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let inputs = CascadeInputs::new_from_style(style_to_reparent);
     let metrics = get_metrics_provider_for_product();
     let pseudo = style_to_reparent.pseudo();
     let element = element.map(GeckoElement);
@@ -5057,21 +4982,21 @@ impl<'a> Iterator for PrioritizedPropert
         }
         self.curr += 1;
         Some(&self.properties[self.sorted_property_indices[self.curr - 1].index])
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_GetComputedKeyframeValues(
-    keyframes: RawGeckoKeyframeListBorrowed,
-    element: RawGeckoElementBorrowed,
-    style: ComputedStyleBorrowed,
-    raw_data: RawServoStyleSetBorrowed,
-    computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut,
+    keyframes: &nsTArray<structs::Keyframe>,
+    element: &RawGeckoElement,
+    style: &ComputedValues,
+    raw_data: &RawServoStyleSet,
+    computed_keyframes: &mut nsTArray<structs::ComputedKeyframeValues>,
 ) {
     use style::properties::LonghandIdSet;
 
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let metrics = get_metrics_provider_for_product();
 
     let element = GeckoElement(element);
     let parent_element = element.inheritance_parent();
@@ -5170,21 +5095,21 @@ pub extern "C" fn Servo_GetComputedKeyfr
                 maybe_append_animation_value(id, Some(value));
             }
         }
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_GetAnimationValues(
-    declarations: RawServoDeclarationBlockBorrowed,
-    element: RawGeckoElementBorrowed,
-    style: ComputedStyleBorrowed,
-    raw_data: RawServoStyleSetBorrowed,
-    animation_values: RawGeckoServoAnimationValueListBorrowedMut,
+    declarations: &RawServoDeclarationBlock,
+    element: &RawGeckoElement,
+    style: &ComputedValues,
+    raw_data: &RawServoStyleSet,
+    animation_values: &mut nsTArray<structs::RefPtr<structs::RawServoAnimationValue>>,
 ) {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let metrics = get_metrics_provider_for_product();
 
     let element = GeckoElement(element);
     let parent_element = element.inheritance_parent();
     let parent_data = parent_element.as_ref().and_then(|e| e.borrow_data());
     let parent_style = parent_data
@@ -5216,21 +5141,21 @@ pub extern "C" fn Servo_GetAnimationValu
     for (index, anim) in iter.enumerate() {
         unsafe { animation_values.set_len((index + 1) as u32) };
         animation_values[index].set_arc_leaky(Arc::new(anim));
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_Compute(
-    element: RawGeckoElementBorrowed,
-    declarations: RawServoDeclarationBlockBorrowed,
-    style: ComputedStyleBorrowed,
-    raw_data: RawServoStyleSetBorrowed,
-) -> RawServoAnimationValueStrong {
+    element: &RawGeckoElement,
+    declarations: &RawServoDeclarationBlock,
+    style: &ComputedValues,
+    raw_data: &RawServoStyleSet,
+) -> bindings::RawServoAnimationValueStrong {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let metrics = get_metrics_provider_for_product();
 
     let element = GeckoElement(element);
     let parent_element = element.inheritance_parent();
     let parent_data = parent_element.as_ref().and_then(|e| e.borrow_data());
     let parent_style = parent_data
         .as_ref()
@@ -5259,26 +5184,26 @@ pub extern "C" fn Servo_AnimationValue_C
     {
         Some((decl, imp)) if imp == Importance::Normal => {
             let animation = AnimationValue::from_declaration(
                 decl,
                 &mut context,
                 None, // No extra custom properties for devtools.
                 default_values,
             );
-            animation.map_or(RawServoAnimationValueStrong::null(), |value| {
+            animation.map_or(Strong::null(), |value| {
                 Arc::new(value).into_strong()
             })
         },
-        _ => RawServoAnimationValueStrong::null(),
+        _ => Strong::null(),
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_AssertTreeIsClean(root: RawGeckoElementBorrowed) {
+pub extern "C" fn Servo_AssertTreeIsClean(root: &RawGeckoElement) {
     if !cfg!(feature = "gecko_debug") {
         panic!("Calling Servo_AssertTreeIsClean in release build");
     }
 
     let root = GeckoElement(root);
     debug!("Servo_AssertTreeIsClean: ");
     debug!("{:?}", ShowSubtreeData(root.as_node()));
 
@@ -5307,20 +5232,20 @@ pub extern "C" fn Servo_IsWorkerThread()
 
 enum Offset {
     Zero,
     One,
 }
 
 fn fill_in_missing_keyframe_values(
     all_properties: &LonghandIdSet,
-    timing_function: nsTimingFunctionBorrowed,
+    timing_function: &nsTimingFunction,
     longhands_at_offset: &LonghandIdSet,
     offset: Offset,
-    keyframes: RawGeckoKeyframeListBorrowedMut,
+    keyframes: &mut nsTArray<structs::Keyframe>,
 ) {
     // Return early if all animated properties are already set.
     if longhands_at_offset.contains_all(all_properties) {
         return;
     }
 
     let keyframe = match offset {
         Offset::Zero => unsafe { Gecko_GetOrCreateInitialKeyframe(keyframes, timing_function) },
@@ -5337,22 +5262,22 @@ fn fill_in_missing_keyframe_values(
                 );
             }
         }
     }
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_StyleSet_GetKeyframesForName(
-    raw_data: RawServoStyleSetBorrowed,
-    element: RawGeckoElementBorrowed,
-    style: ComputedStyleBorrowed,
+    raw_data: &RawServoStyleSet,
+    element: &RawGeckoElement,
+    style: &ComputedValues,
     name: *mut nsAtom,
-    inherited_timing_function: nsTimingFunctionBorrowed,
-    keyframes: RawGeckoKeyframeListBorrowedMut,
+    inherited_timing_function: &nsTimingFunction,
+    keyframes: &mut nsTArray<structs::Keyframe>,
 ) -> bool {
     debug_assert!(keyframes.len() == 0, "keyframes should be initially empty");
 
     let element = GeckoElement(element);
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let name = Atom::from_raw(name);
 
     let animation = match data.stylist.get_animation(&name, element) {
@@ -5522,18 +5447,18 @@ pub unsafe extern "C" fn Servo_StyleSet_
             keyframes,
         );
     }
     true
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_GetFontFaceRules(
-    raw_data: RawServoStyleSetBorrowed,
-    rules: RawGeckoFontFaceRuleListBorrowedMut,
+    raw_data: &RawServoStyleSet,
+    rules: &mut nsTArray<structs::nsFontFaceRuleContainer>,
 ) {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     debug_assert_eq!(rules.len(), 0);
 
     let len: u32 = data
         .stylist
         .iter_extra_data_origins()
         .map(|(d, _)| d.font_faces.len() as u32)
@@ -5548,38 +5473,38 @@ pub extern "C" fn Servo_StyleSet_GetFont
 
     unsafe { rules.set_len(len) };
     for (src, dest) in font_face_iter.zip(rules.iter_mut()) {
         dest.mRule.set_arc_leaky(src.0.clone());
         dest.mSheetType = src.1.into();
     }
 }
 
-// XXX Ideally this should return a RawServoCounterStyleRuleBorrowedOrNull,
+// XXX Ideally this should return a Option<&RawServoCounterStyleRule>,
 // but we cannot, because the value from AtomicRefCell::borrow() can only
 // live in this function, and thus anything derived from it cannot get the
 // same lifetime as raw_data in parameter. See bug 1451543.
 #[no_mangle]
 pub unsafe extern "C" fn Servo_StyleSet_GetCounterStyleRule(
-    raw_data: RawServoStyleSetBorrowed,
+    raw_data: &RawServoStyleSet,
     name: *mut nsAtom,
 ) -> *const RawServoCounterStyleRule {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     Atom::with(name, |name| {
         data.stylist
             .iter_extra_data_origins()
             .filter_map(|(d, _)| d.counter_styles.get(name))
             .next()
             .map_or(ptr::null(), |rule| rule.as_borrowed())
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_BuildFontFeatureValueSet(
-    raw_data: RawServoStyleSetBorrowed,
+    raw_data: &RawServoStyleSet,
 ) -> *mut gfxFontFeatureValueSet {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
 
     let has_rule = data
         .stylist
@@ -5600,19 +5525,19 @@ pub extern "C" fn Servo_StyleSet_BuildFo
         let rule = src.read_with(&guard);
         rule.set_at_rules(set);
     }
     set
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_ResolveForDeclarations(
-    raw_data: RawServoStyleSetBorrowed,
-    parent_style_context: ComputedStyleBorrowedOrNull,
-    declarations: RawServoDeclarationBlockBorrowed,
+    raw_data: &RawServoStyleSet,
+    parent_style_context: Option<&ComputedValues>,
+    declarations: &RawServoDeclarationBlock,
 ) -> ComputedStyleStrong {
     let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let guards = StylesheetGuards::same(&guard);
 
     let parent_style = match parent_style_context {
         Some(parent) => &*parent,
@@ -5627,17 +5552,17 @@ pub extern "C" fn Servo_StyleSet_Resolve
         .into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_AddSizeOfExcludingThis(
     malloc_size_of: GeckoMallocSizeOf,
     malloc_enclosing_size_of: GeckoMallocSizeOf,
     sizes: *mut ServoStyleSetSizes,
-    raw_data: RawServoStyleSetBorrowed,
+    raw_data: &RawServoStyleSet,
 ) {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let mut ops = MallocSizeOfOps::new(
         malloc_size_of.unwrap(),
         Some(malloc_enclosing_size_of.unwrap()),
         None,
     );
     let sizes = unsafe { sizes.as_mut() }.unwrap();
@@ -5656,61 +5581,61 @@ pub extern "C" fn Servo_UACache_AddSizeO
         None,
     );
     let sizes = unsafe { sizes.as_mut() }.unwrap();
     add_size_of_ua_cache(&mut ops, sizes);
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_MightHaveAttributeDependency(
-    raw_data: RawServoStyleSetBorrowed,
-    element: RawGeckoElementBorrowed,
+    raw_data: &RawServoStyleSet,
+    element: &RawGeckoElement,
     local_name: *mut nsAtom,
 ) -> bool {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let element = GeckoElement(element);
 
     unsafe {
         Atom::with(local_name, |atom| {
             data.stylist.any_applicable_rule_data(element, |data| {
                 data.might_have_attribute_dependency(atom)
             })
         })
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_HasStateDependency(
-    raw_data: RawServoStyleSetBorrowed,
-    element: RawGeckoElementBorrowed,
+    raw_data: &RawServoStyleSet,
+    element: &RawGeckoElement,
     state: u64,
 ) -> bool {
     let element = GeckoElement(element);
 
     let state = ElementState::from_bits_truncate(state);
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
 
     data.stylist
         .any_applicable_rule_data(element, |data| data.has_state_dependency(state))
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_HasDocumentStateDependency(
-    raw_data: RawServoStyleSetBorrowed,
+    raw_data: &RawServoStyleSet,
     state: u64,
 ) -> bool {
     let state = DocumentState::from_bits_truncate(state);
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
 
     data.stylist.has_document_state_dependency(state)
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_GetPropertyValue(
-    style: ComputedStyleBorrowed,
+    style: &ComputedValues,
     prop: nsCSSPropertyID,
     value: *mut nsAString,
 ) {
     use style::properties::PropertyFlags;
 
     if let Ok(longhand) = LonghandId::from_nscsspropertyid(prop) {
         debug_assert!(
             !longhand
@@ -5750,17 +5675,17 @@ pub unsafe extern "C" fn Servo_GetProper
         );
         block.push(animated.uncompute(), Importance::Normal);
     }
     block.shorthand_to_css(shorthand, &mut *value).unwrap();
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_GetCustomPropertyValue(
-    computed_values: ComputedStyleBorrowed,
+    computed_values: &ComputedValues,
     name: *const nsAString,
     value: *mut nsAString,
 ) -> bool {
     let custom_properties = match computed_values.custom_properties() {
         Some(p) => p,
         None => return false,
     };
 
@@ -5772,26 +5697,26 @@ pub unsafe extern "C" fn Servo_GetCustom
 
     computed_value
         .to_css(&mut CssWriter::new(&mut *value))
         .unwrap();
     true
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_GetCustomPropertiesCount(computed_values: ComputedStyleBorrowed) -> u32 {
+pub extern "C" fn Servo_GetCustomPropertiesCount(computed_values: &ComputedValues) -> u32 {
     match computed_values.custom_properties() {
         Some(p) => p.len() as u32,
         None => 0,
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_GetCustomPropertyNameAt(
-    computed_values: ComputedStyleBorrowed,
+    computed_values: &ComputedValues,
     index: u32,
     name: *mut nsAString,
 ) -> bool {
     let custom_properties = match computed_values.custom_properties() {
         Some(p) => p,
         None => return false,
     };
 
@@ -5803,42 +5728,42 @@ pub extern "C" fn Servo_GetCustomPropert
     let name = unsafe { name.as_mut().unwrap() };
     name.assign(&*property_name.as_slice());
 
     true
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CssUrlData_GetSerialization(
-    url: RawServoCssUrlDataBorrowed,
+    url: &RawServoCssUrlData,
     utf8_chars: *mut *const u8,
     utf8_len: *mut u32,
 ) {
     let url_data = CssUrlData::as_arc(&url);
     let string = url_data.as_str();
     *utf8_len = string.len() as u32;
     *utf8_chars = string.as_ptr();
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_CssUrlData_GetExtraData(
-    url: RawServoCssUrlDataBorrowed,
-) -> RawGeckoURLExtraDataBorrowedMut {
+    url: &RawServoCssUrlData,
+) -> &mut URLExtraData {
     unsafe { &mut *CssUrlData::as_arc(&url).extra_data.0.get() }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_CssUrlData_IsLocalRef(url: RawServoCssUrlDataBorrowed) -> bool {
+pub extern "C" fn Servo_CssUrlData_IsLocalRef(url: &RawServoCssUrlData) -> bool {
     CssUrlData::as_arc(&url).is_fragment()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ProcessInvalidations(
-    set: RawServoStyleSetBorrowed,
-    element: RawGeckoElementBorrowed,
+    set: &RawServoStyleSet,
+    element: &RawGeckoElement,
     snapshots: *const ServoElementSnapshotTable,
 ) {
     debug_assert!(!snapshots.is_null());
 
     let element = GeckoElement(element);
     debug_assert!(element.has_snapshot());
     debug_assert!(!element.handled_snapshot());
 
@@ -5879,17 +5804,17 @@ pub extern "C" fn Servo_ProcessInvalidat
             unsafe { bindings::Gecko_NoteDirtySubtreeForInvalidation(element.0) };
         } else if result.has_invalidated_self() {
             unsafe { bindings::Gecko_NoteDirtyElement(element.0) };
         }
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_HasPendingRestyleAncestor(element: RawGeckoElementBorrowed) -> bool {
+pub extern "C" fn Servo_HasPendingRestyleAncestor(element: &RawGeckoElement) -> bool {
     let mut element = Some(GeckoElement(element));
     while let Some(e) = element {
         if e.has_animations() {
             return true;
         }
 
         // If the element needs a frame, it means that we haven't styled it yet
         // after it got inserted in the document, and thus we may need to do
@@ -5922,17 +5847,17 @@ pub unsafe extern "C" fn Servo_SelectorL
         Ok(selector_list) => selector_list,
         Err(..) => return ptr::null_mut(),
     };
 
     Box::into_raw(Box::new(selector_list)) as *mut RawServoSelectorList
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn Servo_SelectorList_Drop(list: RawServoSelectorListOwned) {
+pub unsafe extern "C" fn Servo_SelectorList_Drop(list: bindings::RawServoSelectorListOwned) {
     let _ = list.into_box::<::selectors::SelectorList<SelectorImpl>>();
 }
 
 fn parse_color(
     value: &str,
     error_reporter: Option<&ParseErrorReporter>,
 ) -> Result<specified::Color, ()> {
     let mut input = ParserInput::new(value);
@@ -5974,17 +5899,17 @@ fn parse_color(
 #[no_mangle]
 pub extern "C" fn Servo_IsValidCSSColor(value: *const nsAString) -> bool {
     let value = unsafe { (*value).to_string() };
     parse_color(&value, None).is_ok()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ComputeColor(
-    raw_data: RawServoStyleSetBorrowedOrNull,
+    raw_data: Option<&RawServoStyleSet>,
     current_color: structs::nscolor,
     value: *const nsAString,
     result_color: *mut structs::nscolor,
     was_current_color: *mut bool,
     loader: *mut Loader,
 ) -> bool {
     use style::gecko;
 
@@ -6069,17 +5994,17 @@ pub unsafe extern "C" fn Servo_Intersect
     let mut writer = CssWriter::new(&mut *result);
     (*root_margin).to_css(&mut writer).unwrap();
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ParseTransformIntoMatrix(
     value: *const nsAString,
     contain_3d: *mut bool,
-    result: *mut RawGeckoGfxMatrix4x4,
+    result: *mut structs::Matrix4x4Components,
 ) -> bool {
     use style::properties::longhands::transform;
 
     let string = unsafe { (*value).to_string() };
     let mut input = ParserInput::new(&string);
     let mut parser = Parser::new(&mut input);
     let context = ParserContext::new(
         Origin::Author,
@@ -6202,41 +6127,41 @@ pub unsafe extern "C" fn Servo_SourceSiz
 
     // NB: Intentionally not calling parse_entirely.
     let list = SourceSizeList::parse(&context, &mut parser);
     Box::into_raw(Box::new(list)) as *mut _
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SourceSizeList_Evaluate(
-    raw_data: RawServoStyleSetBorrowed,
-    list: RawServoSourceSizeListBorrowedOrNull,
+    raw_data: &RawServoStyleSet,
+    list: Option<&RawServoSourceSizeList>,
 ) -> i32 {
     let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let device = doc_data.stylist.device();
     let quirks_mode = doc_data.stylist.quirks_mode();
 
     let result = match list {
         Some(list) => SourceSizeList::from_ffi(list).evaluate(device, quirks_mode),
         None => SourceSizeList::empty().evaluate(device, quirks_mode),
     };
 
     result.0
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn Servo_SourceSizeList_Drop(list: RawServoSourceSizeListOwned) {
+pub unsafe extern "C" fn Servo_SourceSizeList_Drop(list: bindings::RawServoSourceSizeListOwned) {
     let _ = list.into_box::<SourceSizeList>();
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_InvalidateStyleForDocStateChanges(
-    root: RawGeckoElementBorrowed,
-    document_style: RawServoStyleSetBorrowed,
-    non_document_styles: *const nsTArray<RawServoAuthorStylesBorrowed>,
+    root: &RawGeckoElement,
+    document_style: &RawServoStyleSet,
+    non_document_styles: *const nsTArray<&RawServoAuthorStyles>,
     states_changed: u64,
 ) {
     use style::invalidation::element::document_state::DocumentStateInvalidationProcessor;
     use style::invalidation::element::invalidator::TreeStyleInvalidator;
 
     let document_data = PerDocumentStyleData::from_ffi(document_style).borrow();
 
     let iter = document_data
@@ -6285,58 +6210,56 @@ pub unsafe extern "C" fn Servo_UseCounte
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_UseCounters_Drop(c: bindings::StyleUseCountersOwned) {
     let _ = c.into_box::<UseCounters>();
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_UseCounters_Merge(
-    doc_counters: bindings::StyleUseCountersBorrowed,
-    sheet_counters: bindings::StyleUseCountersBorrowed,
+    doc_counters: &UseCounters,
+    sheet_counters: &UseCounters,
 ) {
-    UseCounters::from_ffi(doc_counters).merge(UseCounters::from_ffi(sheet_counters))
+    doc_counters.merge(sheet_counters)
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_IsCssPropertyRecordedInUseCounter(
-    use_counters: bindings::StyleUseCountersBorrowed,
+    use_counters: &UseCounters,
     property: *const nsACString,
     known_prop: *mut bool,
 ) -> bool {
     let prop_id = parse_enabled_property_name!(property, known_prop, false);
     let non_custom_id = match prop_id.non_custom_id() {
         Some(id) => id,
         None => return false,
     };
 
-    UseCounters::from_ffi(use_counters)
-        .non_custom_properties
-        .recorded(non_custom_id)
-}
-
-#[no_mangle]
-pub extern "C" fn Servo_Quotes_GetInitialValue() -> RawServoQuotesStrong {
+    use_counters.non_custom_properties.recorded(non_custom_id)
+}
+
+#[no_mangle]
+pub extern "C" fn Servo_Quotes_GetInitialValue() -> bindings::RawServoQuotesStrong {
     computed::Quotes::get_initial_value()
         .0
         .clone()
         .into_strong()
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_Quotes_Equal(a: RawServoQuotesBorrowed, b: RawServoQuotesBorrowed) -> bool {
+pub extern "C" fn Servo_Quotes_Equal(a: &RawServoQuotes, b: &RawServoQuotes) -> bool {
     let a = Box::<[QuotePair]>::as_arc(&a);
     let b = Box::<[QuotePair]>::as_arc(&b);
 
     a == b
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_Quotes_GetQuote(
-    quotes: RawServoQuotesBorrowed,
+    quotes: &RawServoQuotes,
     mut depth: i32,
     quote_type: StyleContentType,
     result: *mut nsAString,
 ) {
     debug_assert!(depth >= -1);
 
     let quotes = Box::<[QuotePair]>::as_arc(&quotes);
 
--- a/servo/ports/geckolib/tests/Cargo.toml
+++ b/servo/ports/geckolib/tests/Cargo.toml
@@ -1,16 +1,14 @@
 [package]
 name = "stylo_tests"
 version = "0.0.1"
 authors = ["The Servo Project Developers"]
 license = "MPL-2.0"
 
-build = "build.rs"
-
 [lib]
 name = "stylo_tests"
 path = "lib.rs"
 doctest = false
 
 [dependencies]
 atomic_refcell = "0.1"
 cssparser = "0.25"
@@ -21,11 +19,8 @@ libc = "0.2"
 log = {version = "0.4", features = ["release_max_level_info"]}
 malloc_size_of = {path = "../../../components/malloc_size_of"}
 num-traits = "0.2"
 selectors = {path = "../../../components/selectors"}
 size_of_test = {path = "../../../components/size_of_test"}
 smallvec = "0.6"
 style_traits = {path = "../../../components/style_traits"}
 style = {path = "../../../components/style", features = ["gecko"]}
-
-[build-dependencies]
-regex = "1.0"
deleted file mode 100644
--- a/servo/ports/geckolib/tests/build.rs
+++ /dev/null
@@ -1,109 +0,0 @@
-/* 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 https://mozilla.org/MPL/2.0/. */
-
-extern crate regex;
-
-use regex::Regex;
-use std::env;
-use std::fs::File;
-use std::io::{BufRead, BufReader, Write};
-use std::path::Path;
-
-fn main() {
-    // https://github.com/rust-lang/cargo/issues/3544
-    let style_out_dir = env::var_os(
-        "DEP_FOR SOME REASON THE LINKS KEY IS REQUIRED \
-         TO PASS DATA AROUND BETWEEN BUILD SCRIPTS_OUT_DIR",
-    )
-    .unwrap();
-    let root_path = Path::new("../../../");
-    let bindings_file = Path::new(&style_out_dir).join("gecko/bindings.rs");
-    let glue_file = root_path.join("ports/geckolib/glue.rs");
-
-    println!("cargo:rerun-if-changed=build.rs");
-    println!("cargo:rerun-if-changed={}", glue_file.display());
-    println!("cargo:rerun-if-changed={}", bindings_file.display());
-
-    let env_out_dir = env::var("OUT_DIR").unwrap();
-    let out_dir = Path::new(&env_out_dir);
-
-    {
-        let output = out_dir.join("check_bindings.rs");
-        let r = BufReader::new(File::open(bindings_file).unwrap());
-        let mut w = File::create(output).unwrap();
-
-        w.write_all(b"fn assert_types() {\n").unwrap();
-
-        let matcher = Regex::new(r"fn\s*Servo_([a-zA-Z0-9_]+)\s*\(").unwrap();
-
-        for line in r.lines() {
-            let s = line.unwrap();
-            for cap in matcher.captures_iter(&s) {
-                // This causes a mismatch in old libclangs (the ones that are
-                // used in linux32 mozilla-central) because it generates:
-                //
-                //   *const nsTArray<*const RawServoStyleSet>
-                //
-                // Instead of:
-                //
-                //   *const nsTArray<RawServoStyleSetBorrowed>
-                //
-                // Which is not a problem, but would cause this to not compile.
-                //
-                // Skip this until libclang is updated there.
-                //
-                // Also skip Servo_Element_IsDisplayContents because we
-                // forward-declare it in Element.h without the type bindgen uses
-                // to replace it by a reference, and it depends on the include
-                // order in ServoBindings.h. We have the same problem for
-                // ComputedStyle_{AddRef / Release}, we just don't hit it
-                // because they're included later...
-                if &cap[1] == "InvalidateStyleForDocStateChanges" ||
-                    &cap[1] == "Element_IsDisplayContents"
-                {
-                    continue;
-                }
-                w.write_all(
-                    format!("    [ Servo_{0}, bindings::Servo_{0} ];\n", &cap[1]).as_bytes(),
-                )
-                .unwrap();
-            }
-        }
-
-        w.write_all(b"}\n").unwrap();
-    }
-
-    {
-        let output = out_dir.join("glue.rs");
-        let r = BufReader::new(File::open(glue_file).unwrap());
-        let mut w = File::create(output).unwrap();
-
-        w.write_all(b"pub use style::gecko::arc_types::*;\n")
-            .unwrap();
-
-        for line in r.lines() {
-            let s = line
-                .unwrap()
-                .replace("#[no_mangle]", "")
-                .replace("pub extern \"C\" fn", "pub unsafe extern \"C\" fn");
-            w.write_all(s.as_bytes()).unwrap();
-            w.write_all(b"\n").unwrap();
-        }
-    }
-
-    File::create(out_dir.join("bindings.rs"))
-        .unwrap()
-        .write_all(
-            format!(
-                "include!(concat!({:?}, \"/gecko/structs.rs\"));",
-                style_out_dir
-            )
-            .as_bytes(),
-        )
-        .unwrap();
-
-    if env::var_os("MOZ_SRC").is_some() {
-        println!("cargo:rustc-cfg=linking_with_gecko")
-    }
-}
--- a/servo/ports/geckolib/tests/lib.rs
+++ b/servo/ports/geckolib/tests/lib.rs
@@ -27,17 +27,8 @@ extern crate smallvec;
 extern crate size_of_test;
 #[macro_use]
 extern crate style;
 extern crate style_traits;
 
 #[cfg(target_pointer_width = "64")]
 mod size_of;
 mod specified_values;
-
-mod servo_function_signatures;
-
-use style::*;
-
-#[allow(dead_code, improper_ctypes)]
-mod bindings {
-    include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
-}
deleted file mode 100644
--- a/servo/ports/geckolib/tests/servo_function_signatures.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-/* 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 https://mozilla.org/MPL/2.0/. */
-
-#![allow(unused)]
-
-use self::glue::*;
-use style::gecko_bindings::bindings;
-use style::gecko_properties::*;
-
-include!(concat!(env!("OUT_DIR"), "/check_bindings.rs"));
-
-#[path = "../../../ports/geckolib/error_reporter.rs"]
-mod error_reporter;
-
-#[path = "../../../ports/geckolib/stylesheet_loader.rs"]
-mod stylesheet_loader;
-
-#[allow(non_snake_case, unused_unsafe)]
-mod glue {
-    // this module pretends to be glue.rs, with the safe functions swapped for
-    // unsafe ones. This is a hack to compensate for the fact that `fn` types
-    // cannot coerce to `unsafe fn` types. The imports are populated with the
-    // same things so the type assertion should be equivalent.
-    //
-    // We also rely on #[no_mangle] being stripped out so that it can link on
-    // Windows without linking to Gecko, see bug 1512271.
-    use geckoservo::*;
-    include!(concat!(env!("OUT_DIR"), "/glue.rs"));
-}
--- a/servo/ports/geckolib/tests/size_of.rs
+++ b/servo/ports/geckolib/tests/size_of.rs
@@ -1,20 +1,20 @@
 /* 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 https://mozilla.org/MPL/2.0/. */
 
 use selectors;
-use servo_arc::Arc;
 use style;
 use style::applicable_declarations::ApplicableDeclarationBlock;
 use style::data::{ElementData, ElementStyles};
 use style::gecko::selector_parser::{self, SelectorImpl};
 use style::properties::ComputedValues;
 use style::rule_tree::{RuleNode, StrongRuleNode};
+use style::servo_arc::Arc;
 use style::values::computed;
 use style::values::specified;
 
 size_of_test!(
     size_of_selector,
     selectors::parser::Selector<SelectorImpl>,
     8
 );