Bug 1920357 - Ignore viewport meta tag when we're in RDM and we also force desktop viewport. r=devtools-reviewers,jdescottes

Currently DevTools doesn't do it, but it feels like the right API and is
already there. This allows fixing this on the devtools side however you
want :)

Differential Revision: https://phabricator.services.mozilla.com/D223627
This commit is contained in:
Emilio Cobos Álvarez
2024-10-09 22:34:40 +00:00
parent 5b239838bf
commit 667c1a9396
3 changed files with 49 additions and 21 deletions

View File

@@ -2759,6 +2759,20 @@ void BrowsingContext::DidSet(FieldIndex<IDX_InRDMPane>, bool aOldValue) {
PresContextAffectingFieldChanged();
}
void BrowsingContext::DidSet(FieldIndex<IDX_ForceDesktopViewport>,
bool aOldValue) {
MOZ_ASSERT(IsTop(), "Should only set in the top-level browsing context");
if (ForceDesktopViewport() == aOldValue) {
return;
}
PresContextAffectingFieldChanged();
if (nsIDocShell* shell = GetDocShell()) {
if (RefPtr ps = shell->GetPresShell()) {
ps->MaybeRecreateMobileViewportManager(/* aAfterInitialization= */ true);
}
}
}
bool BrowsingContext::CanSet(FieldIndex<IDX_PageAwakeRequestCount>,
uint32_t aNewValue, ContentParent* aSource) {
return IsTop() && XRE_IsParentProcess() && !aSource;