Bug 1501665 Part 2: Set the inRDMPane property on Documents as they enter/leave RDM. r=gl
☠☠ backed out by af46b1e88998 ☠ ☠
authorBrad Werth <bwerth@mozilla.com>
Mon, 18 Mar 2019 14:56:09 +0000
changeset 464809 8e0afe4a041a2fde722ffcbf2dcee10265c87e19
parent 464808 be1026de486b096cee639ca584b1e8108c4b73cb
child 464810 731d7ee06d86794fb9ec58b32f1495ad11205a1c
push id80720
push userbwerth@mozilla.com
push dateMon, 18 Mar 2019 15:02:22 +0000
treeherderautoland@2fa518cb0dfc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
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 2: Set the inRDMPane property on Documents as they enter/leave RDM. r=gl Differential Revision: https://phabricator.services.mozilla.com/D19237
devtools/client/responsive.html/browser/content.js
--- a/devtools/client/responsive.html/browser/content.js
+++ b/devtools/client/responsive.html/browser/content.js
@@ -50,18 +50,20 @@ var global = this;
     webProgress.addProgressListener(WebProgressListener, Ci.nsIWebProgress.NOTIFY_ALL);
     docShell.deviceSizeIsPageSize = true;
     requiresFloatingScrollbars = data.requiresFloatingScrollbars;
     if (data.notifyOnResize) {
       startOnResize();
     }
 
     // At this point, a content viewer might not be loaded for this
-    // docshell. makeScrollbarsFloating will be triggered by onLocationChange.
+    // docshell. setDocumentInRDMPane and makeScrollbarsFloating will be
+    // triggered by onLocationChange.
     if (docShell.contentViewer) {
+      setDocumentInRDMPane(true);
       makeScrollbarsFloating();
     }
     active = true;
     sendAsyncMessage("ResponsiveMode:Start:Done");
   }
 
   function onResize() {
     const { width, height } = content.screen;
@@ -104,16 +106,17 @@ var global = this;
     }
     active = false;
     removeMessageListener("ResponsiveMode:RequestScreenshot", screenshot);
     const webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
                               .getInterface(Ci.nsIWebProgress);
     webProgress.removeProgressListener(WebProgressListener);
     docShell.deviceSizeIsPageSize = gDeviceSizeWasPageSize;
     restoreScrollbars();
+    setDocumentInRDMPane(false);
     stopOnResize();
     sendAsyncMessage("ResponsiveMode:Stop:Done");
   }
 
   function makeScrollbarsFloating() {
     if (!requiresFloatingScrollbars) {
       return;
     }
@@ -146,16 +149,21 @@ var global = this;
       const winUtils = win.windowUtils;
       try {
         winUtils.removeSheet(gFloatingScrollbarsStylesheet, win.AGENT_SHEET);
       } catch (e) { }
     }
     flushStyle();
   }
 
+  function setDocumentInRDMPane(inRDMPane) {
+    // We don't propegate this property to descendent documents.
+    docShell.contentViewer.DOMDocument.inRDMPane = inRDMPane;
+  }
+
   function flushStyle() {
     // Force presContext destruction
     const isSticky = docShell.contentViewer.sticky;
     docShell.contentViewer.sticky = false;
     docShell.contentViewer.hide();
     docShell.contentViewer.show();
     docShell.contentViewer.sticky = isSticky;
   }
@@ -174,16 +182,17 @@ var global = this;
     sendAsyncMessage("ResponsiveMode:RequestScreenshot:Done", canvas.toDataURL());
   }
 
   const WebProgressListener = {
     onLocationChange(webProgress, request, URI, flags) {
       if (flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT) {
         return;
       }
+      setDocumentInRDMPane(true);
       makeScrollbarsFloating();
     },
     QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener",
                                             "nsISupportsWeakReference"]),
   };
 })();
 
 global.responsiveFrameScriptLoaded = true;