Backed out 4 changesets (bug 1536584, bug 1538661, bug 1538694) for causing build bustages CLOSED TREE
authorBogdan Tara <btara@mozilla.com>
Tue, 26 Mar 2019 16:40:20 +0200
changeset 466101 105411e3cf06b2fca98d4e0507efb80875103228
parent 466100 563e8fb1be5db3fa6f984c34270a35c7cf1dd4e6
child 466102 a0bed49e8b107a7dc6f1f74dcddd5353ae177130
push id81444
push userbtara@mozilla.com
push dateTue, 26 Mar 2019 14:42:30 +0000
treeherderautoland@105411e3cf06 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1536584, 1538661, 1538694
milestone68.0a1
backs out563e8fb1be5db3fa6f984c34270a35c7cf1dd4e6
7bd834c5800c93f54df331311d726dc571813d7b
f1eec8f7a3f87f9d8edbe3a2c5d6fa9c629eb6f2
73a48619739e34609d11f5ed15f3fc1436ee154f
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
Backed out 4 changesets (bug 1536584, bug 1538661, bug 1538694) for causing build bustages CLOSED TREE Backed out changeset 563e8fb1be5d (bug 1538694) Backed out changeset 7bd834c5800c (bug 1536584) Backed out changeset f1eec8f7a3f8 (bug 1538694) Backed out changeset 73a48619739e (bug 1538661)
dom/base/Document.cpp
dom/base/ResponsiveImageSelector.cpp
dom/base/ShadowRoot.cpp
dom/base/nsINode.cpp
dom/xbl/nsXBLPrototypeResources.cpp
layout/style/ComputedStyle.h
layout/style/DeclarationBlock.h
layout/style/GeckoBindings.cpp
layout/style/GeckoBindings.h
layout/style/ServoArcTypeList.h
layout/style/ServoBindingTypes.h
layout/style/ServoBindings.h
layout/style/ServoBindings.toml
layout/style/ServoBoxedTypeList.h
layout/style/moz.build
layout/style/test/gtest/StyloParsingBench.cpp
servo/components/style/build_gecko.rs
servo/components/style/cbindgen.toml
servo/components/style/gecko/arc_types.rs
servo/components/style/gecko_bindings/mod.rs
servo/components/style/gecko_bindings/sugar/ownership.rs
servo/ports/geckolib/glue.rs
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -1343,17 +1343,17 @@ Document::Document(const char* aContentT
       mCachedTabSizeGeneration(0),
       mInRDMPane(false) {
   MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug, ("DOCUMENT %p created", this));
 
   SetIsInDocument();
   SetIsConnected(true);
 
   if (StaticPrefs::layout_css_use_counters_enabled()) {
-    mStyleUseCounters = Servo_UseCounters_Create().Consume();
+    mStyleUseCounters.reset(Servo_UseCounters_Create());
   }
 
   SetContentTypeInternal(nsDependentCString(aContentType));
 
   // Start out mLastStyleSheetSet as null, per spec
   SetDOMStringToNull(mLastStyleSheetSet);
 
   // void state used to differentiate an empty source from an unselected source
--- a/dom/base/ResponsiveImageSelector.cpp
+++ b/dom/base/ResponsiveImageSelector.cpp
@@ -218,17 +218,17 @@ void ResponsiveImageSelector::ClearSelec
   mSelectedCandidateIndex = -1;
   mSelectedCandidateURL = nullptr;
 }
 
 bool ResponsiveImageSelector::SetSizesFromDescriptor(const nsAString& aSizes) {
   ClearSelectedCandidate();
 
   NS_ConvertUTF16toUTF8 sizes(aSizes);
-  mServoSourceSizeList = Servo_SourceSizeList_Parse(&sizes).Consume();
+  mServoSourceSizeList.reset(Servo_SourceSizeList_Parse(&sizes));
   return !!mServoSourceSizeList;
 }
 
 void ResponsiveImageSelector::AppendCandidateIfUnique(
     const ResponsiveImageCandidate& aCandidate) {
   int numCandidates = mCandidates.Length();
 
   // With the exception of Default, which should not be added until we are done
--- a/dom/base/ShadowRoot.cpp
+++ b/dom/base/ShadowRoot.cpp
@@ -361,17 +361,17 @@ void ShadowRoot::InsertSheetAt(size_t aI
   }
 }
 
 void ShadowRoot::InsertSheetIntoAuthorData(size_t aIndex, StyleSheet& aSheet) {
   MOZ_ASSERT(SheetAt(aIndex) == &aSheet);
   MOZ_ASSERT(aSheet.IsApplicable());
 
   if (!mServoStyles) {
-    mServoStyles = Servo_AuthorStyles_Create().Consume();
+    mServoStyles.reset(Servo_AuthorStyles_Create());
   }
 
   if (mStyleRuleMap) {
     mStyleRuleMap->SheetAdded(aSheet);
   }
 
   for (size_t i = aIndex + 1; i < SheetCount(); ++i) {
     StyleSheet* beforeSheet = SheetAt(i);
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -2493,18 +2493,18 @@ const RawServoSelectorList* nsINode::Par
       return nullptr;
     }
 
     return list->get();
   }
 
   NS_ConvertUTF16toUTF8 selectorString(aSelectorString);
 
-  UniquePtr<RawServoSelectorList> selectorList =
-      Servo_SelectorList_Parse(&selectorString).Consume();
+  auto selectorList = UniquePtr<RawServoSelectorList>(
+      Servo_SelectorList_Parse(&selectorString));
   if (!selectorList) {
     aRv.ThrowDOMException(NS_ERROR_DOM_SYNTAX_ERR,
                           NS_LITERAL_CSTRING("'") + selectorString +
                               NS_LITERAL_CSTRING("' is not a valid selector"));
   }
 
   auto* ret = selectorList.get();
   cache.CacheList(aSelectorString, std::move(selectorList));
