From afd9c3eee4f64fb3e373b13c24d3a6bdf44f77e2 Mon Sep 17 00:00:00 2001 From: Emily McDonough Date: Mon, 3 Apr 2023 17:11:24 +0000 Subject: [PATCH] Bug 1576298 - Remove DeviceSizeIsPageSize from nsDocShell and nsPresContext. r=emilio This comes from bug 890195, and it was superseded by bug 1575097. This isn't used for anything anymore, and we can remove the otherwise unused MediaFeatureChangeReason flag as well. Differential Revision: https://phabricator.services.mozilla.com/D174492 --- docshell/base/nsDocShell.cpp | 24 ------------------------ docshell/base/nsDocShell.h | 1 - docshell/base/nsIDocShell.idl | 12 ------------ layout/base/nsPresContext.cpp | 5 ----- layout/base/nsPresContext.h | 2 -- layout/style/MediaFeatureChange.h | 9 +++------ layout/style/ServoStyleSet.h | 2 +- 7 files changed, 4 insertions(+), 51 deletions(-) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 64a118d75811..8b71aa6dff85 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -352,7 +352,6 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext, mAllowAuth(mItemType == typeContent), mAllowKeywordFixup(false), mDisableMetaRefreshWhenInactive(false), - mDeviceSizeIsPageSize(false), mWindowDraggingAllowed(false), mInFrameSwap(false), mFiredUnloadEvent(false), @@ -442,9 +441,6 @@ bool nsDocShell::Initialize() { Preferences::GetBool("browser.meta_refresh_when_inactive.disabled", mDisableMetaRefreshWhenInactive); - mDeviceSizeIsPageSize = Preferences::GetBool( - "docshell.device_size_is_page_size", mDeviceSizeIsPageSize); - if (nsCOMPtr serv = services::GetObserverService()) { const char* msg = mItemType == typeContent ? NS_WEBNAVIGATION_CREATE : NS_CHROME_WEBNAVIGATION_CREATE; @@ -3196,26 +3192,6 @@ nsDocShell::GetIsNavigating(bool* aOut) { return NS_OK; } -NS_IMETHODIMP -nsDocShell::SetDeviceSizeIsPageSize(bool aValue) { - if (mDeviceSizeIsPageSize != aValue) { - mDeviceSizeIsPageSize = aValue; - RefPtr presContext = GetPresContext(); - if (presContext) { - presContext->MediaFeatureValuesChanged( - {MediaFeatureChangeReason::DeviceSizeIsPageSizeChange}, - MediaFeatureChangePropagation::JustThisDocument); - } - } - return NS_OK; -} - -NS_IMETHODIMP -nsDocShell::GetDeviceSizeIsPageSize(bool* aValue) { - *aValue = mDeviceSizeIsPageSize; - return NS_OK; -} - void nsDocShell::ClearFrameHistory(nsISHEntry* aEntry) { MOZ_ASSERT(!mozilla::SessionHistoryInParent()); RefPtr rootSH = GetRootSessionHistory(); diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 8694ae41501b..7eb46fa817ee 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -1316,7 +1316,6 @@ class nsDocShell final : public nsDocLoader, bool mAllowKeywordFixup : 1; bool mDisableMetaRefreshWhenInactive : 1; bool mIsAppTab : 1; - bool mDeviceSizeIsPageSize : 1; bool mWindowDraggingAllowed : 1; bool mInFrameSwap : 1; diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl index a291a2e8d232..68f32e968c7e 100644 --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -622,18 +622,6 @@ interface nsIDocShell : nsIDocShellTreeItem [noscript,notxpcom,nostdcall] Document getExtantDocument(); - /** - * 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 Mode and B2G Simulator. - * - * Default is False. - * Default value can be overriden with - * docshell.device_size_is_page_size pref. - */ - [infallible] attribute boolean deviceSizeIsPageSize; - /** * Notify DocShell when the browser is about to start executing JS, and after * that execution has stopped. This only occurs when the Timeline devtool diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 5ca34d81134e..93746258875d 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -2815,11 +2815,6 @@ nscoord nsPresContext::PhysicalMillimetersToAppUnits(float aMM) const { inches * float(DeviceContext()->AppUnitsPerPhysicalInch())); } -bool nsPresContext::IsDeviceSizePageSize() { - nsIDocShell* docShell = GetDocShell(); - return docShell && docShell->GetDeviceSizeIsPageSize(); -} - uint64_t nsPresContext::GetRestyleGeneration() const { if (!mRestyleManager) { return 0; diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index d20267147268..066c3c809e2c 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -1055,8 +1055,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr { bool HasEverBuiltInvisibleText() const { return mHasEverBuiltInvisibleText; } void SetBuiltInvisibleText() { mHasEverBuiltInvisibleText = true; } - bool IsDeviceSizePageSize(); - bool HasWarnedAboutTooLargeDashedOrDottedRadius() const { return mHasWarnedAboutTooLargeDashedOrDottedRadius; } diff --git a/layout/style/MediaFeatureChange.h b/layout/style/MediaFeatureChange.h index 70f81f7d1cbd..a766406219cb 100644 --- a/layout/style/MediaFeatureChange.h +++ b/layout/style/MediaFeatureChange.h @@ -16,7 +16,7 @@ namespace mozilla { -enum class MediaFeatureChangeReason : uint16_t { +enum class MediaFeatureChangeReason : uint8_t { // The viewport size the document has used has changed. // // This affects size media queries like min-width. @@ -34,16 +34,13 @@ enum class MediaFeatureChangeReason : uint16_t { // A system metric or multiple have changed. This affects all the media // features that expose the presence of a system metric directly. SystemMetricsChange = 1 << 5, - // The fact of whether the device size is the page size has changed, thus - // resolution media queries can change. - DeviceSizeIsPageSizeChange = 1 << 6, // display-mode changed on the document, thus the display-mode media queries // may have changed. - DisplayModeChange = 1 << 7, + DisplayModeChange = 1 << 6, // A preference that affects media query results has changed. For // example, changes to document_color_use will affect // prefers-contrast. - PreferenceChange = 1 << 8, + PreferenceChange = 1 << 7, }; MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(MediaFeatureChangeReason) diff --git a/layout/style/ServoStyleSet.h b/layout/style/ServoStyleSet.h index 8ff9d815c801..394da3ccf65d 100644 --- a/layout/style/ServoStyleSet.h +++ b/layout/style/ServoStyleSet.h @@ -29,7 +29,7 @@ #include "nsSize.h" namespace mozilla { -enum class MediaFeatureChangeReason : uint16_t; +enum class MediaFeatureChangeReason : uint8_t; enum class StylePageSizeOrientation : uint8_t; enum class StyleRuleChangeKind : uint32_t;