editor/libeditor/base/CreateElementTxn.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.

     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 "nsIDOMNode.h"
    13 #include "nsISupportsImpl.h"
    14 #include "nsString.h"
    15 #include "nscore.h"
    17 class nsEditor;
    19 /**
    20  * A transaction that creates a new node in the content tree.
    21  */
    22 class CreateElementTxn : public EditTxn
    23 {
    24 public:
    25   enum { eAppend=-1 };
    27   /** Initialize the transaction.
    28     * @param aEditor the provider of basic editing functionality
    29     * @param aTag    the tag (P, HR, TABLE, etc.) for the new element
    30     * @param aParent the node into which the new element will be inserted
    31     * @param aOffsetInParent the location in aParent to insert the new element
    32     *                        if eAppend, the new element is appended as the last child
    33     */
    34   NS_IMETHOD Init(nsEditor *aEditor,
    35                   const nsAString& aTag,
    36                   nsIDOMNode *aParent,
    37                   uint32_t aOffsetInParent);
    39   CreateElementTxn();
    41   NS_DECL_ISUPPORTS_INHERITED
    42   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CreateElementTxn, EditTxn)
    44   NS_DECL_EDITTXN
    46   NS_IMETHOD RedoTransaction();
    48   NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode);
    50 protected:
    52   /** the document into which the new node will be inserted */
    53   nsEditor* mEditor;
    55   /** the tag (mapping to object type) for the new element */
    56   nsString mTag;
    58   /** the node into which the new node will be inserted */
    59   nsCOMPtr<nsIDOMNode> mParent;
    61   /** the index in mParent for the new node */
    62   uint32_t mOffsetInParent;
    64   /** the new node to insert */
    65   nsCOMPtr<nsIDOMNode> mNewNode;  
    67   /** the node we will insert mNewNode before.  We compute this ourselves. */
    68   nsCOMPtr<nsIDOMNode> mRefNode;
    69 };
    71 #endif

mercurial