Bumping manifests a=b2g-bump
[gecko.git] / editor / libeditor / CreateElementTxn.h
blob007a2128fc492e22c08f4085e4841d44c2a0a31d
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__
9 #include "EditTxn.h"
10 #include "nsCOMPtr.h"
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsISupportsImpl.h"
14 class nsEditor;
15 class nsIAtom;
16 class nsIContent;
17 class nsINode;
19 /**
20 * A transaction that creates a new node in the content tree.
22 namespace mozilla {
23 namespace dom {
25 class Element;
27 class CreateElementTxn : public EditTxn
29 public:
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,
38 nsIAtom& aTag,
39 nsINode& aParent,
40 int32_t aOffsetInParent);
42 NS_DECL_ISUPPORTS_INHERITED
43 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CreateElementTxn, EditTxn)
45 NS_DECL_EDITTXN
47 NS_IMETHOD RedoTransaction();
49 already_AddRefed<Element> GetNewNode();
51 protected:
52 virtual ~CreateElementTxn();
54 /** the document into which the new node will be inserted */
55 nsEditor* mEditor;
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;
76 #endif