1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_PendingFullscreenEvent_h_
8 #define mozilla_PendingFullscreenEvent_h_
10 #include "mozilla/dom/Document.h"
11 #include "nsContentUtils.h"
19 enum class FullscreenEventType
{
25 * Class for dispatching a fullscreen event. It should be queued and
26 * invoked as part of "run the fullscreen steps" algorithm.
28 class PendingFullscreenEvent
{
30 PendingFullscreenEvent(FullscreenEventType aType
, dom::Document
* aDocument
,
32 : mDocument(aDocument
), mTarget(aTarget
), mType(aType
) {
33 MOZ_ASSERT(aDocument
);
37 dom::Document
* Document() const { return mDocument
; }
41 MOZ_ASSERT(!mDispatched
);
46 case FullscreenEventType::Change
:
47 name
= u
"fullscreenchange"_ns
;
49 case FullscreenEventType::Error
:
50 name
= u
"fullscreenerror"_ns
;
53 nsINode
* target
= mTarget
->GetComposedDoc() == mDocument
? mTarget
.get()
55 Unused
<< nsContentUtils::DispatchTrustedEvent(
56 mDocument
, target
, name
, CanBubble::eYes
, Cancelable::eNo
,
61 RefPtr
<dom::Document
> mDocument
;
62 nsCOMPtr
<nsINode
> mTarget
;
63 FullscreenEventType mType
;
65 bool mDispatched
= false;
69 } // namespace mozilla
71 #endif // mozilla_PendingFullscreenEvent_h_