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_NotifyPaintEvent_h_
8 #define mozilla_dom_NotifyPaintEvent_h_
10 #include "mozilla/Attributes.h"
11 #include "mozilla/dom/Event.h"
12 #include "mozilla/dom/BindingDeclarations.h"
13 #include "mozilla/dom/NotifyPaintEventBinding.h"
14 #include "nsDOMNavigationTiming.h"
15 #include "nsPresContext.h"
17 namespace mozilla::dom
{
21 class PaintRequestList
;
23 class NotifyPaintEvent
: public Event
{
25 NotifyPaintEvent(EventTarget
* aOwner
, nsPresContext
* aPresContext
,
26 WidgetEvent
* aEvent
, EventMessage aEventMessage
,
27 nsTArray
<nsRect
>* aInvalidateRequests
,
28 uint64_t aTransactionId
, DOMHighResTimeStamp aTimeStamp
);
30 NS_INLINE_DECL_REFCOUNTING_INHERITED(NotifyPaintEvent
, Event
)
32 void Serialize(IPC::MessageWriter
* aWriter
,
33 bool aSerializeInterfaceType
) override
;
34 bool Deserialize(IPC::MessageReader
* aReader
) override
;
36 virtual JSObject
* WrapObjectInternal(
37 JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) override
{
38 return NotifyPaintEvent_Binding::Wrap(aCx
, this, aGivenProto
);
41 already_AddRefed
<DOMRectList
> ClientRects(SystemCallerGuarantee aGuarantee
);
43 already_AddRefed
<DOMRect
> BoundingClientRect(
44 SystemCallerGuarantee aGuarantee
);
46 already_AddRefed
<PaintRequestList
> PaintRequests(SystemCallerGuarantee
);
48 uint64_t TransactionId(SystemCallerGuarantee
);
50 DOMHighResTimeStamp
PaintTimeStamp(SystemCallerGuarantee
);
53 ~NotifyPaintEvent() = default;
56 nsRegion
GetRegion(SystemCallerGuarantee
);
58 nsTArray
<nsRect
> mInvalidateRequests
;
59 uint64_t mTransactionId
;
60 DOMHighResTimeStamp mTimeStamp
;
63 } // namespace mozilla::dom
65 // This empties aInvalidateRequests.
66 already_AddRefed
<mozilla::dom::NotifyPaintEvent
> NS_NewDOMNotifyPaintEvent(
67 mozilla::dom::EventTarget
* aOwner
, nsPresContext
* aPresContext
,
68 mozilla::WidgetEvent
* aEvent
,
69 mozilla::EventMessage aEventMessage
= mozilla::eVoidEvent
,
70 nsTArray
<nsRect
>* aInvalidateRequests
= nullptr,
71 uint64_t aTransactionId
= 0, DOMHighResTimeStamp aTimeStamp
= 0);
73 #endif // mozilla_dom_NotifyPaintEvent_h_