Bug 1285069 part 1 - Remove code around pending fullscreen request. r=smaug

This code is no longer needed as we are always granting pointerlock request.

MozReview-Commit-ID: 3HVo3CddqWY

--HG--
extra : rebase_source : 53e72af037007d5d490cb9cb449492437e4c4714
extra : source : ce74d9d66912b6dfbe8e1379228b742baff119c3
This commit is contained in:
Xidorn Quan 2016-07-13 10:28:28 +10:00
Родитель ce4badc7bc
Коммит efc0e7f9af
1 изменённых файлов: 0 добавлений и 50 удалений

Просмотреть файл

@ -11878,27 +11878,11 @@ FullscreenRequest::FullscreenRequest(Element* aElement)
, mDocument(static_cast<nsDocument*>(aElement->OwnerDoc()))
{
MOZ_COUNT_CTOR(FullscreenRequest);
mDocument->mPendingFullscreenRequests++;
if (MOZ_UNLIKELY(!mDocument->mPendingFullscreenRequests)) {
NS_WARNING("Pending fullscreen request counter overflow");
}
}
static void RedispatchPendingPointerLockRequest(nsIDocument* aDocument);
FullscreenRequest::~FullscreenRequest()
{
MOZ_COUNT_DTOR(FullscreenRequest);
if (MOZ_UNLIKELY(!mDocument->mPendingFullscreenRequests)) {
NS_WARNING("Pending fullscreen request counter underflow");
return;
}
mDocument->mPendingFullscreenRequests--;
if (!mDocument->mPendingFullscreenRequests) {
// There may be pointer lock request be blocked because of pending
// fullscreen requests. Re-dispatch it to ensure it gets handled.
RedispatchPendingPointerLockRequest(mDocument);
}
}
// Any fullscreen request waiting for the widget to finish being full-
@ -12350,11 +12334,6 @@ public:
}
nsDocument* doc = static_cast<nsDocument*>(d.get());
if (doc->mPendingFullscreenRequests > 0) {
// We're still entering fullscreen.
return NS_OK;
}
if (doc->GetFullscreenElement() || doc->mAllowRelocking) {
Allow(JS::UndefinedHandleValue);
return NS_OK;
@ -12510,35 +12489,6 @@ nsPointerLockPermissionRequest::GetRequester(nsIContentPermissionRequester** aRe
return NS_OK;
}
static void
RedispatchPendingPointerLockRequest(nsIDocument* aDocument)
{
if (!gPendingPointerLockRequest) {
return;
}
nsCOMPtr<nsIDocument> doc =
do_QueryReferent(gPendingPointerLockRequest->mDocument);
if (doc != aDocument) {
return;
}
nsCOMPtr<Element> elem =
do_QueryReferent(gPendingPointerLockRequest->mElement);
if (!elem || elem->GetUncomposedDoc() != aDocument) {
gPendingPointerLockRequest->Handled();
return;
}
// We have a request pending on the document which may previously be
// blocked for fullscreen change. Create a clone and re-dispatch it
// to guarantee that Run() method gets called again.
bool userInputOrChromeCaller =
gPendingPointerLockRequest->mUserInputOrChromeCaller;
gPendingPointerLockRequest->Handled();
gPendingPointerLockRequest =
new nsPointerLockPermissionRequest(elem, userInputOrChromeCaller);
NS_DispatchToMainThread(gPendingPointerLockRequest);
}
nsresult
nsDocument::Observe(nsISupports *aSubject,
const char *aTopic,