зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1267568 part 1 - Add a weak ptr to nsGlobalChromeWindow to remember the pres shell we set the fullscreen change flag. r=smaug
This addresses the review comment from bug 1177155 comment 16 so that the assertion and code to avoid breaking assertion in valid path are no longer needed. MozReview-Commit-ID: GHIYQwyoejC --HG-- extra : source : 3a7d540381d12f58b6b1b150528312150e0c8893
This commit is contained in:
Родитель
95f7be2962
Коммит
2ae314ff8f
|
@ -6461,13 +6461,6 @@ nsGlobalWindow::SetFullscreenInternal(FullscreenReason aReason,
|
|||
}
|
||||
}
|
||||
|
||||
// If we didn't setup the widget, we may need to manually set this
|
||||
// flag, or the assertion in FinishFullscreenChange is violated.
|
||||
if (nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell()) {
|
||||
if (!presShell->IsInFullscreenChange()) {
|
||||
presShell->SetIsInFullscreenChange(true);
|
||||
}
|
||||
}
|
||||
FinishFullscreenChange(aFullScreen);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -6481,8 +6474,15 @@ nsGlobalWindow::SetWidgetFullscreen(FullscreenReason aReason, bool aIsFullscreen
|
|||
MOZ_ASSERT(!AsOuter()->GetFrameElementInternal(), "Content window should not call this");
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
|
||||
if (nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell()) {
|
||||
presShell->SetIsInFullscreenChange(true);
|
||||
if (!NS_WARN_IF(!IsChromeWindow())) {
|
||||
auto chromeWin = static_cast<nsGlobalChromeWindow*>(this);
|
||||
if (!NS_WARN_IF(chromeWin->mFullscreenPresShell)) {
|
||||
if (nsIPresShell* shell = mDocShell->GetPresShell()) {
|
||||
chromeWin->mFullscreenPresShell = do_GetWeakReference(shell);
|
||||
MOZ_ASSERT(chromeWin->mFullscreenPresShell);
|
||||
shell->SetIsInFullscreenChange(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
nsresult rv = aReason == FullscreenReason::ForFullscreenMode ?
|
||||
// If we enter fullscreen for fullscreen mode, we want
|
||||
|
@ -6524,9 +6524,13 @@ nsGlobalWindow::FinishFullscreenChange(bool aIsFullscreen)
|
|||
// respond visually if we are kicked into full screen mode
|
||||
DispatchCustomEvent(NS_LITERAL_STRING("fullscreen"));
|
||||
|
||||
if (nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell()) {
|
||||
MOZ_ASSERT(presShell->IsInFullscreenChange());
|
||||
presShell->SetIsInFullscreenChange(false);
|
||||
if (!NS_WARN_IF(!IsChromeWindow())) {
|
||||
auto chromeWin = static_cast<nsGlobalChromeWindow*>(this);
|
||||
if (nsCOMPtr<nsIPresShell> shell =
|
||||
do_QueryReferent(chromeWin->mFullscreenPresShell)) {
|
||||
shell->SetIsInFullscreenChange(false);
|
||||
chromeWin->mFullscreenPresShell = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mWakeLock && mFullScreen) {
|
||||
|
|
|
@ -1979,6 +1979,10 @@ public:
|
|||
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
||||
nsCOMPtr<nsIMessageBroadcaster> mMessageManager;
|
||||
nsInterfaceHashtable<nsStringHashKey, nsIMessageBroadcaster> mGroupMessageManagers;
|
||||
// A weak pointer to the nsPresShell that we are doing fullscreen for.
|
||||
// The pointer being set indicates we've set the IsInFullscreenChange
|
||||
// flag on this pres shell.
|
||||
nsWeakPtr mFullscreenPresShell;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Загрузка…
Ссылка в новой задаче