Bug 1319950 - DPR watching should move to actor. r=me
MozReview-Commit-ID: KcPhlh5uYJO
--- a/devtools/client/responsive.html/index.js
+++ b/devtools/client/responsive.html/index.js
@@ -94,16 +94,19 @@ window.dispatch = action => bootstrap.di
Object.defineProperty(window, "store", {
get: () => bootstrap.store,
enumerable: true,
});
// Dispatch a `changeDisplayPixelRatio` action when the browser's pixel ratio is changing.
// This is usually triggered when the user changes the monitor resolution, or when the
// browser's window is dragged to a different display with a different pixel ratio.
+// TODO: It would be better to move this watching into the actor, so that it can be
+// better synchronized with any overrides that might be applied. Also, reading a single
+// value like this makes less sense with multiple viewports.
function onDPRChange() {
let dpr = window.devicePixelRatio;
let mql = window.matchMedia(`(resolution: ${dpr}dppx)`);
function listener() {
bootstrap.dispatch(changeDisplayPixelRatio(window.devicePixelRatio));
mql.removeListener(listener);
onDPRChange();