editor/libeditor/base/JoinElementTxn.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 JoinElementTxn_h__
michael@0 7 #define JoinElementTxn_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 "nsID.h" // for REFNSIID
michael@0 13 #include "nsIDOMNode.h" // for nsIDOMNode
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 joins two elements E1 (left node) and E2 (right node)
michael@0 20 * into a single node E.
michael@0 21 * The children of E are the children of E1 followed by the children of E2.
michael@0 22 * After DoTransaction() and RedoTransaction(), E1 is removed from the content
michael@0 23 * tree and E2 remains.
michael@0 24 */
michael@0 25 class JoinElementTxn : public EditTxn
michael@0 26 {
michael@0 27 public:
michael@0 28 /** initialize the transaction
michael@0 29 * @param aEditor the provider of core editing operations
michael@0 30 * @param aLeftNode the first of two nodes to join
michael@0 31 * @param aRightNode the second of two nodes to join
michael@0 32 */
michael@0 33 NS_IMETHOD Init(nsEditor *aEditor,
michael@0 34 nsIDOMNode *aLeftNode,
michael@0 35 nsIDOMNode *aRightNode);
michael@0 36
michael@0 37 JoinElementTxn();
michael@0 38
michael@0 39 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(JoinElementTxn, EditTxn)
michael@0 40 NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
michael@0 41
michael@0 42 NS_DECL_EDITTXN
michael@0 43
michael@0 44 protected:
michael@0 45
michael@0 46 /** the elements to operate upon.
michael@0 47 * After the merge, mRightNode remains and mLeftNode is removed from the content tree.
michael@0 48 */
michael@0 49 nsCOMPtr<nsIDOMNode> mLeftNode;
michael@0 50 nsCOMPtr<nsIDOMNode> mRightNode;
michael@0 51
michael@0 52 /** the offset into mNode where the children of mElement are split (for undo).<BR>
michael@0 53 * mOffset is the index of the first child in the right node.
michael@0 54 * -1 means the left node had no children.
michael@0 55 */
michael@0 56 uint32_t mOffset;
michael@0 57
michael@0 58 /** the parent node containing mLeftNode and mRightNode */
michael@0 59 nsCOMPtr<nsIDOMNode> mParent;
michael@0 60 nsEditor* mEditor;
michael@0 61 };
michael@0 62
michael@0 63 #endif

mercurial