Bug 1188256 part 1 - Move FullscreenRequest into a separate header and inline its methods. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D5847

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Xidorn Quan 2018-09-14 18:57:08 +00:00
parent 48f80b7f64
commit 740ca1c8f3
6 changed files with 64 additions and 43 deletions

View File

@ -65,6 +65,7 @@
#include "mozilla/EventListenerManager.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h"
#include "mozilla/FullscreenRequest.h"
#include "mozilla/InternalMutationEvent.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/RestyleManager.h"

View File

@ -0,0 +1,59 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* Struct for holding fullscreen request.
*/
#ifndef mozilla_FullscreenRequest_h
#define mozilla_FullscreenRequest_h
#include "mozilla/LinkedList.h"
#include "mozilla/dom/Element.h"
#include "nsIDocument.h"
namespace mozilla {
struct FullscreenRequest : public LinkedListElement<FullscreenRequest>
{
FullscreenRequest(dom::Element* aElement, dom::CallerType aCallerType)
: mElement(aElement)
, mDocument(aElement->OwnerDoc())
, mCallerType(aCallerType)
{
MOZ_COUNT_CTOR(FullscreenRequest);
}
FullscreenRequest(const FullscreenRequest&) = delete;
~FullscreenRequest()
{
MOZ_COUNT_DTOR(FullscreenRequest);
}
dom::Element* GetElement() const { return mElement; }
nsIDocument* GetDocument() const { return mDocument; }
private:
RefPtr<dom::Element> mElement;
RefPtr<nsIDocument> mDocument;
public:
// This value should be true if the fullscreen request is
// originated from system code.
const dom::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
// 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;
};
} // namespace mozilla
#endif // mozilla_FullscreenRequest_h

View File

@ -131,6 +131,7 @@ EXPORTS.mozilla += [
'CORSMode.h',
'FeedWriterEnabled.h',
'FlushType.h',
'FullscreenRequest.h',
'RangeBoundary.h',
'SelectionChangeEventDispatcher.h',
'TextInputProcessor.h',

View File

@ -58,6 +58,7 @@
#include "mozilla/BasicEvents.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/FullscreenRequest.h"
#include "mozilla/dom/Attr.h"
#include "mozilla/dom/BindingDeclarations.h"
@ -11224,19 +11225,6 @@ nsIDocument::FullscreenElementReadyCheck(Element* aElement,
return true;
}
FullscreenRequest::FullscreenRequest(Element* aElement, CallerType aCallerType)
: mElement(aElement)
, mDocument(static_cast<nsDocument*>(aElement->OwnerDoc()))
, mCallerType(aCallerType)
{
MOZ_COUNT_CTOR(FullscreenRequest);
}
FullscreenRequest::~FullscreenRequest()
{
MOZ_COUNT_DTOR(FullscreenRequest);
}
// Any fullscreen request waiting for the widget to finish being full-
// screen is queued here. This is declared static instead of a member
// of nsDocument because in the majority of time, there would be at most

View File

@ -53,7 +53,6 @@
#include "nsDataHashtable.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Attributes.h"
#include "mozilla/LinkedList.h"
#include "CustomElementRegistry.h"
#include "mozilla/dom/Performance.h"
#include "mozilla/Maybe.h"
@ -85,33 +84,6 @@ struct LifecycleCallbacks;
class CallbackFunction;
class DOMIntersectionObserver;
class Performance;
struct FullscreenRequest : public LinkedListElement<FullscreenRequest>
{
FullscreenRequest(Element* aElement, CallerType aCallerType);
FullscreenRequest(const FullscreenRequest&) = delete;
~FullscreenRequest();
Element* GetElement() const { return mElement; }
nsIDocument* GetDocument() const { return mDocument; }
private:
RefPtr<Element> mElement;
RefPtr<nsIDocument> mDocument;
public:
// This value should be true if the fullscreen request is
// 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
// 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;
};
} // namespace dom
} // namespace mozilla

View File

@ -125,6 +125,7 @@ class Encoding;
class ErrorResult;
class EventStates;
class EventListenerManager;
struct FullscreenRequest;
class PendingAnimationTracker;
class ServoStyleSet;
template<typename> class OwningNonNull;
@ -160,7 +161,6 @@ class Event;
class EventTarget;
class FontFaceSet;
class FrameRequestCallback;
struct FullscreenRequest;
class ImageTracker;
class HTMLBodyElement;
class HTMLSharedElement;
@ -446,9 +446,9 @@ protected:
public:
typedef nsExternalResourceMap::ExternalResourceLoad ExternalResourceLoad;
typedef mozilla::FullscreenRequest FullscreenRequest;
typedef mozilla::net::ReferrerPolicy ReferrerPolicyEnum;
typedef mozilla::dom::Element Element;
typedef mozilla::dom::FullscreenRequest FullscreenRequest;
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_IID)