2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Implementation of DOM Core's nsIDOMDocumentType node.
|
|
|
|
*/
|
|
|
|
|
2012-12-28 17:34:02 -08:00
|
|
|
#ifndef DocumentType_h
|
|
|
|
#define DocumentType_h
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIDOMDocumentType.h"
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsGenericDOMDataNode.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
|
2012-12-28 17:34:02 -08:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// XXX DocumentType is currently implemented by inheriting the generic
|
|
|
|
// CharacterData object, even though DocumentType is not character
|
|
|
|
// data. This is done simply for convenience and should be changed if
|
|
|
|
// this restricts what should be done for character data.
|
|
|
|
|
2012-12-28 17:34:02 -08:00
|
|
|
class DocumentTypeForward : public nsGenericDOMDataNode,
|
|
|
|
public nsIDOMDocumentType
|
2011-06-14 00:56:48 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-09-01 17:49:25 -07:00
|
|
|
explicit DocumentTypeForward(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2011-06-14 00:56:48 -07:00
|
|
|
: nsGenericDOMDataNode(aNodeInfo)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// nsIDOMNode
|
2012-10-09 05:31:24 -07:00
|
|
|
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
2011-06-14 00:56:48 -07:00
|
|
|
};
|
|
|
|
|
2013-07-11 14:26:54 -07:00
|
|
|
class DocumentType MOZ_FINAL : public DocumentTypeForward
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-06-19 19:01:40 -07:00
|
|
|
DocumentType(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
2012-12-28 17:34:02 -08:00
|
|
|
const nsAString& aPublicId,
|
|
|
|
const nsAString& aSystemId,
|
|
|
|
const nsAString& aInternalSubset);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIDOMNode
|
2011-06-14 00:56:48 -07:00
|
|
|
// Forwarded by base class
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIDOMDocumentType
|
|
|
|
NS_DECL_NSIDOMDOCUMENTTYPE
|
|
|
|
|
2012-10-09 05:31:24 -07:00
|
|
|
// nsINode
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual bool IsNodeOfType(uint32_t aFlags) const MOZ_OVERRIDE;
|
|
|
|
virtual void GetNodeValueInternal(nsAString& aNodeValue) MOZ_OVERRIDE
|
2011-06-14 00:56:48 -07:00
|
|
|
{
|
|
|
|
SetDOMStringToNull(aNodeValue);
|
|
|
|
}
|
2012-10-09 05:31:24 -07:00
|
|
|
virtual void SetNodeValueInternal(const nsAString& aNodeValue,
|
2013-05-29 13:43:41 -07:00
|
|
|
mozilla::ErrorResult& aError) MOZ_OVERRIDE
|
2011-06-14 00:56:48 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// nsIContent overrides
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual const nsTextFragment* GetText() MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-06-19 19:01:40 -07:00
|
|
|
virtual nsGenericDOMDataNode* CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
|
2013-05-29 13:43:41 -07:00
|
|
|
bool aCloneText) const MOZ_OVERRIDE;
|
2011-06-14 00:56:48 -07:00
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }
|
2012-12-28 17:34:02 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
2014-07-08 14:23:16 -07:00
|
|
|
virtual ~DocumentType();
|
|
|
|
|
2014-04-08 15:27:17 -07:00
|
|
|
virtual JSObject* WrapNode(JSContext *cx) MOZ_OVERRIDE;
|
2012-12-28 17:34:02 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsString mPublicId;
|
|
|
|
nsString mSystemId;
|
|
|
|
nsString mInternalSubset;
|
|
|
|
};
|
|
|
|
|
2012-12-28 17:34:02 -08:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
already_AddRefed<mozilla::dom::DocumentType>
|
2012-12-28 17:34:02 -08:00
|
|
|
NS_NewDOMDocumentType(nsNodeInfoManager* aNodeInfoManager,
|
|
|
|
nsIAtom *aName,
|
|
|
|
const nsAString& aPublicId,
|
|
|
|
const nsAString& aSystemId,
|
|
|
|
const nsAString& aInternalSubset,
|
|
|
|
mozilla::ErrorResult& rv);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult
|
|
|
|
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
2011-09-17 06:32:32 -07:00
|
|
|
nsNodeInfoManager* aNodeInfoManager,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIAtom *aName,
|
|
|
|
const nsAString& aPublicId,
|
|
|
|
const nsAString& aSystemId,
|
|
|
|
const nsAString& aInternalSubset);
|
|
|
|
|
2012-12-28 17:34:02 -08:00
|
|
|
#endif // DocumentType_h
|