зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1490539 part 1 - Change FullScreen to Fullscreen in various names. r=smaug
Some methods on Window are not changed because they are part of public interface. Method names from widget are also unchanged. Many "full-screen" in comments are also updated to "fullscreen" instead. Differential Revision: https://phabricator.services.mozilla.com/D5639 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
70d09db423
Коммит
30703bafcb
|
@ -215,9 +215,9 @@ DocumentOrShadowRoot::GetFullscreenElement()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Element* element = AsNode().OwnerDoc()->FullScreenStackTop();
|
||||
Element* element = AsNode().OwnerDoc()->FullscreenStackTop();
|
||||
NS_ASSERTION(!element ||
|
||||
element->State().HasState(NS_EVENT_STATE_FULL_SCREEN),
|
||||
element->State().HasState(NS_EVENT_STATE_FULLSCREEN),
|
||||
"Fullscreen element should have fullscreen styles applied");
|
||||
|
||||
nsIContent* retargeted = Retarget(element);
|
||||
|
|
|
@ -1920,14 +1920,14 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
if (HasPointerLock()) {
|
||||
nsIDocument::UnlockPointer();
|
||||
}
|
||||
if (mState.HasState(NS_EVENT_STATE_FULL_SCREEN)) {
|
||||
// The element being removed is an ancestor of the full-screen element,
|
||||
// exit full-screen state.
|
||||
if (mState.HasState(NS_EVENT_STATE_FULLSCREEN)) {
|
||||
// The element being removed is an ancestor of the fullscreen element,
|
||||
// exit fullscreen state.
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("DOM"), OwnerDoc(),
|
||||
nsContentUtils::eDOM_PROPERTIES,
|
||||
"RemovedFullscreenElement");
|
||||
// Fully exit full-screen.
|
||||
// Fully exit fullscreen.
|
||||
nsIDocument::ExitFullscreenInDocTree(OwnerDoc());
|
||||
}
|
||||
|
||||
|
@ -3560,9 +3560,9 @@ Element::AttrValueToCORSMode(const nsAttrValue* aValue)
|
|||
}
|
||||
|
||||
static const char*
|
||||
GetFullScreenError(CallerType aCallerType)
|
||||
GetFullscreenError(CallerType aCallerType)
|
||||
{
|
||||
if (!nsContentUtils::IsRequestFullScreenAllowed(aCallerType)) {
|
||||
if (!nsContentUtils::IsRequestFullscreenAllowed(aCallerType)) {
|
||||
return "FullscreenDeniedNotInputDriven";
|
||||
}
|
||||
|
||||
|
@ -3572,14 +3572,14 @@ GetFullScreenError(CallerType aCallerType)
|
|||
void
|
||||
Element::RequestFullscreen(CallerType aCallerType, ErrorResult& aError)
|
||||
{
|
||||
// Only grant full-screen requests if this is called from inside a trusted
|
||||
// Only grant fullscreen requests if this is called from inside a trusted
|
||||
// event handler (i.e. inside an event handler for a user initiated event).
|
||||
// This stops the full-screen from being abused similar to the popups of old,
|
||||
// and it also makes it harder for bad guys' script to go full-screen and
|
||||
// This stops the fullscreen from being abused similar to the popups of old,
|
||||
// and it also makes it harder for bad guys' script to go fullscreen and
|
||||
// spoof the browser chrome/window and phish logins etc.
|
||||
// Note that requests for fullscreen inside a web app's origin are exempt
|
||||
// from this restriction.
|
||||
if (const char* error = GetFullScreenError(aCallerType)) {
|
||||
if (const char* error = GetFullscreenError(aCallerType)) {
|
||||
OwnerDoc()->DispatchFullscreenError(error);
|
||||
return;
|
||||
}
|
||||
|
@ -3587,7 +3587,7 @@ Element::RequestFullscreen(CallerType aCallerType, ErrorResult& aError)
|
|||
auto request = MakeUnique<FullscreenRequest>(this);
|
||||
request->mIsCallerChrome = (aCallerType == CallerType::System);
|
||||
|
||||
OwnerDoc()->AsyncRequestFullScreen(std::move(request));
|
||||
OwnerDoc()->AsyncRequestFullscreen(std::move(request));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -89,14 +89,14 @@ ScreenOrientation::ScreenOrientation(nsPIDOMWindowInner* aWindow, nsScreen* aScr
|
|||
ScreenOrientation::~ScreenOrientation()
|
||||
{
|
||||
hal::UnregisterScreenConfigurationObserver(this);
|
||||
MOZ_ASSERT(!mFullScreenListener);
|
||||
MOZ_ASSERT(!mFullscreenListener);
|
||||
}
|
||||
|
||||
class ScreenOrientation::FullScreenEventListener final : public nsIDOMEventListener
|
||||
class ScreenOrientation::FullscreenEventListener final : public nsIDOMEventListener
|
||||
{
|
||||
~FullScreenEventListener() {}
|
||||
~FullscreenEventListener() = default;
|
||||
public:
|
||||
FullScreenEventListener() {}
|
||||
FullscreenEventListener() = default;
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
|
@ -123,7 +123,7 @@ public:
|
|||
Promise* aPromise,
|
||||
hal::ScreenOrientation aOrientationLock,
|
||||
nsIDocument* aDocument,
|
||||
bool aIsFullScreen);
|
||||
bool aIsFullscreen);
|
||||
protected:
|
||||
bool OrientationLockContains(OrientationType aOrientationType);
|
||||
|
||||
|
@ -131,7 +131,7 @@ protected:
|
|||
RefPtr<Promise> mPromise;
|
||||
hal::ScreenOrientation mOrientationLock;
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
bool mIsFullScreen;
|
||||
bool mIsFullscreen;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(ScreenOrientation::LockOrientationTask, nsIRunnable)
|
||||
|
@ -139,10 +139,10 @@ NS_IMPL_ISUPPORTS(ScreenOrientation::LockOrientationTask, nsIRunnable)
|
|||
ScreenOrientation::LockOrientationTask::LockOrientationTask(
|
||||
ScreenOrientation* aScreenOrientation, Promise* aPromise,
|
||||
hal::ScreenOrientation aOrientationLock,
|
||||
nsIDocument* aDocument, bool aIsFullScreen)
|
||||
nsIDocument* aDocument, bool aIsFullscreen)
|
||||
: mScreenOrientation(aScreenOrientation), mPromise(aPromise),
|
||||
mOrientationLock(aOrientationLock), mDocument(aDocument),
|
||||
mIsFullScreen(aIsFullScreen)
|
||||
mIsFullscreen(aIsFullscreen)
|
||||
{
|
||||
MOZ_ASSERT(aScreenOrientation);
|
||||
MOZ_ASSERT(aPromise);
|
||||
|
@ -189,7 +189,7 @@ ScreenOrientation::LockOrientationTask::Run()
|
|||
|
||||
ErrorResult rv;
|
||||
bool result = mScreenOrientation->LockDeviceOrientation(mOrientationLock,
|
||||
mIsFullScreen, rv);
|
||||
mIsFullscreen, rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ ScreenOrientation::LockInternal(hal::ScreenOrientation aOrientation,
|
|||
|
||||
bool
|
||||
ScreenOrientation::LockDeviceOrientation(hal::ScreenOrientation aOrientation,
|
||||
bool aIsFullScreen, ErrorResult& aRv)
|
||||
bool aIsFullscreen, ErrorResult& aRv)
|
||||
{
|
||||
if (!GetOwner()) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
|
@ -359,11 +359,11 @@ ScreenOrientation::LockDeviceOrientation(hal::ScreenOrientation aOrientation,
|
|||
}
|
||||
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(GetOwner()->GetDoc());
|
||||
// We need to register a listener so we learn when we leave full-screen
|
||||
// We need to register a listener so we learn when we leave fullscreen
|
||||
// and when we will have to unlock the screen.
|
||||
// This needs to be done before LockScreenOrientation call to make sure
|
||||
// the locking can be unlocked.
|
||||
if (aIsFullScreen && !target) {
|
||||
if (aIsFullscreen && !target) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -372,13 +372,13 @@ ScreenOrientation::LockDeviceOrientation(hal::ScreenOrientation aOrientation,
|
|||
}
|
||||
|
||||
// We are fullscreen and lock has been accepted.
|
||||
if (aIsFullScreen) {
|
||||
if (!mFullScreenListener) {
|
||||
mFullScreenListener = new FullScreenEventListener();
|
||||
if (aIsFullscreen) {
|
||||
if (!mFullscreenListener) {
|
||||
mFullscreenListener = new FullscreenEventListener();
|
||||
}
|
||||
|
||||
aRv = target->AddSystemEventListener(NS_LITERAL_STRING("fullscreenchange"),
|
||||
mFullScreenListener, /* useCapture = */ true);
|
||||
mFullscreenListener, /* useCapture = */ true);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return false;
|
||||
}
|
||||
|
@ -398,8 +398,8 @@ ScreenOrientation::UnlockDeviceOrientation()
|
|||
{
|
||||
hal::UnlockScreenOrientation();
|
||||
|
||||
if (!mFullScreenListener || !GetOwner()) {
|
||||
mFullScreenListener = nullptr;
|
||||
if (!mFullscreenListener || !GetOwner()) {
|
||||
mFullscreenListener = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -407,11 +407,11 @@ ScreenOrientation::UnlockDeviceOrientation()
|
|||
nsCOMPtr<EventTarget> target = do_QueryInterface(GetOwner()->GetDoc());
|
||||
if (target) {
|
||||
target->RemoveSystemEventListener(NS_LITERAL_STRING("fullscreenchange"),
|
||||
mFullScreenListener,
|
||||
mFullscreenListener,
|
||||
/* useCapture */ true);
|
||||
}
|
||||
|
||||
mFullScreenListener = nullptr;
|
||||
mFullscreenListener = nullptr;
|
||||
}
|
||||
|
||||
OrientationType
|
||||
|
@ -488,7 +488,7 @@ ScreenOrientation::GetLockOrientationPermission(bool aCheckSandbox) const
|
|||
return LOCK_ALLOWED;
|
||||
}
|
||||
|
||||
// Other content must be full-screen in order to lock orientation.
|
||||
// Other content must be fullscreen in order to lock orientation.
|
||||
return doc->Fullscreen() ? FULLSCREEN_LOCK_ALLOWED : LOCK_DENIED;
|
||||
}
|
||||
|
||||
|
@ -655,10 +655,10 @@ ScreenOrientation::VisibleEventListener::HandleEvent(Event* aEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(ScreenOrientation::FullScreenEventListener, nsIDOMEventListener)
|
||||
NS_IMPL_ISUPPORTS(ScreenOrientation::FullscreenEventListener, nsIDOMEventListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
ScreenOrientation::FullScreenEventListener::HandleEvent(Event* aEvent)
|
||||
ScreenOrientation::FullscreenEventListener::HandleEvent(Event* aEvent)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
nsAutoString eventType;
|
||||
|
|
|
@ -57,7 +57,7 @@ private:
|
|||
virtual ~ScreenOrientation();
|
||||
|
||||
// Listener to unlock orientation if we leave fullscreen.
|
||||
class FullScreenEventListener;
|
||||
class FullscreenEventListener;
|
||||
|
||||
// Listener to update document's orienation lock when document becomes
|
||||
// visible.
|
||||
|
@ -98,7 +98,7 @@ private:
|
|||
nsIDocument* GetResponsibleDocument() const;
|
||||
|
||||
RefPtr<nsScreen> mScreen;
|
||||
RefPtr<FullScreenEventListener> mFullScreenListener;
|
||||
RefPtr<FullscreenEventListener> mFullscreenListener;
|
||||
RefPtr<VisibleEventListener> mVisibleListener;
|
||||
OrientationType mType;
|
||||
uint16_t mAngle;
|
||||
|
|
|
@ -291,9 +291,9 @@ nsString* nsContentUtils::sAltText = nullptr;
|
|||
nsString* nsContentUtils::sModifierSeparator = nullptr;
|
||||
|
||||
bool nsContentUtils::sInitialized = false;
|
||||
bool nsContentUtils::sIsFullScreenApiEnabled = false;
|
||||
bool nsContentUtils::sIsFullscreenApiEnabled = false;
|
||||
bool nsContentUtils::sIsUnprefixedFullscreenApiEnabled = false;
|
||||
bool nsContentUtils::sTrustedFullScreenOnly = true;
|
||||
bool nsContentUtils::sTrustedFullscreenOnly = true;
|
||||
bool nsContentUtils::sIsCutCopyAllowed = true;
|
||||
bool nsContentUtils::sIsUpgradableDisplayContentPrefEnabled = false;
|
||||
bool nsContentUtils::sIsFrameTimingPrefEnabled = false;
|
||||
|
@ -640,13 +640,13 @@ nsContentUtils::Init()
|
|||
Preferences::AddBoolVarCache(&sAllowXULXBL_for_file,
|
||||
"dom.allow_XUL_XBL_for_file");
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsFullScreenApiEnabled,
|
||||
Preferences::AddBoolVarCache(&sIsFullscreenApiEnabled,
|
||||
"full-screen-api.enabled");
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsUnprefixedFullscreenApiEnabled,
|
||||
"full-screen-api.unprefix.enabled");
|
||||
|
||||
Preferences::AddBoolVarCache(&sTrustedFullScreenOnly,
|
||||
Preferences::AddBoolVarCache(&sTrustedFullscreenOnly,
|
||||
"full-screen-api.allow-trusted-requests-only");
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsCutCopyAllowed,
|
||||
|
@ -7108,20 +7108,20 @@ nsContentUtils::ChannelShouldInheritPrincipal(nsIPrincipal* aLoadingPrincipal,
|
|||
|
||||
/* static */
|
||||
bool
|
||||
nsContentUtils::IsFullScreenApiEnabled()
|
||||
nsContentUtils::IsFullscreenApiEnabled()
|
||||
{
|
||||
return sIsFullScreenApiEnabled;
|
||||
return sIsFullscreenApiEnabled;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsContentUtils::IsRequestFullScreenAllowed(CallerType aCallerType)
|
||||
nsContentUtils::IsRequestFullscreenAllowed(CallerType aCallerType)
|
||||
{
|
||||
// If more time has elapsed since the user input than is specified by the
|
||||
// dom.event.handling-user-input-time-limit pref (default 1 second), this
|
||||
// function also returns false.
|
||||
|
||||
if (!sTrustedFullScreenOnly || aCallerType == CallerType::System) {
|
||||
if (!sTrustedFullscreenOnly || aCallerType == CallerType::System) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2260,9 +2260,9 @@ public:
|
|||
static bool IsFocusedContent(const nsIContent *aContent);
|
||||
|
||||
/**
|
||||
* Returns true if the DOM full-screen API is enabled.
|
||||
* Returns true if the DOM fullscreen API is enabled.
|
||||
*/
|
||||
static bool IsFullScreenApiEnabled();
|
||||
static bool IsFullscreenApiEnabled();
|
||||
|
||||
/**
|
||||
* Returns true if the unprefixed fullscreen API is enabled.
|
||||
|
@ -2271,12 +2271,12 @@ public:
|
|||
{ return sIsUnprefixedFullscreenApiEnabled; }
|
||||
|
||||
/**
|
||||
* Returns true if requests for full-screen are allowed in the current
|
||||
* Returns true if requests for fullscreen are allowed in the current
|
||||
* context. Requests are only allowed if the user initiated them (like with
|
||||
* a mouse-click or key press), unless this check has been disabled by
|
||||
* setting the pref "full-screen-api.allow-trusted-requests-only" to false.
|
||||
*/
|
||||
static bool IsRequestFullScreenAllowed(mozilla::dom::CallerType aCallerType);
|
||||
static bool IsRequestFullscreenAllowed(mozilla::dom::CallerType aCallerType);
|
||||
|
||||
/**
|
||||
* Returns true if calling execCommand with 'cut' or 'copy' arguments
|
||||
|
@ -3449,9 +3449,9 @@ private:
|
|||
static bool sIsHandlingKeyBoardEvent;
|
||||
static bool sAllowXULXBL_for_file;
|
||||
static bool sDisablePopups;
|
||||
static bool sIsFullScreenApiEnabled;
|
||||
static bool sIsFullscreenApiEnabled;
|
||||
static bool sIsUnprefixedFullscreenApiEnabled;
|
||||
static bool sTrustedFullScreenOnly;
|
||||
static bool sTrustedFullscreenOnly;
|
||||
static bool sIsCutCopyAllowed;
|
||||
static uint32_t sHandlingInputTimeout;
|
||||
static bool sIsPerformanceTimingEnabled;
|
||||
|
|
|
@ -8552,7 +8552,7 @@ NotifyPageHide(nsIDocument* aDocument, void* aData)
|
|||
}
|
||||
|
||||
static void
|
||||
DispatchFullScreenChange(nsIDocument* aTarget)
|
||||
DispatchFullscreenChange(nsIDocument* aTarget)
|
||||
{
|
||||
if (nsPresContext* presContext = aTarget->GetPresContext()) {
|
||||
auto pendingEvent =
|
||||
|
@ -8660,7 +8660,7 @@ nsIDocument::OnPageHide(bool aPersisted, EventTarget* aDispatchStartTarget,
|
|||
EnumerateActivityObservers(NotifyActivityChanged, nullptr);
|
||||
|
||||
ClearPendingFullscreenRequests(this);
|
||||
if (FullScreenStackTop()) {
|
||||
if (FullscreenStackTop()) {
|
||||
// If this document was fullscreen, we should exit fullscreen in this
|
||||
// doctree branch. This ensures that if the user navigates while in
|
||||
// fullscreen mode we don't leave its still visible ancestor documents
|
||||
|
@ -10588,7 +10588,7 @@ nsIDocument::SetFullscreenRoot(nsIDocument* aRoot)
|
|||
void
|
||||
nsIDocument::ExitFullscreen()
|
||||
{
|
||||
RestorePreviousFullScreenState();
|
||||
RestorePreviousFullscreenState();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -10643,7 +10643,7 @@ nsIDocument::AsyncExitFullscreen(nsIDocument* aDoc)
|
|||
static bool
|
||||
CountFullscreenSubDocuments(nsIDocument* aDoc, void* aData)
|
||||
{
|
||||
if (aDoc->FullScreenStackTop()) {
|
||||
if (aDoc->FullscreenStackTop()) {
|
||||
uint32_t* count = static_cast<uint32_t*>(aData);
|
||||
(*count)++;
|
||||
}
|
||||
|
@ -10663,7 +10663,7 @@ nsIDocument::IsFullscreenLeaf()
|
|||
{
|
||||
// A fullscreen leaf document is fullscreen, and has no fullscreen
|
||||
// subdocuments.
|
||||
if (!FullScreenStackTop()) {
|
||||
if (!FullscreenStackTop()) {
|
||||
return false;
|
||||
}
|
||||
return CountFullscreenSubDocuments(this) == 0;
|
||||
|
@ -10676,7 +10676,8 @@ GetFullscreenLeaf(nsIDocument* aDoc, void* aData)
|
|||
nsIDocument** result = static_cast<nsIDocument**>(aData);
|
||||
*result = aDoc;
|
||||
return false;
|
||||
} else if (aDoc->FullScreenStackTop()) {
|
||||
}
|
||||
if (aDoc->FullscreenStackTop()) {
|
||||
aDoc->EnumerateSubDocuments(GetFullscreenLeaf, aData);
|
||||
}
|
||||
return true;
|
||||
|
@ -10695,7 +10696,7 @@ GetFullscreenLeaf(nsIDocument* aDoc)
|
|||
nsIDocument* root = nsContentUtils::GetRootDocument(aDoc);
|
||||
// Check that the root is actually fullscreen so we don't waste time walking
|
||||
// around its descendants.
|
||||
if (!root->FullScreenStackTop()) {
|
||||
if (!root->FullscreenStackTop()) {
|
||||
return nullptr;
|
||||
}
|
||||
GetFullscreenLeaf(root, &leaf);
|
||||
|
@ -10703,16 +10704,16 @@ GetFullscreenLeaf(nsIDocument* aDoc)
|
|||
}
|
||||
|
||||
static bool
|
||||
ResetFullScreen(nsIDocument* aDocument, void* aData)
|
||||
ResetFullscreen(nsIDocument* aDocument, void* aData)
|
||||
{
|
||||
if (aDocument->FullScreenStackTop()) {
|
||||
if (aDocument->FullscreenStackTop()) {
|
||||
NS_ASSERTION(CountFullscreenSubDocuments(aDocument) <= 1,
|
||||
"Should have at most 1 fullscreen subdocument.");
|
||||
aDocument->CleanupFullscreenState();
|
||||
NS_ASSERTION(!aDocument->FullScreenStackTop(),
|
||||
"Should reset full-screen");
|
||||
DispatchFullScreenChange(aDocument);
|
||||
aDocument->EnumerateSubDocuments(ResetFullScreen, nullptr);
|
||||
NS_ASSERTION(!aDocument->FullscreenStackTop(),
|
||||
"Should reset fullscreen");
|
||||
DispatchFullscreenChange(aDocument);
|
||||
aDocument->EnumerateSubDocuments(ResetFullscreen, nullptr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -10760,10 +10761,10 @@ nsIDocument::ExitFullscreenInDocTree(nsIDocument* aMaybeNotARootDoc)
|
|||
UnlockPointer();
|
||||
|
||||
nsCOMPtr<nsIDocument> root = aMaybeNotARootDoc->GetFullscreenRoot();
|
||||
if (!root || !root->FullScreenStackTop()) {
|
||||
if (!root || !root->FullscreenStackTop()) {
|
||||
// If a document was detached before exiting from fullscreen, it is
|
||||
// possible that the root had left fullscreen state. In this case,
|
||||
// we would not get anything from the ResetFullScreen() call. Root's
|
||||
// we would not get anything from the ResetFullscreen() call. Root's
|
||||
// not being a fullscreen doc also means the widget should have
|
||||
// exited fullscreen state. It means even if we do not return here,
|
||||
// we would actually do nothing below except crashing ourselves via
|
||||
|
@ -10779,9 +10780,9 @@ nsIDocument::ExitFullscreenInDocTree(nsIDocument* aMaybeNotARootDoc)
|
|||
nsIDocument* fullscreenLeaf = GetFullscreenLeaf(root);
|
||||
|
||||
// Walk the tree of fullscreen documents, and reset their fullscreen state.
|
||||
ResetFullScreen(root, nullptr);
|
||||
ResetFullscreen(root, nullptr);
|
||||
|
||||
NS_ASSERTION(!root->FullScreenStackTop(),
|
||||
NS_ASSERTION(!root->FullscreenStackTop(),
|
||||
"Fullscreen root should no longer be a fullscreen doc...");
|
||||
|
||||
// Move the top-level window out of fullscreen mode.
|
||||
|
@ -10802,12 +10803,12 @@ DispatchFullscreenNewOriginEvent(nsIDocument* aDoc)
|
|||
}
|
||||
|
||||
void
|
||||
nsIDocument::RestorePreviousFullScreenState()
|
||||
nsIDocument::RestorePreviousFullscreenState()
|
||||
{
|
||||
NS_ASSERTION(!FullScreenStackTop() || !FullscreenRoots::IsEmpty(),
|
||||
NS_ASSERTION(!FullscreenStackTop() || !FullscreenRoots::IsEmpty(),
|
||||
"Should have at least 1 fullscreen root when fullscreen!");
|
||||
|
||||
if (!FullScreenStackTop() || !GetWindow() || FullscreenRoots::IsEmpty()) {
|
||||
if (!FullscreenStackTop() || !GetWindow() || FullscreenRoots::IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -10822,10 +10823,10 @@ nsIDocument::RestorePreviousFullScreenState()
|
|||
MOZ_ASSERT(doc == this, "Must have reached this doc");
|
||||
// Collect all ancestor documents which we are going to change.
|
||||
for (; doc; doc = doc->GetParentDocument()) {
|
||||
MOZ_ASSERT(!doc->mFullScreenStack.IsEmpty(),
|
||||
MOZ_ASSERT(!doc->mFullscreenStack.IsEmpty(),
|
||||
"Ancestor of fullscreen document must also be in fullscreen");
|
||||
if (doc != this) {
|
||||
Element* top = doc->FullScreenStackTop();
|
||||
Element* top = doc->FullscreenStackTop();
|
||||
if (top->IsHTMLElement(nsGkAtoms::iframe)) {
|
||||
if (static_cast<HTMLIFrameElement*>(top)->FullscreenFlag()) {
|
||||
// If this is an iframe, and it explicitly requested
|
||||
|
@ -10835,14 +10836,14 @@ nsIDocument::RestorePreviousFullScreenState()
|
|||
}
|
||||
}
|
||||
exitDocs.AppendElement(doc);
|
||||
if (doc->mFullScreenStack.Length() > 1) {
|
||||
if (doc->mFullscreenStack.Length() > 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nsIDocument* lastDoc = exitDocs.LastElement();
|
||||
if (!lastDoc->GetParentDocument() &&
|
||||
lastDoc->mFullScreenStack.Length() == 1) {
|
||||
lastDoc->mFullscreenStack.Length() == 1) {
|
||||
// If we are fully exiting fullscreen, don't touch anything here,
|
||||
// just wait for the window to get out from fullscreen first.
|
||||
AskWindowToExitFullscreen(this);
|
||||
|
@ -10859,8 +10860,8 @@ nsIDocument::RestorePreviousFullScreenState()
|
|||
// The last document will either rollback one fullscreen element, or
|
||||
// completely exit from the fullscreen state as well.
|
||||
nsIDocument* newFullscreenDoc;
|
||||
if (lastDoc->mFullScreenStack.Length() > 1) {
|
||||
lastDoc->FullScreenStackPop();
|
||||
if (lastDoc->mFullscreenStack.Length() > 1) {
|
||||
lastDoc->FullscreenStackPop();
|
||||
newFullscreenDoc = lastDoc;
|
||||
} else {
|
||||
lastDoc->CleanupFullscreenState();
|
||||
|
@ -10870,7 +10871,7 @@ nsIDocument::RestorePreviousFullScreenState()
|
|||
// that the loop order is reversed so that events are dispatched in
|
||||
// the tree order as indicated in the spec.
|
||||
for (nsIDocument* d : Reversed(exitDocs)) {
|
||||
DispatchFullScreenChange(d);
|
||||
DispatchFullscreenChange(d);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(newFullscreenDoc, "If we were going to exit from fullscreen on "
|
||||
|
@ -10886,18 +10887,18 @@ nsIDocument::RestorePreviousFullScreenState()
|
|||
}
|
||||
}
|
||||
|
||||
class nsCallRequestFullScreen : public Runnable
|
||||
class nsCallRequestFullscreen : public Runnable
|
||||
{
|
||||
public:
|
||||
explicit nsCallRequestFullScreen(UniquePtr<FullscreenRequest>&& aRequest)
|
||||
: mozilla::Runnable("nsCallRequestFullScreen")
|
||||
explicit nsCallRequestFullscreen(UniquePtr<FullscreenRequest>&& aRequest)
|
||||
: mozilla::Runnable("nsCallRequestFullscreen")
|
||||
, mRequest(std::move(aRequest))
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD Run() override
|
||||
{
|
||||
mRequest->GetDocument()->RequestFullScreen(std::move(mRequest));
|
||||
mRequest->GetDocument()->RequestFullscreen(std::move(mRequest));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -10905,17 +10906,17 @@ public:
|
|||
};
|
||||
|
||||
void
|
||||
nsIDocument::AsyncRequestFullScreen(UniquePtr<FullscreenRequest>&& aRequest)
|
||||
nsIDocument::AsyncRequestFullscreen(UniquePtr<FullscreenRequest>&& aRequest)
|
||||
{
|
||||
if (!aRequest->GetElement()) {
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"Must pass non-null element to nsDocument::AsyncRequestFullScreen");
|
||||
"Must pass non-null element to nsDocument::AsyncRequestFullscreen");
|
||||
return;
|
||||
}
|
||||
|
||||
// Request full-screen asynchronously.
|
||||
// Request fullscreen asynchronously.
|
||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||
nsCOMPtr<nsIRunnable> event = new nsCallRequestFullScreen(std::move(aRequest));
|
||||
nsCOMPtr<nsIRunnable> event = new nsCallRequestFullscreen(std::move(aRequest));
|
||||
Dispatch(TaskCategory::Other, event.forget());
|
||||
}
|
||||
|
||||
|
@ -10946,7 +10947,7 @@ static void
|
|||
ClearFullscreenStateOnElement(Element* aElement)
|
||||
{
|
||||
// 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);
|
||||
|
@ -10963,56 +10964,56 @@ nsIDocument::CleanupFullscreenState()
|
|||
// efficient. NOTE that fullscreen-ancestor state would be removed
|
||||
// in bug 1199529, and the elements may not in hierarchy order
|
||||
// after bug 1195213.
|
||||
for (nsWeakPtr& weakPtr : Reversed(mFullScreenStack)) {
|
||||
for (nsWeakPtr& weakPtr : Reversed(mFullscreenStack)) {
|
||||
if (nsCOMPtr<Element> element = do_QueryReferent(weakPtr)) {
|
||||
ClearFullscreenStateOnElement(element);
|
||||
}
|
||||
}
|
||||
mFullScreenStack.Clear();
|
||||
mFullscreenStack.Clear();
|
||||
mFullscreenRoot = nullptr;
|
||||
UpdateViewportScrollbarOverrideForFullscreen(this);
|
||||
}
|
||||
|
||||
bool
|
||||
nsIDocument::FullScreenStackPush(Element* aElement)
|
||||
nsIDocument::FullscreenStackPush(Element* aElement)
|
||||
{
|
||||
NS_ASSERTION(aElement, "Must pass non-null to FullScreenStackPush()");
|
||||
Element* top = FullScreenStackTop();
|
||||
NS_ASSERTION(aElement, "Must pass non-null to FullscreenStackPush()");
|
||||
Element* top = FullscreenStackTop();
|
||||
if (top == aElement || !aElement) {
|
||||
return false;
|
||||
}
|
||||
EventStateManager::SetFullScreenState(aElement, true);
|
||||
mFullScreenStack.AppendElement(do_GetWeakReference(aElement));
|
||||
NS_ASSERTION(FullScreenStackTop() == aElement, "Should match");
|
||||
EventStateManager::SetFullscreenState(aElement, true);
|
||||
mFullscreenStack.AppendElement(do_GetWeakReference(aElement));
|
||||
NS_ASSERTION(FullscreenStackTop() == aElement, "Should match");
|
||||
UpdateViewportScrollbarOverrideForFullscreen(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::FullScreenStackPop()
|
||||
nsIDocument::FullscreenStackPop()
|
||||
{
|
||||
if (mFullScreenStack.IsEmpty()) {
|
||||
if (mFullscreenStack.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ClearFullscreenStateOnElement(FullScreenStackTop());
|
||||
ClearFullscreenStateOnElement(FullscreenStackTop());
|
||||
|
||||
// Remove top element. Note the remaining top element in the stack
|
||||
// will not have full-screen style bits set, so we will need to restore
|
||||
// will not have fullscreen style bits set, so we will need to restore
|
||||
// them on the new top element before returning.
|
||||
uint32_t last = mFullScreenStack.Length() - 1;
|
||||
mFullScreenStack.RemoveElementAt(last);
|
||||
uint32_t last = mFullscreenStack.Length() - 1;
|
||||
mFullscreenStack.RemoveElementAt(last);
|
||||
|
||||
// Pop from the stack null elements (references to elements which have
|
||||
// been GC'd since they were added to the stack) and elements which are
|
||||
// no longer in this document.
|
||||
while (!mFullScreenStack.IsEmpty()) {
|
||||
Element* element = FullScreenStackTop();
|
||||
while (!mFullscreenStack.IsEmpty()) {
|
||||
Element* element = FullscreenStackTop();
|
||||
if (!element || !element->IsInUncomposedDoc() || element->OwnerDoc() != this) {
|
||||
NS_ASSERTION(!element->State().HasState(NS_EVENT_STATE_FULL_SCREEN),
|
||||
"Should have already removed full-screen styles");
|
||||
uint32_t last = mFullScreenStack.Length() - 1;
|
||||
mFullScreenStack.RemoveElementAt(last);
|
||||
NS_ASSERTION(!element->State().HasState(NS_EVENT_STATE_FULLSCREEN),
|
||||
"Should have already removed fullscreen styles");
|
||||
uint32_t last = mFullscreenStack.Length() - 1;
|
||||
mFullscreenStack.RemoveElementAt(last);
|
||||
} else {
|
||||
// The top element of the stack is now an in-doc element. Return here.
|
||||
break;
|
||||
|
@ -11023,16 +11024,16 @@ nsIDocument::FullScreenStackPop()
|
|||
}
|
||||
|
||||
Element*
|
||||
nsIDocument::FullScreenStackTop()
|
||||
nsIDocument::FullscreenStackTop()
|
||||
{
|
||||
if (mFullScreenStack.IsEmpty()) {
|
||||
if (mFullscreenStack.IsEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
uint32_t last = mFullScreenStack.Length() - 1;
|
||||
nsCOMPtr<Element> element(do_QueryReferent(mFullScreenStack[last]));
|
||||
NS_ASSERTION(element, "Should have full-screen element!");
|
||||
NS_ASSERTION(element->IsInComposedDoc(), "Full-screen element should be in doc");
|
||||
NS_ASSERTION(element->OwnerDoc() == this, "Full-screen element should be in this doc");
|
||||
uint32_t last = mFullscreenStack.Length() - 1;
|
||||
nsCOMPtr<Element> element(do_QueryReferent(mFullscreenStack[last]));
|
||||
NS_ASSERTION(element, "Should have fullscreen element!");
|
||||
NS_ASSERTION(element->IsInComposedDoc(), "Fullscreen element should be in doc");
|
||||
NS_ASSERTION(element->OwnerDoc() == this, "Fullscreen element should be in this doc");
|
||||
return element;
|
||||
}
|
||||
|
||||
|
@ -11040,9 +11041,9 @@ nsTArray<Element*>
|
|||
nsIDocument::GetFullscreenStack() const
|
||||
{
|
||||
nsTArray<Element*> elements;
|
||||
for (const nsWeakPtr& ptr : mFullScreenStack) {
|
||||
for (const nsWeakPtr& ptr : mFullscreenStack) {
|
||||
if (nsCOMPtr<Element> elem = do_QueryReferent(ptr)) {
|
||||
MOZ_ASSERT(elem->State().HasState(NS_EVENT_STATE_FULL_SCREEN));
|
||||
MOZ_ASSERT(elem->State().HasState(NS_EVENT_STATE_FULLSCREEN));
|
||||
elements.AppendElement(elem);
|
||||
}
|
||||
}
|
||||
|
@ -11096,14 +11097,14 @@ nsresult nsIDocument::RemoteFrameFullscreenChanged(Element* aFrameElement)
|
|||
auto request = MakeUnique<FullscreenRequest>(aFrameElement);
|
||||
request->mIsCallerChrome = false;
|
||||
request->mShouldNotifyNewOrigin = false;
|
||||
RequestFullScreen(std::move(request));
|
||||
RequestFullscreen(std::move(request));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsIDocument::RemoteFrameFullscreenReverted()
|
||||
{
|
||||
RestorePreviousFullScreenState();
|
||||
RestorePreviousFullscreenState();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -11116,7 +11117,7 @@ nsIDocument::IsUnprefixedFullscreenEnabled(JSContext* aCx, JSObject* aObject)
|
|||
}
|
||||
|
||||
static bool
|
||||
HasFullScreenSubDocument(nsIDocument* aDoc)
|
||||
HasFullscreenSubDocument(nsIDocument* aDoc)
|
||||
{
|
||||
uint32_t count = CountFullscreenSubDocuments(aDoc);
|
||||
NS_ASSERTION(count <= 1, "Fullscreen docs should have at most 1 fullscreen child!");
|
||||
|
@ -11129,9 +11130,9 @@ HasFullScreenSubDocument(nsIDocument* aDoc)
|
|||
static const char*
|
||||
GetFullscreenError(nsIDocument* aDoc, bool aCallerIsChrome)
|
||||
{
|
||||
bool apiEnabled = nsContentUtils::IsFullScreenApiEnabled();
|
||||
bool apiEnabled = nsContentUtils::IsFullscreenApiEnabled();
|
||||
if (apiEnabled && aCallerIsChrome) {
|
||||
// Chrome code can always use the full-screen API, provided it's not
|
||||
// Chrome code can always use the fullscreen API, provided it's not
|
||||
// explicitly disabled.
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -11154,8 +11155,8 @@ nsIDocument::FullscreenElementReadyCheck(Element* aElement,
|
|||
bool aWasCallerChrome)
|
||||
{
|
||||
NS_ASSERTION(aElement,
|
||||
"Must pass non-null element to nsDocument::RequestFullScreen");
|
||||
if (!aElement || aElement == FullScreenStackTop()) {
|
||||
"Must pass non-null element to nsDocument::RequestFullscreen");
|
||||
if (!aElement || aElement == FullscreenStackTop()) {
|
||||
return false;
|
||||
}
|
||||
if (!aElement->IsInComposedDoc()) {
|
||||
|
@ -11178,17 +11179,17 @@ nsIDocument::FullscreenElementReadyCheck(Element* aElement,
|
|||
DispatchFullscreenError("FullscreenDeniedHidden");
|
||||
return false;
|
||||
}
|
||||
if (HasFullScreenSubDocument(this)) {
|
||||
if (HasFullscreenSubDocument(this)) {
|
||||
DispatchFullscreenError("FullscreenDeniedSubDocFullScreen");
|
||||
return false;
|
||||
}
|
||||
//XXXsmaug Note, we don't follow the latest fullscreen spec here.
|
||||
// This whole check could be probably removed.
|
||||
if (FullScreenStackTop() &&
|
||||
if (FullscreenStackTop() &&
|
||||
!nsContentUtils::ContentIsHostIncludingDescendantOf(aElement,
|
||||
FullScreenStackTop())) {
|
||||
// If this document is full-screen, only grant full-screen requests from
|
||||
// a descendant of the current full-screen element.
|
||||
FullscreenStackTop())) {
|
||||
// If this document is fullscreen, only grant fullscreen requests from
|
||||
// a descendant of the current fullscreen element.
|
||||
DispatchFullscreenError("FullscreenDeniedNotDescendant");
|
||||
return false;
|
||||
}
|
||||
|
@ -11199,7 +11200,7 @@ nsIDocument::FullscreenElementReadyCheck(Element* aElement,
|
|||
// Deny requests when a windowed plugin is focused.
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (!fm) {
|
||||
NS_WARNING("Failed to retrieve focus manager in full-screen request.");
|
||||
NS_WARNING("Failed to retrieve focus manager in fullscreen request.");
|
||||
return false;
|
||||
}
|
||||
if (nsContentUtils::HasPluginWithUncontrolledEventDispatch(fm->GetFocusedElement())) {
|
||||
|
@ -11364,7 +11365,7 @@ ShouldApplyFullscreenDirectly(nsIDocument* aDoc,
|
|||
}
|
||||
|
||||
void
|
||||
nsIDocument::RequestFullScreen(UniquePtr<FullscreenRequest>&& aRequest)
|
||||
nsIDocument::RequestFullscreen(UniquePtr<FullscreenRequest>&& aRequest)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindowOuter> rootWin = GetRootWindow(this);
|
||||
if (!rootWin) {
|
||||
|
@ -11450,29 +11451,29 @@ nsIDocument::ApplyFullscreen(const FullscreenRequest& aRequest)
|
|||
// as specified.
|
||||
AutoTArray<nsIDocument*, 8> changed;
|
||||
|
||||
// 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.
|
||||
// Remember the root document, so that if a fullscreen document is hidden
|
||||
// we can reset fullscreen state in the remaining visible fullscreen documents.
|
||||
nsIDocument* fullScreenRootDoc = nsContentUtils::GetRootDocument(this);
|
||||
|
||||
// If a document is already in fullscreen, then unlock the mouse pointer
|
||||
// before setting a new document to fullscreen
|
||||
UnlockPointer();
|
||||
|
||||
// Set the full-screen element. This sets the full-screen style on the
|
||||
// element, and the full-screen-ancestor styles on ancestors of the element
|
||||
// Set the fullscreen element. This sets the fullscreen style on the
|
||||
// element, and the fullscreen-ancestor styles on ancestors of the element
|
||||
// in this document.
|
||||
DebugOnly<bool> x = FullScreenStackPush(elem);
|
||||
NS_ASSERTION(x, "Full-screen state of requesting doc should always change!");
|
||||
DebugOnly<bool> x = FullscreenStackPush(elem);
|
||||
NS_ASSERTION(x, "Fullscreen 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);
|
||||
|
||||
// Propagate up the document hierarchy, setting the full-screen element as
|
||||
// Propagate up the document hierarchy, setting the fullscreen element as
|
||||
// the element's container in ancestor documents. This also sets the
|
||||
// appropriate css styles as well. Note we don't propagate down the
|
||||
// document hierarchy, the full-screen element (or its container) is not
|
||||
// document hierarchy, the fullscreen element (or its container) is not
|
||||
// visible there. Stop when we reach the root document.
|
||||
nsIDocument* child = this;
|
||||
while (true) {
|
||||
|
@ -11484,14 +11485,14 @@ nsIDocument::ApplyFullscreen(const FullscreenRequest& aRequest)
|
|||
}
|
||||
nsIDocument* parent = child->GetParentDocument();
|
||||
Element* element = parent->FindContentForSubDocument(child);
|
||||
if (static_cast<nsDocument*>(parent)->FullScreenStackPush(element)) {
|
||||
if (static_cast<nsDocument*>(parent)->FullscreenStackPush(element)) {
|
||||
changed.AppendElement(parent);
|
||||
child = parent;
|
||||
} else {
|
||||
// We've reached either the root, or a point in the doctree where the
|
||||
// new full-screen element container is the same as the previous
|
||||
// full-screen element's container. No more changes need to be made
|
||||
// to the full-screen stacks of documents further up the tree.
|
||||
// new fullscreen element container is the same as the previous
|
||||
// fullscreen element's container. No more changes need to be made
|
||||
// to the fullscreen stacks of documents further up the tree.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -11525,7 +11526,7 @@ nsIDocument::ApplyFullscreen(const FullscreenRequest& aRequest)
|
|||
// reversed so that events are dispatched in the tree order as
|
||||
// indicated in the spec.
|
||||
for (nsIDocument* d : Reversed(changed)) {
|
||||
DispatchFullScreenChange(d);
|
||||
DispatchFullscreenChange(d);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
// This value denotes whether we should trigger a NewOrigin event if
|
||||
// requesting fullscreen in its document causes the origin which is
|
||||
// fullscreen to change. We may want *not* to trigger that event if
|
||||
// we're calling RequestFullScreen() as part of a continuation of a
|
||||
// we're calling RequestFullscreen() as part of a continuation of a
|
||||
// request in a subdocument in different process, whereupon the caller
|
||||
// need to send some notification itself with the real origin.
|
||||
bool mShouldNotifyNewOrigin = true;
|
||||
|
@ -292,7 +292,7 @@ public:
|
|||
|
||||
nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;
|
||||
|
||||
friend class nsCallRequestFullScreen;
|
||||
friend class nsCallRequestFullscreen;
|
||||
|
||||
// The application cache that this document is associated with, if
|
||||
// any. This can change during the lifetime of the document.
|
||||
|
|
|
@ -3638,15 +3638,15 @@ nsGlobalWindowInner::GetNearestWidget() const
|
|||
}
|
||||
|
||||
void
|
||||
nsGlobalWindowInner::SetFullScreen(bool aFullScreen, mozilla::ErrorResult& aError)
|
||||
nsGlobalWindowInner::SetFullScreen(bool aFullscreen, mozilla::ErrorResult& aError)
|
||||
{
|
||||
FORWARD_TO_OUTER_OR_THROW(SetFullScreenOuter, (aFullScreen, aError), aError, /* void */);
|
||||
FORWARD_TO_OUTER_OR_THROW(SetFullscreenOuter, (aFullscreen, aError), aError, /* void */);
|
||||
}
|
||||
|
||||
bool
|
||||
nsGlobalWindowInner::GetFullScreen(ErrorResult& aError)
|
||||
{
|
||||
FORWARD_TO_OUTER_OR_THROW(GetFullScreenOuter, (), aError, false);
|
||||
FORWARD_TO_OUTER_OR_THROW(GetFullscreenOuter, (), aError, false);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -394,7 +394,7 @@ public:
|
|||
// Inner windows only.
|
||||
void RefreshRealmPrincipal();
|
||||
|
||||
// For accessing protected field mFullScreen
|
||||
// For accessing protected field mFullscreen
|
||||
friend class FullscreenTransitionTask;
|
||||
|
||||
// Inner windows only.
|
||||
|
@ -878,7 +878,7 @@ public:
|
|||
int32_t GetScrollMaxY(mozilla::ErrorResult& aError);
|
||||
bool GetFullScreen(mozilla::ErrorResult& aError);
|
||||
bool GetFullScreen() override;
|
||||
void SetFullScreen(bool aFullScreen, mozilla::ErrorResult& aError);
|
||||
void SetFullScreen(bool aFullscreen, mozilla::ErrorResult& aError);
|
||||
bool Find(const nsAString& aString, bool aCaseSensitive, bool aBackwards,
|
||||
bool aWrapAround, bool aWholeWord, bool aSearchInFrames,
|
||||
bool aShowDialog, mozilla::ErrorResult& aError);
|
||||
|
|
|
@ -818,7 +818,7 @@ nsGlobalWindowOuter::nsGlobalWindowOuter()
|
|||
mIdleCallbackIndex(-1),
|
||||
mCurrentlyIdle(false),
|
||||
mAddActiveEventFuzzTime(true),
|
||||
mFullScreen(false),
|
||||
mFullscreen(false),
|
||||
mFullscreenMode(false),
|
||||
mIsClosed(false),
|
||||
mInClose(false),
|
||||
|
@ -3877,15 +3877,15 @@ nsGlobalWindowOuter::GetNearestWidget() const
|
|||
}
|
||||
|
||||
void
|
||||
nsGlobalWindowOuter::SetFullScreenOuter(bool aFullScreen, mozilla::ErrorResult& aError)
|
||||
nsGlobalWindowOuter::SetFullscreenOuter(bool aFullscreen, mozilla::ErrorResult& aError)
|
||||
{
|
||||
aError = SetFullscreenInternal(FullscreenReason::ForFullscreenMode, aFullScreen);
|
||||
aError = SetFullscreenInternal(FullscreenReason::ForFullscreenMode, aFullscreen);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGlobalWindowOuter::SetFullScreen(bool aFullScreen)
|
||||
nsGlobalWindowOuter::SetFullScreen(bool aFullscreen)
|
||||
{
|
||||
return SetFullscreenInternal(FullscreenReason::ForFullscreenMode, aFullScreen);
|
||||
return SetFullscreenInternal(FullscreenReason::ForFullscreenMode, aFullscreen);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -4046,14 +4046,14 @@ FullscreenTransitionTask::Run()
|
|||
} else if (stage == eToggleFullscreen) {
|
||||
PROFILER_ADD_MARKER("Fullscreen toggle start");
|
||||
mFullscreenChangeStartTime = TimeStamp::Now();
|
||||
if (MOZ_UNLIKELY(mWindow->mFullScreen != mFullscreen)) {
|
||||
if (MOZ_UNLIKELY(mWindow->mFullscreen != mFullscreen)) {
|
||||
// This could happen in theory if several fullscreen requests in
|
||||
// different direction happen continuously in a short time. We
|
||||
// need to ensure the fullscreen state matches our target here,
|
||||
// otherwise the widget would change the window state as if we
|
||||
// toggle for Fullscreen Mode instead of Fullscreen API.
|
||||
NS_WARNING("The fullscreen state of the window does not match");
|
||||
mWindow->mFullScreen = mFullscreen;
|
||||
mWindow->mFullscreen = mFullscreen;
|
||||
}
|
||||
// Toggle the fullscreen state on the widget
|
||||
if (!mWindow->SetWidgetFullscreen(FullscreenReason::ForFullscreenAPI,
|
||||
|
@ -4167,7 +4167,7 @@ MakeWidgetFullscreen(nsGlobalWindowOuter* aWindow, FullscreenReason aReason,
|
|||
|
||||
nsresult
|
||||
nsGlobalWindowOuter::SetFullscreenInternal(FullscreenReason aReason,
|
||||
bool aFullScreen)
|
||||
bool aFullscreen)
|
||||
{
|
||||
MOZ_ASSERT(nsContentUtils::IsSafeToRunScript(),
|
||||
"Requires safe to run script as it "
|
||||
|
@ -4175,7 +4175,7 @@ nsGlobalWindowOuter::SetFullscreenInternal(FullscreenReason aReason,
|
|||
|
||||
NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);
|
||||
|
||||
MOZ_ASSERT(aReason != FullscreenReason::ForForceExitFullscreen || !aFullScreen,
|
||||
MOZ_ASSERT(aReason != FullscreenReason::ForForceExitFullscreen || !aFullscreen,
|
||||
"FullscreenReason::ForForceExitFullscreen can "
|
||||
"only be used with exiting fullscreen");
|
||||
|
||||
|
@ -4186,16 +4186,16 @@ nsGlobalWindowOuter::SetFullscreenInternal(FullscreenReason aReason,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// SetFullScreen needs to be called on the root window, so get that
|
||||
// SetFullscreen needs to be called on the root window, so get that
|
||||
// via the DocShell tree, and if we are not already the root,
|
||||
// call SetFullScreen on that window instead.
|
||||
// call SetFullscreen on that window instead.
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootItem;
|
||||
mDocShell->GetRootTreeItem(getter_AddRefs(rootItem));
|
||||
nsCOMPtr<nsPIDOMWindowOuter> window = rootItem ? rootItem->GetWindow() : nullptr;
|
||||
if (!window)
|
||||
return NS_ERROR_FAILURE;
|
||||
if (rootItem != mDocShell)
|
||||
return window->SetFullscreenInternal(aReason, aFullScreen);
|
||||
return window->SetFullscreenInternal(aReason, aFullscreen);
|
||||
|
||||
// make sure we don't try to set full screen on a non-chrome window,
|
||||
// which might happen in embedding world
|
||||
|
@ -4203,27 +4203,28 @@ nsGlobalWindowOuter::SetFullscreenInternal(FullscreenReason aReason,
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
// If we are already in full screen mode, just return.
|
||||
if (mFullScreen == aFullScreen)
|
||||
if (mFullscreen == aFullscreen) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Note that although entering DOM fullscreen could also cause
|
||||
// consequential calls to this method, those calls will be skipped
|
||||
// at the condition above.
|
||||
if (aReason == FullscreenReason::ForFullscreenMode) {
|
||||
if (!aFullScreen && !mFullscreenMode) {
|
||||
if (!aFullscreen && !mFullscreenMode) {
|
||||
// If we are exiting fullscreen mode, but we actually didn't
|
||||
// entered fullscreen mode, the fullscreen state was only for
|
||||
// the Fullscreen API. Change the reason here so that we can
|
||||
// perform transition for it.
|
||||
aReason = FullscreenReason::ForFullscreenAPI;
|
||||
} else {
|
||||
mFullscreenMode = aFullScreen;
|
||||
mFullscreenMode = aFullscreen;
|
||||
}
|
||||
} else {
|
||||
// If we are exiting from DOM fullscreen while we initially make
|
||||
// the window fullscreen because of fullscreen mode, don't restore
|
||||
// the window. But we still need to exit the DOM fullscreen state.
|
||||
if (!aFullScreen && mFullscreenMode) {
|
||||
if (!aFullscreen && mFullscreenMode) {
|
||||
FinishDOMFullscreenChange(mDoc, false);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4233,20 +4234,20 @@ nsGlobalWindowOuter::SetFullscreenInternal(FullscreenReason aReason,
|
|||
// the window after we set fullscreen mode.
|
||||
nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
|
||||
nsCOMPtr<nsIXULWindow> xulWin(do_GetInterface(treeOwnerAsWin));
|
||||
if (aFullScreen && xulWin) {
|
||||
if (aFullscreen && xulWin) {
|
||||
xulWin->SetIntrinsicallySized(false);
|
||||
}
|
||||
|
||||
// Set this before so if widget sends an event indicating its
|
||||
// gone full screen, the state trap above works.
|
||||
mFullScreen = aFullScreen;
|
||||
mFullscreen = aFullscreen;
|
||||
|
||||
// Sometimes we don't want the top-level widget to actually go fullscreen,
|
||||
// for example in the B2G desktop client, we don't want the emulated screen
|
||||
// dimensions to appear to increase when entering fullscreen mode; we just
|
||||
// want the content to fill the entire client area of the emulator window.
|
||||
if (!Preferences::GetBool("full-screen-api.ignore-widgets", false)) {
|
||||
if (MakeWidgetFullscreen(this, aReason, aFullScreen)) {
|
||||
if (MakeWidgetFullscreen(this, aReason, aFullscreen)) {
|
||||
// The rest of code for switching fullscreen is in nsGlobalWindowOuter::
|
||||
// FinishFullscreenChange() which will be called after sizemodechange
|
||||
// event is dispatched.
|
||||
|
@ -4254,7 +4255,7 @@ nsGlobalWindowOuter::SetFullscreenInternal(FullscreenReason aReason,
|
|||
}
|
||||
}
|
||||
|
||||
FinishFullscreenChange(aFullScreen);
|
||||
FinishFullscreenChange(aFullscreen);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -4299,16 +4300,16 @@ nsGlobalWindowOuter::FullscreenWillChange(bool aIsFullscreen)
|
|||
/* virtual */ void
|
||||
nsGlobalWindowOuter::FinishFullscreenChange(bool aIsFullscreen)
|
||||
{
|
||||
if (aIsFullscreen != mFullScreen) {
|
||||
if (aIsFullscreen != mFullscreen) {
|
||||
NS_WARNING("Failed to toggle fullscreen state of the widget");
|
||||
// We failed to make the widget enter fullscreen.
|
||||
// Stop further changes and restore the state.
|
||||
if (!aIsFullscreen) {
|
||||
mFullScreen = false;
|
||||
mFullscreen = false;
|
||||
mFullscreenMode = false;
|
||||
} else {
|
||||
MOZ_ASSERT_UNREACHABLE("Failed to exit fullscreen?");
|
||||
mFullScreen = true;
|
||||
mFullscreen = true;
|
||||
// We don't know how code can reach here. Not sure
|
||||
// what value should be set for fullscreen mode.
|
||||
mFullscreenMode = false;
|
||||
|
@ -4320,7 +4321,7 @@ nsGlobalWindowOuter::FinishFullscreenChange(bool aIsFullscreen)
|
|||
// of the document before dispatching the "fullscreen" event, so
|
||||
// that the chrome can distinguish between browser fullscreen mode
|
||||
// and DOM fullscreen.
|
||||
FinishDOMFullscreenChange(mDoc, mFullScreen);
|
||||
FinishDOMFullscreenChange(mDoc, mFullscreen);
|
||||
|
||||
// dispatch a "fullscreen" DOM event so that XUL apps can
|
||||
// respond visually if we are kicked into full screen mode
|
||||
|
@ -4336,7 +4337,7 @@ nsGlobalWindowOuter::FinishFullscreenChange(bool aIsFullscreen)
|
|||
}
|
||||
}
|
||||
|
||||
if (!mWakeLock && mFullScreen) {
|
||||
if (!mWakeLock && mFullscreen) {
|
||||
RefPtr<power::PowerManagerService> pmService =
|
||||
power::PowerManagerService::GetInstance();
|
||||
if (!pmService) {
|
||||
|
@ -4349,7 +4350,7 @@ nsGlobalWindowOuter::FinishFullscreenChange(bool aIsFullscreen)
|
|||
GetCurrentInnerWindow(), rv);
|
||||
NS_WARNING_ASSERTION(!rv.Failed(), "Failed to lock the wakelock");
|
||||
rv.SuppressException();
|
||||
} else if (mWakeLock && !mFullScreen) {
|
||||
} else if (mWakeLock && !mFullscreen) {
|
||||
ErrorResult rv;
|
||||
mWakeLock->Unlock(rv);
|
||||
mWakeLock = nullptr;
|
||||
|
@ -4358,9 +4359,9 @@ nsGlobalWindowOuter::FinishFullscreenChange(bool aIsFullscreen)
|
|||
}
|
||||
|
||||
bool
|
||||
nsGlobalWindowOuter::FullScreen() const
|
||||
nsGlobalWindowOuter::Fullscreen() const
|
||||
{
|
||||
NS_ENSURE_TRUE(mDocShell, mFullScreen);
|
||||
NS_ENSURE_TRUE(mDocShell, mFullscreen);
|
||||
|
||||
// Get the fullscreen value of the root window, to always have the value
|
||||
// accurate, even when called from content.
|
||||
|
@ -4369,7 +4370,7 @@ nsGlobalWindowOuter::FullScreen() const
|
|||
if (rootItem == mDocShell) {
|
||||
if (!XRE_IsContentProcess()) {
|
||||
// We are the root window. Return our internal value.
|
||||
return mFullScreen;
|
||||
return mFullscreen;
|
||||
}
|
||||
if (nsCOMPtr<nsIWidget> widget = GetNearestWidget()) {
|
||||
// We are in content process, figure out the value from
|
||||
|
@ -4380,15 +4381,15 @@ nsGlobalWindowOuter::FullScreen() const
|
|||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowOuter> window = rootItem->GetWindow();
|
||||
NS_ENSURE_TRUE(window, mFullScreen);
|
||||
NS_ENSURE_TRUE(window, mFullscreen);
|
||||
|
||||
return nsGlobalWindowOuter::Cast(window)->FullScreen();
|
||||
return nsGlobalWindowOuter::Cast(window)->Fullscreen();
|
||||
}
|
||||
|
||||
bool
|
||||
nsGlobalWindowOuter::GetFullScreenOuter()
|
||||
nsGlobalWindowOuter::GetFullscreenOuter()
|
||||
{
|
||||
return FullScreen();
|
||||
return Fullscreen();
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -347,7 +347,7 @@ public:
|
|||
virtual bool DispatchCustomEvent(const nsAString& aEventName) override;
|
||||
bool DispatchResizeEvent(const mozilla::CSSIntSize& aSize);
|
||||
|
||||
// For accessing protected field mFullScreen
|
||||
// For accessing protected field mFullscreen
|
||||
friend class FullscreenTransitionTask;
|
||||
|
||||
// Outer windows only.
|
||||
|
@ -357,7 +357,7 @@ public:
|
|||
void FinishFullscreenChange(bool aIsFullscreen) final;
|
||||
bool SetWidgetFullscreen(FullscreenReason aReason, bool aIsFullscreen,
|
||||
nsIWidget* aWidget, nsIScreen* aScreen);
|
||||
bool FullScreen() const;
|
||||
bool Fullscreen() const;
|
||||
|
||||
// nsIInterfaceRequestor
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
|
@ -658,10 +658,10 @@ public:
|
|||
float GetMozInnerScreenXOuter(mozilla::dom::CallerType aCallerType);
|
||||
float GetMozInnerScreenYOuter(mozilla::dom::CallerType aCallerType);
|
||||
double GetDevicePixelRatioOuter(mozilla::dom::CallerType aCallerType);
|
||||
bool GetFullScreenOuter();
|
||||
bool GetFullscreenOuter();
|
||||
bool GetFullScreen() override;
|
||||
void SetFullScreenOuter(bool aFullScreen, mozilla::ErrorResult& aError);
|
||||
nsresult SetFullScreen(bool aFullScreen) override;
|
||||
void SetFullscreenOuter(bool aFullscreen, mozilla::ErrorResult& aError);
|
||||
nsresult SetFullScreen(bool aFullscreen) override;
|
||||
bool FindOuter(const nsAString& aString, bool aCaseSensitive, bool aBackwards,
|
||||
bool aWrapAround, bool aWholeWord, bool aSearchInFrames,
|
||||
bool aShowDialog, mozilla::ErrorResult& aError);
|
||||
|
@ -1058,7 +1058,7 @@ public:
|
|||
virtual mozilla::AbstractThread*
|
||||
AbstractMainThreadFor(mozilla::TaskCategory aCategory) override;
|
||||
protected:
|
||||
bool mFullScreen : 1;
|
||||
bool mFullscreen : 1;
|
||||
bool mFullscreenMode : 1;
|
||||
bool mIsClosed : 1;
|
||||
bool mInClose : 1;
|
||||
|
|
|
@ -1745,36 +1745,36 @@ public:
|
|||
* Asynchronously requests that the document make aElement the fullscreen
|
||||
* element, and move into fullscreen mode. The current fullscreen element
|
||||
* (if any) is pushed onto the fullscreen element stack, and it can be
|
||||
* returned to fullscreen status by calling RestorePreviousFullScreenState().
|
||||
* returned to fullscreen status by calling RestorePreviousFullscreenState().
|
||||
*
|
||||
* Note that requesting fullscreen in a document also makes the element which
|
||||
* contains this document in this document's parent document fullscreen. i.e.
|
||||
* the <iframe> or <browser> that contains this document is also mode
|
||||
* fullscreen. This happens recursively in all ancestor documents.
|
||||
*/
|
||||
void AsyncRequestFullScreen(mozilla::UniquePtr<FullscreenRequest>&&);
|
||||
void AsyncRequestFullscreen(mozilla::UniquePtr<FullscreenRequest>&&);
|
||||
|
||||
// Do the "fullscreen element ready check" from the fullscreen spec.
|
||||
// It returns true if the given element is allowed to go into fullscreen.
|
||||
bool FullscreenElementReadyCheck(Element* aElement, bool aWasCallerChrome);
|
||||
|
||||
// This is called asynchronously by nsIDocument::AsyncRequestFullScreen()
|
||||
// to move this document into full-screen mode if allowed.
|
||||
void RequestFullScreen(mozilla::UniquePtr<FullscreenRequest>&& aRequest);
|
||||
// This is called asynchronously by nsIDocument::AsyncRequestFullscreen()
|
||||
// to move this document into fullscreen mode if allowed.
|
||||
void RequestFullscreen(mozilla::UniquePtr<FullscreenRequest>&& aRequest);
|
||||
|
||||
// Removes all elements from the full-screen stack, removing full-scren
|
||||
// Removes all elements from the fullscreen stack, removing full-scren
|
||||
// styles from the top element in the stack.
|
||||
void CleanupFullscreenState();
|
||||
|
||||
// Pushes aElement onto the full-screen stack, and removes full-screen styles
|
||||
// from the former full-screen stack top, and its ancestors, and applies the
|
||||
// styles to aElement. aElement becomes the new "full-screen element".
|
||||
bool FullScreenStackPush(Element* aElement);
|
||||
// Pushes aElement onto the fullscreen stack, and removes fullscreen styles
|
||||
// from the former fullscreen stack top, and its ancestors, and applies the
|
||||
// styles to aElement. aElement becomes the new "fullscreen element".
|
||||
bool FullscreenStackPush(Element* aElement);
|
||||
|
||||
// Remove the top element from the full-screen stack. Removes the full-screen
|
||||
// Remove the top element from the fullscreen stack. Removes the fullscreen
|
||||
// styles from the former top element, and applies them to the new top
|
||||
// element, if there is one.
|
||||
void FullScreenStackPop();
|
||||
void FullscreenStackPop();
|
||||
|
||||
/**
|
||||
* Called when a frame in a child process has entered fullscreen or when a
|
||||
|
@ -1796,11 +1796,11 @@ public:
|
|||
nsresult RemoteFrameFullscreenReverted();
|
||||
|
||||
/**
|
||||
* Restores the previous full-screen element to full-screen status. If there
|
||||
* is no former full-screen element, this exits full-screen, moving the
|
||||
* top-level browser window out of full-screen mode.
|
||||
* Restores the previous fullscreen element to fullscreen status. If there
|
||||
* is no former fullscreen element, this exits fullscreen, moving the
|
||||
* top-level browser window out of fullscreen mode.
|
||||
*/
|
||||
void RestorePreviousFullScreenState();
|
||||
void RestorePreviousFullscreenState();
|
||||
|
||||
/**
|
||||
* Returns true if this document is a fullscreen leaf document, i.e. it
|
||||
|
@ -3277,9 +3277,9 @@ public:
|
|||
void ReleaseCapture() const;
|
||||
void MozSetImageElement(const nsAString& aImageElementId, Element* aElement);
|
||||
nsIURI* GetDocumentURIObject() const;
|
||||
// Not const because all the full-screen goop is not const
|
||||
// Not const because all the fullscreen goop is not const
|
||||
bool FullscreenEnabled(mozilla::dom::CallerType aCallerType);
|
||||
Element* FullScreenStackTop();
|
||||
Element* FullscreenStackTop();
|
||||
bool Fullscreen()
|
||||
{
|
||||
return !!GetFullscreenElement();
|
||||
|
@ -4576,10 +4576,10 @@ protected:
|
|||
nsTHashtable<nsPtrHashKey<mozilla::dom::DOMIntersectionObserver>>
|
||||
mIntersectionObservers;
|
||||
|
||||
// Stack of full-screen elements. When we request full-screen we push the
|
||||
// full-screen element onto this stack, and when we cancel full-screen we
|
||||
// pop one off this stack, restoring the previous full-screen state
|
||||
nsTArray<nsWeakPtr> mFullScreenStack;
|
||||
// Stack of fullscreen elements. When we request fullscreen we push the
|
||||
// fullscreen element onto this stack, and when we cancel fullscreen we
|
||||
// pop one off this stack, restoring the previous fullscreen state
|
||||
nsTArray<nsWeakPtr> mFullscreenStack;
|
||||
|
||||
// The root of the doc tree in which this document is in. This is only
|
||||
// non-null when this document is in fullscreen mode.
|
||||
|
|
|
@ -1139,7 +1139,7 @@ public:
|
|||
|
||||
virtual bool Closed() = 0;
|
||||
virtual bool GetFullScreen() = 0;
|
||||
virtual nsresult SetFullScreen(bool aFullScreen) = 0;
|
||||
virtual nsresult SetFullScreen(bool aFullscreen) = 0;
|
||||
|
||||
virtual nsresult Focus() = 0;
|
||||
virtual nsresult Close() = 0;
|
||||
|
|
|
@ -5117,9 +5117,9 @@ GetLabelTarget(nsIContent* aPossibleLabel)
|
|||
|
||||
/* static */
|
||||
void
|
||||
EventStateManager::SetFullScreenState(Element* aElement, bool aIsFullScreen)
|
||||
EventStateManager::SetFullscreenState(Element* aElement, bool aIsFullscreen)
|
||||
{
|
||||
DoStateChange(aElement, NS_EVENT_STATE_FULL_SCREEN, aIsFullScreen);
|
||||
DoStateChange(aElement, NS_EVENT_STATE_FULLSCREEN, aIsFullscreen);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -304,8 +304,8 @@ public:
|
|||
static void SetActiveManager(EventStateManager* aNewESM,
|
||||
nsIContent* aContent);
|
||||
|
||||
// Sets the full-screen event state on aElement to aIsFullScreen.
|
||||
static void SetFullScreenState(dom::Element* aElement, bool aIsFullScreen);
|
||||
// Sets the fullscreen event state on aElement to aIsFullscreen.
|
||||
static void SetFullscreenState(dom::Element* aElement, bool aIsFullscreen);
|
||||
|
||||
static bool IsRemoteTarget(nsIContent* aTarget);
|
||||
|
||||
|
|
|
@ -214,8 +214,8 @@ private:
|
|||
// Content is URL's target (ref).
|
||||
#define NS_EVENT_STATE_URLTARGET NS_DEFINE_EVENT_STATE_MACRO(8)
|
||||
// Content is the full screen element, or a frame containing the
|
||||
// current full-screen element.
|
||||
#define NS_EVENT_STATE_FULL_SCREEN NS_DEFINE_EVENT_STATE_MACRO(9)
|
||||
// current fullscreen element.
|
||||
#define NS_EVENT_STATE_FULLSCREEN NS_DEFINE_EVENT_STATE_MACRO(9)
|
||||
// Content is valid (and can be invalid).
|
||||
#define NS_EVENT_STATE_VALID NS_DEFINE_EVENT_STATE_MACRO(10)
|
||||
// Content is invalid.
|
||||
|
@ -360,7 +360,7 @@ private:
|
|||
NS_EVENT_STATE_FOCUS | \
|
||||
NS_EVENT_STATE_FOCUSRING | \
|
||||
NS_EVENT_STATE_FOCUS_WITHIN | \
|
||||
NS_EVENT_STATE_FULL_SCREEN | \
|
||||
NS_EVENT_STATE_FULLSCREEN | \
|
||||
NS_EVENT_STATE_HOVER | \
|
||||
NS_EVENT_STATE_URLTARGET \
|
||||
)
|
||||
|
|
Загрузка…
Ссылка в новой задаче