Bug 1166960 - Remove redundant call to UnlockPointer and unnecessary check before calling that function. r=smaug

This commit is contained in:
Xidorn Quan 2015-06-10 13:14:57 +12:00
parent a8384e6fa4
commit 921ab27a26

View File

@ -11196,12 +11196,8 @@ ExitFullscreenInDocTree(nsIDocument* aMaybeNotARootDoc)
void void
nsDocument::ExitFullscreen(nsIDocument* aDoc) nsDocument::ExitFullscreen(nsIDocument* aDoc)
{ {
// Unlock the pointer, if it's locked. // Unlock the pointer
nsCOMPtr<Element> pointerLockedElement = UnlockPointer();
do_QueryReferent(EventStateManager::sPointerLockedElement);
if (pointerLockedElement) {
UnlockPointer();
}
if (aDoc) { if (aDoc) {
ExitFullscreenInDocTree(aDoc); ExitFullscreenInDocTree(aDoc);
@ -11258,11 +11254,7 @@ nsDocument::RestorePreviousFullScreenState()
} }
// If fullscreen mode is updated the pointer should be unlocked // If fullscreen mode is updated the pointer should be unlocked
nsCOMPtr<Element> pointerLockedElement = UnlockPointer();
do_QueryReferent(EventStateManager::sPointerLockedElement);
if (pointerLockedElement) {
UnlockPointer();
}
nsCOMPtr<nsIDocument> fullScreenDoc = GetFullscreenLeaf(this); nsCOMPtr<nsIDocument> fullScreenDoc = GetFullscreenLeaf(this);
@ -11271,7 +11263,6 @@ nsDocument::RestorePreviousFullScreenState()
while (doc != this) { while (doc != this) {
NS_ASSERTION(doc->IsFullScreenDoc(), "Should be full-screen doc"); NS_ASSERTION(doc->IsFullScreenDoc(), "Should be full-screen doc");
static_cast<nsDocument*>(doc)->CleanupFullscreenState(); static_cast<nsDocument*>(doc)->CleanupFullscreenState();
UnlockPointer();
DispatchFullScreenChange(doc); DispatchFullScreenChange(doc);
doc = doc->GetParentDocument(); doc = doc->GetParentDocument();
} }
@ -11280,7 +11271,6 @@ nsDocument::RestorePreviousFullScreenState()
NS_ASSERTION(doc == this, "Must have reached this doc."); NS_ASSERTION(doc == this, "Must have reached this doc.");
while (doc != nullptr) { while (doc != nullptr) {
static_cast<nsDocument*>(doc)->FullScreenStackPop(); static_cast<nsDocument*>(doc)->FullScreenStackPop();
UnlockPointer();
DispatchFullScreenChange(doc); DispatchFullScreenChange(doc);
if (static_cast<nsDocument*>(doc)->mFullScreenStack.IsEmpty()) { if (static_cast<nsDocument*>(doc)->mFullScreenStack.IsEmpty()) {
// Full-screen stack in document is empty. Go back up to the parent // Full-screen stack in document is empty. Go back up to the parent
@ -11666,19 +11656,10 @@ nsDocument::RequestFullScreen(Element* aElement,
// Remember the root document, so that if a full-screen document is hidden // Remember the root document, so that if a full-screen document is hidden
// we can reset full-screen state in the remaining visible full-screen documents. // we can reset full-screen state in the remaining visible full-screen documents.
nsIDocument* fullScreenRootDoc = nsContentUtils::GetRootDocument(this); nsIDocument* fullScreenRootDoc = nsContentUtils::GetRootDocument(this);
if (fullScreenRootDoc->IsFullScreenDoc()) {
// A document is already in fullscreen, unlock the mouse pointer
// before setting a new document to fullscreen
UnlockPointer();
}
// If a document is already in fullscreen, then unlock the mouse pointer // If a document is already in fullscreen, then unlock the mouse pointer
// before setting a new document to fullscreen // before setting a new document to fullscreen
nsCOMPtr<Element> pointerLockedElement = UnlockPointer();
do_QueryReferent(EventStateManager::sPointerLockedElement);
if (pointerLockedElement) {
UnlockPointer();
}
// Process options -- in this case, just HMD // Process options -- in this case, just HMD
if (aOptions.mVRHMDDevice) { if (aOptions.mVRHMDDevice) {