mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1196290 - Do not update orientation lock when app docshell is activated. r=smaug
This commit is contained in:
parent
7789a2567f
commit
646f86353a
@ -5936,7 +5936,10 @@ nsDocShell::SetIsActive(bool aIsActive)
|
||||
if (mScriptGlobal) {
|
||||
mScriptGlobal->SetIsBackground(!aIsActive);
|
||||
if (nsCOMPtr<nsIDocument> doc = mScriptGlobal->GetExtantDoc()) {
|
||||
if (aIsActive) {
|
||||
// Update orientation when the top-level browsing context becomes active.
|
||||
// We make an exception for apps because they currently rely on
|
||||
// orientation locks persisting across browsing contexts.
|
||||
if (aIsActive && !GetIsApp()) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
GetSameTypeParent(getter_AddRefs(parent));
|
||||
if (!parent) {
|
||||
@ -10071,7 +10074,9 @@ nsDocShell::InternalLoad(nsIURI* aURI,
|
||||
// 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) {
|
||||
// We make an exception for apps because they currently rely on
|
||||
// orientation locks persisting across browsing contexts.
|
||||
if (OrientationLock() != eScreenOrientation_None && !GetIsApp()) {
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIDocShellTreeItem> parent;
|
||||
GetSameTypeParent(getter_AddRefs(parent));
|
||||
|
@ -197,6 +197,29 @@ nsScreen::GetSlowMozOrientation(nsAString& aOrientation)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
UpdateDocShellOrientationLock(nsPIDOMWindow* aWindow,
|
||||
ScreenOrientationInternal aOrientation)
|
||||
{
|
||||
if (!aWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell();
|
||||
if (!docShell) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> root;
|
||||
docShell->GetSameTypeRootTreeItem(getter_AddRefs(root));
|
||||
nsCOMPtr<nsIDocShell> rootShell(do_QueryInterface(root));
|
||||
if (!rootShell) {
|
||||
return;
|
||||
}
|
||||
|
||||
rootShell->SetOrientationLock(aOrientation);
|
||||
}
|
||||
|
||||
bool
|
||||
nsScreen::MozLockOrientation(const nsAString& aOrientation, ErrorResult& aRv)
|
||||
{
|
||||
@ -245,8 +268,10 @@ nsScreen::MozLockOrientation(const Sequence<nsString>& aOrientations,
|
||||
case ScreenOrientation::LOCK_DENIED:
|
||||
return false;
|
||||
case ScreenOrientation::LOCK_ALLOWED:
|
||||
UpdateDocShellOrientationLock(GetOwner(), orientation);
|
||||
return mScreenOrientation->LockDeviceOrientation(orientation, false, aRv);
|
||||
case ScreenOrientation::FULLSCREEN_LOCK_ALLOWED:
|
||||
UpdateDocShellOrientationLock(GetOwner(), orientation);
|
||||
return mScreenOrientation->LockDeviceOrientation(orientation, true, aRv);
|
||||
}
|
||||
|
||||
@ -258,6 +283,7 @@ nsScreen::MozLockOrientation(const Sequence<nsString>& aOrientations,
|
||||
void
|
||||
nsScreen::MozUnlockOrientation()
|
||||
{
|
||||
UpdateDocShellOrientationLock(GetOwner(), eScreenOrientation_None);
|
||||
mScreenOrientation->UnlockDeviceOrientation();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user