LCOV - code coverage report
Current view: top level - dom/base - DocumentType.h (source / functions) Hit Total Coverage
Test: output.info Lines: 3 11 27.3 %
Date: 2017-07-14 16:53:18 Functions: 1 25 4.0 %
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             : /*
       8             :  * Implementation of DOM Core's nsIDOMDocumentType node.
       9             :  */
      10             : 
      11             : #ifndef DocumentType_h
      12             : #define DocumentType_h
      13             : 
      14             : #include "mozilla/Attributes.h"
      15             : #include "nsCOMPtr.h"
      16             : #include "nsIDOMDocumentType.h"
      17             : #include "nsIContent.h"
      18             : #include "nsGenericDOMDataNode.h"
      19             : #include "nsString.h"
      20             : 
      21             : namespace mozilla {
      22             : namespace dom {
      23             : 
      24             : // XXX DocumentType is currently implemented by inheriting the generic
      25             : // CharacterData object, even though DocumentType is not character
      26             : // data. This is done simply for convenience and should be changed if
      27             : // this restricts what should be done for character data.
      28             : 
      29           0 : class DocumentTypeForward : public nsGenericDOMDataNode,
      30             :                             public nsIDOMDocumentType
      31             : {
      32             : public:
      33           1 :   explicit DocumentTypeForward(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
      34           1 :     : nsGenericDOMDataNode(aNodeInfo)
      35             :   {
      36           1 :   }
      37             : 
      38             :   // nsIDOMNode
      39           0 :   NS_FORWARD_NSIDOMNODE_TO_NSINODE
      40             : };
      41             : 
      42             : class DocumentType final : public DocumentTypeForward
      43             : {
      44             : public:
      45             :   DocumentType(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
      46             :                const nsAString& aPublicId,
      47             :                const nsAString& aSystemId,
      48             :                const nsAString& aInternalSubset);
      49             : 
      50             :   // nsISupports
      51             :   NS_DECL_ISUPPORTS_INHERITED
      52             : 
      53             :   // nsIDOMNode
      54             :   // Forwarded by base class
      55             : 
      56             :   // nsIDOMDocumentType
      57             :   NS_DECL_NSIDOMDOCUMENTTYPE
      58             : 
      59             :   // nsINode
      60             :   virtual bool IsNodeOfType(uint32_t aFlags) const override;
      61           0 :   virtual void GetNodeValueInternal(nsAString& aNodeValue) override
      62             :   {
      63           0 :     SetDOMStringToNull(aNodeValue);
      64           0 :   }
      65           0 :   virtual void SetNodeValueInternal(const nsAString& aNodeValue,
      66             :                                     mozilla::ErrorResult& aError) override
      67             :   {
      68           0 :   }
      69             : 
      70             :   // nsIContent overrides
      71             :   virtual const nsTextFragment* GetText() override;
      72             : 
      73             :   virtual nsGenericDOMDataNode* CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
      74             :                                               bool aCloneText) const override;
      75             : 
      76           0 :   virtual nsIDOMNode* AsDOMNode() override { return this; }
      77             : 
      78             : protected:
      79             :   virtual ~DocumentType();
      80             : 
      81             :   virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
      82             : 
      83             :   nsString mPublicId;
      84             :   nsString mSystemId;
      85             :   nsString mInternalSubset;
      86             : };
      87             : 
      88             : } // namespace dom
      89             : } // namespace mozilla
      90             : 
      91             : already_AddRefed<mozilla::dom::DocumentType>
      92             : NS_NewDOMDocumentType(nsNodeInfoManager* aNodeInfoManager,
      93             :                       nsIAtom *aName,
      94             :                       const nsAString& aPublicId,
      95             :                       const nsAString& aSystemId,
      96             :                       const nsAString& aInternalSubset,
      97             :                       mozilla::ErrorResult& rv);
      98             : 
      99             : nsresult
     100             : NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
     101             :                       nsNodeInfoManager* aNodeInfoManager,
     102             :                       nsIAtom *aName,
     103             :                       const nsAString& aPublicId,
     104             :                       const nsAString& aSystemId,
     105             :                       const nsAString& aInternalSubset);
     106             : 
     107             : #endif // DocumentType_h

Generated by: LCOV version 1.13