Bug 1541175 Part 2: Force RDM UI to be at 100% zoom. r=pbro,ochameau
authorBrad Werth <bwerth@mozilla.com>
Mon, 06 May 2019 07:21:13 +0000
changeset 534829 2f85ada34acb9da79c83f9fb73b59f8d8d295a8d
parent 534828 b377b5bdd883b97fedbfc61666edb780964c1f96
child 534830 20a54f437d518408622e82484c9b5a6997766dab
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro, ochameau
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 1541175 Part 2: Force RDM UI to be at 100% zoom. r=pbro,ochameau Once RDM is up-and-running, the Zoom UI will stay synchronized with the zoom level of the RDM content pane. These changes ensure that the RDM tools are forced to 100%, and then does a fixup to get the Zoom UI to match the RDM content pane zoom level again. Differential Revision: https://phabricator.services.mozilla.com/D26045
--- a/devtools/client/responsive.html/manager.js
+++ b/devtools/client/responsive.html/manager.js
@@ -347,16 +347,35 @@ ResponsiveUI.prototype = {
         debug("Wait until browser mounted");
         await message.wait(toolWindow, "browser-mounted");
         return ui.getViewportBrowser();
     debug("Wait until swap start");
     await this.swap.start();
+    // Set the ui toolWindow to fullZoom and textZoom of 100%. Directly change
+    // the zoom levels of the toolwindow docshell. That doesn't affect the zoom
+    // of the RDM content, but it does send events that confuse the Zoom UI.
+    // So before we adjust the zoom levels of the toolWindow, we first cache
+    // the reported zoom levels of the RDM content, because we'll have to
+    // re-apply them to re-sync the Zoom UI.
+    // Cache the values now and we'll re-apply them near the end of this function.
+    // This is important since other steps here can also cause the Zoom UI update
+    // event to be sent for other browsers, and this means that the changes from
+    // our Zoom UI update event would be overwritten. After this function, future
+    // changes to zoom levels will send Zoom UI update events in an order that
+    // keeps the Zoom UI synchronized with the RDM content zoom levels.
+    const fullZoom = this.tab.linkedBrowser.fullZoom;
+    const textZoom = this.tab.linkedBrowser.textZoom;
+    ui.toolWindow.docShell.contentViewer.fullZoom = 1;
+    ui.toolWindow.docShell.contentViewer.textZoom = 1;
     this.tab.addEventListener("BeforeTabRemotenessChange", this);
     // Notify the inner browser to start the frame script
     debug("Wait until start frame script");
     await message.request(this.toolWindow, "start-frame-script");
     // Get the protocol ready to speak with emulation actor
     debug("Wait until RDP server connect");
@@ -366,16 +385,21 @@ ResponsiveUI.prototype = {
     await this.restoreState();
     // Show the settings onboarding tooltip
     if (Services.prefs.getBoolPref(SHOW_SETTING_TOOLTIP_PREF)) {
       this.settingOnboardingTooltip =
         new SettingOnboardingTooltip(ui.toolWindow.document);
+    // Re-apply our cached zoom levels. Other Zoom UI update events have finished
+    // by now.
+    this.tab.linkedBrowser.fullZoom = fullZoom;
+    this.tab.linkedBrowser.textZoom = textZoom;
     // Non-blocking message to tool UI to start any delayed init activities
     message.post(this.toolWindow, "post-init");
     debug("Init done");
    * Close RDM and restore page content back into a regular tab.