Bug 1461933 - Remove ServoBindings.h from ComputedStyleInline.h. r=emilio
authorXidorn Quan <me@upsuper.org>
Wed, 16 May 2018 15:35:59 +1000
changeset 418492 ce7798f62689e38772e62ca85dc0b4e3d4e35781
parent 418491 cd876c420775f0d39eb531464979c68683c32168
child 418493 d12609149b23842215f0d715a0f875918589f2e9
push id34003
push usershindli@mozilla.com
push dateWed, 16 May 2018 18:31:07 +0000
treeherdermozilla-central@a35fc68a2471 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1461933
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 1461933 - Remove ServoBindings.h from ComputedStyleInline.h. r=emilio For doing this, ServoComputedData is split into separate files, so that files don't need to include ServoBindings.h just for accessing style structs from ComputedStyles. MozReview-Commit-ID: DPAd7PUUCl9
dom/base/nsDOMWindowUtils.cpp
dom/xbl/nsXBLPrototypeResources.cpp
layout/base/PresShell.cpp
layout/inspector/InspectorFontFace.cpp
layout/painting/nsDisplayList.h
layout/printing/nsPrintJob.cpp
layout/style/ComputedStyle.h
layout/style/ComputedStyleInlines.h
layout/style/ServoBindingTypes.h
layout/style/ServoBindings.h
layout/style/ServoComputedData.h
layout/style/ServoComputedDataInlines.h
layout/style/ServoTypes.h
layout/style/moz.build
layout/style/nsStyleStruct.h
toolkit/components/resistfingerprinting/nsRFPService.cpp
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -103,16 +103,17 @@
 #include "nsCSSPseudoElements.h"            // for CSSPseudoElementType
 #include "nsNetUtil.h"
 #include "nsDocument.h"
 #include "HTMLImageElement.h"
 #include "HTMLCanvasElement.h"
 #include "mozilla/css/ImageLoader.h"
 #include "mozilla/layers/IAPZCTreeManager.h" // for layers::ZoomToRectBehavior
 #include "mozilla/dom/Promise.h"
+#include "mozilla/ServoBindings.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/gfx/GPUProcessManager.h"
 #include "mozilla/dom/TimeoutManager.h"
 #include "mozilla/PreloadedStyleSheet.h"
 #include "mozilla/layers/WebRenderBridgeChild.h"
 #include "mozilla/layers/WebRenderLayerManager.h"
 
 #ifdef XP_WIN
--- a/dom/xbl/nsXBLPrototypeResources.cpp
+++ b/dom/xbl/nsXBLPrototypeResources.cpp
@@ -11,16 +11,17 @@
 #include "nsXBLPrototypeResources.h"
 #include "nsXBLPrototypeBinding.h"
 #include "nsIDocumentObserver.h"
 #include "mozilla/css/Loader.h"
 #include "nsIURI.h"
 #include "nsLayoutCID.h"
 #include "mozilla/dom/URL.h"
 #include "mozilla/DebugOnly.h"
+#include "mozilla/ServoBindings.h"
 #include "mozilla/ServoStyleRuleMap.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
 
 using namespace mozilla;
 using mozilla::dom::IsChromeURI;
 
 nsXBLPrototypeResources::nsXBLPrototypeResources(nsXBLPrototypeBinding* aBinding)
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -172,16 +172,17 @@
 #include "nsIDragSession.h"
 #include "nsIFrameInlines.h"
 #include "mozilla/gfx/2D.h"
 #include "nsSubDocumentFrame.h"
 #include "nsQueryObject.h"
 #include "nsLayoutStylesheetCache.h"
 #include "mozilla/layers/InputAPZContext.h"
 #include "mozilla/layers/FocusTarget.h"
+#include "mozilla/ServoBindings.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/dom/ImageTracker.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsBindingManager.h"
 #include "nsClassHashtable.h"
 #include "nsHashKeys.h"
