Bug 1769033 - Add OpenBSD sandboxing support r=gaston
[gecko.git] / editor / libeditor / EditAggregateTransaction.h
blob6a24e202806a5b1dfeee6ad3b707a599a7a5d112
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef EditAggregateTransaction_h
7 #define EditAggregateTransaction_h
9 #include "EditTransactionBase.h"
11 #include "mozilla/OwningNonNull.h"
12 #include "nsCOMPtr.h"
13 #include "nsCycleCollectionParticipant.h"
14 #include "nsAtom.h"
15 #include "nsISupportsImpl.h"
16 #include "nsTArray.h"
17 #include "nscore.h"
19 namespace mozilla {
21 /**
22 * base class for all document editing transactions that require aggregation.
23 * provides a list of child transactions.
25 class EditAggregateTransaction : public EditTransactionBase {
26 protected:
27 EditAggregateTransaction() = default;
29 public:
30 /**
31 * Creates an edit aggregate transaction. This never returns nullptr.
33 static already_AddRefed<EditAggregateTransaction> Create() {
34 RefPtr<EditAggregateTransaction> transaction =
35 new EditAggregateTransaction();
36 return transaction.forget();
39 NS_DECL_ISUPPORTS_INHERITED
40 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(EditAggregateTransaction,
41 EditTransactionBase)
43 NS_DECL_EDITTRANSACTIONBASE
45 MOZ_CAN_RUN_SCRIPT NS_IMETHOD RedoTransaction() override;
46 NS_IMETHOD Merge(nsITransaction* aOtherTransaction, bool* aDidMerge) override;
48 /**
49 * Append a transaction to this aggregate.
51 NS_IMETHOD AppendChild(EditTransactionBase* aTransaction);
53 /**
54 * Get the name assigned to this transaction.
56 NS_IMETHOD GetName(nsAtom** aName);
58 const nsTArray<OwningNonNull<EditTransactionBase>>& ChildTransactions()
59 const {
60 return mChildren;
63 protected:
64 virtual ~EditAggregateTransaction() = default;
66 nsTArray<OwningNonNull<EditTransactionBase>> mChildren;
67 RefPtr<nsAtom> mName;
70 } // namespace mozilla
72 #endif // #ifndef EditAggregateTransaction_h