mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 726943 - Fullscreen button in HTML video makes the browser go fullscreen but not the video [r=mstange]
Don't fire extraneous NS_SIZEMODE events from windowDidResize, that cause the DOM fullscreen requests to be cancelled on Mac.
This commit is contained in:
parent
f2f1957bdc
commit
b0d8bcd61c
@ -367,6 +367,8 @@ protected:
|
||||
bool mSheetNeedsShow; // if this is a sheet, are we waiting to be shown?
|
||||
// this is used for sibling sheet contention only
|
||||
bool mFullScreen;
|
||||
bool mInFullScreenTransition; // true from the request to enter/exit fullscreen
|
||||
// (MakeFullScreen() call) to EnteredFullScreen()
|
||||
bool mModal;
|
||||
|
||||
bool mUsesNativeFullScreen; // only true on Lion if SetShowsFullScreenButton(true);
|
||||
|
@ -139,6 +139,7 @@ nsCocoaWindow::nsCocoaWindow()
|
||||
, mWindowMadeHere(false)
|
||||
, mSheetNeedsShow(false)
|
||||
, mFullScreen(false)
|
||||
, mInFullScreenTransition(false)
|
||||
, mModal(false)
|
||||
, mUsesNativeFullScreen(false)
|
||||
, mIsAnimationSuppressed(false)
|
||||
@ -1186,6 +1187,7 @@ NS_IMETHODIMP nsCocoaWindow::HideWindowChrome(bool aShouldHide)
|
||||
|
||||
void nsCocoaWindow::EnteredFullScreen(bool aFullScreen)
|
||||
{
|
||||
mInFullScreenTransition = false;
|
||||
mFullScreen = aFullScreen;
|
||||
DispatchSizeModeEvent();
|
||||
}
|
||||
@ -1200,9 +1202,10 @@ NS_METHOD nsCocoaWindow::MakeFullScreen(bool aFullScreen)
|
||||
if (mFullScreen == aFullScreen) {
|
||||
return NS_OK;
|
||||
}
|
||||
mInFullScreenTransition = true;
|
||||
|
||||
if (mUsesNativeFullScreen) {
|
||||
// Calling toggleFullScreen will result in windowDid(Enter|Exit)FullScreen
|
||||
// Calling toggleFullScreen will result in windowDid(FailTo)?(Enter|Exit)FullScreen
|
||||
// to be called from the OS. We will call EnteredFullScreen from those methods,
|
||||
// where mFullScreen will be set and a sizemode event will be dispatched.
|
||||
[mWindow toggleFullScreen:nil];
|
||||
@ -1472,8 +1475,13 @@ void
|
||||
nsCocoaWindow::DispatchSizeModeEvent()
|
||||
{
|
||||
nsSizeMode newMode = GetWindowSizeMode(mWindow, mFullScreen);
|
||||
if (mSizeMode == newMode)
|
||||
|
||||
// Don't dispatch a sizemode event if:
|
||||
// 1. the window is transitioning to fullscreen
|
||||
// 2. the new sizemode is the same as the current sizemode
|
||||
if (mInFullScreenTransition || mSizeMode == newMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
mSizeMode = newMode;
|
||||
nsSizeModeEvent event(true, NS_SIZEMODE, this);
|
||||
@ -1952,6 +1960,24 @@ bool nsCocoaWindow::ShouldFocusPlugin()
|
||||
mGeckoWindow->EnteredFullScreen(false);
|
||||
}
|
||||
|
||||
- (void)windowDidFailToEnterFullScreen:(NSWindow *)window
|
||||
{
|
||||
if (!mGeckoWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
mGeckoWindow->EnteredFullScreen(false);
|
||||
}
|
||||
|
||||
- (void)windowDidFailToExitFullScreen:(NSWindow *)window
|
||||
{
|
||||
if (!mGeckoWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
mGeckoWindow->EnteredFullScreen(true);
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeMain:(NSNotification *)aNotification
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
Loading…
Reference in New Issue
Block a user