--- a/layout/inspector/InspectorFontFace.cpp
+++ b/layout/inspector/InspectorFontFace.cpp
@@ -8,16 +8,17 @@
 
 #include "gfxTextRun.h"
 #include "gfxUserFontSet.h"
 #include "nsFontFaceLoader.h"
 #include "mozilla/gfx/2D.h"
 #include "brotli/decode.h"
 #include "zlib.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()
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -30,16 +30,17 @@
 #include "nsRect.h"
 #include "nsRegion.h"
 #include "nsDisplayListInvalidation.h"
 #include "DisplayItemClipChain.h"
 #include "DisplayListClipState.h"
 #include "LayerState.h"
 #include "FrameMetrics.h"
 #include "ImgDrawResult.h"
+#include "mozilla/EffectCompositor.h"
 #include "mozilla/EnumeratedArray.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/gfx/UserData.h"
 #include "mozilla/layers/LayerAttributes.h"
 #include "nsCSSRenderingBorders.h"
 #include "nsPresArena.h"
--- a/layout/printing/nsPrintJob.cpp
+++ b/layout/printing/nsPrintJob.cpp
@@ -6,16 +6,17 @@
 
 #include "nsPrintJob.h"
 
 #include "nsIStringBundle.h"
 #include "nsReadableUtils.h"
 #include "nsCRT.h"
 
 #include "mozilla/AsyncEventDispatcher.h"
+#include "mozilla/ComputedStyleInlines.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/dom/CustomEvent.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDocShell.h"
 #include "nsIURI.h"
 #include "nsITextToSubURI.h"
--- a/layout/style/ComputedStyle.h
+++ b/layout/style/ComputedStyle.h
@@ -8,16 +8,17 @@
 
 #ifndef _ComputedStyle_h_
 #define _ComputedStyle_h_
 
 #include "nsIMemoryReporter.h"
 #include <algorithm>
 #include "mozilla/ArenaObjectID.h"
 #include "mozilla/Assertions.h"
+#include "mozilla/ServoComputedData.h"
 #include "mozilla/ServoTypes.h"
 #include "mozilla/ServoUtils.h"
 #include "mozilla/StyleComplexColor.h"
 #include "mozilla/CachedInheritingStyles.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsCSSPseudoElements.h"
 
 // Includes nsStyleStructID.
--- a/layout/style/ComputedStyleInlines.h
+++ b/layout/style/ComputedStyleInlines.h
@@ -10,30 +10,29 @@
  * virtual dispatch (by checking which kind of container it is)
  * in stylo mode.
  */
 
 #ifndef ComputedStyleInlines_h
 #define ComputedStyleInlines_h
 
 #include "mozilla/ComputedStyle.h"
-#include "mozilla/ComputedStyle.h"
+#include "mozilla/ServoComputedDataInlines.h"
 #include "mozilla/ServoUtils.h"
-#include "mozilla/ServoBindings.h"
 
 namespace mozilla {
 
 #define STYLE_STRUCT(name_)                                 \
 const nsStyle##name_ *                                      \
 ComputedStyle::Style##name_() {                             \
   return DoGetStyle##name_<true>();                         \
 }                                                           \
 const nsStyle##name_ *                                      \
 ComputedStyle::ThreadsafeStyle##name_() {                   \
-  if (mozilla::ServoStyleSet::IsInServoTraversal()) {       \
+  if (mozilla::IsInServoTraversal()) {                      \
     return ComputedData()->GetStyle##name_();               \
   }                                                         \
   return Style##name_();                                    \
 }                                                           \
 const nsStyle##name_ * ComputedStyle::PeekStyle##name_() {  \
   return DoGetStyle##name_<false>();                        \
 }
 #include "nsStyleStructList.h"
