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 "nsContentUtils.h"
18 enum class FullscreenEventType
{
24 * Class for dispatching a fullscreen event. It should be queued and
25 * invoked as part of "run the fullscreen steps" algorithm.
27 class PendingFullscreenEvent
{
29 PendingFullscreenEvent(FullscreenEventType aType
, dom::Document
* aDocument
,
31 : mDocument(aDocument
), mTarget(aTarget
), mType(aType
) {
32 MOZ_ASSERT(aDocument
);
36 dom::Document
* Document() const { return mDocument
; }
40 MOZ_ASSERT(!mDispatched
);
45 case FullscreenEventType::Change
:
46 name
= u
"fullscreenchange"_ns
;
48 case FullscreenEventType::Error
:
49 name
= u
"fullscreenerror"_ns
;
52 nsINode
* target
= mTarget
->GetComposedDoc() == mDocument
? mTarget
.get()
54 Unused
<< nsContentUtils::DispatchTrustedEvent(
55 mDocument
, target
, name
, CanBubble::eYes
, Cancelable::eNo
,
60 RefPtr
<dom::Document
> mDocument
;
61 nsCOMPtr
<nsINode
> mTarget
;
62 FullscreenEventType mType
;
64 bool mDispatched
= false;
68 } // namespace mozilla
70 #endif // mozilla_PendingFullscreenEvent_h_