Bug 1451289 - Part 5: Rename ServoFontFaceRule to CSSFontFaceRule r=emilio
authorNazım Can Altınova <canaltinova@gmail.com>
Tue, 05 Jun 2018 01:55:11 +0200
changeset 476671 77f31a0e6340126f368022b5acfa945710ca857f
parent 476670 b9cf191f3443a7359ba00824651ec45ce689c6c2
child 476672 828e691c05ddd0258485d9617ab24addedd0d9ab
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1451289
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1451289 - Part 5: Rename ServoFontFaceRule to CSSFontFaceRule r=emilio MozReview-Commit-ID: 9S7aW0373NL
dom/bindings/Bindings.conf
layout/inspector/InspectorFontFace.cpp
layout/inspector/InspectorFontFace.h
layout/style/CSSFontFaceRule.cpp
layout/style/CSSFontFaceRule.h
layout/style/FontFace.cpp
layout/style/FontFace.h
layout/style/FontFaceSet.cpp
layout/style/ServoCSSRuleList.cpp
layout/style/ServoFontFaceRule.cpp
layout/style/ServoFontFaceRule.h
layout/style/moz.build
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -173,21 +173,16 @@ DOMInterfaces = {
     'headerFile': 'mozilla/css/GroupRule.h',
 },
 
 'CSSCounterStyleRule': {
     'nativeType': 'mozilla::ServoCounterStyleRule',
     'headerFile': 'mozilla/ServoCounterStyleRule.h',
 },
 
-'CSSFontFaceRule': {
-    'nativeType': 'mozilla::ServoFontFaceRule',
-    'headerFile': 'mozilla/ServoFontFaceRule.h',
-},
-
 'CSSGroupingRule': {
     'concrete': False,
     'nativeType': 'mozilla::css::GroupRule',
 },
 
 'CSSLexer': {
     'wrapperCache': False
 },
--- a/layout/inspector/InspectorFontFace.cpp
+++ b/layout/inspector/InspectorFontFace.cpp
@@ -8,19 +8,19 @@
 
 #include "gfxPlatformFontList.h"
 #include "gfxTextRun.h"
 #include "gfxUserFontSet.h"
 #include "nsFontFaceLoader.h"
 #include "mozilla/gfx/2D.h"
 #include "brotli/decode.h"
 #include "zlib.h"
+#include "mozilla/dom/CSSFontFaceRule.h"
 #include "mozilla/dom/FontFaceSet.h"
 #include "mozilla/ServoBindings.h"
