diff --git a/browser/devtools/responsivedesign/responsivedesign.jsm b/browser/devtools/responsivedesign/responsivedesign.jsm index 4a54f003a327..cceda150dd9a 100644 --- a/browser/devtools/responsivedesign/responsivedesign.jsm +++ b/browser/devtools/responsivedesign/responsivedesign.jsm @@ -185,6 +185,7 @@ function ResponsiveUI(aWindow, aTab) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShell); + this._deviceSizeWasPageSize = this.docShell.deviceSizeIsPageSize; this.docShell.deviceSizeIsPageSize = true; try { @@ -255,7 +256,7 @@ ResponsiveUI.prototype = { return; this.closing = true; - this.docShell.deviceSizeIsPageSize = false; + this.docShell.deviceSizeIsPageSize = this._deviceSizeWasPageSize; this.browser.removeEventListener("load", this.bound_onPageLoad, true); this.browser.removeEventListener("unload", this.bound_onPageUnload, true); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index ad83c81075d6..05b5bbed5f84 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -4951,6 +4951,10 @@ nsDocShell::Create() gAddedPreferencesVarCache = true; } + mDeviceSizeIsPageSize = + Preferences::GetBool("docshell.device_size_is_page_size", + mDeviceSizeIsPageSize); + nsCOMPtr serv = services::GetObserverService(); if (serv) { const char* msg = mItemType == typeContent ? diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index eac85028b032..c260f65cd6ec 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -912,7 +912,11 @@ interface nsIDocShell : nsIDocShellTreeItem * If deviceSizeIsPageSize is set to true, device-width/height media queries * will be calculated from the page size, not the device size. * - * Used by the Responsive Design View. + * Used by the Responsive Design View and B2G Simulator. + * + * Default is False. + * Default value can be overriden with + * docshell.device_size_is_page_size pref. */ [infallible] attribute boolean deviceSizeIsPageSize; };