Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / events / CompositionEvent.h
blob400829104a3ed42d8076ee4b8591164f8957b316
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_CompositionEvent_h_
8 #define mozilla_dom_CompositionEvent_h_
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"
16 namespace mozilla::dom {
18 using TextClauseArray = nsTArray<RefPtr<TextClause>>;
20 class CompositionEvent : public UIEvent {
21 public:
22 CompositionEvent(EventTarget* aOwner, nsPresContext* aPresContext,
23 WidgetCompositionEvent* aEvent);
25 NS_DECL_ISUPPORTS_INHERITED
26 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CompositionEvent, UIEvent)
28 static already_AddRefed<CompositionEvent> Constructor(
29 const GlobalObject& aGlobal, const nsAString& aType,
30 const CompositionEventInit& aParam);
32 virtual JSObject* WrapObjectInternal(
33 JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override {
34 return CompositionEvent_Binding::Wrap(aCx, this, aGivenProto);
37 void InitCompositionEvent(const nsAString& aType, bool aCanBubble,
38 bool aCancelable, nsGlobalWindowInner* aView,
39 const nsAString& aData, const nsAString& aLocale);
40 void GetData(nsAString&) const;
41 void GetLocale(nsAString&) const;
42 void GetRanges(TextClauseArray& aRanges);
44 protected:
45 ~CompositionEvent() = default;
47 nsString mData;
48 nsString mLocale;
49 TextClauseArray mRanges;
52 } // namespace mozilla::dom
54 already_AddRefed<mozilla::dom::CompositionEvent> NS_NewDOMCompositionEvent(
55 mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext,
56 mozilla::WidgetCompositionEvent* aEvent);
58 #endif // mozilla_dom_CompositionEvent_h_