LCOV - code coverage report
Current view: top level - editor/libeditor - SplitNodeTransaction.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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/. */
       5             : 
       6             : #ifndef SplitNodeTransaction_h
       7             : #define SplitNodeTransaction_h
       8             : 
       9             : #include "mozilla/EditTransactionBase.h" // for EditTxn, etc.
      10             : #include "nsCOMPtr.h"                   // for nsCOMPtr
      11             : #include "nsCycleCollectionParticipant.h"
      12             : #include "nsISupportsImpl.h"            // for NS_DECL_ISUPPORTS_INHERITED
      13             : #include "nscore.h"                     // for NS_IMETHOD
      14             : 
      15             : class nsIContent;
      16             : class nsINode;
      17             : 
      18             : namespace mozilla {
      19             : 
      20             : class EditorBase;
      21             : 
      22             : /**
      23             :  * A transaction that splits a node into two identical nodes, with the children
      24             :  * divided between the new nodes.
      25             :  */
      26             : class SplitNodeTransaction final : public EditTransactionBase
      27             : {
      28             : public:
      29             :   /**
      30             :    * @param aEditorBase The provider of core editing operations
      31             :    * @param aNode       The node to split
      32             :    * @param aOffset     The location within aNode to do the split.  aOffset may
      33             :    *                    refer to children of aNode, or content of aNode.  The
      34             :    *                    left node will have child|content 0..aOffset-1.
      35             :    */
      36             :   SplitNodeTransaction(EditorBase& aEditorBase, nsIContent& aNode,
      37             :                        int32_t aOffset);
      38             : 
      39             :   NS_DECL_ISUPPORTS_INHERITED
      40           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SplitNodeTransaction,
      41             :                                            EditTransactionBase)
      42             : 
      43             :   NS_DECL_EDITTRANSACTIONBASE
      44             : 
      45             :   NS_IMETHOD RedoTransaction() override;
      46             : 
      47             :   nsIContent* GetNewNode();
      48             : 
      49             : protected:
      50             :   virtual ~SplitNodeTransaction();
      51             : 
      52             :   RefPtr<EditorBase> mEditorBase;
      53             : 
      54             :   // The node to operate upon.
      55             :   nsCOMPtr<nsIContent> mExistingRightNode;
      56             : 
      57             :   // The offset into mExistingRightNode where its children are split.  mOffset
      58             :   // is the index of the first child in the right node.  -1 means the new node
      59             :   // gets no children.
      60             :   int32_t mOffset;
      61             : 
      62             :   // The node we create when splitting mExistingRightNode.
      63             :   nsCOMPtr<nsIContent> mNewLeftNode;
      64             : 
      65             :   // The parent shared by mExistingRightNode and mNewLeftNode.
      66             :   nsCOMPtr<nsINode> mParent;
      67             : };
      68             : 
      69             : } // namespace mozilla
      70             : 
      71             : #endif // #ifndef SplitNodeTransaction_h

Generated by: LCOV version 1.13