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 DOM_SMIL_TIMEEVENT_H_
8 #define DOM_SMIL_TIMEEVENT_H_
10 #include "nsDocShell.h"
11 #include "mozilla/dom/Event.h"
12 #include "mozilla/dom/TimeEventBinding.h"
13 #include "mozilla/dom/Nullable.h"
14 #include "mozilla/dom/WindowProxyHolder.h"
16 class nsGlobalWindowInner
;
18 namespace mozilla::dom
{
20 class TimeEvent final
: public Event
{
22 TimeEvent(EventTarget
* aOwner
, nsPresContext
* aPresContext
,
23 InternalSMILTimeEvent
* aEvent
);
25 // nsISupports interface:
26 NS_DECL_ISUPPORTS_INHERITED
27 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TimeEvent
, Event
)
29 JSObject
* WrapObjectInternal(JSContext
* aCx
,
30 JS::Handle
<JSObject
*> aGivenProto
) override
{
31 return TimeEvent_Binding::Wrap(aCx
, this, aGivenProto
);
34 void InitTimeEvent(const nsAString
& aType
, nsGlobalWindowInner
* aView
,
37 int32_t Detail() const { return mDetail
; }
39 Nullable
<WindowProxyHolder
> GetView() const {
43 return WindowProxyHolder(mView
->GetBrowsingContext());
46 TimeEvent
* AsTimeEvent() final
{ return this; }
49 ~TimeEvent() = default;
51 nsCOMPtr
<nsPIDOMWindowOuter
> mView
;
55 } // namespace mozilla::dom
57 already_AddRefed
<mozilla::dom::TimeEvent
> NS_NewDOMTimeEvent(
58 mozilla::dom::EventTarget
* aOwner
, nsPresContext
* aPresContext
,
59 mozilla::InternalSMILTimeEvent
* aEvent
);
61 #endif // DOM_SMIL_TIMEEVENT_H_