Bug 1191597 part 5 - Ensure to cleanup old window size from the list when exit fullscreen. r=smaug

This commit is contained in:
Xidorn Quan 2016-01-11 09:38:53 +11:00
parent 9a1b1a3c54
commit 71588c6764

View File

@ -3096,6 +3096,10 @@ nsDOMWindowUtils::ExitFullscreen()
{
nsCOMPtr<nsIDocument> doc = GetDocument();
NS_ENSURE_STATE(doc);
// Although we would not use the old size if we have already exited
// fullscreen, we still want to cleanup in case we haven't.
nsSize oldSize = OldWindowSize::GetAndRemove(doc->GetWindow());
if (!doc->IsFullScreenDoc()) {
return NS_OK;
}
@ -3104,9 +3108,7 @@ nsDOMWindowUtils::ExitFullscreen()
// set the window dimensions in advance. Since the resize message
// comes after the fullscreen change call, doing so could avoid an
// extra resize reflow after this point.
FullscreenChangePrepare prepare(
GetPresShell(), OldWindowSize::GetAndRemove(doc->GetWindow()));
FullscreenChangePrepare prepare(GetPresShell(), oldSize);
nsIDocument::ExitFullscreenInDocTree(doc);
return NS_OK;
}