@@ -48,17 +47,17 @@ const nsStyle##name_ * ComputedStyle::Do
     return nullptr;                                                         \
   }                                                                         \
                                                                             \
   const nsStyle##name_* data = ComputedData()->GetStyle##name_();           \
                                                                             \
   /* perform any remaining main thread work on the struct */                \
   if (needToCompute) {                                                      \
     MOZ_ASSERT(NS_IsMainThread());                                          \
-    MOZ_ASSERT(!mozilla::ServoStyleSet::IsInServoTraversal());              \
+    MOZ_ASSERT(!mozilla::IsInServoTraversal());                             \
     const_cast<nsStyle##name_*>(data)->FinishStyle(mPresContext, nullptr);  \
     /* the ComputedStyle owns the struct */                                 \
     AddStyleBit(NS_STYLE_INHERIT_BIT(name_));                               \
   }                                                                         \
   return data;                                                              \
 }
 
 #define STYLE_STRUCT_RESET(name_)                                           \
--- a/layout/style/ServoBindingTypes.h
+++ b/layout/style/ServoBindingTypes.h
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_ServoBindingTypes_h
 #define mozilla_ServoBindingTypes_h
 
 #include "mozilla/RefPtr.h"
+#include "mozilla/ServoComputedData.h"
 #include "mozilla/ServoTypes.h"
 #include "mozilla/SheetType.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/gfx/Types.h"
 #include "nsCSSPropertyID.h"
 #include "nsStyleAutoArray.h"
 #include "nsTArray.h"
 
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -7,25 +7,25 @@
 #ifndef mozilla_ServoBindings_h
 #define mozilla_ServoBindings_h
 
 #include <stdint.h>
 
 #include "mozilla/AtomArray.h"
 #include "mozilla/ServoTypes.h"
 #include "mozilla/ServoBindingTypes.h"
+#include "mozilla/ServoComputedDataInlines.h"
 #include "mozilla/ServoElementSnapshot.h"
 #include "mozilla/css/SheetLoadData.h"
 #include "mozilla/css/SheetParsingMode.h"
 #include "mozilla/css/URLMatchingFunction.h"
 #include "mozilla/EffectCompositor.h"
 #include "mozilla/ComputedTimingFunction.h"
 #include "nsChangeHint.h"
 #include "nsIDocument.h"
-#include "nsStyleStruct.h"
 
 /*
  * API for Servo to access Gecko data structures.
  *
  * Functions beginning with Gecko_ are implemented in Gecko and invoked from Servo.
  * Functions beginning with Servo_ are implemented in Servo and invoked from Gecko.
  */
 
@@ -73,27 +73,16 @@ struct nsStyleDisplay;
 class nsXBLBinding;
 
 #ifdef NIGHTLY_BUILD
 const bool GECKO_IS_NIGHTLY = true;
 #else
 const bool GECKO_IS_NIGHTLY = false;
 #endif
 
-namespace mozilla {
-  #define STYLE_STRUCT(name_) struct Gecko##name_ {nsStyle##name_ gecko;};
-  #include "nsStyleStructList.h"
-  #undef STYLE_STRUCT
-}
-
-#define STYLE_STRUCT(name_) \
-  const nsStyle##name_* ServoComputedData::GetStyle##name_() const { return &name_.mPtr->gecko; }
-#include "nsStyleStructList.h"
-#undef STYLE_STRUCT
-
 #define NS_DECL_THREADSAFE_FFI_REFCOUNTING(class_, name_)                     \
   void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr);                    \
   void Gecko_Release##name_##ArbitraryThread(class_* aPtr);
 #define NS_IMPL_THREADSAFE_FFI_REFCOUNTING(class_, name_)                     \
   static_assert(class_::HasThreadSafeRefCnt::value,                           \
                 "NS_DECL_THREADSAFE_FFI_REFCOUNTING can only be used with "   \
                 "classes that have thread-safe refcounting");                 \
   void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr)                     \
