Merge remote-tracking branch 'origin/master' into media-works

This commit is contained in:
2022-03-18 12:52:38 +08:00
310 changed files with 10628 additions and 6702 deletions
+40
View File
@@ -16,6 +16,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/ProfileTimelineMarkerBinding.h"
#include "mozilla/dom/ScreenOrientation.h"
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/dom/workers/ServiceWorkerManager.h"
#include "mozilla/EventStateManager.h"
@@ -757,6 +758,7 @@ nsDocShell::nsDocShell()
, mLoadedTransIndex(-1)
, mSandboxFlags(0)
, mFullscreenAllowed(CHECK_ATTRIBUTES)
, mOrientationLock(eScreenOrientation_None)
, mCreated(false)
, mAllowSubframes(true)
, mAllowPlugins(true)
@@ -2561,6 +2563,18 @@ nsDocShell::SetFullscreenAllowed(bool aFullscreenAllowed)
return NS_OK;
}
ScreenOrientationInternal
nsDocShell::OrientationLock()
{
return mOrientationLock;
}
void
nsDocShell::SetOrientationLock(ScreenOrientationInternal aOrientationLock)
{
mOrientationLock = aOrientationLock;
}
NS_IMETHODIMP
nsDocShell::GetMayEnableCharacterEncodingMenu(
bool* aMayEnableCharacterEncodingMenu)
@@ -6066,6 +6080,16 @@ nsDocShell::SetIsActive(bool aIsActive)
if (mScriptGlobal) {
mScriptGlobal->SetIsBackground(!aIsActive);
if (nsCOMPtr<nsIDocument> doc = mScriptGlobal->GetExtantDoc()) {
if (aIsActive) {
nsCOMPtr<nsIDocShellTreeItem> parent;
GetSameTypeParent(getter_AddRefs(parent));
if (!parent) {
// We only care about the top-level browsing context.
uint16_t orientation = OrientationLock();
ScreenOrientation::UpdateActiveOrientationLock(orientation);
}
}
doc->PostVisibilityUpdateEvent();
}
}
@@ -10271,6 +10295,22 @@ nsDocShell::InternalLoad2(nsIURI* aURI,
mTiming->NotifyUnloadAccepted(mCurrentURI);
}
// Whenever a top-level browsing context is navigated, the user agent MUST
// lock the orientation of the document to the document's default
// orientation. We don't explicitly check for a top-level browsing context
// here because orientation is only set on top-level browsing contexts.
if (OrientationLock() != eScreenOrientation_None) {
#ifdef DEBUG
nsCOMPtr<nsIDocShellTreeItem> parent;
GetSameTypeParent(getter_AddRefs(parent));
MOZ_ASSERT(!parent);
#endif
SetOrientationLock(eScreenOrientation_None);
if (mIsActive) {
ScreenOrientation::UpdateActiveOrientationLock(eScreenOrientation_None);
}
}
// Check for saving the presentation here, before calling Stop().
// This is necessary so that we can catch any pending requests.
// Since the new request has not been created yet, we pass null for the