Bug 1686495 [wpt PR 27132] - Add tests for proposed WebDriver Shadow DOM support...
[gecko.git] / editor / libeditor / EditAggregateTransaction.h
blobd9ae9b7f786ff8b6ae5cb2cb9c500d1f3bf015e4
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 "mozilla/EditTransactionBase.h"
10 #include "mozilla/OwningNonNull.h"
11 #include "nsCOMPtr.h"
12 #include "nsCycleCollectionParticipant.h"
13 #include "nsAtom.h"
14 #include "nsISupportsImpl.h"
15 #include "nsTArray.h"
16 #include "nscore.h"
18 namespace mozilla {
20 /**
21 * base class for all document editing transactions that require aggregation.
22 * provides a list of child transactions.
24 class EditAggregateTransaction : public EditTransactionBase {
25 protected:
26 EditAggregateTransaction() = default;
28 public:
29 /**
30 * Creates an edit aggregate transaction. This never returns nullptr.
32 static already_AddRefed<EditAggregateTransaction> Create() {
33 RefPtr<EditAggregateTransaction> transaction =
34 new EditAggregateTransaction();
35 return transaction.forget();
38 NS_DECL_ISUPPORTS_INHERITED
39 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(EditAggregateTransaction,
40 EditTransactionBase)
42 NS_DECL_EDITTRANSACTIONBASE
44 MOZ_CAN_RUN_SCRIPT NS_IMETHOD RedoTransaction() override;
45 NS_IMETHOD Merge(nsITransaction* aOtherTransaction, bool* aDidMerge) override;
47 /**
48 * Append a transaction to this aggregate.
50 NS_IMETHOD AppendChild(EditTransactionBase* aTransaction);
52 /**
53 * Get the name assigned to this transaction.
55 NS_IMETHOD GetName(nsAtom** aName);
57 const nsTArray<OwningNonNull<EditTransactionBase>>& ChildTransactions()
58 const {
59 return mChildren;
62 protected:
63 virtual ~EditAggregateTransaction() = default;
65 nsTArray<OwningNonNull<EditTransactionBase>> mChildren;
66 RefPtr<nsAtom> mName;
69 } // namespace mozilla
71 #endif // #ifndef EditAggregateTransaction_h