mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-18 06:45:33 +00:00
Bug 1187801 part 3 - Add iframe fullscreen flag and stop auto-rollback when this flag presents. r=smaug
--HG-- extra : source : f7801f9c5b8e65862ead640f7b07ad87a40c9345
This commit is contained in:
parent
2d891027c2
commit
f6fe1e11ba
@ -155,6 +155,7 @@
|
|||||||
#include "nsHtml5TreeOpExecutor.h"
|
#include "nsHtml5TreeOpExecutor.h"
|
||||||
#include "mozilla/dom/HTMLLinkElement.h"
|
#include "mozilla/dom/HTMLLinkElement.h"
|
||||||
#include "mozilla/dom/HTMLMediaElement.h"
|
#include "mozilla/dom/HTMLMediaElement.h"
|
||||||
|
#include "mozilla/dom/HTMLIFrameElement.h"
|
||||||
#include "mozilla/dom/HTMLImageElement.h"
|
#include "mozilla/dom/HTMLImageElement.h"
|
||||||
#include "mozilla/dom/MediaSource.h"
|
#include "mozilla/dom/MediaSource.h"
|
||||||
|
|
||||||
@ -11239,6 +11240,16 @@ nsDocument::RestorePreviousFullScreenState()
|
|||||||
nsDocument* theDoc = static_cast<nsDocument*>(doc);
|
nsDocument* theDoc = static_cast<nsDocument*>(doc);
|
||||||
MOZ_ASSERT(!theDoc->mFullScreenStack.IsEmpty(),
|
MOZ_ASSERT(!theDoc->mFullScreenStack.IsEmpty(),
|
||||||
"Ancestor of fullscreen document must also be in fullscreen");
|
"Ancestor of fullscreen document must also be in fullscreen");
|
||||||
|
if (doc != this) {
|
||||||
|
Element* top = theDoc->FullScreenStackTop();
|
||||||
|
if (top->IsHTMLElement(nsGkAtoms::iframe)) {
|
||||||
|
if (static_cast<HTMLIFrameElement*>(top)->FullscreenFlag()) {
|
||||||
|
// If this is an iframe, and it explicitly requested
|
||||||
|
// fullscreen, don't rollback it automatically.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
exitDocs.AppendElement(theDoc);
|
exitDocs.AppendElement(theDoc);
|
||||||
if (theDoc->mFullScreenStack.Length() > 1) {
|
if (theDoc->mFullScreenStack.Length() > 1) {
|
||||||
break;
|
break;
|
||||||
@ -11361,6 +11372,10 @@ ClearFullscreenStateOnElement(Element* aElement)
|
|||||||
aElement->DeleteProperty(nsGkAtoms::vr_state);
|
aElement->DeleteProperty(nsGkAtoms::vr_state);
|
||||||
// Remove styles from existing top element.
|
// Remove styles from existing top element.
|
||||||
EventStateManager::SetFullScreenState(aElement, false);
|
EventStateManager::SetFullScreenState(aElement, false);
|
||||||
|
// Reset iframe fullscreen flag.
|
||||||
|
if (aElement->IsHTMLElement(nsGkAtoms::iframe)) {
|
||||||
|
static_cast<HTMLIFrameElement*>(aElement)->SetFullscreenFlag(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -11853,6 +11868,10 @@ nsDocument::ApplyFullscreen(const FullscreenRequest& aRequest)
|
|||||||
// in this document.
|
// in this document.
|
||||||
DebugOnly<bool> x = FullScreenStackPush(elem);
|
DebugOnly<bool> x = FullScreenStackPush(elem);
|
||||||
NS_ASSERTION(x, "Full-screen state of requesting doc should always change!");
|
NS_ASSERTION(x, "Full-screen state of requesting doc should always change!");
|
||||||
|
// Set the iframe fullscreen flag.
|
||||||
|
if (elem->IsHTMLElement(nsGkAtoms::iframe)) {
|
||||||
|
static_cast<HTMLIFrameElement*>(elem)->SetFullscreenFlag(true);
|
||||||
|
}
|
||||||
changed.AppendElement(this);
|
changed.AppendElement(this);
|
||||||
|
|
||||||
// Propagate up the document hierarchy, setting the full-screen element as
|
// Propagate up the document hierarchy, setting the full-screen element as
|
||||||
|
@ -184,6 +184,13 @@ public:
|
|||||||
// nsGenericHTMLFrameElement::GetFrameLoader is fine
|
// nsGenericHTMLFrameElement::GetFrameLoader is fine
|
||||||
// nsGenericHTMLFrameElement::GetAppManifestURL is fine
|
// nsGenericHTMLFrameElement::GetAppManifestURL is fine
|
||||||
|
|
||||||
|
// The fullscreen flag is set to true only when requestFullscreen is
|
||||||
|
// explicitly called on this <iframe> element. In case this flag is
|
||||||
|
// set, the fullscreen state of this element will not be reverted
|
||||||
|
// automatically when its subdocument exits fullscreen.
|
||||||
|
bool FullscreenFlag() const { return mFullscreenFlag; }
|
||||||
|
void SetFullscreenFlag(bool aValue) { mFullscreenFlag = aValue; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~HTMLIFrameElement();
|
virtual ~HTMLIFrameElement();
|
||||||
|
|
||||||
|
@ -113,6 +113,11 @@ protected:
|
|||||||
bool mBrowserFrameListenersRegistered;
|
bool mBrowserFrameListenersRegistered;
|
||||||
bool mFrameLoaderCreationDisallowed;
|
bool mFrameLoaderCreationDisallowed;
|
||||||
|
|
||||||
|
// This flag is only used by <iframe>. See HTMLIFrameElement::
|
||||||
|
// FullscreenFlag() for details. It is placed here so that we
|
||||||
|
// do not bloat any struct.
|
||||||
|
bool mFullscreenFlag = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void GetManifestURLByType(nsIAtom *aAppType, nsAString& aOut);
|
void GetManifestURLByType(nsIAtom *aAppType, nsAString& aOut);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user