From 0bfdbb753aaedb00bd953c0b90b90ecef71f78a0 Mon Sep 17 00:00:00 2001 From: Brad Werth Date: Thu, 24 Oct 2019 23:42:56 +0000 Subject: [PATCH] Bug 1561227 Part 4: Make RDM force the UI ZoomChild Actor to cache its zoom level. r=mconley,gl The ZoomChild actor normally caches its full zoom level only when it is changed, then emits a FullZoomChange event. That event causes problems with Responsive Design Mode, which receives the event after other similar events that carry the full zoom level of the RDM pane content. The RDM UI pane itself always stays at 1.0 zoom. This change makes the ZoomChild cache its initial fullZoom level as soon as possible, which prevents the first RDM zoom change from sending the unwanted event. Differential Revision: https://phabricator.services.mozilla.com/D49793 --HG-- extra : moz-landing-system : lando --- devtools/client/responsive/ui.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/devtools/client/responsive/ui.js b/devtools/client/responsive/ui.js index f886fa8bb00b..cb88918a7d97 100644 --- a/devtools/client/responsive/ui.js +++ b/devtools/client/responsive/ui.js @@ -208,6 +208,13 @@ class ResponsiveUI { await this.restoreState(); if (!this.isBrowserUIEnabled) { + // Force the newly created Zoom actor to cache its 1.0 zoom level. This + // prevents it from sending out FullZoomChange events when the content + // full zoom level is changed the first time. + const bc = this.toolWindow.docShell.browsingContext; + const zoomActor = bc.currentWindowGlobal.getActor("Zoom"); + zoomActor.sendAsyncMessage("FullZoom", { value: 1.0 }); + // Re-apply our cached zoom levels. Other Zoom UI update events have finished // by now. rdmContent.fullZoom = fullZoom;