LCOV - code coverage report
Current view: top level - dom/base - nsTextNode.h (source / functions) Hit Total Coverage
Test: output.info Lines: 13 15 86.7 %
Date: 2017-07-14 16:53:18 Functions: 5 33 15.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef nsTextNode_h
       8             : #define nsTextNode_h
       9             : 
      10             : /*
      11             :  * Implementation of DOM Core's nsIDOMText node.
      12             :  */
      13             : 
      14             : #include "mozilla/Attributes.h"
      15             : #include "mozilla/dom/Text.h"
      16             : #include "nsIDOMText.h"
      17             : #include "nsDebug.h"
      18             : 
      19             : class nsNodeInfoManager;
      20             : 
      21             : /**
      22             :  * Class used to implement DOM text nodes
      23             :  */
      24             : class nsTextNode : public mozilla::dom::Text,
      25             :                    public nsIDOMText
      26             : {
      27             : private:
      28         347 :   void Init()
      29             :   {
      30         347 :     MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE,
      31             :                "Bad NodeType in aNodeInfo");
      32         347 :   }
      33             : 
      34             : public:
      35          16 :   explicit nsTextNode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
      36          16 :     : mozilla::dom::Text(aNodeInfo)
      37             :   {
      38          16 :     Init();
      39          16 :   }
      40             : 
      41         331 :   explicit nsTextNode(nsNodeInfoManager* aNodeInfoManager)
      42         331 :     : mozilla::dom::Text(aNodeInfoManager->GetTextNodeInfo())
      43             :   {
      44         331 :     Init();
      45         331 :   }
      46             : 
      47             :   // nsISupports
      48             :   NS_DECL_ISUPPORTS_INHERITED
      49             : 
      50             :   // nsIDOMNode
      51           0 :   NS_FORWARD_NSIDOMNODE_TO_NSINODE
      52             :   using mozilla::dom::Text::GetParentElement;
      53             : 
      54             :   // nsIDOMCharacterData
      55           2 :   NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
      56             :   using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function.
      57             : 
      58             :   // nsIDOMText
      59           0 :   NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
      60             : 
      61             :   // nsINode
      62             :   virtual bool IsNodeOfType(uint32_t aFlags) const override;
      63             : 
      64             :   virtual nsGenericDOMDataNode* CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
      65             :                                               bool aCloneText) const override;
      66             : 
      67             :   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
      68             :                               nsIContent* aBindingParent,
      69             :                               bool aCompileEventHandlers) override;
      70             :   virtual void UnbindFromTree(bool aDeep = true,
      71             :                               bool aNullParent = true) override;
      72             : 
      73             :   nsresult AppendTextForNormalize(const char16_t* aBuffer, uint32_t aLength,
      74             :                                   bool aNotify, nsIContent* aNextSibling);
      75             : 
      76           1 :   virtual nsIDOMNode* AsDOMNode() override { return this; }
      77             : 
      78             : #ifdef DEBUG
      79             :   virtual void List(FILE* out, int32_t aIndent) const override;
      80             :   virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const override;
      81             : #endif
      82             : 
      83             : protected:
      84             :   virtual ~nsTextNode();
      85             : 
      86             :   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
      87             : };
      88             : 
      89             : #endif // nsTextNode_h

Generated by: LCOV version 1.13