new file mode 100644
--- /dev/null
+++ b/layout/style/ServoComputedData.h
@@ -0,0 +1,111 @@
+/* -*- 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_ServoComputedData_h
+#define mozilla_ServoComputedData_h
+
+#include "mozilla/ServoTypes.h"
+
+/*
+ * ServoComputedData and its related types.
+ */
+
+#define STYLE_STRUCT(name_) struct nsStyle##name_;
+#include "nsStyleStructList.h"
+#undef STYLE_STRUCT
+
+namespace mozilla {
+
+struct ServoWritingMode {
+  uint8_t mBits;
+};
+
+struct ServoCustomPropertiesMap {
+  uintptr_t mPtr;
+};
+
+struct ServoRuleNode {
+  uintptr_t mPtr;
+};
+
+class ComputedStyle;
+
+struct ServoVisitedStyle {
+  // This is actually a strong reference
+  // but ServoComputedData's destructor is
+  // managed by the Rust code so we just use a
+  // regular pointer
+  ComputedStyle* mPtr;
+};
+
+struct ServoComputedValueFlags {
+  uint16_t mFlags;
+};
+
+#define STYLE_STRUCT(name_) struct Gecko##name_;
+#include "nsStyleStructList.h"
+#undef STYLE_STRUCT
+
+} // namespace mozilla
+
+class ServoComputedData;
+
+struct ServoComputedDataForgotten
+{
+  // Make sure you manually mem::forget the backing ServoComputedData
+  // after calling this
+  explicit ServoComputedDataForgotten(const ServoComputedData* aValue) : mPtr(aValue) {}
+  const ServoComputedData* mPtr;
+};
+
+/**
+ * We want C++ to be able to read the style struct fields of ComputedValues
+ * so we define this type on the C++ side and use the bindgenned version
+ * on the Rust side.
+ */
+class ServoComputedData
+{
+  friend class mozilla::ComputedStyle;
+
+public:
+  // Constructs via memcpy.  Will not move out of aValue.
+  explicit ServoComputedData(const ServoComputedDataForgotten aValue);
+
+#define STYLE_STRUCT(name_)                                \
+  mozilla::ServoRawOffsetArc<mozilla::Gecko##name_> name_; \
+  inline const nsStyle##name_* GetStyle##name_() const;
+#include "nsStyleStructList.h"
+#undef STYLE_STRUCT
+
+  void AddSizeOfExcludingThis(nsWindowSizes& aSizes) const;
+
+private:
+  mozilla::ServoCustomPropertiesMap custom_properties;
+  mozilla::ServoWritingMode writing_mode;
+  mozilla::ServoComputedValueFlags flags;
+  /// The rule node representing the ordered list of rules matched for this
+  /// node.  Can be None for default values and text nodes.  This is
+  /// essentially an optimization to avoid referencing the root rule node.
+  mozilla::ServoRuleNode rules;
+  /// The element's computed values if visited, only computed if there's a
+  /// relevant link for this element. A element's "relevant link" is the
+  /// element being matched if it is a link or the nearest ancestor link.
+  mozilla::ServoVisitedStyle visited_style;
+
+  // C++ just sees this struct as a bucket of bits, and will
+  // do the wrong thing if we let it use the default copy ctor/assignment
+  // operator. Remove them so that there is no footgun.
+  //
+  // We remove the move ctor/assignment operator as well, because
+  // moves in C++ don't prevent destructors from being called,
+  // which will lead to double frees.
+  ServoComputedData& operator=(const ServoComputedData&) = delete;
+  ServoComputedData(const ServoComputedData&) = delete;
+  ServoComputedData&& operator=(const ServoComputedData&&) = delete;
+  ServoComputedData(const ServoComputedData&&) = delete;
+};
+
+#endif // mozilla_ServoComputedData_h
new file mode 100644
--- /dev/null
+++ b/layout/style/ServoComputedDataInlines.h
@@ -0,0 +1,24 @@
+/* -*- 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_ServoComputedDataInlines_h
+#define mozilla_ServoComputedDataInlines_h
+
+#include "mozilla/ServoComputedData.h"
+#include "nsStyleStruct.h"
+
+namespace mozilla {
+  #define STYLE_STRUCT(name_) struct Gecko##name_ {nsStyle##name_ gecko;};
+  #include "nsStyleStructList.h"
+  #undef STYLE_STRUCT
+}
+
+#define STYLE_STRUCT(name_) \
+  const nsStyle##name_* ServoComputedData::GetStyle##name_() const { return &name_.mPtr->gecko; }
+#include "nsStyleStructList.h"
+#undef STYLE_STRUCT
+
+#endif // mozilla_ServoComputedDataInlines_h
--- a/layout/style/ServoTypes.h
+++ b/layout/style/ServoTypes.h
@@ -4,20 +4,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_ServoTypes_h
 #define mozilla_ServoTypes_h
 
 #include "mozilla/TypedEnumBits.h"
 
-#define STYLE_STRUCT(name_) struct nsStyle##name_;
-#include "nsStyleStructList.h"
-#undef STYLE_STRUCT
-
 /*
  * Type definitions used to interact with Servo. This gets included by nsINode,
  * so don't add significant include dependencies to this file.
  */
 
 class nsWindowSizes;
 struct ServoNodeData;
 namespace mozilla {
@@ -124,54 +120,16 @@ enum class InheritTarget {
   // We're requesting a text style.
   Text,
   // We're requesting a first-letter continuation frame style.
   FirstLetterContinuation,
   // We're requesting a style for a placeholder frame.
   PlaceholderFrame,
 };
 
-struct ServoWritingMode {
-  uint8_t mBits;
-};
-
-struct ServoCustomPropertiesMap {
-  uintptr_t mPtr;
-};
-
-struct ServoRuleNode {
-  uintptr_t mPtr;
-};
-
-
-class ComputedStyle;
-
-struct ServoVisitedStyle {
-  // This is actually a strong reference
-  // but ServoComputedData's destructor is
-  // managed by the Rust code so we just use a
-  // regular pointer
-  ComputedStyle* mPtr;
-};
-
-template <typename T>
-struct ServoRawOffsetArc {
-  // Again, a strong reference, but
-  // managed by the Rust code
-  T* mPtr;
-};
-
-struct ServoComputedValueFlags {
-  uint16_t mFlags;
-};
-
-#define STYLE_STRUCT(name_) struct Gecko##name_;
-#include "nsStyleStructList.h"
-#undef STYLE_STRUCT
-
 // These measurements are obtained for both the UA cache and the Stylist, but
 // not all the fields are used in both cases.
 class ServoStyleSetSizes
 {
 public:
   size_t mRuleTree;                // Stylist-only
   size_t mPrecomputedPseudos;      // UA cache-only
   size_t mElementAndPseudosMaps;   // Used for both
@@ -184,68 +142,18 @@ public:
     , mPrecomputedPseudos(0)
     , mElementAndPseudosMaps(0)
     , mInvalidationMap(0)
     , mRevalidationSelectors(0)
     , mOther(0)
   {}
 };
 
-} // namespace mozilla
-
-class ServoComputedData;
-
-struct ServoComputedDataForgotten
-{
-  // Make sure you manually mem::forget the backing ServoComputedData
-  // after calling this
-  explicit ServoComputedDataForgotten(const ServoComputedData* aValue) : mPtr(aValue) {}
-  const ServoComputedData* mPtr;
+template <typename T>
+struct ServoRawOffsetArc {
+  // Again, a strong reference, but
+  // managed by the Rust code
+  T* mPtr;
 };
 
-/**
- * We want C++ to be able to read the style struct fields of ComputedValues
- * so we define this type on the C++ side and use the bindgenned version
- * on the Rust side.
- */
-class ServoComputedData
-{
-  friend class mozilla::ComputedStyle;
-
-public:
-  // Constructs via memcpy.  Will not move out of aValue.
-  explicit ServoComputedData(const ServoComputedDataForgotten aValue);
-
-#define STYLE_STRUCT(name_)                                \
-  mozilla::ServoRawOffsetArc<mozilla::Gecko##name_> name_; \
-  inline const nsStyle##name_* GetStyle##name_() const;
-#include "nsStyleStructList.h"
-#undef STYLE_STRUCT
-
-  void AddSizeOfExcludingThis(nsWindowSizes& aSizes) const;
-
-private:
-  mozilla::ServoCustomPropertiesMap custom_properties;
-  mozilla::ServoWritingMode writing_mode;
-  mozilla::ServoComputedValueFlags flags;
-  /// The rule node representing the ordered list of rules matched for this
-  /// node.  Can be None for default values and text nodes.  This is
-  /// essentially an optimization to avoid referencing the root rule node.
-  mozilla::ServoRuleNode rules;
-  /// The element's computed values if visited, only computed if there's a
-  /// relevant link for this element. A element's "relevant link" is the
-  /// element being matched if it is a link or the nearest ancestor link.
-  mozilla::ServoVisitedStyle visited_style;
-
-  // C++ just sees this struct as a bucket of bits, and will
-  // do the wrong thing if we let it use the default copy ctor/assignment
-  // operator. Remove them so that there is no footgun.
-  //
-  // We remove the move ctor/assignment operator as well, because
-  // moves in C++ don't prevent destructors from being called,
-  // which will lead to double frees.
-  ServoComputedData& operator=(const ServoComputedData&) = delete;
-  ServoComputedData(const ServoComputedData&) = delete;
-  ServoComputedData&& operator=(const ServoComputedData&&) = delete;
-  ServoComputedData(const ServoComputedData&&) = delete;
-};
+} // namespace mozilla
 
 #endif // mozilla_ServoTypes_h
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -76,16 +76,18 @@ EXPORTS.mozilla += [
     'LayerAnimationInfo.h',
     'MediaFeatureChange.h',
     'PostTraversalTask.h',
     'PreloadedStyleSheet.h',
     'ServoArcTypeList.h',
     'ServoBindingList.h',
     'ServoBindings.h',
     'ServoBindingTypes.h',
+    'ServoComputedData.h',
+    'ServoComputedDataInlines.h',
     'ServoCounterStyleRule.h',
     'ServoCSSParser.h',
     'ServoCSSRuleList.h',
     'ServoDeclarationBlock.h',
     'ServoDocumentRule.h',
     'ServoElementSnapshot.h',
     'ServoElementSnapshotTable.h',
     'ServoFontFaceRule.h',
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -38,16 +38,17 @@
 #include <utility>
 #include "X11UndefineNone.h"
 
 class nsIFrame;
 class nsIURI;
 class nsTextFrame;
 class imgIContainer;
 class nsPresContext;
+struct nsStyleDisplay;
 struct nsStyleVisibility;
 namespace mozilla {
 class ComputedStyle;
 namespace dom {
 class ImageTracker;
 } // namespace dom
 } // namespace mozilla
 
--- a/toolkit/components/resistfingerprinting/nsRFPService.cpp
+++ b/toolkit/components/resistfingerprinting/nsRFPService.cpp
@@ -5,16 +5,17 @@
 
 #include "nsRFPService.h"
 
 #include <algorithm>
 #include <memory>
 #include <time.h>
 
 #include "mozilla/ClearOnShutdown.h"
+#include "mozilla/dom/Element.h"
 #include "mozilla/Logging.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/dom/KeyboardEventBinding.h"
 
@@ -977,17 +978,17 @@ nsRFPService::GetSpoofedKeyCodeInfo(cons
   // document. Otherwise, we use the default one.
   if (aDoc) {
     nsAutoString language;
     aDoc->GetContentLanguage(language);
 
     // If the content-langauge is not given, we try to get langauge from the HTML
     // lang attribute.
     if (language.IsEmpty()) {
-      Element* elm = aDoc->GetHtmlElement();
+      dom::Element* elm = aDoc->GetHtmlElement();
 
       if (elm) {
         elm->GetLang(language);
       }
     }
 
     // If two or more languages are given, per HTML5 spec, we should consider
     // it as 'unknown'. So we use the default one.