editor/libeditor/base/DeleteRangeTxn.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 DeleteRangeTxn_h__
     7 #define DeleteRangeTxn_h__
     9 #include "EditAggregateTxn.h"
    10 #include "EditTxn.h"
    11 #include "nsAutoPtr.h"
    12 #include "nsCycleCollectionParticipant.h"
    13 #include "nsID.h"
    14 #include "nsIEditor.h"
    15 #include "nsISupportsImpl.h"
    16 #include "nsRange.h"
    17 #include "nscore.h"
    19 class nsEditor;
    20 class nsINode;
    21 class nsRangeUpdater;
    23 /**
    24  * A transaction that deletes an entire range in the content tree
    25  */
    26 class DeleteRangeTxn : public EditAggregateTxn
    27 {
    28 public:
    29   /** initialize the transaction.
    30     * @param aEditor the object providing basic editing operations
    31     * @param aRange  the range to delete
    32     */
    33   nsresult Init(nsEditor* aEditor,
    34                 nsRange* aRange,
    35                 nsRangeUpdater* aRangeUpdater);
    37   DeleteRangeTxn();
    39   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteRangeTxn, EditAggregateTxn)
    40   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
    42   NS_DECL_EDITTXN
    44   NS_IMETHOD RedoTransaction();
    46   virtual void LastRelease()
    47   {
    48     mRange = nullptr;
    49     EditAggregateTxn::LastRelease();
    50   }
    51 protected:
    53   nsresult CreateTxnsToDeleteBetween(nsINode* aNode,
    54                                      int32_t aStartOffset,
    55                                      int32_t aEndOffset);
    57   nsresult CreateTxnsToDeleteNodesBetween();
    59   nsresult CreateTxnsToDeleteContent(nsINode* aParent,
    60                                      int32_t aOffset,
    61                                      nsIEditor::EDirection aAction);
    63 protected:
    65   /** p1 in the range */
    66   nsRefPtr<nsRange> mRange;
    68   /** the editor for this transaction */
    69   nsEditor* mEditor;
    71   /** range updater object */
    72   nsRangeUpdater* mRangeUpdater;
    73 };
    75 #endif

mercurial