diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /editor/txmgr/nsITransaction.idl | |
parent | Initial commit. (diff) | |
download | firefox-upstream/124.0.1.tar.xz firefox-upstream/124.0.1.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'editor/txmgr/nsITransaction.idl')
-rw-r--r-- | editor/txmgr/nsITransaction.idl | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/editor/txmgr/nsITransaction.idl b/editor/txmgr/nsITransaction.idl new file mode 100644 index 0000000000..bc8a8ed1d2 --- /dev/null +++ b/editor/txmgr/nsITransaction.idl @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +%{ C++ +namespace mozilla { +class EditTransactionBase; +} +template <typename T> +struct already_AddRefed; +%} + +[ptr] native EditTransactionBasePtr(mozilla::EditTransactionBase); + +/* + * The nsITransaction interface. + * <P> + * This interface is implemented by an object that needs to + * execute some behavior that must be tracked by the transaction manager. + */ +[scriptable, uuid(58e330c1-7b48-11d2-98b9-00805f297d89)] +interface nsITransaction : nsISupports +{ + /** + * Executes the transaction. + */ + [can_run_script] + void doTransaction(); + + /** + * Restores the state to what it was before the transaction was executed. + */ + [can_run_script] + void undoTransaction(); + + /** + * Executes the transaction again. Can only be called on a transaction that + * was previously undone. + * <P> + * In most cases, the redoTransaction() method will actually call the + * doTransaction() method to execute the transaction again. + */ + [can_run_script] + void redoTransaction(); + + /** + * The transaction's transient state. This attribute is checked by + * the transaction manager after the transaction's Execute() method is called. + * If the transient state is false, a reference to the transaction is + * held by the transaction manager so that the transactions' undoTransaction() + * and redoTransaction() methods can be called. If the transient state is + * true, the transaction manager returns immediately after the transaction's + * doTransaction() method is called, no references to the transaction are + * maintained. Transient transactions cannot be undone or redone by the + * transaction manager. + */ + readonly attribute boolean isTransient; + + /** + * Attempts to merge a transaction into "this" transaction. Both transactions + * must be in their undo state, doTransaction() methods already called. The + * transaction manager calls this method to coalesce a new transaction with + * the transaction on the top of the undo stack. + * This method returns a boolean value that indicates the merge result. + * A true value indicates that the transactions were merged successfully, + * a false value if the merge was not possible or failed. If true, + * the transaction manager will Release() the new transacton instead of + * pushing it on the undo stack. + * @param aTransaction the previously executed transaction to merge. + */ + boolean merge(in nsITransaction aTransaction); + + [noscript] EditTransactionBasePtr getAsEditTransactionBase(); + +%{ C++ + inline already_AddRefed<mozilla::EditTransactionBase> + GetAsEditTransactionBase(); +%} +}; |