зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1490539 part 3 - Put CallerType into FullscreenRequest. r=smaug
Depends on D5640 Differential Revision: https://phabricator.services.mozilla.com/D5641 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b75f5a16d1
Коммит
2629806922
|
@ -3584,9 +3584,7 @@ Element::RequestFullscreen(CallerType aCallerType, ErrorResult& aError)
|
|||
return;
|
||||
}
|
||||
|
||||
auto request = MakeUnique<FullscreenRequest>(this);
|
||||
request->mIsCallerChrome = (aCallerType == CallerType::System);
|
||||
|
||||
auto request = MakeUnique<FullscreenRequest>(this, aCallerType);
|
||||
OwnerDoc()->AsyncRequestFullscreen(std::move(request));
|
||||
}
|
||||
|
||||
|
|
|
@ -11094,8 +11094,8 @@ nsresult nsIDocument::RemoteFrameFullscreenChanged(Element* aFrameElement)
|
|||
// Ensure the frame element is the fullscreen element in this document.
|
||||
// If the frame element is already the fullscreen element in this document,
|
||||
// this has no effect.
|
||||
auto request = MakeUnique<FullscreenRequest>(aFrameElement);
|
||||
request->mIsCallerChrome = false;
|
||||
auto request = MakeUnique<FullscreenRequest>(aFrameElement,
|
||||
CallerType::NonSystem);
|
||||
request->mShouldNotifyNewOrigin = false;
|
||||
RequestFullscreen(std::move(request));
|
||||
|
||||
|
@ -11128,10 +11128,10 @@ HasFullscreenSubDocument(nsIDocument* aDoc)
|
|||
// in the given document. Returns a static string indicates the reason
|
||||
// why it is not enabled otherwise.
|
||||
static const char*
|
||||
GetFullscreenError(nsIDocument* aDoc, bool aCallerIsChrome)
|
||||
GetFullscreenError(nsIDocument* aDoc, CallerType aCallerType)
|
||||
{
|
||||
bool apiEnabled = nsContentUtils::IsFullscreenApiEnabled();
|
||||
if (apiEnabled && aCallerIsChrome) {
|
||||
if (apiEnabled && aCallerType == CallerType::System) {
|
||||
// Chrome code can always use the fullscreen API, provided it's not
|
||||
// explicitly disabled.
|
||||
return nullptr;
|
||||
|
@ -11152,7 +11152,7 @@ GetFullscreenError(nsIDocument* aDoc, bool aCallerIsChrome)
|
|||
|
||||
bool
|
||||
nsIDocument::FullscreenElementReadyCheck(Element* aElement,
|
||||
bool aWasCallerChrome)
|
||||
CallerType aCallerType)
|
||||
{
|
||||
NS_ASSERTION(aElement,
|
||||
"Must pass non-null element to nsDocument::RequestFullscreen");
|
||||
|
@ -11171,7 +11171,7 @@ nsIDocument::FullscreenElementReadyCheck(Element* aElement,
|
|||
DispatchFullscreenError("FullscreenDeniedLostWindow");
|
||||
return false;
|
||||
}
|
||||
if (const char* msg = GetFullscreenError(this, aWasCallerChrome)) {
|
||||
if (const char* msg = GetFullscreenError(this, aCallerType)) {
|
||||
DispatchFullscreenError(msg);
|
||||
return false;
|
||||
}
|
||||
|
@ -11210,9 +11210,10 @@ nsIDocument::FullscreenElementReadyCheck(Element* aElement,
|
|||
return true;
|
||||
}
|
||||
|
||||
FullscreenRequest::FullscreenRequest(Element* aElement)
|
||||
FullscreenRequest::FullscreenRequest(Element* aElement, CallerType aCallerType)
|
||||
: mElement(aElement)
|
||||
, mDocument(static_cast<nsDocument*>(aElement->OwnerDoc()))
|
||||
, mCallerType(aCallerType)
|
||||
{
|
||||
MOZ_COUNT_CTOR(FullscreenRequest);
|
||||
}
|
||||
|
@ -11389,7 +11390,7 @@ nsIDocument::RequestFullscreen(UniquePtr<FullscreenRequest> aRequest)
|
|||
|
||||
// We don't need to check element ready before this point, because
|
||||
// if we called ApplyFullscreen, it would check that for us.
|
||||
if (!FullscreenElementReadyCheck(elem, aRequest->mIsCallerChrome)) {
|
||||
if (!FullscreenElementReadyCheck(elem, aRequest->mCallerType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -11436,7 +11437,7 @@ bool
|
|||
nsIDocument::ApplyFullscreen(const FullscreenRequest& aRequest)
|
||||
{
|
||||
Element* elem = aRequest.GetElement();
|
||||
if (!FullscreenElementReadyCheck(elem, aRequest.mIsCallerChrome)) {
|
||||
if (!FullscreenElementReadyCheck(elem, aRequest.mCallerType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -11534,7 +11535,7 @@ nsIDocument::ApplyFullscreen(const FullscreenRequest& aRequest)
|
|||
bool
|
||||
nsIDocument::FullscreenEnabled(CallerType aCallerType)
|
||||
{
|
||||
return !GetFullscreenError(this, aCallerType == CallerType::System);
|
||||
return !GetFullscreenError(this, aCallerType);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -88,7 +88,7 @@ class Performance;
|
|||
|
||||
struct FullscreenRequest : public LinkedListElement<FullscreenRequest>
|
||||
{
|
||||
explicit FullscreenRequest(Element* aElement);
|
||||
FullscreenRequest(Element* aElement, CallerType aCallerType);
|
||||
FullscreenRequest(const FullscreenRequest&) = delete;
|
||||
~FullscreenRequest();
|
||||
|
||||
|
@ -101,8 +101,8 @@ private:
|
|||
|
||||
public:
|
||||
// This value should be true if the fullscreen request is
|
||||
// originated from chrome code.
|
||||
bool mIsCallerChrome = false;
|
||||
// originated from system code.
|
||||
const CallerType mCallerType;
|
||||
// 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
|
||||
|
|
|
@ -1756,7 +1756,8 @@ public:
|
|||
|
||||
// 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);
|
||||
bool FullscreenElementReadyCheck(Element* aElement,
|
||||
mozilla::dom::CallerType aCallerType);
|
||||
|
||||
// This is called asynchronously by nsIDocument::AsyncRequestFullscreen()
|
||||
// to move this document into fullscreen mode if allowed.
|
||||
|
|
Загрузка…
Ссылка в новой задаче