2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04: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/. */
|
2000-03-22 17:38:50 +03:00
|
|
|
|
2006-03-30 12:03:04 +04:00
|
|
|
/*
|
2006-03-31 12:41:49 +04:00
|
|
|
* Implementation of DOM Core's nsIDOMDocumentType node.
|
2006-03-30 12:03:04 +04:00
|
|
|
*/
|
|
|
|
|
2012-12-29 05:34:02 +04:00
|
|
|
#ifndef DocumentType_h
|
|
|
|
#define DocumentType_h
|
2000-03-22 17:38:50 +03:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2003-11-19 04:20:56 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2000-03-22 17:38:50 +03:00
|
|
|
#include "nsIDOMDocumentType.h"
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsGenericDOMDataNode.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
|
2012-12-29 05:34:02 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2001-12-16 09:59:31 +03: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-29 05:34:02 +04:00
|
|
|
class DocumentTypeForward : public nsGenericDOMDataNode,
|
|
|
|
public nsIDOMDocumentType
|
2011-06-14 11:56:48 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit DocumentTypeForward(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2011-06-14 11:56:48 +04:00
|
|
|
: nsGenericDOMDataNode(aNodeInfo)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// nsIDOMNode
|
2012-10-09 16:31:24 +04:00
|
|
|
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
2011-06-14 11:56:48 +04:00
|
|
|
};
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class DocumentType final : public DocumentTypeForward
|
2000-03-22 17:38:50 +03:00
|
|
|
{
|
|
|
|
public:
|
2014-06-20 06:01:40 +04:00
|
|
|
DocumentType(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
2012-12-29 05:34:02 +04:00
|
|
|
const nsAString& aPublicId,
|
|
|
|
const nsAString& aSystemId,
|
|
|
|
const nsAString& aInternalSubset);
|
2000-03-22 17:38:50 +03:00
|
|
|
|
|
|
|
// nsISupports
|
2001-12-16 09:59:31 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2000-03-22 17:38:50 +03:00
|
|
|
|
|
|
|
// nsIDOMNode
|
2011-06-14 11:56:48 +04:00
|
|
|
// Forwarded by base class
|
2000-03-22 17:38:50 +03:00
|
|
|
|
|
|
|
// nsIDOMDocumentType
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_DECL_NSIDOMDOCUMENTTYPE
|
2000-03-22 17:38:50 +03:00
|
|
|
|
2012-10-09 16:31:24 +04:00
|
|
|
// nsINode
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
|
|
|
virtual void GetNodeValueInternal(nsAString& aNodeValue) override
|
2011-06-14 11:56:48 +04:00
|
|
|
{
|
|
|
|
SetDOMStringToNull(aNodeValue);
|
|
|
|
}
|
2012-10-09 16:31:24 +04:00
|
|
|
virtual void SetNodeValueInternal(const nsAString& aNodeValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::ErrorResult& aError) override
|
2011-06-14 11:56:48 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// nsIContent overrides
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual const nsTextFragment* GetText() override;
|
2006-11-22 21:35:05 +03:00
|
|
|
|
2014-06-20 06:01:40 +04:00
|
|
|
virtual nsGenericDOMDataNode* CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aCloneText) const override;
|
2011-06-14 11:56:48 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIDOMNode* AsDOMNode() override { return this; }
|
2012-12-29 05:34:02 +04:00
|
|
|
|
2000-03-22 17:38:50 +03:00
|
|
|
protected:
|
2014-07-09 01:23:16 +04:00
|
|
|
virtual ~DocumentType();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
|
2012-12-29 05:34:02 +04:00
|
|
|
|
2000-03-22 17:38:50 +03:00
|
|
|
nsString mPublicId;
|
|
|
|
nsString mSystemId;
|
|
|
|
nsString mInternalSubset;
|
|
|
|
};
|
|
|
|
|
2012-12-29 05:34:02 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
already_AddRefed<mozilla::dom::DocumentType>
|
2012-12-29 05:34:02 +04:00
|
|
|
NS_NewDOMDocumentType(nsNodeInfoManager* aNodeInfoManager,
|
|
|
|
nsIAtom *aName,
|
|
|
|
const nsAString& aPublicId,
|
|
|
|
const nsAString& aSystemId,
|
|
|
|
const nsAString& aInternalSubset,
|
|
|
|
mozilla::ErrorResult& rv);
|
|
|
|
|
2003-03-05 18:08:41 +03:00
|
|
|
nsresult
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
2011-09-17 17:32:32 +04:00
|
|
|
nsNodeInfoManager* aNodeInfoManager,
|
2003-11-19 04:20:56 +03:00
|
|
|
nsIAtom *aName,
|
2002-03-24 02:54:46 +03:00
|
|
|
const nsAString& aPublicId,
|
|
|
|
const nsAString& aSystemId,
|
|
|
|
const nsAString& aInternalSubset);
|
2000-03-22 17:38:50 +03:00
|
|
|
|
2012-12-29 05:34:02 +04:00
|
|
|
#endif // DocumentType_h
|