Line data Source code
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_CompositionEvent_h_
8 : #define mozilla_dom_CompositionEvent_h_
9 :
10 : #include "mozilla/dom/CompositionEventBinding.h"
11 : #include "mozilla/dom/TextClause.h"
12 : #include "mozilla/dom/TypedArray.h"
13 : #include "mozilla/dom/UIEvent.h"
14 : #include "mozilla/EventForwards.h"
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : typedef nsTArray<RefPtr<TextClause>> TextClauseArray;
20 :
21 : class CompositionEvent : public UIEvent
22 : {
23 : public:
24 : CompositionEvent(EventTarget* aOwner,
25 : nsPresContext* aPresContext,
26 : WidgetCompositionEvent* aEvent);
27 :
28 : NS_DECL_ISUPPORTS_INHERITED
29 0 : NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CompositionEvent, UIEvent)
30 0 : NS_FORWARD_TO_UIEVENT
31 :
32 : static already_AddRefed<CompositionEvent> Constructor(const GlobalObject& aGlobal,
33 : const nsAString& aType,
34 : const CompositionEventInit& aParam,
35 : ErrorResult& aRv);
36 :
37 0 : virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
38 : {
39 0 : return CompositionEventBinding::Wrap(aCx, this, aGivenProto);
40 : }
41 :
42 : void InitCompositionEvent(const nsAString& aType,
43 : bool aCanBubble,
44 : bool aCancelable,
45 : nsGlobalWindow* aView,
46 : const nsAString& aData,
47 : const nsAString& aLocale);
48 : void GetData(nsAString&) const;
49 : void GetLocale(nsAString&) const;
50 : void GetRanges(TextClauseArray& aRanges);
51 :
52 : protected:
53 0 : ~CompositionEvent() {}
54 :
55 : nsString mData;
56 : nsString mLocale;
57 : TextClauseArray mRanges;
58 : };
59 :
60 : } // namespace dom
61 : } // namespace mozilla
62 :
63 : already_AddRefed<mozilla::dom::CompositionEvent>
64 : NS_NewDOMCompositionEvent(mozilla::dom::EventTarget* aOwner,
65 : nsPresContext* aPresContext,
66 : mozilla::WidgetCompositionEvent* aEvent);
67 :
68 : #endif // mozilla_dom_CompositionEvent_h_
|