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