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_dom_ScrollAreaEvent_h_
8 #define mozilla_dom_ScrollAreaEvent_h_
10 #include "mozilla/dom/DOMRect.h"
11 #include "mozilla/dom/ScrollAreaEventBinding.h"
12 #include "mozilla/dom/UIEvent.h"
13 #include "mozilla/Attributes.h"
14 #include "mozilla/EventForwards.h"
16 namespace mozilla::dom
{
18 class ScrollAreaEvent
: public UIEvent
{
20 ScrollAreaEvent(EventTarget
* aOwner
, nsPresContext
* aPresContext
,
21 InternalScrollAreaEvent
* aEvent
);
23 NS_DECL_ISUPPORTS_INHERITED
24 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ScrollAreaEvent
, UIEvent
)
26 void Serialize(IPC::MessageWriter
* aWriter
,
27 bool aSerializeInterfaceType
) override
;
28 bool Deserialize(IPC::MessageReader
* aReader
) override
;
30 virtual JSObject
* WrapObjectInternal(
31 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) override
{
32 return ScrollAreaEvent_Binding::Wrap(aCx
, this, aGivenProto
);
35 float X() const { return mClientArea
->Left(); }
37 float Y() const { return mClientArea
->Top(); }
39 float Width() const { return mClientArea
->Width(); }
41 float Height() const { return mClientArea
->Height(); }
43 void InitScrollAreaEvent(const nsAString
& aType
, bool aCanBubble
,
44 bool aCancelable
, nsGlobalWindowInner
* aView
,
45 int32_t aDetail
, float aX
, float aY
, float aWidth
,
49 ~ScrollAreaEvent() = default;
51 RefPtr
<DOMRect
> mClientArea
;
54 } // namespace mozilla::dom
56 already_AddRefed
<mozilla::dom::ScrollAreaEvent
> NS_NewDOMScrollAreaEvent(
57 mozilla::dom::EventTarget
* aOwner
, nsPresContext
* aPresContext
,
58 mozilla::InternalScrollAreaEvent
* aEvent
);
60 #endif // mozilla_dom_ScrollAreaEvent_h_