Bug 1540015 - part 2: Make nsPresContext.h stop including nsIPresShel.h and nsIPresShellInlines.h r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 29 Mar 2019 15:11:22 +0000
changeset 466777 f2267d0779f7bc110e0a110a4b18eb651e4a1466
parent 466776 65f80cb57b308ce1aa3120fabb8135b2f659a8b4
child 466778 f529b394cb111fff7e16028f063f3b8c3b96b225
push id35780
push useropoprus@mozilla.com
push dateFri, 29 Mar 2019 21:53:01 +0000
treeherdermozilla-central@414f37afbe07 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1540015
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1540015 - part 2: Make nsPresContext.h stop including nsIPresShel.h and nsIPresShellInlines.h r=smaug `*Inlines.h` shouldn't be included by another header file, but `nsPresContext.h` does it. This causes include-hell which blocks the following fix. Additionally, it causes an include hell between `PresShell.h` vs. `nsIPresShell.h` and `nsPresContext.h if `Document.h` includes `PresShell.h`. Therefore, this patch also solves this include hell with adding `nsPresContextInlines.h`. Differential Revision: https://phabricator.services.mozilla.com/D25333
dom/animation/KeyframeEffect.cpp
dom/animation/KeyframeUtils.cpp
dom/base/Element.h
layout/base/PresShell.h
layout/base/RestyleManager.h
layout/base/moz.build
layout/base/nsIPresShellInlines.h
layout/base/nsLayoutUtils.cpp
layout/base/nsPresContext.cpp
layout/base/nsPresContext.h
layout/base/nsPresContextInlines.h
layout/forms/nsButtonFrameRenderer.cpp
layout/forms/nsRangeFrame.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsFirstLetterFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsInlineFrame.cpp
layout/mathml/nsMathMLFrame.cpp
layout/style/CounterStyleManager.cpp
layout/style/MediaList.cpp
layout/style/nsAnimationManager.cpp
layout/xul/tree/nsTreeStyleCache.cpp
uriloader/base/nsDocLoader.cpp
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -28,16 +28,17 @@
 #include "nsContentUtils.h"
 #include "nsCSSPropertyIDSet.h"
 #include "nsCSSProps.h"             // For nsCSSProps::PropHasFlags
 #include "nsCSSPseudoElements.h"    // For PseudoStyleType
 #include "nsDOMMutationObserver.h"  // For nsAutoAnimationMutationBatch
 #include "nsIFrame.h"
 #include "nsIPresShell.h"
 #include "nsIScriptError.h"
