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