content/base/src/DocumentType.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 /*
     7  * Implementation of DOM Core's nsIDOMDocumentType node.
     8  */
    10 #ifndef DocumentType_h
    11 #define DocumentType_h
    13 #include "mozilla/Attributes.h"
    14 #include "nsCOMPtr.h"
    15 #include "nsIDOMDocumentType.h"
    16 #include "nsIContent.h"
    17 #include "nsGenericDOMDataNode.h"
    18 #include "nsString.h"
    20 namespace mozilla {
    21 namespace dom {
    23 // XXX DocumentType is currently implemented by inheriting the generic
    24 // CharacterData object, even though DocumentType is not character
    25 // data. This is done simply for convenience and should be changed if
    26 // this restricts what should be done for character data.
    28 class DocumentTypeForward : public nsGenericDOMDataNode,
    29                             public nsIDOMDocumentType
    30 {
    31 public:
    32   DocumentTypeForward(already_AddRefed<nsINodeInfo>& aNodeInfo)
    33     : nsGenericDOMDataNode(aNodeInfo)
    34   {
    35   }
    37   // nsIDOMNode
    38   NS_FORWARD_NSIDOMNODE_TO_NSINODE
    39 };
    41 class DocumentType MOZ_FINAL : public DocumentTypeForward
    42 {
    43 public:
    44   DocumentType(already_AddRefed<nsINodeInfo>& aNodeInfo,
    45                const nsAString& aPublicId,
    46                const nsAString& aSystemId,
    47                const nsAString& aInternalSubset);
    49   virtual ~DocumentType();
    51   // nsISupports
    52   NS_DECL_ISUPPORTS_INHERITED
    54   // nsIDOMNode
    55   // Forwarded by base class
    57   // nsIDOMDocumentType
    58   NS_DECL_NSIDOMDOCUMENTTYPE
    60   // nsINode
    61   virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE;
    62   virtual void GetNodeValueInternal(nsAString& aNodeValue) MOZ_OVERRIDE
    63   {
    64     SetDOMStringToNull(aNodeValue);
    65   }
    66   virtual void SetNodeValueInternal(const nsAString& aNodeValue,
    67                                     mozilla::ErrorResult& aError) MOZ_OVERRIDE
    68   {
    69   }
    71   // nsIContent overrides
    72   virtual const nsTextFragment* GetText() MOZ_OVERRIDE;
    74   virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo,
    75                                               bool aCloneText) const MOZ_OVERRIDE;
    77   virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
    79 protected:
    80   virtual JSObject* WrapNode(JSContext *cx) MOZ_OVERRIDE;
    82   nsString mPublicId;
    83   nsString mSystemId;
    84   nsString mInternalSubset;
    85 };
    87 } // namespace dom
    88 } // namespace mozilla
    90 already_AddRefed<mozilla::dom::DocumentType>
    91 NS_NewDOMDocumentType(nsNodeInfoManager* aNodeInfoManager,
    92                       nsIAtom *aName,
    93                       const nsAString& aPublicId,
    94                       const nsAString& aSystemId,
    95                       const nsAString& aInternalSubset,
    96                       mozilla::ErrorResult& rv);
    98 nsresult
    99 NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
   100                       nsNodeInfoManager* aNodeInfoManager,
   101                       nsIAtom *aName,
   102                       const nsAString& aPublicId,
   103                       const nsAString& aSystemId,
   104                       const nsAString& aInternalSubset);
   106 #endif // DocumentType_h

mercurial