Bug 1174966 part 2 - Replace mAsyncFullscreenPending flag with mPendingFullscreenRequests counter. r=smaug

This commit is contained in:
Xidorn Quan 2015-06-19 10:09:52 +10:00
parent 75ad362d04
commit 6f6102976b
2 changed files with 7 additions and 11 deletions

View File

@ -11295,19 +11295,16 @@ public:
const FullScreenOptions& aOptions)
: mElement(aElement),
mDoc(aElement->OwnerDoc()),
mOptions(aOptions),
mHadRequestPending(static_cast<nsDocument*>(mDoc.get())->
mAsyncFullscreenPending)
mOptions(aOptions)
{
static_cast<nsDocument*>(mDoc.get())->
mAsyncFullscreenPending = true;
auto doc = static_cast<nsDocument*>(mDoc.get());
doc->mPendingFullscreenRequests++;
}
NS_IMETHOD Run()
{
static_cast<nsDocument*>(mDoc.get())->
mAsyncFullscreenPending = mHadRequestPending;
nsDocument* doc = static_cast<nsDocument*>(mDoc.get());
doc->mPendingFullscreenRequests--;
doc->RequestFullScreen(mElement, mOptions);
return NS_OK;
}
@ -11315,7 +11312,6 @@ public:
nsRefPtr<Element> mElement;
nsCOMPtr<nsIDocument> mDoc;
FullScreenOptions mOptions;
bool mHadRequestPending;
};
void
@ -12011,7 +12007,7 @@ public:
// We're about to enter fullscreen mode.
nsDocument* doc = static_cast<nsDocument*>(d.get());
if (doc->mAsyncFullscreenPending ||
if (doc->mPendingFullscreenRequests > 0 ||
(doc->mHasFullscreenApprovedObserver && !doc->mIsApprovedForFullscreen)) {
// We're still waiting for approval.
return NS_OK;

View File

@ -1663,8 +1663,6 @@ public:
// user.
bool mAllowRelocking:1;
bool mAsyncFullscreenPending:1;
// Whether we're observing the "app-theme-changed" observer service
// notification. We need to keep track of this because we might get multiple
// OnPageShow notifications in a row without an OnPageHide in between, if
@ -1679,6 +1677,8 @@ public:
// The value is saturated to kPointerLockRequestLimit+1 = 3.
uint8_t mCancelledPointerLockRequests:2;
uint8_t mPendingFullscreenRequests;
uint8_t mXMLDeclarationBits;
nsInterfaceHashtable<nsPtrHashKey<nsIContent>, nsPIBoxObject> *mBoxObjectTable;