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 CreateElementTxn_h__
7 #define CreateElementTxn_h__
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsISupportsImpl.h"
20 * A transaction that creates a new node in the content tree.
27 class CreateElementTxn
: public EditTxn
30 /** Initialize the transaction.
31 * @param aEditor the provider of basic editing functionality
32 * @param aTag the tag (P, HR, TABLE, etc.) for the new element
33 * @param aParent the node into which the new element will be inserted
34 * @param aOffsetInParent the location in aParent to insert the new element
35 * if eAppend, the new element is appended as the last child
37 CreateElementTxn(nsEditor
& aEditor
,
40 int32_t aOffsetInParent
);
42 NS_DECL_ISUPPORTS_INHERITED
43 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CreateElementTxn
, EditTxn
)
47 NS_IMETHOD
RedoTransaction();
49 already_AddRefed
<Element
> GetNewNode();
52 virtual ~CreateElementTxn();
54 /** the document into which the new node will be inserted */
57 /** the tag (mapping to object type) for the new element */
58 nsCOMPtr
<nsIAtom
> mTag
;
60 /** the node into which the new node will be inserted */
61 nsCOMPtr
<nsINode
> mParent
;
63 /** the index in mParent for the new node */
64 int32_t mOffsetInParent
;
66 /** the new node to insert */
67 nsCOMPtr
<Element
> mNewNode
;
69 /** the node we will insert mNewNode before. We compute this ourselves. */
70 nsCOMPtr
<nsIContent
> mRefNode
;