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/. */
6 #ifndef mozilla_dom_FocusEvent_h_
7 #define mozilla_dom_FocusEvent_h_
9 #include "mozilla/dom/FocusEventBinding.h"
10 #include "mozilla/dom/UIEvent.h"
11 #include "mozilla/EventForwards.h"
13 namespace mozilla::dom
{
15 class FocusEvent
: public UIEvent
{
17 NS_INLINE_DECL_REFCOUNTING_INHERITED(FocusEvent
, UIEvent
)
19 virtual JSObject
* WrapObjectInternal(
20 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) override
{
21 return FocusEvent_Binding::Wrap(aCx
, this, aGivenProto
);
24 FocusEvent(EventTarget
* aOwner
, nsPresContext
* aPresContext
,
25 InternalFocusEvent
* aEvent
);
27 already_AddRefed
<EventTarget
> GetRelatedTarget();
29 static already_AddRefed
<FocusEvent
> Constructor(const GlobalObject
& aGlobal
,
30 const nsAString
& aType
,
31 const FocusEventInit
& aParam
);
34 ~FocusEvent() = default;
36 void InitFocusEvent(const nsAString
& aType
, bool aCanBubble
, bool aCancelable
,
37 nsGlobalWindowInner
* aView
, int32_t aDetail
,
38 EventTarget
* aRelatedTarget
);
41 } // namespace mozilla::dom
43 already_AddRefed
<mozilla::dom::FocusEvent
> NS_NewDOMFocusEvent(
44 mozilla::dom::EventTarget
* aOwner
, nsPresContext
* aPresContext
,
45 mozilla::InternalFocusEvent
* aEvent
);
47 #endif // mozilla_dom_FocusEvent_h_