editor/libeditor/base/SplitElementTxn.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef SplitElementTxn_h__
michael@0 7 #define SplitElementTxn_h__
michael@0 8
michael@0 9 #include "EditTxn.h" // for EditTxn, NS_DECL_EDITTXN
michael@0 10 #include "nsCOMPtr.h" // for nsCOMPtr
michael@0 11 #include "nsCycleCollectionParticipant.h"
michael@0 12 #include "nsIDOMNode.h" // for nsIDOMNode
michael@0 13 #include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS_INHERITED
michael@0 14 #include "nscore.h" // for NS_IMETHOD
michael@0 15
michael@0 16 class nsEditor;
michael@0 17
michael@0 18 /**
michael@0 19 * A transaction that splits an element E into two identical nodes, E1 and E2
michael@0 20 * with the children of E divided between E1 and E2.
michael@0 21 */
michael@0 22 class SplitElementTxn : public EditTxn
michael@0 23 {
michael@0 24 public:
michael@0 25 /** initialize the transaction.
michael@0 26 * @param aEditor the provider of core editing operations
michael@0 27 * @param aNode the node to split
michael@0 28 * @param aOffset the location within aNode to do the split.
michael@0 29 * aOffset may refer to children of aNode, or content of aNode.
michael@0 30 * The left node will have child|content 0..aOffset-1.
michael@0 31 */
michael@0 32 NS_IMETHOD Init (nsEditor *aEditor,
michael@0 33 nsIDOMNode *aNode,
michael@0 34 int32_t aOffset);
michael@0 35
michael@0 36 SplitElementTxn();
michael@0 37
michael@0 38 NS_DECL_ISUPPORTS_INHERITED
michael@0 39 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SplitElementTxn, EditTxn)
michael@0 40
michael@0 41 NS_DECL_EDITTXN
michael@0 42
michael@0 43 NS_IMETHOD RedoTransaction(void);
michael@0 44
michael@0 45 NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode);
michael@0 46
michael@0 47 protected:
michael@0 48
michael@0 49 /** the element to operate upon */
michael@0 50 nsCOMPtr<nsIDOMNode> mExistingRightNode;
michael@0 51
michael@0 52 /** the offset into mElement where the children of mElement are split.<BR>
michael@0 53 * mOffset is the index of the first child in the right node.
michael@0 54 * -1 means the new node gets no children.
michael@0 55 */
michael@0 56 int32_t mOffset;
michael@0 57
michael@0 58 /** the element we create when splitting mElement */
michael@0 59 nsCOMPtr<nsIDOMNode> mNewLeftNode;
michael@0 60
michael@0 61 /** the parent shared by mExistingRightNode and mNewLeftNode */
michael@0 62 nsCOMPtr<nsIDOMNode> mParent;
michael@0 63 nsEditor* mEditor;
michael@0 64 };
michael@0 65
michael@0 66 #endif

mercurial