Bug 1501665 Part 1: Add a webidl property to Document to track if it's in an RDM pane. r=smaug
☠☠ backed out by af46b1e88998 ☠ ☠
authorBrad Werth <bwerth@mozilla.com>
Mon, 18 Mar 2019 14:55:51 +0000
changeset 464806 be1026de486b096cee639ca584b1e8108c4b73cb
parent 464805 0d3ffa66494bb802e3f4de566d5313bc929cf495
child 464807 8e0afe4a041a2fde722ffcbf2dcee10265c87e19
push id35727
push userdvarga@mozilla.com
push dateTue, 19 Mar 2019 09:48:59 +0000
treeherdermozilla-central@70baa37ae1eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1501665
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 1501665 Part 1: Add a webidl property to Document to track if it's in an RDM pane. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D19235
dom/base/Document.cpp
dom/base/Document.h
dom/webidl/Document.webidl
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -1335,17 +1335,18 @@ Document::Document(const char* aContentT
       mCurrentOrientationType(OrientationType::Portrait_primary),
       mServoRestyleRootDirtyBits(0),
       mThrowOnDynamicMarkupInsertionCounter(0),
       mIgnoreOpensDuringUnloadCounter(0),
       mDocLWTheme(Doc_Theme_Uninitialized),
       mSavedResolution(1.0f),
       mPendingInitialTranslation(false),
       mGeneration(0),
-      mCachedTabSizeGeneration(0) {
+      mCachedTabSizeGeneration(0),
+      mInRDMPane(false) {
   MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug, ("DOCUMENT %p created", this));
 
   SetIsInDocument();
   SetIsConnected(true);
 
   if (StaticPrefs::layout_css_use_counters_enabled()) {
     mStyleUseCounters.reset(Servo_UseCounters_Create());
   }
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -3710,16 +3710,19 @@ class Document : public nsINode,
   void MaybeInitializeFinalizeFrameLoaders();
 
   void SetDelayFrameLoaderInitialization(bool aDelayFrameLoaderInitialization) {
     mDelayFrameLoaderInitialization = aDelayFrameLoaderInitialization;
   }
 
   void SetPrototypeDocument(nsXULPrototypeDocument* aPrototype);
 
+  bool InRDMPane() const { return mInRDMPane; }
+  void SetInRDMPane(bool aInRDMPane) { mInRDMPane = aInRDMPane; }
+
  protected:
   void DoUpdateSVGUseElementShadowTrees();
 
   already_AddRefed<nsIPrincipal> MaybeDowngradePrincipal(
       nsIPrincipal* aPrincipal);
 
   void EnsureOnloadBlocker();
 
@@ -4673,16 +4676,18 @@ class Document : public nsINode,
 
   // Document generation. Gets incremented everytime it changes.
   int32_t mGeneration;
 
   // Cached TabSizes values for the document.
   int32_t mCachedTabSizeGeneration;
   nsTabSizes mCachedTabSizes;
 
+  bool mInRDMPane;
+
  public:
   // Needs to be public because the bindings code pokes at it.
   js::ExpandoAndGeneration mExpandoAndGeneration;
 
   bool HasPendingInitialTranslation() { return mPendingInitialTranslation; }
 
   void TraceProtos(JSTracer* aTrc);
 };
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -562,8 +562,18 @@ Document implements GeometryUtils;
 Document implements FontFaceSource;
 Document implements DocumentOrShadowRoot;
 
 // https://wicg.github.io/feature-policy/#policy
 partial interface Document {
     [SameObject, Pref="dom.security.featurePolicy.webidl.enabled"]
     readonly attribute Policy policy;
 };
+
+/**
+ * Document extensions to support devtools.
+ */
+partial interface Document {
+  // Is the Document embedded in a Responsive Design Mode pane. This property
+  // is not propegated to descendant Documents upon settting.
+  [ChromeOnly]
+  attribute boolean inRDMPane;
+};