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
|
|
|
/*
|
2018-03-13 23:24:01 +03:00
|
|
|
* Implementation of DOM Core's DocumentType 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"
|
2018-03-19 22:18:07 +03:00
|
|
|
#include "mozilla/dom/CharacterData.h"
|
2003-11-19 04:20:56 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2000-03-22 17:38:50 +03:00
|
|
|
#include "nsIContent.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.
|
|
|
|
|
2018-05-30 05:58:51 +03:00
|
|
|
class DocumentType final : public CharacterData
|
2000-03-22 17:38:50 +03:00
|
|
|
{
|
|
|
|
public:
|
2018-09-21 23:45:49 +03: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
|
2018-05-30 05:58:51 +03:00
|
|
|
NS_INLINE_DECL_REFCOUNTING_INHERITED(DocumentType, CharacterData)
|
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
|
|
|
|
2018-03-19 22:50:16 +03:00
|
|
|
virtual already_AddRefed<CharacterData>
|
|
|
|
CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
|
|
|
|
bool aCloneText) const override;
|
2011-06-14 11:56:48 +04:00
|
|
|
|
2018-03-13 23:24:01 +03:00
|
|
|
// WebIDL API
|
|
|
|
void GetName(nsAString& aName) const;
|
|
|
|
void GetPublicId(nsAString& aPublicId) const;
|
|
|
|
void GetSystemId(nsAString& aSystemId) const;
|
|
|
|
void GetInternalSubset(nsAString& aInternalSubset) const;
|
|
|
|
|
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,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom *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
|