--- a/dom/xbl/nsXBLPrototypeResources.cpp
+++ b/dom/xbl/nsXBLPrototypeResources.cpp
@@ -115,17 +115,17 @@ void nsXBLPrototypeResources::Traverse(n
 }
 
 void nsXBLPrototypeResources::Unlink() { mStyleSheetList.Clear(); }
 
 void nsXBLPrototypeResources::ClearLoader() { mLoader = nullptr; }
 
 void nsXBLPrototypeResources::SyncServoStyles() {
   mStyleRuleMap.reset(nullptr);
-  mServoStyles = Servo_AuthorStyles_Create().Consume();
+  mServoStyles.reset(Servo_AuthorStyles_Create());
   for (auto& sheet : mStyleSheetList) {
     Servo_AuthorStyles_AppendStyleSheet(mServoStyles.get(), sheet);
   }
 }
 
 void nsXBLPrototypeResources::ComputeServoStyles(
     const ServoStyleSet& aMasterStyleSet) {
   SyncServoStyles();
--- a/layout/style/ComputedStyle.h
+++ b/layout/style/ComputedStyle.h
@@ -29,16 +29,18 @@ class nsIPresShell;
 class nsPresContext;
 class nsWindowSizes;
 
 #define STYLE_STRUCT(name_) struct nsStyle##name_;
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 
 extern "C" {
+void Servo_ComputedStyle_AddRef(const mozilla::ComputedStyle* aStyle);
+void Servo_ComputedStyle_Release(const mozilla::ComputedStyle* aStyle);
 void Gecko_ComputedStyle_Destroy(mozilla::ComputedStyle*);
 }
 
 namespace mozilla {
 
 namespace dom {
 class Document;
 }
@@ -84,16 +86,19 @@ class ComputedStyle {
   using Bit = ComputedStyleBit;
 
  public:
   ComputedStyle(PseudoStyleType aPseudoType,
                 ServoComputedDataForgotten aComputedValues);
 
   Bit Bits() const { return static_cast<Bit>(mSource.flags.mFlags); }
 
+  void AddRef() { Servo_ComputedStyle_AddRef(this); }
+  void Release() { Servo_ComputedStyle_Release(this); }
+
   // Return the ComputedStyle whose style data should be used for the R,
   // G, and B components of color, background-color, and border-*-color
   // if RelevantLinkIsVisited().
   //
   // GetPseudo() and GetPseudoType() on this ComputedStyle return the
   // same as on |this|, and its depth in the tree (number of GetParent()
   // calls until null is returned) is the same as |this|, since its
   // parent is either |this|'s parent or |this|'s parent's
--- a/layout/style/DeclarationBlock.h
+++ b/layout/style/DeclarationBlock.h
@@ -143,26 +143,25 @@ class DeclarationBlock final {
   RawServoDeclarationBlock* Raw() const { return mRaw; }
   RawServoDeclarationBlock* const* RefRaw() const {
     static_assert(sizeof(RefPtr<RawServoDeclarationBlock>) ==
                       sizeof(RawServoDeclarationBlock*),
                   "RefPtr should just be a pointer");
     return reinterpret_cast<RawServoDeclarationBlock* const*>(&mRaw);
   }
 
-  const StyleStrong<RawServoDeclarationBlock>* RefRawStrong() const {
+  const RawServoDeclarationBlockStrong* RefRawStrong() const {
     static_assert(sizeof(RefPtr<RawServoDeclarationBlock>) ==
                       sizeof(RawServoDeclarationBlock*),
                   "RefPtr should just be a pointer");
     static_assert(
         sizeof(RefPtr<RawServoDeclarationBlock>) ==
-            sizeof(StyleStrong<RawServoDeclarationBlock>),
+            sizeof(RawServoDeclarationBlockStrong),
         "RawServoDeclarationBlockStrong should be the same as RefPtr");
-    return reinterpret_cast<const StyleStrong<RawServoDeclarationBlock>*>(
-        &mRaw);
+    return reinterpret_cast<const RawServoDeclarationBlockStrong*>(&mRaw);
   }
 
   void ToString(nsAString& aResult) const {
     Servo_DeclarationBlock_GetCssText(mRaw, &aResult);
   }
 
   uint32_t Count() const { return Servo_DeclarationBlock_Count(mRaw); }
 
--- a/layout/style/GeckoBindings.cpp
+++ b/layout/style/GeckoBindings.cpp
@@ -80,16 +80,26 @@
 #if defined(MOZ_MEMORY)
 #  include "mozmemory.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::css;
 using namespace mozilla::dom;
 
+#define SERVO_ARC_TYPE(name_, type_)                 \
+  already_AddRefed<type_> type_##Strong::Consume() { \
+    RefPtr<type_> result;                            \
+    result.swap(mPtr);                               \
+    return result.forget();                          \
+  }
+#include "mozilla/ServoArcTypeList.h"
+SERVO_ARC_TYPE(ComputedStyle, ComputedStyle)
+#undef SERVO_ARC_TYPE
+
 // Definitions of the global traversal stats.
 bool ServoTraversalStatistics::sActive = false;
 ServoTraversalStatistics ServoTraversalStatistics::sSingleton;
 
 static RWLock* sServoFFILock = nullptr;
 
 static const nsFont* ThreadSafeGetDefaultFontHelper(const Document& aDocument,
                                                     nsAtom* aLanguage,
@@ -340,72 +350,72 @@ 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);
 }
 
-const StyleStrong<RawServoDeclarationBlock>* Gecko_GetStyleAttrDeclarationBlock(
+const RawServoDeclarationBlockStrong* Gecko_GetStyleAttrDeclarationBlock(
     const Element* aElement) {
   DeclarationBlock* decl = aElement->GetInlineStyleDeclaration();
   if (!decl) {
     return nullptr;
   }
   return decl->RefRawStrong();
 }
 
 void Gecko_UnsetDirtyStyleAttr(const Element* aElement) {
   DeclarationBlock* decl = aElement->GetInlineStyleDeclaration();
   if (!decl) {
     return;
   }
   decl->UnsetDirty();
 }
 
-static const StyleStrong<RawServoDeclarationBlock>* AsRefRawStrong(
+static const RawServoDeclarationBlockStrong* AsRefRawStrong(
     const RefPtr<RawServoDeclarationBlock>& aDecl) {
   static_assert(sizeof(RefPtr<RawServoDeclarationBlock>) ==
-                    sizeof(StyleStrong<RawServoDeclarationBlock>),
+                    sizeof(RawServoDeclarationBlockStrong),
                 "RefPtr should just be a pointer");
-  return reinterpret_cast<const StyleStrong<RawServoDeclarationBlock>*>(&aDecl);
+  return reinterpret_cast<const RawServoDeclarationBlockStrong*>(&aDecl);
 }
 
-const StyleStrong<RawServoDeclarationBlock>*
+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());
 }
 
-const StyleStrong<RawServoDeclarationBlock>*
-Gecko_GetExtraContentStyleDeclarations(const Element* 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;
 }
 
-const StyleStrong<RawServoDeclarationBlock>*
+const RawServoDeclarationBlockStrong*
 Gecko_GetUnvisitedLinkAttrDeclarationBlock(const Element* aElement) {
   nsHTMLStyleSheet* sheet = aElement->OwnerDoc()->GetAttributeStyleSheet();
   if (!sheet) {
     return nullptr;
   }
 
   return AsRefRawStrong(sheet->GetServoUnvisitedLinkDecl());
 }
@@ -433,28 +443,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();
 }
 
-const StyleStrong<RawServoDeclarationBlock>*
-Gecko_GetVisitedLinkAttrDeclarationBlock(const Element* aElement) {
+const RawServoDeclarationBlockStrong* Gecko_GetVisitedLinkAttrDeclarationBlock(
+    const Element* aElement) {
   nsHTMLStyleSheet* sheet = aElement->OwnerDoc()->GetAttributeStyleSheet();
   if (!sheet) {
     return nullptr;
   }
 
   return AsRefRawStrong(sheet->GetServoVisitedLinkDecl());
 }
 
-const StyleStrong<RawServoDeclarationBlock>*
-Gecko_GetActiveLinkAttrDeclarationBlock(const Element* aElement) {
+const RawServoDeclarationBlockStrong* Gecko_GetActiveLinkAttrDeclarationBlock(
+    const Element* aElement) {
   nsHTMLStyleSheet* sheet = aElement->OwnerDoc()->GetAttributeStyleSheet();
   if (!sheet) {
     return nullptr;
   }
 
   return AsRefRawStrong(sheet->GetServoActiveLinkDecl());
 }
 
@@ -1626,17 +1636,17 @@ void Gecko_nsStyleSVG_SetContextProperti
 }
 
 void Gecko_nsStyleSVG_CopyContextProperties(nsStyleSVG* aDst,
                                             const nsStyleSVG* aSrc) {
   aDst->mContextProps = aSrc->mContextProps;
   aDst->mContextPropsBits = aSrc->mContextPropsBits;
 }
 
-URLValue* Gecko_URLValue_Create(StyleStrong<RawServoCssUrlData> aCssUrl,
+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) {
@@ -2045,20 +2055,19 @@ GeckoFontMetrics Gecko_GetFontMetrics(co
                     ? NS_round(aPresContext->AppUnitsPerDevPixel() * zeroWidth)
                     : -1.0;
   return ret;
 }
 
 NS_IMPL_THREADSAFE_FFI_REFCOUNTING(SheetLoadDataHolder, SheetLoadDataHolder);
 
 void Gecko_StyleSheet_FinishAsyncParse(
-    SheetLoadDataHolder* aData,
-    StyleStrong<RawServoStyleSheetContents> aSheetContents,
-    StyleOwnedOrNull<StyleUseCounters> aUseCounters) {
-  UniquePtr<StyleUseCounters> useCounters = aUseCounters.Consume();
+    SheetLoadDataHolder* aData, RawServoStyleSheetContentsStrong aSheetContents,
+    StyleUseCountersOwned aUseCounters) {
+  UniquePtr<StyleUseCounters> useCounters(aUseCounters);
   RefPtr<SheetLoadDataHolder> loadData = aData;
   RefPtr<RawServoStyleSheetContents> sheetContents = aSheetContents.Consume();
   NS_DispatchToMainThread(NS_NewRunnableFunction(
       __func__, [d = std::move(loadData), contents = std::move(sheetContents),
                  counters = std::move(useCounters)]() mutable {
         MOZ_ASSERT(NS_IsMainThread());
         SheetLoadData* data = d->get();
         if (Document* doc = data->mLoader->GetDocument()) {
@@ -2114,32 +2123,32 @@ static already_AddRefed<StyleSheet> Load
 
   RefPtr<StyleSheet> sheet = static_cast<StyleSheet*>(aParent->GetFirstChild());
   return sheet.forget();
 }
 
 StyleSheet* Gecko_LoadStyleSheet(Loader* aLoader, StyleSheet* aParent,
                                  SheetLoadData* aParentLoadData,
                                  LoaderReusableStyleSheets* aReusableSheets,
-                                 StyleStrong<RawServoCssUrlData> aCssUrl,
-                                 StyleStrong<RawServoMediaList> aMediaList) {
+                                 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<URLValue> url = new URLValue(aCssUrl.Consume(), CORS_NONE);
   return LoadImportSheet(aLoader, aParent, aParentLoadData, aReusableSheets,
                          url, aMediaList.Consume())
       .take();
 }
 
 void Gecko_LoadStyleSheetAsync(SheetLoadDataHolder* aParentData,
-                               StyleStrong<RawServoCssUrlData> aCssUrl,
-                               StyleStrong<RawServoMediaList> aMediaList,
-                               StyleStrong<RawServoImportRule> aImportRule) {
+                               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<URLValue> urlVal = new URLValue(aCssUrl.Consume(), CORS_NONE);
   RefPtr<RawServoMediaList> mediaList = aMediaList.Consume();
   RefPtr<RawServoImportRule> importRule = aImportRule.Consume();
   NS_DispatchToMainThread(NS_NewRunnableFunction(
       __func__,
--- a/layout/style/GeckoBindings.h
+++ b/layout/style/GeckoBindings.h
@@ -104,30 +104,29 @@ void Gecko_DestroyStyleChildrenIterator(
 
 const nsINode* Gecko_GetNextStyleChild(mozilla::dom::StyleChildrenIterator*);
 
 NS_DECL_THREADSAFE_FFI_REFCOUNTING(mozilla::css::SheetLoadDataHolder,
                                    SheetLoadDataHolder);
 
 void Gecko_StyleSheet_FinishAsyncParse(
     mozilla::css::SheetLoadDataHolder* data,
-    mozilla::StyleStrong<RawServoStyleSheetContents> sheet_contents,
-    mozilla::StyleOwnedOrNull<StyleUseCounters> use_counters);
+    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,
-    mozilla::StyleStrong<RawServoCssUrlData> url,
-    mozilla::StyleStrong<RawServoMediaList> media_list);
+    RawServoCssUrlDataStrong url, RawServoMediaListStrong media_list);
 
 void Gecko_LoadStyleSheetAsync(mozilla::css::SheetLoadDataHolder* parent_data,
-                               mozilla::StyleStrong<RawServoCssUrlData>,
-                               mozilla::StyleStrong<RawServoMediaList>,
-                               mozilla::StyleStrong<RawServoImportRule>);
+                               RawServoCssUrlDataStrong,
+                               RawServoMediaListStrong,
+                               RawServoImportRuleStrong);
 
 // Selector Matching.
 uint64_t Gecko_ElementState(const mozilla::dom::Element*);
 bool Gecko_IsRootElement(const mozilla::dom::Element*);
 
 bool Gecko_MatchLang(const mozilla::dom::Element*, nsAtom* override_lang,
                      bool has_override_lang, const char16_t* value);
 
@@ -166,37 +165,37 @@ SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNC
                                               const mozilla::dom::Element*)
 
 SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(
     Gecko_Snapshot, const mozilla::ServoElementSnapshot*)
 
 #undef SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS
 
 // Style attributes.
-const mozilla::StyleStrong<RawServoDeclarationBlock>*
-Gecko_GetStyleAttrDeclarationBlock(const mozilla::dom::Element* element);
+const RawServoDeclarationBlockStrong* Gecko_GetStyleAttrDeclarationBlock(
+    const mozilla::dom::Element* element);
 
 void Gecko_UnsetDirtyStyleAttr(const mozilla::dom::Element* element);
 
-const mozilla::StyleStrong<RawServoDeclarationBlock>*
+const RawServoDeclarationBlockStrong*
 Gecko_GetHTMLPresentationAttrDeclarationBlock(
     const mozilla::dom::Element* element);
 
-const mozilla::StyleStrong<RawServoDeclarationBlock>*
-Gecko_GetExtraContentStyleDeclarations(const mozilla::dom::Element* element);
+const RawServoDeclarationBlockStrong* Gecko_GetExtraContentStyleDeclarations(
+    const mozilla::dom::Element* element);
 
-const mozilla::StyleStrong<RawServoDeclarationBlock>*
+const RawServoDeclarationBlockStrong*
 Gecko_GetUnvisitedLinkAttrDeclarationBlock(
     const mozilla::dom::Element* element);
 
-const mozilla::StyleStrong<RawServoDeclarationBlock>*
-Gecko_GetVisitedLinkAttrDeclarationBlock(const mozilla::dom::Element* element);
+const RawServoDeclarationBlockStrong* Gecko_GetVisitedLinkAttrDeclarationBlock(
+    const mozilla::dom::Element* element);
 
-const mozilla::StyleStrong<RawServoDeclarationBlock>*
-Gecko_GetActiveLinkAttrDeclarationBlock(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(
@@ -563,18 +562,18 @@ void Gecko_nsStyleSVG_SetDashArrayLength
 
 void Gecko_nsStyleSVG_CopyDashArray(nsStyleSVG* dst, const nsStyleSVG* src);
 
 void Gecko_nsStyleSVG_SetContextPropertiesLength(nsStyleSVG* svg, uint32_t len);
 
 void Gecko_nsStyleSVG_CopyContextProperties(nsStyleSVG* dst,
                                             const nsStyleSVG* src);
 
-mozilla::css::URLValue* Gecko_URLValue_Create(
-    mozilla::StyleStrong<RawServoCssUrlData> url, mozilla::CORSMode aCORSMode);
+mozilla::css::URLValue* Gecko_URLValue_Create(RawServoCssUrlDataStrong url,
+                                              mozilla::CORSMode aCORSMode);
 
 size_t Gecko_URLValue_SizeOfIncludingThis(mozilla::css::URLValue* url);
 
 void Gecko_GetComputedURLSpec(const mozilla::css::URLValue* url,
                               nsCString* spec);
 
 void Gecko_GetComputedImageURLSpec(const mozilla::css::URLValue* url,
                                    nsCString* spec);
--- a/layout/style/ServoArcTypeList.h
+++ b/layout/style/ServoArcTypeList.h
@@ -32,14 +32,14 @@ SERVO_ARC_TYPE(Keyframe, RawServoKeyfram
 SERVO_ARC_TYPE(KeyframesRule, RawServoKeyframesRule)
 SERVO_ARC_TYPE(MediaList, RawServoMediaList)
 SERVO_ARC_TYPE(MediaRule, RawServoMediaRule)
 SERVO_ARC_TYPE(NamespaceRule, RawServoNamespaceRule)
 SERVO_ARC_TYPE(PageRule, RawServoPageRule)
 SERVO_ARC_TYPE(SupportsRule, RawServoSupportsRule)
 SERVO_ARC_TYPE(DocumentRule, RawServoMozDocumentRule)
 SERVO_ARC_TYPE(FontFeatureValuesRule, RawServoFontFeatureValuesRule)
+SERVO_ARC_TYPE(RuleNode, RawServoRuleNode)
 SERVO_ARC_TYPE(FontFaceRule, RawServoFontFaceRule)
 SERVO_ARC_TYPE(CounterStyleRule, RawServoCounterStyleRule)
 SERVO_ARC_TYPE(CssUrlData, RawServoCssUrlData)
 SERVO_ARC_TYPE(Quotes, RawServoQuotes)
-
 // clang-format on
--- a/layout/style/ServoBindingTypes.h
+++ b/layout/style/ServoBindingTypes.h
@@ -24,22 +24,28 @@
 //
 // 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:
 //
 //   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 strong, and owned types are generated by adding
 // entries to one of these files:
 //
 //   ServoArcTypeList.h
 //     generates the Strong type
 //
+//   ServoBoxedTypeList.h
+//     generates the Owned & OwnedOrNull types
 //
 // 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.
 //
@@ -51,16 +57,23 @@
 // 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 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
 // types at least have MOZ_MUST_USE_TYPE on them.
 //
 //
 // Using these types in Rust =========================
 //
 // The FFI type names are available in Rust in the gecko_bindings::bindings mod,
@@ -83,38 +96,43 @@
 // `Arc<Foo>`.
 //
 // The Owned types are defined as gecko_bindings::sugar::ownership::Owned<T>
 // (or OwnedOrNull<T>).
 //
 // This is another FFI safe type that represents the owning reference to the
 // value.  Dropping an Owned<T> will leak the value.
 //
-// An Owned<RawServoFoo> received from FFI can be converted into a `Box<Foo>`
-// by calling `into_box()`.  To pass an Owned<RawServoFoo> back to Gecko, call
-// `HasBoxFFI::into_ffi()` passing in the `Box<Foo>` value.
+// A RawServoFooOwned received from FFI can be converted into a `Box<Foo>`
+// by calling `into_box()` or `into_box_opt()` on it.  To pass a
+// RawServoFooOwned back to Gecko, call `HasBoxFFI::into_ffi()` passing in
+// the `Box<Foo>` value.
+//
 //
 // Reading through servo/components/style/gecko_bindings/sugar/ownership.rs
 // is also instructive in understanding all this.
 
 #ifndef mozilla_ServoBindingTypes_h
 #define mozilla_ServoBindingTypes_h
 
 #include "mozilla/RefPtr.h"
 #include "mozilla/ServoComputedData.h"
 #include "mozilla/ServoTypes.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/gfx/Types.h"
 #include "nsCSSPropertyID.h"
 #include "nsStyleAutoArray.h"
-#include "nsStyleConsts.h"
 #include "nsTArray.h"
 
 // Forward declarations.
 
+#define SERVO_BOXED_TYPE(name_, type_) struct type_;
+#include "mozilla/ServoBoxedTypeList.h"
+#undef SERVO_BOXED_TYPE
+
 #define SERVO_ARC_TYPE(name_, type_) struct type_;
 #include "mozilla/ServoArcTypeList.h"
 #undef SERVO_ARC_TYPE
 
 class nsCSSPropertyIDSet;
 class nsCSSValue;
 class nsINode;
 class nsPresContext;
@@ -135,59 +153,64 @@ struct URLExtraData;
 using ComputedKeyframeValues = nsTArray<PropertyStyleAnimationValuePair>;
 using GfxMatrix4x4 = mozilla::gfx::Float[16];
 
 namespace dom {
 class StyleChildrenIterator;
 class Document;
 class Element;
 }  // namespace dom
-
 }  // namespace mozilla
 
+#define DECL_OWNED_REF_TYPE_FOR(type_) typedef type_* type_##Owned;
+
+#define DECL_NULLABLE_OWNED_REF_TYPE_FOR(type_) \
+  typedef type_* type_##OwnedOrNull;
+
 #define SERVO_ARC_TYPE(name_, type_)                                    \
+  struct MOZ_MUST_USE_TYPE type_##Strong {                              \
+    type_* mPtr;                                                        \
+    already_AddRefed<type_> Consume();                                  \
+  };                                                                    \
   extern "C" {                                                          \
   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); } \
   };                                                                    \
   }
 #include "mozilla/ServoArcTypeList.h"
-SERVO_ARC_TYPE(ComputedStyle, mozilla::ComputedStyle)
 #undef SERVO_ARC_TYPE
 
-// See the comment in ServoBindings.h about the same.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
-
-#define SERVO_BOXED_TYPE(name_, type_)                              \
-  struct type_;                                                     \
-  extern "C" void Servo_##name_##_Drop(mozilla::StyleOwned<type_>); \
-  namespace mozilla {                                               \
-  template <>                                                       \
-  class DefaultDelete<type_> {                                      \
-   public:                                                          \
-    void operator()(type_* aPtr) const {                            \
-      Servo_##name_##_Drop(mozilla::StyleOwned<type_>{aPtr});       \
-    }                                                               \
-  };                                                                \
+#define SERVO_BOXED_TYPE(name_, type_)                                 \
+  DECL_OWNED_REF_TYPE_FOR(type_)                                       \
+  DECL_NULLABLE_OWNED_REF_TYPE_FOR(type_)                              \
+  extern "C" void Servo_##name_##_Drop(type_##Owned ptr);              \
+  namespace mozilla {                                                  \
+  template <>                                                          \
+  class DefaultDelete<type_> {                                         \
+   public:                                                             \
+    void operator()(type_* aPtr) const { Servo_##name_##_Drop(aPtr); } \
+  };                                                                   \
   }
-SERVO_BOXED_TYPE(StyleSet, RawServoStyleSet)
-SERVO_BOXED_TYPE(AuthorStyles, RawServoAuthorStyles)
-SERVO_BOXED_TYPE(SelectorList, RawServoSelectorList)
-SERVO_BOXED_TYPE(SourceSizeList, RawServoSourceSizeList)
-SERVO_BOXED_TYPE(UseCounters, StyleUseCounters)
+#include "mozilla/ServoBoxedTypeList.h"
 #undef SERVO_BOXED_TYPE
 
-#pragma GCC diagnostic pop
-
 // Other special cases.
 
 // TODO(heycam): Handle these elsewhere.
 struct RawServoAnimationValueTable;
 struct RawServoAnimationValueMap;
 
+struct MOZ_MUST_USE_TYPE ComputedStyleStrong {
+  mozilla::ComputedStyle* mPtr;
+  already_AddRefed<mozilla::ComputedStyle> Consume();
+};
+
+#undef DECL_ARC_REF_TYPE_FOR
+#undef DECL_OWNED_REF_TYPE_FOR
+#undef DECL_NULLABLE_OWNED_REF_TYPE_FOR
+
 #endif  // mozilla_ServoBindingTypes_h
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -45,82 +45,74 @@ namespace dom {
 enum class IterationCompositeOperation : uint8_t;
 }
 }  // namespace mozilla
 
 namespace nsStyleTransformMatrix {
 enum class MatrixTransformOperator : uint8_t;
 }
 
-// The clang we use on windows complains about returning StyleStrong<> and
-// StyleOwned<>, since the template parameters are incomplete.
-//
-// But they only contain pointers so it is ok.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
-
 extern "C" {
 
 // Element data
 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, const mozilla::dom::Element* node);
 
 bool Servo_Element_HasPrimaryComputedValues(const mozilla::dom::Element* node);
 
-mozilla::StyleStrong<mozilla::ComputedStyle>
-Servo_Element_GetPrimaryComputedValues(const mozilla::dom::Element* node);
+ComputedStyleStrong Servo_Element_GetPrimaryComputedValues(
+    const mozilla::dom::Element* node);
 
 bool Servo_Element_HasPseudoComputedValues(const mozilla::dom::Element* node,
                                            size_t index);
 
-mozilla::StyleStrong<mozilla::ComputedStyle>
-Servo_Element_GetPseudoComputedValues(const mozilla::dom::Element* node,
-                                      size_t index);
+ComputedStyleStrong Servo_Element_GetPseudoComputedValues(
+    const mozilla::dom::Element* node, size_t index);
 
 bool Servo_Element_IsDisplayNone(const mozilla::dom::Element* element);
 bool Servo_Element_IsDisplayContents(const mozilla::dom::Element* element);
 
 bool Servo_Element_IsPrimaryStyleReusedViaRuleNode(
     const mozilla::dom::Element* element);
 
 void Servo_InvalidateStyleForDocStateChanges(
     const mozilla::dom::Element* root, const RawServoStyleSet* doc_styles,
     const nsTArray<const RawServoAuthorStyles*>* non_document_styles,
     uint64_t aStatesChanged);
 
 // Styleset and Stylesheet management
 
-mozilla::StyleStrong<RawServoStyleSheetContents> Servo_StyleSheet_FromUTF8Bytes(
+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,
     mozilla::URLExtraData* extra_data, uint32_t line_number_offset,
     nsCompatibility quirks_mode,
     mozilla::css::LoaderReusableStyleSheets* reusable_sheets,
     const StyleUseCounters* use_counters);
 
 void Servo_StyleSheet_FromUTF8BytesAsync(
     mozilla::css::SheetLoadDataHolder* load_data,
     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);
 
-mozilla::StyleStrong<RawServoStyleSheetContents> Servo_StyleSheet_Empty(
+RawServoStyleSheetContentsStrong Servo_StyleSheet_Empty(
     mozilla::css::SheetParsingMode parsing_mode);
 
 bool Servo_StyleSheet_HasRules(const RawServoStyleSheetContents* sheet);
 
-mozilla::StyleStrong<ServoCssRules> Servo_StyleSheet_GetRules(
+ServoCssRulesStrong Servo_StyleSheet_GetRules(
     const RawServoStyleSheetContents* sheet);
 
-mozilla::StyleStrong<RawServoStyleSheetContents> Servo_StyleSheet_Clone(
+RawServoStyleSheetContentsStrong Servo_StyleSheet_Clone(
     const RawServoStyleSheetContents* sheet,
     const mozilla::StyleSheet* reference_sheet);
 
 size_t Servo_StyleSheet_SizeOfIncludingThis(
     mozilla::MallocSizeOf malloc_size_of,
     mozilla::MallocSizeOf malloc_enclosing_size_of,
     const RawServoStyleSheetContents* sheet);
 
@@ -141,16 +133,17 @@ void Servo_StyleSet_RebuildCachedData(co
 // 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(
     const RawServoStyleSet* document_set,
     nsTArray<RawServoAuthorStyles*>* non_document_sets,
     bool may_affect_default_style);
 
+void Servo_StyleSet_Drop(RawServoStyleSetOwned set);
 void Servo_StyleSet_CompatModeChanged(const RawServoStyleSet* raw_data);
 
 void Servo_StyleSet_AppendStyleSheet(const RawServoStyleSet* set,
                                      const mozilla::StyleSheet* gecko_sheet);
 
 void Servo_StyleSet_RemoveStyleSheet(const RawServoStyleSet* set,
                                      const mozilla::StyleSheet* gecko_sheet);
 
@@ -180,29 +173,29 @@ void Servo_StyleSet_GetFontFaceRules(con
 const RawServoCounterStyleRule* Servo_StyleSet_GetCounterStyleRule(
     const RawServoStyleSet* set, nsAtom* name);
 
 // This function may return nullptr or gfxFontFeatureValueSet with zero
 // references.
 gfxFontFeatureValueSet* Servo_StyleSet_BuildFontFeatureValueSet(
     const RawServoStyleSet* set);
 
-mozilla::StyleStrong<mozilla::ComputedStyle>
-Servo_StyleSet_ResolveForDeclarations(
+ComputedStyleStrong Servo_StyleSet_ResolveForDeclarations(
     const RawServoStyleSet* set, const mozilla::ComputedStyle* parent_style,
     const RawServoDeclarationBlock* declarations);
 
-mozilla::StyleOwnedOrNull<RawServoSelectorList> Servo_SelectorList_Parse(
-    const nsACString* selector_list);
-mozilla::StyleOwned<RawServoSourceSizeList> Servo_SourceSizeList_Parse(
-    const nsACString* value);
+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(const RawServoStyleSet* set,
                                       const RawServoSourceSizeList*);
 
+void Servo_SourceSizeList_Drop(RawServoSourceSizeList*);
+
 bool Servo_SelectorList_Matches(const mozilla::dom::Element*,
                                 const RawServoSelectorList*);
 
 const mozilla::dom::Element* Servo_SelectorList_Closest(
     const mozilla::dom::Element*, const RawServoSelectorList*);
 
 const mozilla::dom::Element* Servo_SelectorList_QueryFirst(
     const nsINode*, const RawServoSelectorList*, bool may_use_invalidation);
@@ -217,17 +210,18 @@ void Servo_StyleSet_AddSizeOfExcludingTh
     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
 
-mozilla::StyleOwned<RawServoAuthorStyles> Servo_AuthorStyles_Create();
+RawServoAuthorStyles* Servo_AuthorStyles_Create();
+void Servo_AuthorStyles_Drop(RawServoAuthorStyles*);
 
 void Servo_AuthorStyles_AppendStyleSheet(RawServoAuthorStyles*,
                                          const mozilla::StyleSheet*);
 
 void Servo_AuthorStyles_RemoveStyleSheet(RawServoAuthorStyles*,
                                          const mozilla::StyleSheet*);
 
 void Servo_AuthorStyles_InsertStyleSheetBefore(
@@ -241,16 +235,20 @@ void Servo_AuthorStyles_ForceDirty(RawSe
 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,
     const RawServoAuthorStyles* self);
 
+void Servo_ComputedStyle_AddRef(const mozilla::ComputedStyle* ctx);
+
+void Servo_ComputedStyle_Release(const mozilla::ComputedStyle* ctx);
+
 bool Servo_StyleSet_MightHaveAttributeDependency(
     const RawServoStyleSet* set, const mozilla::dom::Element* element,
     nsAtom* local_name);
 
 bool Servo_StyleSet_HasStateDependency(const RawServoStyleSet* set,
                                        const mozilla::dom::Element* element,
                                        uint64_t state);
 
@@ -272,26 +270,25 @@ nsresult Servo_CssRules_InsertRule(const
 nsresult Servo_CssRules_DeleteRule(const ServoCssRules* rules, uint32_t index);
 
 // CSS Rules
 
 #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_)                                         \
-  mozilla::StyleStrong<RawServo##type_##Rule>                           \
-      Servo_CssRules_Get##type_##RuleAt(const ServoCssRules* 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_)                                           \
-  mozilla::StyleStrong<ServoCssRules> Servo_##type_##Rule_GetRules( \
+#define GROUP_RULE_FUNCS(type_)                     \
+  BASIC_RULE_FUNCS(type_)                           \
+  ServoCssRulesStrong Servo_##type_##Rule_GetRules( \
       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)
@@ -303,17 +300,17 @@ 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];
 
-mozilla::StyleStrong<RawServoDeclarationBlock> Servo_StyleRule_GetStyle(
+RawServoDeclarationBlockStrong Servo_StyleRule_GetStyle(
     const RawServoStyleRule*);
 
 void Servo_StyleRule_SetStyle(const RawServoStyleRule* rule,
                               const RawServoDeclarationBlock* declarations);
 
 void Servo_StyleRule_GetSelectorText(const RawServoStyleRule* rule,
                                      nsAString* result);
 
@@ -346,53 +343,52 @@ void Servo_ImportRule_SetSheet(const Raw
 
 void Servo_Keyframe_GetKeyText(const RawServoKeyframe* keyframe,
                                nsAString* result);
 
 // Returns whether it successfully changes the key text.
 bool Servo_Keyframe_SetKeyText(const RawServoKeyframe* keyframe,
                                const nsACString* text);
 
-mozilla::StyleStrong<RawServoDeclarationBlock> Servo_Keyframe_GetStyle(
+RawServoDeclarationBlockStrong Servo_Keyframe_GetStyle(
     const RawServoKeyframe* keyframe);
 
 void Servo_Keyframe_SetStyle(const RawServoKeyframe* keyframe,
                              const RawServoDeclarationBlock* declarations);
 
 nsAtom* Servo_KeyframesRule_GetName(const RawServoKeyframesRule* rule);
 
 // This method takes an addrefed nsAtom.
 void Servo_KeyframesRule_SetName(const RawServoKeyframesRule* rule,
                                  nsAtom* name);
 
 uint32_t Servo_KeyframesRule_GetCount(const RawServoKeyframesRule* rule);
 
-mozilla::StyleStrong<RawServoKeyframe> Servo_KeyframesRule_GetKeyframeAt(
+RawServoKeyframeStrong Servo_KeyframesRule_GetKeyframeAt(
     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(const RawServoKeyframesRule* rule,
                                       const nsACString* key);
 
 // Returns whether it successfully appends the rule.
 bool Servo_KeyframesRule_AppendRule(const RawServoKeyframesRule* rule,
                                     const RawServoStyleSheetContents* sheet,
                                     const nsACString* css);
 
 void Servo_KeyframesRule_DeleteRule(const RawServoKeyframesRule* rule,
                                     uint32_t index);
 
-mozilla::StyleStrong<RawServoMediaList> Servo_MediaRule_GetMedia(
-    const RawServoMediaRule* rule);
+RawServoMediaListStrong Servo_MediaRule_GetMedia(const RawServoMediaRule* rule);
 
 nsAtom* Servo_NamespaceRule_GetPrefix(const RawServoNamespaceRule* rule);
 nsAtom* Servo_NamespaceRule_GetURI(const RawServoNamespaceRule* rule);
 
-mozilla::StyleStrong<RawServoDeclarationBlock> Servo_PageRule_GetStyle(
+RawServoDeclarationBlockStrong Servo_PageRule_GetStyle(
     const RawServoPageRule* rule);
 
 void Servo_PageRule_SetStyle(const RawServoPageRule* rule,
                              const RawServoDeclarationBlock* declarations);
 
 void Servo_SupportsRule_GetConditionText(const RawServoSupportsRule* rule,
                                          nsAString* result);
 
@@ -400,19 +396,19 @@ void Servo_MozDocumentRule_GetConditionT
                                             nsAString* result);
 
 void Servo_FontFeatureValuesRule_GetFontFamily(
     const RawServoFontFeatureValuesRule* rule, nsAString* result);
 
 void Servo_FontFeatureValuesRule_GetValueText(
     const RawServoFontFeatureValuesRule* rule, nsAString* result);
 
-mozilla::StyleStrong<RawServoFontFaceRule> Servo_FontFaceRule_CreateEmpty();
+RawServoFontFaceRuleStrong Servo_FontFaceRule_CreateEmpty();
 
-mozilla::StyleStrong<RawServoFontFaceRule> Servo_FontFaceRule_Clone(
+RawServoFontFaceRuleStrong Servo_FontFaceRule_Clone(
     const RawServoFontFaceRule* rule);
 
 void Servo_FontFaceRule_GetSourceLocation(const RawServoFontFaceRule* rule,
                                           uint32_t* line, uint32_t* column);
 
 uint32_t Servo_FontFaceRule_Length(const RawServoFontFaceRule* rule);
 
 nsCSSFontDesc Servo_FontFaceRule_IndexGetter(const RawServoFontFaceRule* rule,
@@ -495,17 +491,17 @@ void Servo_CounterStyleRule_GetDescripto
     nsAString* result);
 
 bool Servo_CounterStyleRule_SetDescriptor(const RawServoCounterStyleRule* rule,
                                           nsCSSCounterDesc desc,
                                           const nsACString* value);
 
 // Animations API
 
-mozilla::StyleStrong<RawServoDeclarationBlock> Servo_ParseProperty(
+RawServoDeclarationBlockStrong Servo_ParseProperty(
     nsCSSPropertyID property, const nsACString* value,
     mozilla::URLExtraData* data, mozilla::ParsingMode parsing_mode,
     nsCompatibility quirks_mode, mozilla::css::Loader* loader);
 
 bool Servo_ParseEasing(const nsAString* easing, mozilla::URLExtraData* data,
                        nsTimingFunction* output);
 
 void Servo_SerializeEasing(const nsTimingFunction* easing, nsAString* output);
@@ -513,18 +509,17 @@ void Servo_SerializeEasing(const nsTimin
 void Servo_SerializeBorderRadius(const mozilla::StyleBorderRadius*, nsAString*);
 
 void Servo_GetComputedKeyframeValues(
     const nsTArray<mozilla::Keyframe>* keyframes,
     const mozilla::dom::Element* element, const mozilla::ComputedStyle* style,
     const RawServoStyleSet* set,
     nsTArray<mozilla::ComputedKeyframeValues>* result);
 
-mozilla::StyleStrong<RawServoAnimationValue>
-Servo_ComputedValues_ExtractAnimationValue(
+RawServoAnimationValueStrong Servo_ComputedValues_ExtractAnimationValue(
     const mozilla::ComputedStyle* computed_values, nsCSSPropertyID property);
 
 bool Servo_ComputedValues_SpecifiesAnimationsOrTransitions(
     const mozilla::ComputedStyle* computed_values);
 
 bool Servo_Property_IsAnimatable(nsCSSPropertyID property);
 bool Servo_Property_IsTransitionable(nsCSSPropertyID property);
 bool Servo_Property_IsDiscreteAnimatable(nsCSSPropertyID property);
@@ -541,76 +536,74 @@ void Servo_MatrixTransform_Operate(
 void Servo_GetAnimationValues(
     const RawServoDeclarationBlock* declarations,
     const mozilla::dom::Element* element, const mozilla::ComputedStyle* style,
     const RawServoStyleSet* style_set,
     nsTArray<RefPtr<RawServoAnimationValue>>* animation_values);
 
 // AnimationValues handling
 
-mozilla::StyleStrong<RawServoAnimationValue> Servo_AnimationValues_Interpolate(
+RawServoAnimationValueStrong Servo_AnimationValues_Interpolate(
     const RawServoAnimationValue* from, const RawServoAnimationValue* to,
     double progress);
 
 bool Servo_AnimationValues_IsInterpolable(const RawServoAnimationValue* from,
                                           const RawServoAnimationValue* to);
 
-mozilla::StyleStrong<RawServoAnimationValue> Servo_AnimationValues_Add(
+RawServoAnimationValueStrong Servo_AnimationValues_Add(
     const RawServoAnimationValue* a, const RawServoAnimationValue* b);
 
-mozilla::StyleStrong<RawServoAnimationValue> Servo_AnimationValues_Accumulate(
+RawServoAnimationValueStrong Servo_AnimationValues_Accumulate(
     const RawServoAnimationValue* a, const RawServoAnimationValue* b,
     uint64_t count);
 
-mozilla::StyleStrong<RawServoAnimationValue> Servo_AnimationValues_GetZeroValue(
+RawServoAnimationValueStrong Servo_AnimationValues_GetZeroValue(
     const RawServoAnimationValue* value_to_match);
 
 double Servo_AnimationValues_ComputeDistance(const RawServoAnimationValue* from,
                                              const RawServoAnimationValue* to);
 
 void Servo_AnimationValue_Serialize(const RawServoAnimationValue* value,
                                     nsCSSPropertyID property,
                                     nsAString* buffer);
 
 nscolor Servo_AnimationValue_GetColor(const RawServoAnimationValue* value,
                                       nscolor foregroundColor);
-mozilla::StyleStrong<RawServoAnimationValue> Servo_AnimationValue_Color(
-    nsCSSPropertyID, nscolor);
+RawServoAnimationValueStrong Servo_AnimationValue_Color(nsCSSPropertyID,
+                                                        nscolor);
 
 float Servo_AnimationValue_GetOpacity(const RawServoAnimationValue* value);
-mozilla::StyleStrong<RawServoAnimationValue> Servo_AnimationValue_Opacity(
-    float);
+RawServoAnimationValueStrong Servo_AnimationValue_Opacity(float);
 
 nsCSSPropertyID Servo_AnimationValue_GetTransform(
     const RawServoAnimationValue* value, RefPtr<nsCSSValueSharedList>* list);
 
-mozilla::StyleStrong<RawServoAnimationValue> Servo_AnimationValue_Transform(
+RawServoAnimationValueStrong Servo_AnimationValue_Transform(
     nsCSSPropertyID property, const nsCSSValueSharedList& list);
 
 bool Servo_AnimationValue_DeepEqual(const RawServoAnimationValue*,
                                     const RawServoAnimationValue*);
 
-mozilla::StyleStrong<RawServoDeclarationBlock> Servo_AnimationValue_Uncompute(
+RawServoDeclarationBlockStrong Servo_AnimationValue_Uncompute(
     const RawServoAnimationValue* value);
 
-mozilla::StyleStrong<RawServoAnimationValue> Servo_AnimationValue_Compute(
+RawServoAnimationValueStrong Servo_AnimationValue_Compute(
     const mozilla::dom::Element* element,
     const RawServoDeclarationBlock* declarations,
     const mozilla::ComputedStyle* style, const RawServoStyleSet* raw_data);
 
 // Style attribute
 
-mozilla::StyleStrong<RawServoDeclarationBlock> Servo_ParseStyleAttribute(
+RawServoDeclarationBlockStrong Servo_ParseStyleAttribute(
     const nsACString* data, mozilla::URLExtraData* extra_data,
     nsCompatibility quirks_mode, mozilla::css::Loader* loader);
 
-mozilla::StyleStrong<RawServoDeclarationBlock>
-Servo_DeclarationBlock_CreateEmpty();
+RawServoDeclarationBlockStrong Servo_DeclarationBlock_CreateEmpty();
 
-mozilla::StyleStrong<RawServoDeclarationBlock> Servo_DeclarationBlock_Clone(
+RawServoDeclarationBlockStrong Servo_DeclarationBlock_Clone(
     const RawServoDeclarationBlock* declarations);
 
 bool Servo_DeclarationBlock_Equals(const RawServoDeclarationBlock* a,
                                    const RawServoDeclarationBlock* b);
 
 void Servo_DeclarationBlock_GetCssText(
     const RawServoDeclarationBlock* declarations, nsAString* result);
 
@@ -678,17 +671,17 @@ void Servo_AnimationCompose(
 
 // 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.
-mozilla::StyleStrong<RawServoAnimationValue> Servo_ComposeAnimationSegment(
+RawServoAnimationValueStrong Servo_ComposeAnimationSegment(
     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
 
@@ -749,19 +742,19 @@ void Servo_DeclarationBlock_SetTextDecor
     const RawServoDeclarationBlock* declarations);
 
 void Servo_DeclarationBlock_SetBackgroundImage(
     const RawServoDeclarationBlock* declarations, const nsAString& value,
     mozilla::URLExtraData* extra_data);
 
 // MediaList
 
-mozilla::StyleStrong<RawServoMediaList> Servo_MediaList_Create();
+RawServoMediaListStrong Servo_MediaList_Create();
 
-mozilla::StyleStrong<RawServoMediaList> Servo_MediaList_DeepClone(
+RawServoMediaListStrong Servo_MediaList_DeepClone(
     const RawServoMediaList* list);
 
 bool Servo_MediaList_Matches(const RawServoMediaList* list,
                              const RawServoStyleSet* set);
 
 void Servo_MediaList_GetText(const RawServoMediaList* list, nsAString* result);
 
 void Servo_MediaList_SetText(const RawServoMediaList* list,
@@ -786,22 +779,21 @@ size_t Servo_MediaList_SizeOfIncludingTh
 
 // CSS supports();
 
 bool Servo_CSSSupports2(const nsACString* name, const nsACString* value);
 bool Servo_CSSSupports(const nsACString* cond);
 
 // Computed style data
 
-mozilla::StyleStrong<mozilla::ComputedStyle>
-Servo_ComputedValues_GetForAnonymousBox(
+ComputedStyleStrong Servo_ComputedValues_GetForAnonymousBox(
     const mozilla::ComputedStyle* parent_style_or_null,
     mozilla::PseudoStyleType, const RawServoStyleSet* set);
 
-mozilla::StyleStrong<mozilla::ComputedStyle> Servo_ComputedValues_Inherit(
+ComputedStyleStrong Servo_ComputedValues_Inherit(
     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(
     const mozilla::ComputedStyle* values,
@@ -821,26 +813,25 @@ void Servo_NoteExplicitHints(const mozil
                              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(const mozilla::dom::Element* element,
                               bool* was_restyled);
 
-mozilla::StyleStrong<mozilla::ComputedStyle> Servo_ResolveStyle(
-    const mozilla::dom::Element* element, const RawServoStyleSet* set);
+ComputedStyleStrong Servo_ResolveStyle(const mozilla::dom::Element* element,
+                                       const RawServoStyleSet* set);
 
-mozilla::StyleStrong<mozilla::ComputedStyle> Servo_ResolvePseudoStyle(
+ComputedStyleStrong Servo_ResolvePseudoStyle(
     const mozilla::dom::Element* element, mozilla::PseudoStyleType pseudo_type,
     bool is_probe, const mozilla::ComputedStyle* inherited_style,
     const RawServoStyleSet* set);
 
-mozilla::StyleStrong<mozilla::ComputedStyle>
-Servo_ComputedValues_ResolveXULTreePseudoStyle(
+ComputedStyleStrong Servo_ComputedValues_ResolveXULTreePseudoStyle(
     const mozilla::dom::Element* element, nsAtom* pseudo_tag,
     const mozilla::ComputedStyle* inherited_style,
     const mozilla::AtomArray* input_word, const RawServoStyleSet* set);
 
 void Servo_SetExplicitStyle(const mozilla::dom::Element* element,
                             const mozilla::ComputedStyle* primary_style);
 
 bool Servo_HasAuthorSpecifiedRules(const RawServoStyleSet* set,
@@ -852,24 +843,24 @@ bool Servo_HasAuthorSpecifiedRules(const
 // 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.
 
-mozilla::StyleStrong<mozilla::ComputedStyle> Servo_ResolveStyleLazily(
+ComputedStyleStrong Servo_ResolveStyleLazily(
     const mozilla::dom::Element* element, mozilla::PseudoStyleType pseudo_type,
     mozilla::StyleRuleInclusion rule_inclusion,
     const mozilla::ServoElementSnapshotTable* snapshots,
     const RawServoStyleSet* set);
 
 // Reparents style to the new parents.
-mozilla::StyleStrong<mozilla::ComputedStyle> Servo_ReparentStyle(
+ComputedStyleStrong Servo_ReparentStyle(
     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.
     const mozilla::dom::Element* element, const RawServoStyleSet* set);
 
@@ -886,25 +877,23 @@ void Servo_AssertTreeIsClean(const mozil
 // 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(const RawServoStyleSet* set);
 
 // Returns computed values for the given element without any animations rules.
-mozilla::StyleStrong<mozilla::ComputedStyle>
-Servo_StyleSet_GetBaseComputedValuesForElement(
+ComputedStyleStrong Servo_StyleSet_GetBaseComputedValuesForElement(
     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.
-mozilla::StyleStrong<mozilla::ComputedStyle>
-Servo_StyleSet_GetComputedValuesByAddingAnimation(
+ComputedStyleStrong Servo_StyleSet_GetComputedValuesByAddingAnimation(
     const RawServoStyleSet* set, const mozilla::dom::Element* element,
     const mozilla::ComputedStyle* existing_style,
     const mozilla::ServoElementSnapshotTable* snapshots,
     const RawServoAnimationValue* animation);
 
 // For canvas font.
 void Servo_SerializeFontValueForCanvas(
     const RawServoDeclarationBlock* declarations, nsAString* buffer);
@@ -978,29 +967,35 @@ bool Servo_Property_IsInherited(const ns
 bool Servo_Property_SupportsType(const nsACString* name, uint8_t ty,
                                  bool* found);
 
 void Servo_Property_GetCSSValuesForProperty(const nsACString* name, bool* found,
                                             nsTArray<nsString>* result);
 
 uint64_t Servo_PseudoClass_GetStates(const nsACString* name);
 
-mozilla::StyleOwned<StyleUseCounters> Servo_UseCounters_Create();
+StyleUseCounters* Servo_UseCounters_Create();
+void Servo_UseCounters_Drop(StyleUseCountersOwned);
 
 void Servo_UseCounters_Merge(const StyleUseCounters* doc_counters,
                              const StyleUseCounters* sheet_counters);
 
 bool Servo_IsCssPropertyRecordedInUseCounter(const StyleUseCounters*,
                                              const nsACString* property,
                                              bool* out_known_prop);
 
-mozilla::StyleStrong<RawServoQuotes> Servo_Quotes_GetInitialValue();
+RawServoQuotesStrong Servo_Quotes_GetInitialValue();
 bool Servo_Quotes_Equal(const RawServoQuotes* a, RawServoQuotes* b);
 
 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(const type_*); \
+  void Servo_##name_##_Release(const type_*);
+#include "mozilla/ServoArcTypeList.h"
+#undef SERVO_ARC_TYPE
+
 }  // extern "C"
 
-#pragma GCC diagnostic pop
-
 #endif  // mozilla_ServoBindings_h
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -21,17 +21,16 @@ headers = [
     "mozilla/ServoElementSnapshot.h",
     "mozilla/ServoElementSnapshotTable.h",
     "mozilla/dom/Element.h",
     "mozilla/dom/ChildIterator.h",
     "mozilla/dom/NameSpaceConstants.h",
     "mozilla/LookAndFeel.h",
     "mozilla/StaticPrefs.h",
     "mozilla/GeckoBindings.h",
-    "mozilla/ServoBindings.h",
     "mozilla/ComputedStyle.h",
     "mozilla/ServoTraversalStatistics.h",
     "mozilla/SizeOfState.h",
     "nsCSSProps.h",
     "nsContentUtils.h",
     "nsNameSpaceManager.h",
     "nsMediaFeatures.h",
     "nsXBLBinding.h",
@@ -42,16 +41,17 @@ raw-lines = [
     "pub use self::root::*;",
     "pub use self::root::mozilla::*;",
     "pub use self::root::mozilla::css::*;",
     "pub use self::root::mozilla::dom::*;",
     "use atomic_refcell::AtomicRefCell;",
     "use data::ElementData;",
 ]
 hide-types = [
+    "nsString",
     ".*char_traits",
     ".*incompatible_char_type",
     # https://github.com/rust-lang/rust-bindgen/issues/1503
     "mozilla::StyleTimingFunction.*",
 ]
 bitfield-enums = [
     "nsChangeHint",
     "mozilla::OriginFlags",
@@ -449,33 +449,52 @@ cbindgen-types = [
     { gecko = "StyleLetterSpacing", servo = "values::computed::text::LetterSpacing" },
     { gecko = "StyleGenericLineHeight", servo = "values::generics::text::LineHeight" },
     { gecko = "StyleContain", servo = "values::computed::Contain" },
     { gecko = "StyleRestyleHint", servo = "invalidation::element::restyle_hints::RestyleHint" },
     { gecko = "StyleTouchAction", servo = "values::computed::TouchAction" },
     { gecko = "StyleWillChangeBits", servo = "values::specified::box_::WillChangeBits" },
     { gecko = "StyleTextDecorationLine", servo = "values::computed::TextDecorationLine" },
     { gecko = "StyleMozListReversed", servo = "values::computed::MozListReversed" },
-    { gecko = "StyleOwned", servo = "gecko_bindings::sugar::ownership::Owned" },
-    { gecko = "StyleOwnedOrNull", servo = "gecko_bindings::sugar::ownership::OwnedOrNull" },
-    { gecko = "StyleStrong", servo = "gecko_bindings::sugar::ownership::Strong" },
 ]
 
 mapped-generic-types = [
     { generic = true, gecko = "mozilla::RustCell", servo = "::std::cell::Cell" },
     { generic = false, gecko = "ServoNodeData", servo = "AtomicRefCell<ElementData>" },
     { generic = false, gecko = "mozilla::ServoWritingMode", servo = "::logical_geometry::WritingMode" },
     { generic = false, gecko = "mozilla::ServoCustomPropertiesMap", servo = "Option<::servo_arc::Arc<::custom_properties::CustomPropertiesMap>>" },
     { generic = false, gecko = "mozilla::ServoRuleNode", servo = "Option<::rule_tree::StrongRuleNode>" },
     { generic = false, gecko = "mozilla::ServoVisitedStyle", servo = "Option<::servo_arc::RawOffsetArc<::properties::ComputedValues>>" },
     { generic = false, gecko = "mozilla::ServoComputedValueFlags", servo = "::properties::computed_value_flags::ComputedValueFlags" },
     { generic = true, gecko = "mozilla::ServoRawOffsetArc", servo = "::servo_arc::RawOffsetArc" },
-    { generic = false, gecko = "nsACString", servo = "nsstring::nsACString" },
-    { generic = false, gecko = "nsAString", servo = "nsstring::nsAString" },
-    { generic = false, gecko = "nsCString", servo = "nsstring::nsCString" },
-    { generic = false, gecko = "nsString", servo = "nsstring::nsStringRepr" },
+    { generic = false, gecko = "ComputedStyleStrong", servo = "::gecko_bindings::sugar::ownership::Strong<::properties::ComputedValues>" },
+]
+fixups = [
+    { pat = "\\broot\\s*::\\s*nsString\\b", rep = "::nsstring::nsStringRepr" },
+    { pat = "\\broot\\s*::\\s*nsTString\\s*<\\s*u16\\s*>", rep = "::nsstring::nsStringRepr" },
 ]
 
+[bindings]
+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",
+]
+raw-lines = [
+    "pub use nsstring::{nsACString, nsAString, nsCString, nsString, nsStringRepr};",
+    "use gecko_bindings::structs::*;",
+    "use gecko_bindings::structs::mozilla::gfx::*;",
+    "use gecko_bindings::structs::nsStyleTransformMatrix::*;",
+    "type nsACString_internal = nsACString;",
+    "type nsAString_internal = nsAString;",
+]
 whitelist-functions = ["Servo_.*", "Gecko_.*"]
-
 fixups = [
-    { pat = "\\broot\\s*::\\s*nsTString\\s*<\\s*u16\\s*>", rep = "::nsstring::nsStringRepr" },
+    # 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" },
 ]
new file mode 100644
--- /dev/null
+++ b/layout/style/ServoBoxedTypeList.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* a list of all Servo Box<T> types used across bindings, for preprocessing */
+
+// The first argument is the name of the Servo type used inside the Box.
+// This doesn't need to be accurate; it's only used to generate nice looking
+// FFI function names.
+//
+// The second argument is the name of an opaque Gecko type that will
+// correspond to the Servo type used inside the Box.  The convention for the
+// the name of the opaque Gecko type is "RawServo{Type}", where {Type} is
+// the name of the Servo type or something close to it.
+//
+// See the comment at the top of ServoBindingTypes.h for how to use these.
+//
+// If you add an entry to this file, you should also add impls of HasFFI
+// (with FFIType equal to ::gecko_bindings::structs::RawServo{Type}),
+// HasSimpleFFI, and HasBoxFFI to the Servo type. You will also need to
+// add a Servo_{FriendlyServoName}_Drop function to servo/ports/gecko/glue.rs.
+//
+// TODO(heycam): Do some of this automatically.
+
+// clang-format off
+// Needs to be a on single line
+SERVO_BOXED_TYPE(StyleSet, RawServoStyleSet)
+SERVO_BOXED_TYPE(AuthorStyles, RawServoAuthorStyles)
+SERVO_BOXED_TYPE(SelectorList, RawServoSelectorList)
+SERVO_BOXED_TYPE(SourceSizeList, RawServoSourceSizeList)
+SERVO_BOXED_TYPE(UseCounters, StyleUseCounters)
+// clang-format on
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -88,16 +88,17 @@ EXPORTS.mozilla += [
     'PostTraversalTask.h',
     'PreferenceSheet.h',
     'PreloadedStyleSheet.h',
     'PseudoStyleType.h',
     'RustCell.h',
     'ServoArcTypeList.h',
     'ServoBindings.h',
     'ServoBindingTypes.h',
+    'ServoBoxedTypeList.h',
     'ServoComputedData.h',
     'ServoComputedDataInlines.h',
     'ServoCSSParser.h',
     'ServoCSSRuleList.h',
     'ServoElementSnapshot.h',
     'ServoElementSnapshotTable.h',
     'ServoStyleSet.h',
     'ServoStyleSetInlines.h',
--- a/layout/style/test/gtest/StyloParsingBench.cpp
+++ b/layout/style/test/gtest/StyloParsingBench.cpp
@@ -80,17 +80,17 @@ static void ServoGetPropertyValueById() 
     ASSERT_TRUE(value.EqualsLiteral("10px"));
   }
 }
 
 MOZ_GTEST_BENCH(Stylo, Servo_StyleSheet_FromUTF8Bytes_Bench,
                 [] { ServoParsingBench(nullptr); });
 
 MOZ_GTEST_BENCH(Stylo, Servo_StyleSheet_FromUTF8Bytes_Bench_UseCounters, [] {
-  UniquePtr<StyleUseCounters> counters = Servo_UseCounters_Create().Consume();
+  UniquePtr<StyleUseCounters> counters(Servo_UseCounters_Create());
   ServoParsingBench(counters.get());
 });
 
 MOZ_GTEST_BENCH(Stylo, Servo_DeclarationBlock_SetPropertyById_Bench,
                 [] { ServoSetPropertyByIdBench(NS_LITERAL_CSTRING("10px")); });
 
 MOZ_GTEST_BENCH(Stylo,
                 Servo_DeclarationBlock_SetPropertyById_WithInitialSpace_Bench,
--- a/servo/components/style/build_gecko.rs
+++ b/servo/components/style/build_gecko.rs
@@ -27,16 +27,17 @@ mod bindings {
     use std::process::{exit, Command};
     use std::slice;
     use std::sync::Mutex;
     use std::time::SystemTime;
     use toml;
     use toml::value::Table;
 
     const STRUCTS_FILE: &'static str = "structs.rs";
+    const BINDINGS_FILE: &'static str = "bindings.rs";
 
     fn read_config(path: &PathBuf) -> Table {
         println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
         update_last_modified(&path);
 
         let mut contents = String::new();
         File::open(path)
             .expect("Failed to open config file")
@@ -214,16 +215,61 @@ mod bindings {
         }
         let bytes = result.into_bytes();
         File::create(&out_file)
             .unwrap()
             .write_all(&bytes)
             .expect("Unable to write output");
     }
 
+    fn get_types(filename: &str, macro_pat: &str) -> Vec<(String, String)> {
+        // Read the file
+        let path = DISTDIR_PATH.join("include/mozilla/").join(filename);
+        let mut list_file = File::open(path).expect(&format!("Unable to open {}", filename));
+        let mut content = String::new();
+        list_file
+            .read_to_string(&mut content)
+            .expect(&format!("Failed to read {}", filename));
+        // Remove comments
+        let block_comment_re = Regex::new(r#"(?s)/\*.*?\*/"#).unwrap();
+        let line_comment_re = Regex::new(r#"//.*"#).unwrap();
+        let content = block_comment_re.replace_all(&content, "");
+        let content = line_comment_re.replace_all(&content, "");
+        // Extract the list
+        let re_string = format!(r#"^({})\(.+,\s*(\w+)\)$"#, macro_pat);
+        let re = Regex::new(&re_string).unwrap();
+        content
+            .lines()
+            .map(|line| line.trim())
+            .filter(|line| !line.is_empty())
+            .map(|line| {
+                let captures = re
+                    .captures(&line)
+                    .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_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> {
+        get_types("ServoBoxedTypeList.h", "SERVO_BOXED_TYPE")
+            .into_iter()
+            .map(|(_, type_name)| type_name)
+            .collect()
+    }
+
     struct BuilderWithConfig<'a> {
         builder: Builder,
         config: &'a Table,
         used_keys: HashSet<&'static str>,
     }
     impl<'a> BuilderWithConfig<'a> {
         fn new(builder: Builder, config: &'a Table) -> Self {
             BuilderWithConfig {
@@ -289,21 +335,20 @@ mod bindings {
             }
             self.builder
         }
     }
 
     fn generate_structs() {
         let builder = Builder::get_initial_builder()
             .enable_cxx_namespaces()
-            .with_codegen_config(CodegenConfig::TYPES | CodegenConfig::VARS | CodegenConfig::FUNCTIONS);
+            .with_codegen_config(CodegenConfig::TYPES | CodegenConfig::VARS);
         let mut fixups = vec![];
         let builder = BuilderWithConfig::new(builder, CONFIG["structs"].as_table().unwrap())
             .handle_common(&mut fixups)
-            .handle_str_items("whitelist-functions", |b, item| b.whitelist_function(item))
             .handle_str_items("bitfield-enums", |b, item| b.bitfield_enum(item))
             .handle_str_items("rusty-enums", |b, item| b.rustified_enum(item))
             .handle_str_items("whitelist-vars", |b, item| b.whitelist_var(item))
             .handle_str_items("whitelist-types", |b, item| b.whitelist_type(item))
             .handle_str_items("opaque-types", |b, item| b.opaque_type(item))
             .handle_table_items("cbindgen-types", |b, item| {
                 let gecko = item["gecko"].as_str().unwrap();
                 let servo = item["servo"].as_str().unwrap();
@@ -384,16 +429,54 @@ 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 fixups = vec![];
+        let mut builder = BuilderWithConfig::new(builder, config)
+            .handle_common(&mut fixups)
+            .handle_str_items("whitelist-functions", |b, item| b.whitelist_function(item))
+            .get_builder();
+        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
+                ));
+        }
+        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
+                ));
+        }
+        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");
         println!("cargo:rerun-if-changed={}", script.display());
         let status = Command::new(&*PYTHON)
             .arg(&script)
             .arg(DISTDIR_PATH.as_os_str())
@@ -401,19 +484,34 @@ mod bindings {
             .status()
             .unwrap();
         if !status.success() {
             exit(1);
         }
     }
 
     pub fn generate() {
-        setup_logging();
-        generate_structs();
-        generate_atoms();
+        use std::thread;
+        macro_rules! run_tasks {
+            ($($task:expr,)+) => {
+                if setup_logging() {
+                    $($task;)+
+                } else {
+                    let threads = vec![$( thread::spawn(|| $task) ),+];
+                    for thread in threads.into_iter() {
+                        thread.join().unwrap();
+                    }
+                }
+            }
+        }
+        run_tasks! {
+            generate_structs(),
+            generate_bindings(),
+            generate_atoms(),
+        }
 
         for path in ADDED_PATHS.lock().unwrap().iter() {
             println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
         }
     }
 }
 
 #[cfg(not(feature = "bindgen"))]
--- a/servo/components/style/cbindgen.toml
+++ b/servo/components/style/cbindgen.toml
@@ -104,19 +104,16 @@ include = [
   "TransformOrigin",
   "WordBreak",
   "Contain",
   "RestyleHint",
   "TouchAction",
   "WillChangeBits",
   "TextDecorationLine",
   "MozListReversed",
-  "Owned",
-  "OwnedOrNull",
-  "Strong",
 ]
 item_types = ["enums", "structs", "typedefs"]
 
 [export.body]
 "CSSPixelLength" = """
   inline nscoord ToAppUnits() const;
   inline bool IsZero() const;
 """
@@ -206,34 +203,8 @@ item_types = ["enums", "structs", "typed
   inline const StyleLengthPercentage& Get(mozilla::HalfCorner) const;
 """
 
 "RestyleHint" = """
   static inline StyleRestyleHint RestyleSubtree();
   static inline StyleRestyleHint RecascadeSubtree();
   static inline StyleRestyleHint ForAnimations();
 """
-
-# TODO(emilio): Add hooks to cbindgen to be able to generate MOZ_MUST_USE_TYPE
-# or MOZ_MUST_USE on the functions.
-"Owned" = """
-  UniquePtr<GeckoType> Consume() {
-    UniquePtr<GeckoType> ret(ptr);
-    ptr = nullptr;
-    return ret;
-  }
-"""
-
-"OwnedOrNull" = """
-  UniquePtr<GeckoType> Consume() {
-    UniquePtr<GeckoType> ret(ptr);
-    ptr = nullptr;
-    return ret;
-  }
-"""
-
-"Strong" = """
-  already_AddRefed<GeckoType> Consume() {
-    already_AddRefed<GeckoType> ret(const_cast<GeckoType*>(ptr));
-    ptr = nullptr;
-    return ret;
-  }
-"""
--- a/servo/components/style/gecko/arc_types.rs
+++ b/servo/components/style/gecko/arc_types.rs
@@ -13,30 +13,33 @@ use crate::gecko_bindings::structs::RawS
 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;
 use crate::gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI, Strong};
 use crate::media_queries::MediaList;
 use crate::properties::animated_properties::AnimationValue;
 use crate::properties::{ComputedValues, PropertyDeclarationBlock};
+use crate::rule_tree::StrongRuleNode;
 use crate::shared_lock::Locked;
 use crate::stylesheets::keyframes_rule::Keyframe;
 use crate::stylesheets::{CounterStyleRule, CssRules, FontFaceRule, FontFeatureValuesRule};
 use crate::stylesheets::{DocumentRule, ImportRule, KeyframesRule, MediaRule};
 use crate::stylesheets::{NamespaceRule, PageRule};
 use crate::stylesheets::{StyleRule, StylesheetContents, SupportsRule};
 use servo_arc::{Arc, ArcBorrow};
 use std::{mem, ptr};
@@ -113,16 +116,41 @@ impl_arc_ffi!(Locked<CounterStyleRule> =
               [Servo_CounterStyleRule_AddRef, Servo_CounterStyleRule_Release]);
 
 impl_arc_ffi!(CssUrlData => RawServoCssUrlData
               [Servo_CssUrlData_AddRef, Servo_CssUrlData_Release]);
 
 impl_arc_ffi!(Box<[QuotePair]> => RawServoQuotes
               [Servo_Quotes_AddRef, Servo_Quotes_Release]);
 
+// RuleNode is a Arc-like type but it does not use Arc.
+
+impl StrongRuleNode {
+    pub fn into_strong(self) -> RawServoRuleNodeStrong {
+        let ptr = self.ptr();
+        mem::forget(self);
+        unsafe { mem::transmute(ptr) }
+    }
+
+    pub fn from_ffi<'a>(ffi: &'a &RawServoRuleNode) -> &'a Self {
+        unsafe { &*(ffi as *const &RawServoRuleNode as *const StrongRuleNode) }
+    }
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn Servo_RuleNode_AddRef(obj: &RawServoRuleNode) {
+    mem::forget(StrongRuleNode::from_ffi(&obj).clone());
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn Servo_RuleNode_Release(obj: &RawServoRuleNode) {
+    let ptr = StrongRuleNode::from_ffi(&obj);
+    ptr::read(ptr as *const StrongRuleNode);
+}
+
 // ComputedStyle is not an opaque type on any side of FFI.
 // This means that doing the HasArcFFI type trick is actually unsound,
 // since it gives us a way to construct an Arc<ComputedStyle> from
 // an &ComputedStyle, which in general is not allowed. So we
 // implement the restricted set of arc type functionality we need.
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_ComputedStyle_AddRef(obj: &ComputedValues) {
--- a/servo/components/style/gecko_bindings/mod.rs
+++ b/servo/components/style/gecko_bindings/mod.rs
@@ -1,25 +1,28 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
 
 //! Gecko's C++ bindings, along with some rust helpers to ease its use.
 
+#[allow(dead_code, improper_ctypes, non_camel_case_types, missing_docs)]
+pub mod bindings {
+    include!(concat!(env!("OUT_DIR"), "/gecko/bindings.rs"));
+}
+
 // FIXME: We allow `improper_ctypes` (for now), because the lint doesn't allow
 // foreign structs to have `PhantomData`. We should remove this once the lint
 // ignores this case.
 
 #[allow(
     dead_code,
     improper_ctypes,
     non_camel_case_types,
     non_snake_case,
     non_upper_case_globals,
     missing_docs
 )]
 pub mod structs {
     include!(concat!(env!("OUT_DIR"), "/gecko/structs.rs"));
 }
 
-pub use self::structs as bindings;
-
 pub mod sugar;
--- a/servo/components/style/gecko_bindings/sugar/ownership.rs
+++ b/servo/components/style/gecko_bindings/sugar/ownership.rs
@@ -130,22 +130,22 @@ pub unsafe trait HasArcFFI: HasFFI {
                 Some(transmute::<&&Self::FFIType, &RawOffsetArc<_>>(reference))
             } else {
                 None
             }
         }
     }
 }
 
+#[repr(C)]
 /// Gecko-FFI-safe Arc (T is an ArcInner).
 ///
 /// This can be null.
 ///
 /// Leaks on drop. Please don't drop this.
-#[repr(C)]
 pub struct Strong<GeckoType> {
     ptr: *const GeckoType,
     _marker: PhantomData<GeckoType>,
 }
 
 impl<GeckoType> Strong<GeckoType> {
     #[inline]
     /// Returns whether this reference is null.
@@ -315,16 +315,37 @@ impl<GeckoType> OwnedOrNull<GeckoType> {
     }
 
     /// Returns whether this pointer is null.
     #[inline]
     pub fn is_null(&self) -> bool {
         self.ptr.is_null()
     }
 
+    /// Returns an owned pointer if this is non-null, and `None` otherwise.
+    pub fn into_box_opt<ServoType>(self) -> Option<Box<ServoType>>
+    where
+        ServoType: HasBoxFFI<FFIType = GeckoType>,
+    {
+        if self.is_null() {
+            None
+        } else {
+            Some(unsafe { transmute(self) })
+        }
+    }
+
+    /// Returns an `Owned<GeckoType>` if non-null, `None` otherwise.
+    pub fn into_owned_opt(self) -> Option<Owned<GeckoType>> {
+        if self.is_null() {
+            None
+        } else {
+            Some(unsafe { transmute(self) })
+        }
+    }
+
     /// Gets a immutable reference to the underlying Gecko type, or `None` if
     /// null.
     pub fn borrow(&self) -> Option<&GeckoType> {
         unsafe { transmute(self) }
     }
 
     /// Gets a mutable reference to the underlying Gecko type, or `None` if
     /// null.
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -68,16 +68,17 @@ use style::gecko_bindings::structs::nsCo
 use style::gecko_bindings::structs::nsStyleTransformMatrix::MatrixTransformOperator;
 use style::gecko_bindings::structs::nsTArray;
 use style::gecko_bindings::structs::nsTimingFunction;
 use style::gecko_bindings::structs::nsresult;
 use style::gecko_bindings::structs::AtomArray;
 use style::gecko_bindings::structs::PseudoStyleType;
 use style::gecko_bindings::structs::CallerType;
 use style::gecko_bindings::structs::CompositeOperation;
+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::RawServoSelectorList;
@@ -90,17 +91,17 @@ use style::gecko_bindings::structs::Serv
 use style::gecko_bindings::structs::SheetLoadData;
 use style::gecko_bindings::structs::SheetLoadDataHolder;
 use style::gecko_bindings::structs::SheetParsingMode;
 use style::gecko_bindings::structs::StyleContentType;
 use style::gecko_bindings::structs::StyleRuleInclusion;
 use style::gecko_bindings::structs::StyleSheet as DomStyleSheet;
 use style::gecko_bindings::structs::URLExtraData;
 use style::gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI, HasFFI};
-use style::gecko_bindings::sugar::ownership::{HasSimpleFFI, HasBoxFFI, Strong, Owned, OwnedOrNull};
+use style::gecko_bindings::sugar::ownership::{HasSimpleFFI, Strong};
 use style::gecko_bindings::sugar::refptr::RefPtr;
 use style::gecko_properties;
 use style::global_style_data::{GlobalStyleData, GLOBAL_STYLE_DATA, STYLE_THREAD_POOL};
 use style::invalidation::element::restyle_hints::RestyleHint;
 use style::media_queries::MediaList;
 use style::parser::{self, Parse, ParserContext};
 use style::properties::animated_properties::AnimationValue;
 use style::properties::{parse_one_declaration_into, parse_style_attribute};
@@ -356,17 +357,17 @@ pub extern "C" fn Servo_MaybeGCRuleTree(
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValues_Interpolate(
     from: &RawServoAnimationValue,
     to: &RawServoAnimationValue,
     progress: f64,
-) -> Strong<RawServoAnimationValue> {
+) -> 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 {
         Strong::null()
     }
 }
@@ -382,45 +383,45 @@ pub extern "C" fn Servo_AnimationValues_
         .animate(to_value, Procedure::Interpolate { progress: 0.5 })
         .is_ok()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValues_Add(
     a: &RawServoAnimationValue,
     b: &RawServoAnimationValue,
-) -> Strong<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 {
         Strong::null()
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValues_Accumulate(
     a: &RawServoAnimationValue,
     b: &RawServoAnimationValue,
     count: u64,
-) -> Strong<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::Accumulate { count }) {
         Arc::new(value).into_strong()
     } else {
         Strong::null()
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValues_GetZeroValue(
     value_to_match: &RawServoAnimationValue,
-) -> Strong<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 {
         Strong::null()
     }
 }
 
@@ -592,17 +593,17 @@ fn compose_animation_segment(
 #[no_mangle]
 pub extern "C" fn Servo_ComposeAnimationSegment(
     segment: &structs::AnimationPropertySegment,
     underlying_value: Option<&RawServoAnimationValue>,
     last_value: Option<&RawServoAnimationValue>,
     iteration_composite: IterationCompositeOperation,
     progress: f64,
     current_iteration: u64,
-) -> Strong<RawServoAnimationValue> {
+) -> 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,
@@ -750,25 +751,25 @@ pub extern "C" fn Servo_AnimationValue_G
     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) -> Strong<RawServoAnimationValue> {
+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,
-) -> Strong<RawServoAnimationValue> {
+) -> 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);
 
@@ -829,17 +830,17 @@ 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,
-) -> Strong<RawServoAnimationValue> {
+) -> 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 transform = gecko_properties::clone_transform_from_list(list);
     match property {
@@ -878,17 +879,17 @@ pub extern "C" fn Servo_AnimationValue_D
     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: &RawServoAnimationValue,
-) -> Strong<RawServoDeclarationBlock> {
+) -> 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,
@@ -925,17 +926,17 @@ fn resolve_rules_for_element_with_contex
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_GetBaseComputedValuesForElement(
     raw_style_set: &RawServoStyleSet,
     element: &RawGeckoElement,
     computed_values: &ComputedValues,
     snapshots: *const ServoElementSnapshotTable,
-) -> Strong<ComputedValues> {
+) -> 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,
     };
 
@@ -967,20 +968,20 @@ pub extern "C" fn Servo_StyleSet_GetBase
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_GetComputedValuesByAddingAnimation(
     raw_style_set: &RawServoStyleSet,
     element: &RawGeckoElement,
     computed_values: &ComputedValues,
     snapshots: *const ServoElementSnapshotTable,
     animation_value: &RawServoAnimationValue,
-) -> Strong<ComputedValues> {
+) -> ComputedStyleStrong {
     debug_assert!(!snapshots.is_null());
     let rules = match computed_values.rules {
-        None => return Strong::null(),
+        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();
     let doc_data = PerDocumentStyleData::from_ffi(raw_style_set).borrow();
 
@@ -992,17 +993,17 @@ pub extern "C" fn Servo_StyleSet_GetComp
         doc_data
             .stylist
             .rule_tree()
             .add_animation_rules_at_transition_level(rules, declarations, &guards)
     };
 
     let element = GeckoElement(element);
     if element.borrow_data().is_none() {
-        return Strong::null();
+        return ComputedStyleStrong::null();
     }
 
     let shared = create_shared_context(
         &global_style_data,
         &guard,
         &doc_data,
         TraversalFlags::empty(),
         unsafe { &*snapshots },
@@ -1015,17 +1016,17 @@ pub extern "C" fn Servo_StyleSet_GetComp
 
     resolve_rules_for_element_with_context(element, context, with_animations_rules).into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ComputedValues_ExtractAnimationValue(
     computed_values: &ComputedValues,
     property_id: nsCSSPropertyID,
-) -> Strong<RawServoAnimationValue> {
+) -> 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(),
     }
@@ -1211,17 +1212,17 @@ pub extern "C" fn Servo_Element_HasPrima
         .borrow_data()
         .expect("Looking for CVs on unstyled element");
     data.has_styles()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Element_GetPrimaryComputedValues(
     element: &RawGeckoElement,
-) -> Strong<ComputedValues> {
+) -> ComputedStyleStrong {
     let element = GeckoElement(element);
     let data = element
         .borrow_data()
         .expect("Getting CVs on unstyled element");
     data.styles.primary().clone().into()
 }
 
 #[no_mangle]
@@ -1235,17 +1236,17 @@ pub extern "C" fn Servo_Element_HasPseud
         .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: &RawGeckoElement,
     index: usize,
-) -> Strong<ComputedValues> {
+) -> 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()
@@ -1302,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,
-) -> Strong<RawServoStyleSheetContents> {
+) -> 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,
@@ -1335,17 +1336,17 @@ pub extern "C" fn Servo_StyleSheet_FromU
     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: Option<&UseCounters>,
-) -> Strong<RawServoStyleSheetContents> {
+) -> 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 {
@@ -1421,22 +1422,22 @@ pub extern "C" fn Servo_StyleSet_AppendS
     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() -> Owned<RawServoAuthorStyles> {
-    Box::new(AuthorStyles::<GeckoStyleSheet>::new()).into_ffi()
-}
-
-#[no_mangle]
-pub extern "C" fn Servo_AuthorStyles_Drop(styles: Owned<RawServoAuthorStyles>) {
+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: bindings::RawServoAuthorStylesOwned) {
     let _ = styles.into_box::<AuthorStyles<_>>();
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AuthorStyles_AppendStyleSheet(
     styles: &mut RawServoAuthorStyles,
     sheet: *const DomStyleSheet,
 ) {
@@ -1678,28 +1679,28 @@ pub extern "C" fn Servo_StyleSheet_HasRu
         .read_with(&guard)
         .0
         .is_empty()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_GetRules(
     sheet: &RawServoStyleSheetContents,
-) -> Strong<ServoCssRules> {
+) -> bindings::ServoCssRulesStrong {
     StylesheetContents::as_arc(&sheet)
         .rules
         .clone()
         .into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_Clone(
     raw_sheet: &RawServoStyleSheetContents,
     reference_sheet: *const DomStyleSheet,
-) -> Strong<RawServoStyleSheetContents> {
+) -> 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()
@@ -1940,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) -> Strong<ServoCssRules> {
+        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),
@@ -2025,17 +2026,17 @@ impl_basic_rule_funcs! { (CounterStyle, 
     getter: Servo_CssRules_GetCounterStyleRuleAt,
     debug: Servo_CounterStyleRule_Debug,
     to_css: Servo_CounterStyleRule_GetCssText,
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleRule_GetStyle(
     rule: &RawServoStyleRule,
-) -> Strong<RawServoDeclarationBlock> {
+) -> bindings::RawServoDeclarationBlockStrong {
     read_locked_arc(rule, |rule: &StyleRule| rule.block.clone().into_strong())
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleRule_SetStyle(
     rule: &RawServoStyleRule,
     declarations: &RawServoDeclarationBlock,
 ) {
@@ -2329,17 +2330,17 @@ pub extern "C" fn Servo_Keyframe_SetKeyT
     } else {
         false
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Keyframe_GetStyle(
     keyframe: &RawServoKeyframe,
-) -> Strong<RawServoDeclarationBlock> {
+) -> bindings::RawServoDeclarationBlockStrong {
     read_locked_arc(keyframe, |keyframe: &Keyframe| {
         keyframe.block.clone().into_strong()
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Keyframe_SetStyle(
     keyframe: &RawServoKeyframe,
@@ -2372,17 +2373,17 @@ pub extern "C" fn Servo_KeyframesRule_Ge
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_KeyframesRule_GetKeyframeAt(
     rule: &RawServoKeyframesRule,
     index: u32,
     line: *mut u32,
     column: *mut u32,
-) -> Strong<RawServoKeyframe> {
+) -> 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;
@@ -2431,17 +2432,17 @@ pub extern "C" fn Servo_KeyframesRule_De
     write_locked_arc(rule, |rule: &mut KeyframesRule| {
         rule.keyframes.remove(index as usize);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MediaRule_GetMedia(
     rule: &RawServoMediaRule,
-) -> Strong<RawServoMediaList> {
+) -> bindings::RawServoMediaListStrong {
     read_locked_arc(rule, |rule: &MediaRule| {
         rule.media_queries.clone().into_strong()
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_NamespaceRule_GetPrefix(
     rule: &RawServoNamespaceRule,
@@ -2454,17 +2455,17 @@ pub extern "C" fn Servo_NamespaceRule_Ge
 #[no_mangle]
 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: &RawServoPageRule,
-) -> Strong<RawServoDeclarationBlock> {
+) -> bindings::RawServoDeclarationBlockStrong {
     read_locked_arc(rule, |rule: &PageRule| rule.block.clone().into_strong())
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_PageRule_SetStyle(
     rule: &RawServoPageRule,
     declarations: &RawServoDeclarationBlock,
 ) {
@@ -2516,34 +2517,34 @@ pub extern "C" fn Servo_FontFeatureValue
 ) {
     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() -> Strong<RawServoFontFaceRule> {
+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: &RawServoFontFaceRule,
-) -> Strong<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: &RawServoFontFaceRule,
@@ -3100,17 +3101,17 @@ counter_style_descriptors! {
     ]
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_ComputedValues_GetForAnonymousBox(
     parent_style_or_null: Option<&ComputedValues>,
     pseudo: PseudoStyleType,
     raw_data: &RawServoStyleSet,
-) -> Strong<ComputedValues> {
+) -> 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());
 
     let metrics = get_metrics_provider_for_product();
@@ -3156,17 +3157,17 @@ pub unsafe extern "C" fn Servo_ComputedV
 
 #[no_mangle]
 pub extern "C" fn Servo_ResolvePseudoStyle(
     element: &RawGeckoElement,
     pseudo_type: PseudoStyleType,
     is_probe: bool,
     inherited_style: Option<&ComputedValues>,
     raw_data: &RawServoStyleSet,
-) -> Strong<ComputedValues> {
+) -> 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),
         is_probe
@@ -3235,17 +3236,17 @@ fn debug_atom_array(atoms: &AtomArray) -
 
 #[no_mangle]
 pub extern "C" fn Servo_ComputedValues_ResolveXULTreePseudoStyle(
     element: &RawGeckoElement,
     pseudo_tag: *mut nsAtom,
     inherited_style: &ComputedValues,
     input_word: *const AtomArray,
     raw_data: &RawServoStyleSet,
-) -> Strong<ComputedValues> {
+) -> ComputedStyleStrong {
     let element = GeckoElement(element);
     let data = element
         .borrow_data()
         .expect("Calling ResolveXULTreePseudoStyle on unstyled element?");
 
     let pseudo = unsafe {
         Atom::with(pseudo_tag, |atom| {
             PseudoElement::from_tree_pseudo_atom(atom, Box::new([]))
@@ -3429,17 +3430,17 @@ fn get_pseudo_style(
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_ComputedValues_Inherit(
     raw_data: &RawServoStyleSet,
     pseudo: PseudoStyleType,
     parent_style_context: Option<&ComputedValues>,
     target: structs::InheritTarget,
-) -> Strong<ComputedValues> {
+) -> 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());
 
     let mut style =
         StyleBuilder::for_inheritance(data.stylist.device(), parent_style_context, Some(&pseudo));
@@ -3508,17 +3509,17 @@ pub extern "C" fn Servo_StyleSet_Init(
 
 #[no_mangle]
 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: Owned<RawServoStyleSet>) {
+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: &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());
@@ -3552,17 +3553,17 @@ 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,
-) -> Strong<RawServoDeclarationBlock> {
+) -> bindings::RawServoDeclarationBlockStrong {
     let id =
         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,
@@ -3708,45 +3709,45 @@ 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,
-) -> Strong<RawServoDeclarationBlock> {
+) -> 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() -> Strong<RawServoDeclarationBlock> {
+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: &RawServoDeclarationBlock,
-) -> Strong<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()),
     )
@@ -4062,25 +4063,25 @@ pub extern "C" fn Servo_DeclarationBlock
     remove_property(
         declarations,
         get_property_id_from_nscsspropertyid!(property, false),
         before_change_closure,
     )
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_MediaList_Create() -> Strong<RawServoMediaList> {
+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: &RawServoMediaList,
-) -> Strong<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(
@@ -4820,17 +4821,17 @@ pub extern "C" fn Servo_TakeChangeHint(
     // 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: &RawGeckoElement,
     _raw_data: &RawServoStyleSet,
-) -> Strong<ComputedValues> {
+) -> ComputedStyleStrong {
     let element = GeckoElement(element);
     debug!("Servo_ResolveStyle: {:?}", element);
     let data = element
         .borrow_data()
         .expect("Resolving style on unstyled element");
 
     debug_assert!(
         element.has_current_styles(&*data),
@@ -4843,17 +4844,17 @@ pub extern "C" fn Servo_ResolveStyle(
 
 #[no_mangle]
 pub extern "C" fn Servo_ResolveStyleLazily(
     element: &RawGeckoElement,
     pseudo_type: PseudoStyleType,
     rule_inclusion: StyleRuleInclusion,
     snapshots: *const ServoElementSnapshotTable,
     raw_data: &RawServoStyleSet,
-) -> Strong<ComputedValues> {
+) -> 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);
     let pseudo = PseudoElement::from_pseudo_type(pseudo_type);
@@ -4921,17 +4922,17 @@ pub extern "C" fn Servo_ResolveStyleLazi
 #[no_mangle]
 pub extern "C" fn Servo_ReparentStyle(
     style_to_reparent: &ComputedValues,
     parent_style: &ComputedValues,
     parent_style_ignoring_first_line: &ComputedValues,
     layout_parent_style: &ComputedValues,
     element: Option<&RawGeckoElement>,
     raw_data: &RawServoStyleSet,
-) -> Strong<ComputedValues> {
+) -> 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);
 
@@ -5195,17 +5196,17 @@ pub extern "C" fn Servo_GetAnimationValu
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_Compute(
     element: &RawGeckoElement,
     declarations: &RawServoDeclarationBlock,
     style: &ComputedValues,
     raw_data: &RawServoStyleSet,
-) -> Strong<RawServoAnimationValue> {
+) -> 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()
@@ -5578,17 +5579,17 @@ pub extern "C" fn Servo_StyleSet_BuildFo
     set
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_ResolveForDeclarations(
     raw_data: &RawServoStyleSet,
     parent_style_context: Option<&ComputedValues>,
     declarations: &RawServoDeclarationBlock,
-) -> Strong<ComputedValues> {
+) -> 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,
         None => doc_data.default_computed_values(),
@@ -5882,32 +5883,32 @@ pub extern "C" fn Servo_HasPendingRestyl
         element = e.traversal_parent();
     }
     false
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SelectorList_Parse(
     selector_list: *const nsACString,
-) -> OwnedOrNull<RawServoSelectorList> {
+) -> *mut RawServoSelectorList {
     use style::selector_parser::SelectorParser;
 
     debug_assert!(!selector_list.is_null());
 
     let input = (*selector_list).as_str_unchecked();
     let selector_list = match SelectorParser::parse_author_origin_no_namespace(&input) {
         Ok(selector_list) => selector_list,
-        Err(..) => return OwnedOrNull::null(),
+        Err(..) => return ptr::null_mut(),
     };
 
-    Box::new(selector_list).into_ffi().maybe()
-}
-
-#[no_mangle]
-pub unsafe extern "C" fn Servo_SelectorList_Drop(list: Owned<RawServoSelectorList>) {
+    Box::into_raw(Box::new(selector_list)) as *mut RawServoSelectorList
+}
+
+#[no_mangle]
+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);
@@ -6155,34 +6156,34 @@ pub unsafe extern "C" fn Servo_ParseFont
     };
 
     true
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SourceSizeList_Parse(
     value: *const nsACString,
-) -> Owned<RawServoSourceSizeList> {
+) -> *mut RawServoSourceSizeList {
     let value = (*value).as_str_unchecked();
     let mut input = ParserInput::new(value);
     let mut parser = Parser::new(&mut input);
 
     let context = ParserContext::new(
         Origin::Author,
         dummy_url_data(),
         Some(CssRuleType::Style),
         ParsingMode::DEFAULT,
         QuirksMode::NoQuirks,
         None,
         None,
     );
 
     // NB: Intentionally not calling parse_entirely.
     let list = SourceSizeList::parse(&context, &mut parser);
-    Box::new(list).into_ffi()
+    Box::into_raw(Box::new(list)) as *mut _
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SourceSizeList_Evaluate(
     raw_data: &RawServoStyleSet,
     list: Option<&RawServoSourceSizeList>,
 ) -> i32 {
     let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
@@ -6193,17 +6194,17 @@ pub unsafe extern "C" fn Servo_SourceSiz
         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: Owned<RawServoSourceSizeList>) {
+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: &RawGeckoElement,
     document_style: &RawServoStyleSet,
     non_document_styles: *const nsTArray<&RawServoAuthorStyles>,
@@ -6249,22 +6250,22 @@ pub unsafe extern "C" fn Servo_PseudoCla
         None => 0,
         // Ignore :any-link since it contains both visited and unvisited state.
         Some(NonTSPseudoClass::AnyLink) => 0,
         Some(pseudo_class) => pseudo_class.state_flag().bits(),
     }
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn Servo_UseCounters_Create() -> Owned<structs::StyleUseCounters> {
-    Box::<UseCounters>::default().into_ffi()
-}
-
-#[no_mangle]
-pub unsafe extern "C" fn Servo_UseCounters_Drop(c: Owned<structs::StyleUseCounters>) {
+pub unsafe extern "C" fn Servo_UseCounters_Create() -> *mut structs::StyleUseCounters {
+    Box::into_raw(Box::<UseCounters>::default()) as *mut _
+}
+
+#[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: &UseCounters,
     sheet_counters: &UseCounters,
 ) {
@@ -6282,17 +6283,17 @@ pub unsafe extern "C" fn Servo_IsCssProp
         Some(id) => id,
         None => return false,
     };
 
     use_counters.non_custom_properties.recorded(non_custom_id)
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_Quotes_GetInitialValue() -> Strong<RawServoQuotes> {
+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: &RawServoQuotes, b: &RawServoQuotes) -> bool {