-#include "mozilla/ServoFontFaceRule.h"
 #include "mozilla/Unused.h"
 
 namespace mozilla {
 namespace dom {
 
 bool
 InspectorFontFace::FromFontGroup()
 {
@@ -64,17 +64,17 @@ InspectorFontFace::GetCSSGeneric(nsAStri
   if (genericType >= FontFamilyType::eFamily_generic_first &&
       genericType <= FontFamilyType::eFamily_generic_last) {
     aName.AssignASCII(gfxPlatformFontList::GetGenericName(genericType));
   } else {
     aName.Truncate(0);
   }
 }
 
-ServoFontFaceRule*
+CSSFontFaceRule*
 InspectorFontFace::GetRule()
 {
   if (!mRule) {
     // check whether this font entry is associated with an @font-face rule
     // in the relevant font group's user font set
     RawServoFontFaceRule* rule = nullptr;
     if (mFontEntry->IsUserFont()) {
       FontFaceSet::UserFontSet* fontSet =
@@ -89,17 +89,17 @@ InspectorFontFace::GetRule()
     if (rule) {
       // XXX It would be better if we can share this with CSSOM tree,
       // but that may require us to create another map, which is not
       // great either. As far as they would use the same backend, and
       // we don't really support mutating @font-face rule via CSSOM,
       // it's probably fine for now.
       uint32_t line, column;
       Servo_FontFaceRule_GetSourceLocation(rule, &line, &column);
-      mRule = new ServoFontFaceRule(do_AddRef(rule), line, column);
+      mRule = new CSSFontFaceRule(do_AddRef(rule), line, column);
     }
   }
   return mRule;
 }
 
 int32_t
 InspectorFontFace::SrcIndex()
 {
--- a/layout/inspector/InspectorFontFace.h
+++ b/layout/inspector/InspectorFontFace.h
@@ -2,17 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_InspectorFontFace_h
 #define mozilla_InspectorFontFace_h
 
-#include "mozilla/ServoFontFaceRule.h"
+#include "mozilla/dom/CSSFontFaceRule.h"
 #include "mozilla/dom/InspectorUtilsBinding.h"
 #include "mozilla/dom/NonRefcountedDOMObject.h"
 #include "nsRange.h"
 #include "gfxFont.h"
 
 class gfxFontGroup;
 
 namespace mozilla {
@@ -52,17 +52,17 @@ public:
 
   // Web IDL
   bool FromFontGroup();
   bool FromLanguagePrefs();
   bool FromSystemFallback();
   void GetName(nsAString& aName);
   void GetCSSFamilyName(nsAString& aCSSFamilyName);
   void GetCSSGeneric(nsAString& aGeneric);
-  ServoFontFaceRule* GetRule();
+  CSSFontFaceRule* GetRule();
   int32_t SrcIndex();
   void GetURI(nsAString& aURI);
   void GetLocalName(nsAString& aLocalName);
   void GetFormat(nsAString& aFormat);
   void GetMetadata(nsAString& aMetadata);
 
   void GetVariationAxes(nsTArray<InspectorVariationAxis>& aResult,
                         ErrorResult& aRV);
@@ -78,17 +78,17 @@ public:
                   JS::MutableHandle<JSObject*> aReflector)
   {
     return InspectorFontFaceBinding::Wrap(aCx, this, aGivenProto, aReflector);
   }
 
 protected:
   RefPtr<gfxFontEntry> mFontEntry;
   RefPtr<gfxFontGroup> mFontGroup;
-  RefPtr<ServoFontFaceRule> mRule;
+  RefPtr<CSSFontFaceRule> mRule;
   gfxTextRange::MatchType mMatchType;
 
   nsTArray<RefPtr<nsRange>> mRanges;
 };
 
 } // namespace dom
 } // namespace mozilla
 
rename from layout/style/ServoFontFaceRule.cpp
rename to layout/style/CSSFontFaceRule.cpp
--- a/layout/style/ServoFontFaceRule.cpp
+++ b/layout/style/CSSFontFaceRule.cpp
@@ -1,230 +1,230 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "mozilla/ServoFontFaceRule.h"
+#include "mozilla/dom/CSSFontFaceRule.h"
 
 #include "mozilla/dom/CSSFontFaceRuleBinding.h"
 #include "mozilla/dom/CSSStyleDeclarationBinding.h"
 #include "nsCSSProps.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 // -------------------------------------------
-// ServoFontFaceRuleDecl and related routines
+// CSSFontFaceRuleDecl and related routines
 //
 
-// QueryInterface implementation for ServoFontFaceRuleDecl
-NS_INTERFACE_MAP_BEGIN(ServoFontFaceRuleDecl)
+// QueryInterface implementation for CSSFontFaceRuleDecl
+NS_INTERFACE_MAP_BEGIN(CSSFontFaceRuleDecl)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsICSSDeclaration)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   // We forward the cycle collection interfaces to ContainingRule(), which is
   // never null (in fact, we're part of that object!)
   if (aIID.Equals(NS_GET_IID(nsCycleCollectionISupports)) ||
       aIID.Equals(NS_GET_IID(nsXPCOMCycleCollectionParticipant))) {
     return ContainingRule()->QueryInterface(aIID, aInstancePtr);
   }
   else
 NS_INTERFACE_MAP_END
 
-NS_IMPL_ADDREF_USING_AGGREGATOR(ServoFontFaceRuleDecl, ContainingRule())
-NS_IMPL_RELEASE_USING_AGGREGATOR(ServoFontFaceRuleDecl, ContainingRule())
+NS_IMPL_ADDREF_USING_AGGREGATOR(CSSFontFaceRuleDecl, ContainingRule())
+NS_IMPL_RELEASE_USING_AGGREGATOR(CSSFontFaceRuleDecl, ContainingRule())
 
 // helper for string GetPropertyValue and RemovePropertyValue
 void
-ServoFontFaceRuleDecl::GetPropertyValue(nsCSSFontDesc aFontDescID,
-                                        nsAString& aResult) const
+CSSFontFaceRuleDecl::GetPropertyValue(nsCSSFontDesc aFontDescID,
+                                      nsAString& aResult) const
 {
   MOZ_ASSERT(aResult.IsEmpty());
   Servo_FontFaceRule_GetDescriptorCssText(mRawRule, aFontDescID, &aResult);
 }
 
 void
-ServoFontFaceRuleDecl::GetCssText(nsAString& aCssText)
+CSSFontFaceRuleDecl::GetCssText(nsAString& aCssText)
 {
   aCssText.Truncate();
   Servo_FontFaceRule_GetDeclCssText(mRawRule, &aCssText);
 }
 
 void
-ServoFontFaceRuleDecl::SetCssText(const nsAString& aCssText,
-                                  nsIPrincipal* aSubjectPrincipal,
-                                  ErrorResult& aRv)
+CSSFontFaceRuleDecl::SetCssText(const nsAString& aCssText,
+                                nsIPrincipal* aSubjectPrincipal,
+                                ErrorResult& aRv)
 {
   aRv.Throw(NS_ERROR_NOT_IMPLEMENTED); // bug 443978
 }
 
 NS_IMETHODIMP
-ServoFontFaceRuleDecl::GetPropertyValue(const nsAString& aPropName,
-                                        nsAString& aResult)
+CSSFontFaceRuleDecl::GetPropertyValue(const nsAString& aPropName,
+                                      nsAString& aResult)
 {
   aResult.Truncate();
   GetPropertyValue(nsCSSProps::LookupFontDesc(aPropName), aResult);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-ServoFontFaceRuleDecl::RemoveProperty(const nsAString& aPropName,
-                                      nsAString& aResult)
+CSSFontFaceRuleDecl::RemoveProperty(const nsAString& aPropName,
+                                    nsAString& aResult)
 {
   nsCSSFontDesc descID = nsCSSProps::LookupFontDesc(aPropName);
   NS_ASSERTION(descID >= eCSSFontDesc_UNKNOWN &&
                descID < eCSSFontDesc_COUNT,
                "LookupFontDesc returned value out of range");
 
   aResult.Truncate();
   if (descID != eCSSFontDesc_UNKNOWN) {
     GetPropertyValue(descID, aResult);
     Servo_FontFaceRule_ResetDescriptor(mRawRule, descID);
   }
   return NS_OK;
 }
 
 void
-ServoFontFaceRuleDecl::GetPropertyPriority(const nsAString& aPropName,
-                                           nsAString& aResult)
+CSSFontFaceRuleDecl::GetPropertyPriority(const nsAString& aPropName,
+                                         nsAString& aResult)
 {
   // font descriptors do not have priorities at present
   aResult.Truncate();
 }
 
 NS_IMETHODIMP
-ServoFontFaceRuleDecl::SetProperty(const nsAString& aPropName,
-                                   const nsAString& aValue,
-                                   const nsAString& aPriority,
-                                   nsIPrincipal* aSubjectPrincipal)
+CSSFontFaceRuleDecl::SetProperty(const nsAString& aPropName,
+                                 const nsAString& aValue,
+                                 const nsAString& aPriority,
+                                 nsIPrincipal* aSubjectPrincipal)
 {
   // FIXME(heycam): If we are changing unicode-range, then a FontFace object
   // representing this rule must have its mUnicodeRange value invalidated.
 
   return NS_ERROR_NOT_IMPLEMENTED; // bug 443978
 }
 
 uint32_t
-ServoFontFaceRuleDecl::Length()
+CSSFontFaceRuleDecl::Length()
 {
   return Servo_FontFaceRule_Length(mRawRule);
 }
 
 void
-ServoFontFaceRuleDecl::IndexedGetter(uint32_t aIndex, bool& aFound,
-                                     nsAString& aResult)
+CSSFontFaceRuleDecl::IndexedGetter(uint32_t aIndex, bool& aFound,
+                                   nsAString& aResult)
 {
   nsCSSFontDesc id = Servo_FontFaceRule_IndexGetter(mRawRule, aIndex);
   if (id != eCSSFontDesc_UNKNOWN) {
     aFound = true;
     aResult.AssignASCII(nsCSSProps::GetStringValue(id).get());
   } else {
     aFound = false;
   }
 }
 
 css::Rule*
-ServoFontFaceRuleDecl::GetParentRule()
+CSSFontFaceRuleDecl::GetParentRule()
 {
   return ContainingRule();
 }
 
 nsINode*
-ServoFontFaceRuleDecl::GetParentObject()
+CSSFontFaceRuleDecl::GetParentObject()
 {
   return ContainingRule()->GetParentObject();
 }
 
 JSObject*
-ServoFontFaceRuleDecl::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
+CSSFontFaceRuleDecl::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
 {
   return CSSStyleDeclarationBinding::Wrap(cx, this, aGivenProto);
 }
 
 // -------------------------------------------
-// ServoFontFaceRule
+// CSSFontFaceRule
 //
 
-NS_IMPL_CYCLE_COLLECTION_CLASS(ServoFontFaceRule)
+NS_IMPL_CYCLE_COLLECTION_CLASS(CSSFontFaceRule)
 
-NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(ServoFontFaceRule,
+NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(CSSFontFaceRule,
                                                mozilla::css::Rule)
   // Keep this in sync with IsCCLeaf.
 
   // Trace the wrapper for our declaration.  This just expands out
   // NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER which we can't use
   // directly because the wrapper is on the declaration, not on us.
   tmp->mDecl.TraceWrapper(aCallbacks, aClosure);
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(ServoFontFaceRule,
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(CSSFontFaceRule,
                                                 mozilla::css::Rule)
   // Keep this in sync with IsCCLeaf.
 
   // Unlink the wrapper for our declaraton.  This just expands out
   // NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER which we can't use
   // directly because the wrapper is on the declaration, not on us.
   tmp->mDecl.ReleaseWrapper(static_cast<nsISupports*>(p));
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ServoFontFaceRule,
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(CSSFontFaceRule,
                                                   mozilla::css::Rule)
   // Keep this in sync with IsCCLeaf.
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 bool
-ServoFontFaceRule::IsCCLeaf() const
+CSSFontFaceRule::IsCCLeaf() const
 {
   if (!Rule::IsCCLeaf()) {
     return false;
   }
 
   return !mDecl.PreservingWrapper();
 }
 
-NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(ServoFontFaceRule, mozilla::css::Rule)
+NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(CSSFontFaceRule, mozilla::css::Rule)
 
 #ifdef DEBUG
 void
-ServoFontFaceRule::List(FILE* out, int32_t aIndent) const
+CSSFontFaceRule::List(FILE* out, int32_t aIndent) const
 {
   nsAutoCString str;
   for (int32_t i = 0; i < aIndent; i++) {
     str.AppendLiteral("  ");
   }
   Servo_FontFaceRule_Debug(Raw(), &str);
   fprintf_stderr(out, "%s\n", str.get());
 }
 #endif
 
 uint16_t
-ServoFontFaceRule::Type() const
+CSSFontFaceRule::Type() const
 {
   return CSSRuleBinding::FONT_FACE_RULE;
 }
 
 void
-ServoFontFaceRule::GetCssText(nsAString& aCssText) const
+CSSFontFaceRule::GetCssText(nsAString& aCssText) const
 {
   aCssText.Truncate();
   Servo_FontFaceRule_GetCssText(Raw(), &aCssText);
 }
 
 nsICSSDeclaration*
-ServoFontFaceRule::Style()
+CSSFontFaceRule::Style()
 {
   return &mDecl;
 }
 
 /* virtual */ size_t
-ServoFontFaceRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
+CSSFontFaceRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
 {
   return aMallocSizeOf(this);
 }
 
 /* virtual */ JSObject*
-ServoFontFaceRule::WrapObject(JSContext* aCx,
-                              JS::Handle<JSObject*> aGivenProto)
+CSSFontFaceRule::WrapObject(JSContext* aCx,
+                            JS::Handle<JSObject*> aGivenProto)
 {
   return CSSFontFaceRuleBinding::Wrap(aCx, this, aGivenProto);
 }
rename from layout/style/ServoFontFaceRule.h
rename to layout/style/CSSFontFaceRule.h
--- a/layout/style/ServoFontFaceRule.h
+++ b/layout/style/CSSFontFaceRule.h
@@ -1,70 +1,72 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef mozilla_ServoFontFaceRule_h
-#define mozilla_ServoFontFaceRule_h
+#ifndef mozilla_CSSFontFaceRule_h
+#define mozilla_CSSFontFaceRule_h
 
 #include "mozilla/ServoBindingTypes.h"
 #include "mozilla/css/Rule.h"
 #include "nsICSSDeclaration.h"
 
 namespace mozilla {
+namespace dom {
 
-// A ServoFontFaceRuleDecl is always embeded in a ServoFontFaceRule.
-class ServoFontFaceRule;
-class ServoFontFaceRuleDecl final : public nsICSSDeclaration
+
+// A CSSFontFaceRuleDecl is always embeded in a CSSFontFaceRule.
+class CSSFontFaceRule;
+class CSSFontFaceRuleDecl final : public nsICSSDeclaration
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER
 
   nsINode* GetParentObject() final;
   void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName) final;
 
   void GetPropertyValue(nsCSSFontDesc aFontDescID, nsAString& aResult) const;
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
 
 protected:
   // For accessing the constructor.
-  friend class ServoFontFaceRule;
+  friend class CSSFontFaceRule;
 
-  explicit ServoFontFaceRuleDecl(already_AddRefed<RawServoFontFaceRule> aDecl)
+  explicit CSSFontFaceRuleDecl(already_AddRefed<RawServoFontFaceRule> aDecl)
     : mRawRule(std::move(aDecl)) {}
 
-  ~ServoFontFaceRuleDecl() = default;
+  ~CSSFontFaceRuleDecl() = default;
 
-  inline ServoFontFaceRule* ContainingRule();
-  inline const ServoFontFaceRule* ContainingRule() const;
+  inline CSSFontFaceRule* ContainingRule();
+  inline const CSSFontFaceRule* ContainingRule() const;
 
   RefPtr<RawServoFontFaceRule> mRawRule;
 
 private:
   void* operator new(size_t size) CPP_THROW_NEW = delete;
 };
 
-class ServoFontFaceRule final : public css::Rule
+class CSSFontFaceRule final : public css::Rule
 {
 public:
-  ServoFontFaceRule(already_AddRefed<RawServoFontFaceRule> aRawRule,
+  CSSFontFaceRule(already_AddRefed<RawServoFontFaceRule> aRawRule,
                     uint32_t aLine, uint32_t aColumn)
     : css::Rule(aLine, aColumn)
     , mDecl(std::move(aRawRule))
   {}
 
-  ServoFontFaceRule(const ServoFontFaceRule&) = delete;
+  CSSFontFaceRule(const CSSFontFaceRule&) = delete;
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
-      ServoFontFaceRule, css::Rule)
+      CSSFontFaceRule, css::Rule)
   bool IsCCLeaf() const final;
 
   RawServoFontFaceRule* Raw() const { return mDecl.mRawRule; }
 
   // WebIDL interface
   uint16_t Type() const final;
   void GetCssText(nsAString& aCssText) const final;
   nsICSSDeclaration* Style();
@@ -75,33 +77,34 @@ public:
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
 
 #ifdef DEBUG
   void List(FILE* out = stdout, int32_t aIndent = 0) const final;
 #endif
 
 private:
-  virtual ~ServoFontFaceRule() = default;
+  virtual ~CSSFontFaceRule() = default;
 
   // For computing the offset of mDecl.
-  friend class ServoFontFaceRuleDecl;
+  friend class CSSFontFaceRuleDecl;
 
-  ServoFontFaceRuleDecl mDecl;
+  CSSFontFaceRuleDecl mDecl;
 };
 
-inline ServoFontFaceRule*
-ServoFontFaceRuleDecl::ContainingRule()
+inline CSSFontFaceRule*
+CSSFontFaceRuleDecl::ContainingRule()
 {
-  return reinterpret_cast<ServoFontFaceRule*>
-    (reinterpret_cast<char*>(this) - offsetof(ServoFontFaceRule, mDecl));
+  return reinterpret_cast<CSSFontFaceRule*>
+    (reinterpret_cast<char*>(this) - offsetof(CSSFontFaceRule, mDecl));
 }
 
-inline const ServoFontFaceRule*
-ServoFontFaceRuleDecl::ContainingRule() const
+inline const CSSFontFaceRule*
+CSSFontFaceRuleDecl::ContainingRule() const
 {
-  return reinterpret_cast<const ServoFontFaceRule*>
-    (reinterpret_cast<const char*>(this) - offsetof(ServoFontFaceRule, mDecl));
+  return reinterpret_cast<const CSSFontFaceRule*>
+    (reinterpret_cast<const char*>(this) - offsetof(CSSFontFaceRule, mDecl));
 }
 
+} // namespace dom
 } // namespace mozilla
 
-#endif // mozilla_ServoFontFaceRule_h
+#endif // mozilla_CSSFontFaceRule_h
--- a/layout/style/FontFace.cpp
+++ b/layout/style/FontFace.cpp
@@ -2,25 +2,25 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/FontFace.h"
 
 #include <algorithm>
+#include "mozilla/dom/CSSFontFaceRule.h"
 #include "mozilla/dom/FontFaceBinding.h"
 #include "mozilla/dom/FontFaceSet.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/TypedArray.h"
 #include "mozilla/dom/UnionTypes.h"
 #include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/ServoCSSParser.h"
-#include "mozilla/ServoFontFaceRule.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/ServoUtils.h"
 #include "mozilla/StaticPrefs.h"
 #include "nsIDocument.h"
 #include "nsStyleUtil.h"
 
 namespace mozilla {
 namespace dom {
--- a/layout/style/FontFace.h
+++ b/layout/style/FontFace.h
@@ -16,18 +16,18 @@
 #include "nsWrapperCache.h"
 
 class gfxFontFaceBufferSource;
 struct RawServoFontFaceRule;
 
 namespace mozilla {
 struct CSSFontFaceDescriptors;
 class PostTraversalTask;
-class ServoFontFaceRule;
 namespace dom {
+class CSSFontFaceRule;
 class FontFaceBufferSource;
 struct FontFaceDescriptors;
 class FontFaceSet;
 class Promise;
 class StringOrArrayBufferOrArrayBufferView;
 } // namespace dom
 } // namespace mozilla
 
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -5,29 +5,29 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FontFaceSet.h"
 
 #include "gfxFontConstants.h"
 #include "gfxFontSrcPrincipal.h"
 #include "gfxFontSrcURI.h"
 #include "mozilla/css/Loader.h"
+#include "mozilla/dom/CSSFontFaceRule.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/FontFaceSetBinding.h"
 #include "mozilla/dom/FontFaceSetIterator.h"
 #include "mozilla/dom/FontFaceSetLoadEvent.h"
 #include "mozilla/dom/FontFaceSetLoadEventBinding.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/FontPropertyTypes.h"
 #include "mozilla/net/ReferrerPolicy.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/Logging.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ServoCSSParser.h"
-#include "mozilla/ServoFontFaceRule.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/ServoUtils.h"
 #include "mozilla/Sprintf.h"
 #include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/LoadInfo.h"
 #include "nsAutoPtr.h"
 #include "nsContentPolicyUtils.h"
--- a/layout/style/ServoCSSRuleList.cpp
+++ b/layout/style/ServoCSSRuleList.cpp
@@ -3,26 +3,26 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* representation of CSSRuleList for stylo */
 
 #include "mozilla/ServoCSSRuleList.h"
 
+#include "mozilla/dom/CSSFontFaceRule.h"
 #include "mozilla/dom/CSSKeyframesRule.h"
 #include "mozilla/dom/CSSMediaRule.h"
 #include "mozilla/dom/CSSNamespaceRule.h"
 #include "mozilla/dom/CSSStyleRule.h"
 #include "mozilla/IntegerRange.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/ServoCounterStyleRule.h"
 #include "mozilla/ServoDocumentRule.h"
 #include "mozilla/ServoImportRule.h"
-#include "mozilla/ServoFontFaceRule.h"
 #include "mozilla/ServoFontFeatureValuesRule.h"
 #include "mozilla/ServoPageRule.h"
 #include "mozilla/ServoSupportsRule.h"
 #include "mozilla/StyleSheet.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
@@ -108,17 +108,17 @@ ServoCSSRuleList::GetRule(uint32_t aInde
       CASE_RULE_CSS(KEYFRAMES, Keyframes)
       CASE_RULE_CSS(MEDIA, Media)
       CASE_RULE_CSS(NAMESPACE, Namespace)
       CASE_RULE(PAGE, Page)
       CASE_RULE(SUPPORTS, Supports)
       CASE_RULE(DOCUMENT, Document)
       CASE_RULE(IMPORT, Import)
       CASE_RULE(FONT_FEATURE_VALUES, FontFeatureValues)
-      CASE_RULE(FONT_FACE, FontFace)
+      CASE_RULE_CSS(FONT_FACE, FontFace)
       CASE_RULE(COUNTER_STYLE, CounterStyle)
 #undef CASE_RULE
       case CSSRuleBinding::KEYFRAME_RULE:
         MOZ_ASSERT_UNREACHABLE("keyframe rule cannot be here");
         return nullptr;
       default:
         NS_WARNING("stylo: not implemented yet");
         return nullptr;
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -83,17 +83,16 @@ EXPORTS.mozilla += [
     'ServoComputedData.h',
     'ServoComputedDataInlines.h',
     'ServoCounterStyleRule.h',
     'ServoCSSParser.h',
     'ServoCSSRuleList.h',
     'ServoDocumentRule.h',
     'ServoElementSnapshot.h',
     'ServoElementSnapshotTable.h',
-    'ServoFontFaceRule.h',
     'ServoFontFeatureValuesRule.h',
     'ServoImportRule.h',
     'ServoPageRule.h',
     'ServoSpecifiedValues.h',
     'ServoStyleSet.h',
     'ServoStyleSetInlines.h',
     'ServoSupportsRule.h',
     'ServoTraversalStatistics.h',
@@ -105,16 +104,17 @@ EXPORTS.mozilla += [
     'StyleSheet.h',
     'StyleSheetInfo.h',
     'StyleSheetInlines.h',
     'URLExtraData.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'CSS.h',
+    'CSSFontFaceRule.h',
     'CSSFontFeatureValuesRule.h',
     'CSSImportRule.h',
     'CSSKeyframeRule.h',
     'CSSKeyframesRule.h',
     'CSSLexer.h',
     'CSSMediaRule.h',
     'CSSMozDocumentRule.h',
     'CSSNamespaceRule.h',
@@ -144,16 +144,17 @@ EXPORTS.mozilla.css += [
 
 UNIFIED_SOURCES += [
     'AnimationCollection.cpp',
     'BindingStyleRule.cpp',
     'CachedInheritingStyles.cpp',
     'ComputedStyle.cpp',
     'CounterStyleManager.cpp',
     'CSS.cpp',
+    'CSSFontFaceRule.cpp',
     'CSSFontFeatureValuesRule.cpp',
     'CSSImportRule.cpp',
     'CSSKeyframeRule.cpp',
     'CSSKeyframesRule.cpp',
     'CSSLexer.cpp',
     'CSSMediaRule.cpp',
     'CSSMozDocumentRule.cpp',
     'CSSNamespaceRule.cpp',
@@ -200,17 +201,16 @@ UNIFIED_SOURCES += [
     'PreloadedStyleSheet.cpp',
     'Rule.cpp',
     'ServoBindings.cpp',
     'ServoCounterStyleRule.cpp',
     'ServoCSSParser.cpp',
     'ServoCSSRuleList.cpp',
     'ServoDocumentRule.cpp',
     'ServoElementSnapshot.cpp',
-    'ServoFontFaceRule.cpp',
     'ServoFontFeatureValuesRule.cpp',
     'ServoImportRule.cpp',
     'ServoPageRule.cpp',
     'ServoSpecifiedValues.cpp',
     'ServoStyleSet.cpp',
     'ServoSupportsRule.cpp',
     'StreamLoader.cpp',
     'StyleAnimationValue.cpp',