+#include "nsPresContextInlines.h"
 #include "nsRefreshDriver.h"
 
 namespace mozilla {
 
 void AnimationProperty::SetPerformanceWarning(
     const AnimationPerformanceWarning& aWarning, const Element* aElement) {
   if (mPerformanceWarning && *mPerformanceWarning == aWarning) {
     return;
--- a/dom/animation/KeyframeUtils.cpp
+++ b/dom/animation/KeyframeUtils.cpp
@@ -25,16 +25,17 @@
 #include "jsapi.h"             // For most JSAPI
 #include "js/ForOfIterator.h"  // For JS::ForOfIterator
 #include "nsClassHashtable.h"
 #include "nsContentUtils.h"  // For GetContextForContent
 #include "nsCSSPropertyIDSet.h"
 #include "nsCSSProps.h"
 #include "nsCSSPseudoElements.h"  // For PseudoStyleType
 #include "nsIScriptError.h"
+#include "nsPresContextInlines.h"
 #include "nsTArray.h"
 #include <algorithm>  // For std::stable_sort, std::min
 
 using mozilla::dom::Nullable;
 
 namespace mozilla {
 
 // ------------------------------------------------------------------
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -26,16 +26,18 @@
 #include "nsNodeUtils.h"
 #include "nsPresContext.h"
 #include "Units.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/CORSMode.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/FlushType.h"
+#include "mozilla/PresShell.h"
+#include "mozilla/PseudoStyleType.h"
 #include "mozilla/RustCell.h"
 #include "mozilla/SMILAttr.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/dom/Attr.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/DirectionalityUtils.h"
 #include "mozilla/dom/FragmentOrElement.h"
 #include "mozilla/dom/DOMRect.h"
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -558,22 +558,17 @@ class PresShell final : public nsIPresSh
                                    bool aIsHandlingNativeEvent,
                                    nsIContent** aTargetContent,
                                    nsIContent* aOverrideClickTarget);
 
     /**
      * OnPresShellDestroy() is called when every PresShell instance is being
      * destroyed.
      */
-    static inline void OnPresShellDestroy(Document* aDocument) {
-      if (sLastKeyDownEventTargetElement &&
-          sLastKeyDownEventTargetElement->OwnerDoc() == aDocument) {
-        sLastKeyDownEventTargetElement = nullptr;
-      }
-    }
+    static inline void OnPresShellDestroy(Document* aDocument);
 
    private:
     static bool InZombieDocument(nsIContent* aContent);
     static nsIFrame* GetNearestFrameContainingPresShell(
         nsIPresShell* aPresShell);
     static already_AddRefed<nsIURI> GetDocumentURIToCompareWithBlacklist(
         PresShell& aPresShell);
 
@@ -981,17 +976,17 @@ class PresShell final : public nsIPresSh
      * ComputeFocusedEventTargetElement() returns event target element for
      * aGUIEvent which should be handled with focused content.
      * This may set/unset sLastKeyDownEventTarget if necessary.
      *
      * @param aGUIEvent                 The handling event.
      * @return                          The element which should be the event
      *                                  target of aGUIEvent.
      */
-    Element* ComputeFocusedEventTargetElement(WidgetGUIEvent* aGUIEvent);
+    dom::Element* ComputeFocusedEventTargetElement(WidgetGUIEvent* aGUIEvent);
 
     /**
      * MaybeHandleEventWithAnotherPresShell() may handle aGUIEvent with another
      * PresShell.
      *
      * @param aEventTargetElement       The event target element of aGUIEvent.
      * @param aGUIEvent                 Handling event.
      * @param aEventStatus              [in/out] EventStatus of aGUIEvent.
@@ -999,17 +994,17 @@ class PresShell final : public nsIPresSh
      *                                  error handling the event.
      * @return                          false if caller needs to keep handling
      *                                  the event by itself.
      *                                  true if caller shouldn't keep handling
      *                                  the event.  Note that when no PresShell
      *                                  can handle the event, this returns true.
      */
     MOZ_CAN_RUN_SCRIPT
-    bool MaybeHandleEventWithAnotherPresShell(Element* aEventTargetElement,
+    bool MaybeHandleEventWithAnotherPresShell(dom::Element* aEventTargetElement,
                                               WidgetGUIEvent* aGUIEvent,
                                               nsEventStatus* aEventStatus,
                                               nsresult* aRv);
 
     /**
      * HandleRetargetedEvent() dispatches aGUIEvent on the PresShell without
      * retargetting.  This should be used only when caller computes final
      * target of aGUIEvent.
@@ -1272,17 +1267,17 @@ class PresShell final : public nsIPresSh
     void PushDelayedEventIntoQueue(UniquePtr<DelayedEvent>&& aDelayedEvent) {
       mPresShell->mDelayedEvents.AppendElement(std::move(aDelayedEvent));
     }
 
     OwningNonNull<PresShell> mPresShell;
     AutoCurrentEventInfoSetter* mCurrentEventInfoSetter;
     static TimeStamp sLastInputCreated;
     static TimeStamp sLastInputProcessed;
-    static StaticRefPtr<Element> sLastKeyDownEventTargetElement;
+    static StaticRefPtr<dom::Element> sLastKeyDownEventTargetElement;
   };
 
   void SynthesizeMouseMove(bool aFromScroll) override;
 
   PresShell* GetRootPresShell();
 
   nscolor GetDefaultBackgroundColorToDraw();
 
--- a/layout/base/RestyleManager.h
+++ b/layout/base/RestyleManager.h
@@ -10,16 +10,17 @@
 #include "mozilla/AutoRestore.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/OverflowChangedTracker.h"
 #include "mozilla/ServoElementSnapshot.h"
 #include "mozilla/ServoElementSnapshotTable.h"
 #include "nsChangeHint.h"
 #include "nsPresContext.h"
+#include "nsPresContextInlines.h"  // XXX Shouldn't be included by header though
 #include "nsStringFwd.h"
 
 class nsAttrValue;
 class nsCSSFrameConstructor;
 class nsAtom;
 class nsIContent;
 class nsIFrame;
 class nsStyleChangeList;
--- a/layout/base/moz.build
+++ b/layout/base/moz.build
@@ -54,16 +54,17 @@ EXPORTS += [
     'nsIPercentBSizeObserver.h',
     'nsIPresShell.h',
     'nsIPresShellInlines.h',
     'nsIReflowCallback.h',
     'nsLayoutUtils.h',
     'nsPresArena.h',
     'nsPresArenaObjectList.h',
     'nsPresContext.h',
+    'nsPresContextInlines.h',
     'nsQuoteList.h',
     'nsRefreshDriver.h',
     'nsStyleChangeList.h',
     'nsStyleSheetService.h',
     'StackArena.h',
     'TouchManager.h',
     'Units.h',
     'UnitTransforms.h',
--- a/layout/base/nsIPresShellInlines.h
+++ b/layout/base/nsIPresShellInlines.h
@@ -48,9 +48,21 @@ void nsIPresShell::SetNeedThrottledAnima
   mNeedThrottledAnimationFlush = true;
   if (mozilla::dom::Document* doc = mDocument->GetDisplayDocument()) {
     if (nsIPresShell* shell = doc->GetShell()) {
       shell->mNeedThrottledAnimationFlush = true;
     }
   }
 }
 
+namespace mozilla {
+
+/* static */
+inline void PresShell::EventHandler::OnPresShellDestroy(Document* aDocument) {
+  if (sLastKeyDownEventTargetElement &&
+      sLastKeyDownEventTargetElement->OwnerDoc() == aDocument) {
+    sLastKeyDownEventTargetElement = nullptr;
+  }
+}
+
+}  // namespace mozilla
+
 #endif  // nsIPresShellInlines_h
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -22,16 +22,17 @@
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/ServoStyleSetInlines.h"
 #include "mozilla/StaticPrefs.h"
 #include "mozilla/Unused.h"
 #include "nsCharTraits.h"
 #include "mozilla/dom/Document.h"
 #include "nsFontMetrics.h"
 #include "nsPresContext.h"
+#include "nsPresContextInlines.h"
 #include "nsIContent.h"
 #include "nsFrameList.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsAtom.h"
 #include "nsCaret.h"
 #include "nsCSSPseudoElements.h"
 #include "nsCSSAnonBoxes.h"
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -2,16 +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/. */
 
 /* a presentation of a document, part 1 */
 
 #include "nsPresContext.h"
+#include "nsPresContextInlines.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Encoding.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventStateManager.h"
 
 #include "base/basictypes.h"
@@ -1481,16 +1482,30 @@ void nsPresContext::StopEmulatingMedium(
   }
 }
 
 void nsPresContext::ContentLanguageChanged() {
   PostRebuildAllStyleDataEvent(nsChangeHint(0),
                                RestyleHint::RecascadeSubtree());
 }
 
+void nsPresContext::MediaFeatureValuesChanged(
+    const MediaFeatureChange& aChange) {
+  if (mShell) {
+    mShell->EnsureStyleFlush();
+  }
+
+  if (!mPendingMediaFeatureValuesChange) {
+    mPendingMediaFeatureValuesChange.emplace(aChange);
+    return;
+  }
+
+  *mPendingMediaFeatureValuesChange |= aChange;
+}
+
 void nsPresContext::RebuildAllStyleData(nsChangeHint aExtraHint,
                                         RestyleHint aRestyleHint) {
   if (!mShell) {
     // We must have been torn down. Nothing to do here.
     return;
   }
 
   // FIXME(emilio): Why is it safe to reset mUsesRootEMUnits / mUsesEXChUnits
@@ -2455,16 +2470,26 @@ void nsPresContext::FlushFontFeatureValu
 
   if (mFontFeatureValuesDirty) {
     ServoStyleSet* styleSet = mShell->StyleSet();
     mFontFeatureValuesLookup = styleSet->BuildFontFeatureValueSet();
     mFontFeatureValuesDirty = false;
   }
 }
 
+#ifdef DEBUG
+
+void nsPresContext::ValidatePresShellAndDocumentReleation() const {
+  NS_ASSERTION(
+      !mShell || !mShell->GetDocument() || mShell->GetDocument() == mDocument,
+      "nsPresContext doesn't have the same document as nsPresShell!");
+}
+
+#endif  // #ifdef DEBUG
+
 nsRootPresContext::nsRootPresContext(dom::Document* aDocument,
                                      nsPresContextType aType)
     : nsPresContext(aDocument, aType) {}
 
 nsRootPresContext::~nsRootPresContext() {
   NS_ASSERTION(mRegisteredPlugins.Count() == 0,
                "All plugins should have been unregistered");
   CancelApplyPluginGeometryTimer();
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -14,18 +14,16 @@
 #include "mozilla/NotNull.h"
 #include "mozilla/ScrollStyles.h"
 #include "mozilla/PreferenceSheet.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/WeakPtr.h"
 #include "nsColor.h"
 #include "nsCoord.h"
 #include "nsCOMPtr.h"
-#include "nsIPresShell.h"
-#include "nsIPresShellInlines.h"
 #include "nsRect.h"
 #include "nsStringFwd.h"
 #include "nsFont.h"
 #include "gfxFontConstants.h"
 #include "nsAtom.h"
 #include "nsITimer.h"
 #include "nsCRT.h"
 #include "nsIWidgetListener.h"
@@ -45,28 +43,32 @@
 #include "Units.h"
 #include "prenv.h"
 #include "mozilla/StaticPresData.h"
 
 class nsBidi;
 class nsIPrintSettings;
 class nsDocShell;
 class nsIDocShell;
+class nsIPresShell;
 class nsITheme;
 class nsIContent;
 class nsIFrame;
 class nsFrameManager;
 class nsILinkHandler;
 class nsAtom;
 class nsIRunnable;
 class gfxFontFeatureValueSet;
 class gfxUserFontEntry;
 class gfxUserFontSet;
 class gfxTextPerfMetrics;
 class nsCSSFontFeatureValuesRule;
+class nsCSSFrameConstructor;
+class nsDisplayList;
+class nsDisplayListBuilder;
 class nsPluginFrame;
 class nsTransitionManager;
 class nsAnimationManager;
 class nsRefreshDriver;
 class nsIWidget;
 class nsDeviceContext;
 class gfxMissingFontRecorder;
 
@@ -206,33 +208,29 @@ class nsPresContext : public nsISupports
    * hierarchy that contains this presentation context, or nullptr if it can't
    * be found (e.g. it's detached).
    */
   nsRootPresContext* GetRootPresContext();
 
   virtual bool IsRoot() { return false; }
 
   mozilla::dom::Document* Document() const {
-    NS_ASSERTION(
-        !mShell || !mShell->GetDocument() || mShell->GetDocument() == mDocument,
-        "nsPresContext doesn't have the same document as nsPresShell!");
+#ifdef DEBUG
+    ValidatePresShellAndDocumentReleation();
+#endif  // #ifdef DEBUG
     return mDocument;
   }
 
-  mozilla::ServoStyleSet* StyleSet() const {
-    return GetPresShell()->StyleSet();
-  }
+  inline mozilla::ServoStyleSet* StyleSet() const;
 
   bool HasPendingMediaQueryUpdates() const {
     return !!mPendingMediaFeatureValuesChange;
   }
 
-  nsCSSFrameConstructor* FrameConstructor() {
-    return PresShell()->FrameConstructor();
-  }
+  inline nsCSSFrameConstructor* FrameConstructor();
 
   mozilla::AnimationEventDispatcher* AnimationEventDispatcher() {
     return mAnimationEventDispatcher;
   }
 
   mozilla::EffectCompositor* EffectCompositor() { return mEffectCompositor; }
   nsTransitionManager* TransitionManager() { return mTransitionManager.get(); }
   nsAnimationManager* AnimationManager() { return mAnimationManager.get(); }
@@ -266,28 +264,17 @@ class nsPresContext : public nsISupports
   void PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
                                     mozilla::RestyleHint);
 
   void ContentLanguageChanged();
 
   /**
    * Handle changes in the values of media features (used in media queries).
    */
-  void MediaFeatureValuesChanged(const mozilla::MediaFeatureChange& aChange) {
-    if (mShell) {
-      mShell->EnsureStyleFlush();
-    }
-
-    if (!mPendingMediaFeatureValuesChange) {
-      mPendingMediaFeatureValuesChange.emplace(aChange);
-      return;
-    }
-
-    *mPendingMediaFeatureValuesChange |= aChange;
-  }
+  void MediaFeatureValuesChanged(const mozilla::MediaFeatureChange& aChange);
 
   void FlushPendingMediaFeatureValuesChanged();
 
   /**
    * Calls MediaFeatureValuesChanged for this pres context and all descendant
    * subdocuments that have a pres context. This should be used for media
    * features that must be updated in all subdocuments e.g. display-mode.
    */
@@ -487,16 +474,20 @@ class nsPresContext : public nsISupports
 
     mTextZoom = aZoom;
     UpdateEffectiveTextZoom();
   }
 
  protected:
   void UpdateEffectiveTextZoom();
 
+#ifdef DEBUG
+  void ValidatePresShellAndDocumentReleation() const;
+#endif  // #ifdef DEBUG
+
  public:
   /**
    * Corresponds to the product of text zoom and system font scale, limited
    * by zoom.maxPercent and minPercent.
    * As the system font scale is automatically set by the PresShell, code that
    * e.g. wants to transfer zoom levels to a new document should use TextZoom()
    * instead, which corresponds to the text zoom level that was actually set by
    * the front-end/user.
new file mode 100644
--- /dev/null
+++ b/layout/base/nsPresContextInlines.h
@@ -0,0 +1,21 @@
+/* -*- 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 nsIPresContextInlines_h
+#define nsIPresContextInlines_h
+
+#include "mozilla/PresShell.h"
+#include "nsCSSFrameConstructor.h"
+
+inline mozilla::ServoStyleSet* nsPresContext::StyleSet() const {
+  return GetPresShell()->StyleSet();
+}
+
+inline nsCSSFrameConstructor* nsPresContext::FrameConstructor() {
+  return PresShell()->FrameConstructor();
+}
+
+#endif  // #ifndef nsIPresContextInlines_h
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -1,16 +1,17 @@
 /* -*- 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 "nsButtonFrameRenderer.h"
 #include "nsCSSRendering.h"
 #include "nsPresContext.h"
+#include "nsPresContextInlines.h"
 #include "nsGkAtoms.h"
 #include "nsCSSPseudoElements.h"
 #include "nsNameSpaceManager.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/Unused.h"
 #include "nsDisplayList.h"
 #include "nsITheme.h"
 #include "nsFrame.h"
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -16,16 +16,17 @@
 #include "nsCheckboxRadioFrame.h"
 #include "nsIContent.h"
 #include "mozilla/dom/Document.h"
 #include "nsNameSpaceManager.h"
 #include "nsIPresShell.h"
 #include "nsGkAtoms.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "nsPresContext.h"
+#include "nsPresContextInlines.h"
 #include "nsNodeInfoManager.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/ServoStyleSet.h"
 #include "nsStyleConsts.h"
 
 #ifdef ACCESSIBILITY
 #  include "nsAccessibilityService.h"
 #endif
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -27,16 +27,17 @@
 #include "nsFontMetrics.h"
 #include "nsGenericHTMLElement.h"
 #include "nsLineBox.h"
 #include "nsLineLayout.h"
 #include "nsPlaceholderFrame.h"
 #include "nsStyleConsts.h"
 #include "nsFrameManager.h"
 #include "nsPresContext.h"
+#include "nsPresContextInlines.h"
 #include "nsIPresShell.h"
 #include "nsHTMLParts.h"
 #include "nsGkAtoms.h"
 #include "nsAttrValueInlines.h"
 #include "mozilla/Sprintf.h"
 #include "nsFloatManager.h"
 #include "prenv.h"
 #include "plstr.h"
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* rendering object for CSS :first-letter pseudo-element */
 
 #include "nsFirstLetterFrame.h"
 #include "nsPresContext.h"
+#include "nsPresContextInlines.h"
 #include "mozilla/ComputedStyle.h"
 #include "nsIContent.h"
 #include "nsLineLayout.h"
 #include "nsGkAtoms.h"
 #include "mozilla/ServoStyleSet.h"
 #include "nsFrameManager.h"
 #include "mozilla/RestyleManager.h"
 #include "nsPlaceholderFrame.h"
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -40,16 +40,17 @@
 #include "nsAtom.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsTableWrapperFrame.h"
 #include "nsView.h"
 #include "nsViewManager.h"
 #include "nsIScrollableFrame.h"
 #include "nsPresContext.h"
+#include "nsPresContextInlines.h"
 #include "nsStyleConsts.h"
 #include "nsIPresShell.h"
 #include "mozilla/Logging.h"
 #include "nsLayoutUtils.h"
 #include "LayoutLogging.h"
 #include "mozilla/RestyleManager.h"
 #include "nsInlineFrame.h"
 #include "nsFrameSelection.h"
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -9,16 +9,17 @@
 #include "nsInlineFrame.h"
 
 #include "gfxContext.h"
 #include "nsLineLayout.h"
 #include "nsBlockFrame.h"
 #include "nsPlaceholderFrame.h"
 #include "nsGkAtoms.h"
 #include "nsPresContext.h"
+#include "nsPresContextInlines.h"
 #include "nsCSSAnonBoxes.h"
 #include "mozilla/RestyleManager.h"
 #include "nsDisplayList.h"
 #include "mozilla/Likely.h"
 #include "SVGTextFrame.h"
 #include "nsStyleChangeList.h"
 #include "mozilla/ComputedStyle.h"
 #include "mozilla/ServoStyleSet.h"
--- a/layout/mathml/nsMathMLFrame.cpp
+++ b/layout/mathml/nsMathMLFrame.cpp
@@ -10,16 +10,17 @@
 #include "gfxUtils.h"
 #include "mozilla/gfx/2D.h"
 #include "nsLayoutUtils.h"
 #include "nsNameSpaceManager.h"
 #include "nsMathMLChar.h"
 #include "nsCSSPseudoElements.h"
 #include "nsMathMLElement.h"
 #include "gfxMathTable.h"
+#include "nsPresContextInlines.h"
 
 // used to map attributes into CSS rules
 #include "mozilla/ServoStyleSet.h"
 #include "nsDisplayList.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 
--- a/layout/style/CounterStyleManager.cpp
+++ b/layout/style/CounterStyleManager.cpp
@@ -8,16 +8,17 @@
 
 #include "mozilla/ArenaObjectID.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/CheckedInt.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Types.h"
 #include "mozilla/WritingModes.h"
 #include "nsPresContext.h"
+#include "nsPresContextInlines.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "nsTHashtable.h"
 #include "nsUnicodeProperties.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/ServoStyleSet.h"
 
 namespace mozilla {
--- a/layout/style/MediaList.cpp
+++ b/layout/style/MediaList.cpp
@@ -9,16 +9,17 @@
 #include "mozilla/dom/MediaList.h"
 
 #include "mozAutoDocUpdate.h"
 #include "mozilla/dom/MediaListBinding.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "nsPresContext.h"
+#include "nsPresContextInlines.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaList)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -15,16 +15,17 @@
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/StyleAnimationValue.h"
 #include "mozilla/dom/AnimationEffect.h"
 #include "mozilla/dom/DocumentTimeline.h"
 #include "mozilla/dom/KeyframeEffect.h"
 
 #include "nsPresContext.h"
+#include "nsPresContextInlines.h"
 #include "nsStyleChangeList.h"
 #include "nsLayoutUtils.h"
 #include "nsIFrame.h"
 #include "mozilla/dom/Document.h"
 #include "nsDOMMutationObserver.h"
 #include "nsIPresShell.h"
 #include "nsIPresShellInlines.h"
 #include "nsRFPService.h"
--- a/layout/xul/tree/nsTreeStyleCache.cpp
+++ b/layout/xul/tree/nsTreeStyleCache.cpp
@@ -2,16 +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/. */
 
 #include "nsTreeStyleCache.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/ServoStyleSet.h"
+#include "nsPresContextInlines.h"
 
 using namespace mozilla;
 
 nsTreeStyleCache::Transition::Transition(DFAState aState, nsAtom* aSymbol)
     : mState(aState), mInputSymbol(aSymbol) {}
 
 bool nsTreeStyleCache::Transition::operator==(const Transition& aOther) const {
   return aOther.mState == mState && aOther.mInputSymbol == mInputSymbol;
--- a/uriloader/base/nsDocLoader.cpp
+++ b/uriloader/base/nsDocLoader.cpp
@@ -5,16 +5,17 @@
 
 #include "nspr.h"
 #include "mozilla/dom/Document.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/Components.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/Logging.h"
 #include "mozilla/IntegerPrintfMacros.h"
+#include "mozilla/PresShell.h"
 
 #include "nsDocLoader.h"
 #include "nsNetUtil.h"
 #include "nsIHttpChannel.h"
 #include "nsIWebNavigation.h"
 #include "nsIWebProgressListener2.h"
 
 #include "nsIServiceManager.h"