Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /* |
michael@0 | 7 | * Implementation of DOM Core's nsIDOMDocumentType node. |
michael@0 | 8 | */ |
michael@0 | 9 | |
michael@0 | 10 | #ifndef DocumentType_h |
michael@0 | 11 | #define DocumentType_h |
michael@0 | 12 | |
michael@0 | 13 | #include "mozilla/Attributes.h" |
michael@0 | 14 | #include "nsCOMPtr.h" |
michael@0 | 15 | #include "nsIDOMDocumentType.h" |
michael@0 | 16 | #include "nsIContent.h" |
michael@0 | 17 | #include "nsGenericDOMDataNode.h" |
michael@0 | 18 | #include "nsString.h" |
michael@0 | 19 | |
michael@0 | 20 | namespace mozilla { |
michael@0 | 21 | namespace dom { |
michael@0 | 22 | |
michael@0 | 23 | // XXX DocumentType is currently implemented by inheriting the generic |
michael@0 | 24 | // CharacterData object, even though DocumentType is not character |
michael@0 | 25 | // data. This is done simply for convenience and should be changed if |
michael@0 | 26 | // this restricts what should be done for character data. |
michael@0 | 27 | |
michael@0 | 28 | class DocumentTypeForward : public nsGenericDOMDataNode, |
michael@0 | 29 | public nsIDOMDocumentType |
michael@0 | 30 | { |
michael@0 | 31 | public: |
michael@0 | 32 | DocumentTypeForward(already_AddRefed<nsINodeInfo>& aNodeInfo) |
michael@0 | 33 | : nsGenericDOMDataNode(aNodeInfo) |
michael@0 | 34 | { |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | // nsIDOMNode |
michael@0 | 38 | NS_FORWARD_NSIDOMNODE_TO_NSINODE |
michael@0 | 39 | }; |
michael@0 | 40 | |
michael@0 | 41 | class DocumentType MOZ_FINAL : public DocumentTypeForward |
michael@0 | 42 | { |
michael@0 | 43 | public: |
michael@0 | 44 | DocumentType(already_AddRefed<nsINodeInfo>& aNodeInfo, |
michael@0 | 45 | const nsAString& aPublicId, |
michael@0 | 46 | const nsAString& aSystemId, |
michael@0 | 47 | const nsAString& aInternalSubset); |
michael@0 | 48 | |
michael@0 | 49 | virtual ~DocumentType(); |
michael@0 | 50 | |
michael@0 | 51 | // nsISupports |
michael@0 | 52 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 53 | |
michael@0 | 54 | // nsIDOMNode |
michael@0 | 55 | // Forwarded by base class |
michael@0 | 56 | |
michael@0 | 57 | // nsIDOMDocumentType |
michael@0 | 58 | NS_DECL_NSIDOMDOCUMENTTYPE |
michael@0 | 59 | |
michael@0 | 60 | // nsINode |
michael@0 | 61 | virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE; |
michael@0 | 62 | virtual void GetNodeValueInternal(nsAString& aNodeValue) MOZ_OVERRIDE |
michael@0 | 63 | { |
michael@0 | 64 | SetDOMStringToNull(aNodeValue); |
michael@0 | 65 | } |
michael@0 | 66 | virtual void SetNodeValueInternal(const nsAString& aNodeValue, |
michael@0 | 67 | mozilla::ErrorResult& aError) MOZ_OVERRIDE |
michael@0 | 68 | { |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | // nsIContent overrides |
michael@0 | 72 | virtual const nsTextFragment* GetText() MOZ_OVERRIDE; |
michael@0 | 73 | |
michael@0 | 74 | virtual nsGenericDOMDataNode* CloneDataNode(nsINodeInfo *aNodeInfo, |
michael@0 | 75 | bool aCloneText) const MOZ_OVERRIDE; |
michael@0 | 76 | |
michael@0 | 77 | virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } |
michael@0 | 78 | |
michael@0 | 79 | protected: |
michael@0 | 80 | virtual JSObject* WrapNode(JSContext *cx) MOZ_OVERRIDE; |
michael@0 | 81 | |
michael@0 | 82 | nsString mPublicId; |
michael@0 | 83 | nsString mSystemId; |
michael@0 | 84 | nsString mInternalSubset; |
michael@0 | 85 | }; |
michael@0 | 86 | |
michael@0 | 87 | } // namespace dom |
michael@0 | 88 | } // namespace mozilla |
michael@0 | 89 | |
michael@0 | 90 | already_AddRefed<mozilla::dom::DocumentType> |
michael@0 | 91 | NS_NewDOMDocumentType(nsNodeInfoManager* aNodeInfoManager, |
michael@0 | 92 | nsIAtom *aName, |
michael@0 | 93 | const nsAString& aPublicId, |
michael@0 | 94 | const nsAString& aSystemId, |
michael@0 | 95 | const nsAString& aInternalSubset, |
michael@0 | 96 | mozilla::ErrorResult& rv); |
michael@0 | 97 | |
michael@0 | 98 | nsresult |
michael@0 | 99 | NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType, |
michael@0 | 100 | nsNodeInfoManager* aNodeInfoManager, |
michael@0 | 101 | nsIAtom *aName, |
michael@0 | 102 | const nsAString& aPublicId, |
michael@0 | 103 | const nsAString& aSystemId, |
michael@0 | 104 | const nsAString& aInternalSubset); |
michael@0 | 105 | |
michael@0 | 106 | #endif // DocumentType_h |