diff options
Diffstat (limited to 'dom/xml')
77 files changed, 8373 insertions, 0 deletions
diff --git a/dom/xml/CDATASection.cpp b/dom/xml/CDATASection.cpp new file mode 100644 index 0000000000..4858c24af1 --- /dev/null +++ b/dom/xml/CDATASection.cpp @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#include "mozilla/dom/CDATASection.h" +#include "mozilla/dom/CDATASectionBinding.h" +#include "mozilla/IntegerPrintfMacros.h" + +namespace mozilla::dom { + +CDATASection::~CDATASection() = default; + +JSObject* CDATASection::WrapNode(JSContext* aCx, + JS::Handle<JSObject*> aGivenProto) { + return CDATASection_Binding::Wrap(aCx, this, aGivenProto); +} + +already_AddRefed<CharacterData> CDATASection::CloneDataNode( + mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const { + RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo; + auto* nim = ni->NodeInfoManager(); + RefPtr<CDATASection> it = new (nim) CDATASection(ni.forget()); + if (aCloneText) { + it->mText = mText; + } + + return it.forget(); +} + +#ifdef MOZ_DOM_LIST +void CDATASection::List(FILE* out, int32_t aIndent) const { + int32_t index; + for (index = aIndent; --index >= 0;) fputs(" ", out); + + fprintf(out, "CDATASection refcount=%" PRIuPTR "<", mRefCnt.get()); + + nsAutoString tmp; + ToCString(tmp, 0, mText.GetLength()); + fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out); + + fputs(">\n", out); +} + +void CDATASection::DumpContent(FILE* out, int32_t aIndent, + bool aDumpAll) const {} +#endif + +} // namespace mozilla::dom diff --git a/dom/xml/CDATASection.h b/dom/xml/CDATASection.h new file mode 100644 index 0000000000..ab20a2d21e --- /dev/null +++ b/dom/xml/CDATASection.h @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef mozilla_dom_CDATASection_h +#define mozilla_dom_CDATASection_h + +#include "mozilla/Attributes.h" +#include "mozilla/dom/Text.h" + +namespace mozilla::dom { + +class CDATASection final : public Text { + private: + void Init() { + MOZ_ASSERT(mNodeInfo->NodeType() == CDATA_SECTION_NODE, + "Bad NodeType in aNodeInfo"); + } + + virtual ~CDATASection(); + + public: + explicit CDATASection(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) + : Text(std::move(aNodeInfo)) { + Init(); + } + + explicit CDATASection(nsNodeInfoManager* aNodeInfoManager) + : Text(aNodeInfoManager->GetNodeInfo(nsGkAtoms::cdataTagName, nullptr, + kNameSpaceID_None, + CDATA_SECTION_NODE)) { + Init(); + } + + // nsISupports + NS_INLINE_DECL_REFCOUNTING_INHERITED(CDATASection, Text) + + // nsINode + already_AddRefed<CharacterData> CloneDataNode( + mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const override; + +#ifdef MOZ_DOM_LIST + void List(FILE* out, int32_t aIndent) const override; + void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const override; +#endif + + protected: + JSObject* WrapNode(JSContext* aCx, + JS::Handle<JSObject*> aGivenProto) override; +}; + +} // namespace mozilla::dom + +#endif // mozilla_dom_CDATASection_h diff --git a/dom/xml/ProcessingInstruction.cpp b/dom/xml/ProcessingInstruction.cpp new file mode 100644 index 0000000000..1875487212 --- /dev/null +++ b/dom/xml/ProcessingInstruction.cpp @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#include "nsGkAtoms.h" +#include "nsUnicharUtils.h" +#include "mozilla/dom/LinkStyle.h" +#include "mozilla/dom/ProcessingInstruction.h" +#include "mozilla/dom/ProcessingInstructionBinding.h" +#include "mozilla/dom/XMLStylesheetProcessingInstruction.h" +#include "mozilla/IntegerPrintfMacros.h" +#include "nsContentUtils.h" + +already_AddRefed<mozilla::dom::ProcessingInstruction> +NS_NewXMLProcessingInstruction(nsNodeInfoManager* aNodeInfoManager, + const nsAString& aTarget, + const nsAString& aData) { + using mozilla::dom::ProcessingInstruction; + using mozilla::dom::XMLStylesheetProcessingInstruction; + + MOZ_ASSERT(aNodeInfoManager, "Missing nodeinfo manager"); + + RefPtr<nsAtom> target = NS_Atomize(aTarget); + MOZ_ASSERT(target); + + if (target == nsGkAtoms::xml_stylesheet) { + RefPtr<XMLStylesheetProcessingInstruction> pi = new (aNodeInfoManager) + XMLStylesheetProcessingInstruction(aNodeInfoManager, aData); + return pi.forget(); + } + + RefPtr<mozilla::dom::NodeInfo> ni; + ni = aNodeInfoManager->GetNodeInfo( + nsGkAtoms::processingInstructionTagName, nullptr, kNameSpaceID_None, + nsINode::PROCESSING_INSTRUCTION_NODE, target); + + RefPtr<ProcessingInstruction> instance = + new (aNodeInfoManager) ProcessingInstruction(ni.forget(), aData); + + return instance.forget(); +} + +namespace mozilla::dom { + +ProcessingInstruction::ProcessingInstruction( + already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, + const nsAString& aData) + : CharacterData(std::move(aNodeInfo)) { + MOZ_ASSERT(mNodeInfo->NodeType() == nsINode::PROCESSING_INSTRUCTION_NODE, + "Bad NodeType in aNodeInfo"); + + SetTextInternal(0, mText.GetLength(), aData.BeginReading(), aData.Length(), + false); // Don't notify (bug 420429). +} + +ProcessingInstruction::~ProcessingInstruction() = default; + +StyleSheet* ProcessingInstruction::GetSheetForBindings() const { + if (const auto* linkStyle = LinkStyle::FromNode(*this)) { + return linkStyle->GetSheetForBindings(); + } + return nullptr; +} + +JSObject* ProcessingInstruction::WrapNode(JSContext* aCx, + JS::Handle<JSObject*> aGivenProto) { + return ProcessingInstruction_Binding::Wrap(aCx, this, aGivenProto); +} + +bool ProcessingInstruction::GetAttrValue(nsAtom* aName, nsAString& aValue) { + nsAutoString data; + + GetData(data); + return nsContentUtils::GetPseudoAttributeValue(data, aName, aValue); +} + +already_AddRefed<CharacterData> ProcessingInstruction::CloneDataNode( + mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const { + nsAutoString data; + GetData(data); + RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo; + auto* nim = ni->NodeInfoManager(); + return do_AddRef(new (nim) ProcessingInstruction(ni.forget(), data)); +} + +#ifdef MOZ_DOM_LIST +void ProcessingInstruction::List(FILE* out, int32_t aIndent) const { + int32_t index; + for (index = aIndent; --index >= 0;) fputs(" ", out); + + fprintf(out, "Processing instruction refcount=%" PRIuPTR "<", mRefCnt.get()); + + nsAutoString tmp; + ToCString(tmp, 0, mText.GetLength()); + tmp.Insert(nsDependentAtomString(NodeInfo()->GetExtraName()).get(), 0); + fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out); + + fputs(">\n", out); +} + +void ProcessingInstruction::DumpContent(FILE* out, int32_t aIndent, + bool aDumpAll) const {} +#endif + +} // namespace mozilla::dom diff --git a/dom/xml/ProcessingInstruction.h b/dom/xml/ProcessingInstruction.h new file mode 100644 index 0000000000..69902049d4 --- /dev/null +++ b/dom/xml/ProcessingInstruction.h @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef mozilla_dom_ProcessingInstruction_h +#define mozilla_dom_ProcessingInstruction_h + +#include "mozilla/Attributes.h" +#include "mozilla/dom/CharacterData.h" +#include "nsAString.h" + +class nsIPrincipal; +class nsIURI; + +namespace mozilla { + +class StyleSheet; + +namespace dom { + +class ProcessingInstruction : public CharacterData { + public: + ProcessingInstruction(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, + const nsAString& aData); + + virtual already_AddRefed<CharacterData> CloneDataNode( + dom::NodeInfo* aNodeInfo, bool aCloneText) const override; + +#ifdef MOZ_DOM_LIST + virtual void List(FILE* out, int32_t aIndent) const override; + virtual void DumpContent(FILE* out, int32_t aIndent, + bool aDumpAll) const override; +#endif + + // WebIDL API + void GetTarget(nsAString& aTarget) { aTarget = NodeName(); } + // This is the WebIDL API for LinkStyle, even though only + // XMLStylesheetProcessingInstruction actually implements LinkStyle. + StyleSheet* GetSheetForBindings() const; + + NS_IMPL_FROMNODE_HELPER(ProcessingInstruction, IsProcessingInstruction()) + + protected: + virtual ~ProcessingInstruction(); + + /** + * This will parse the content of the PI, to extract the value of the pseudo + * attribute with the name specified in aName. See + * http://www.w3.org/TR/xml-stylesheet/#NT-StyleSheetPI for the specification + * which is used to parse the content of the PI. + * + * @param aName the name of the attribute to get the value for + * @param aValue [out] the value for the attribute with name specified in + * aAttribute. Empty if the attribute isn't present. + */ + bool GetAttrValue(nsAtom* aName, nsAString& aValue); + + JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override; +}; + +} // namespace dom +} // namespace mozilla + +/** + * aNodeInfoManager must not be null. + */ +already_AddRefed<mozilla::dom::ProcessingInstruction> +NS_NewXMLProcessingInstruction(nsNodeInfoManager* aNodeInfoManager, + const nsAString& aTarget, + const nsAString& aData); + +#endif // mozilla_dom_ProcessingInstruction_h diff --git a/dom/xml/XMLDocument.cpp b/dom/xml/XMLDocument.cpp new file mode 100644 index 0000000000..e62269b9a6 --- /dev/null +++ b/dom/xml/XMLDocument.cpp @@ -0,0 +1,339 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#include "mozilla/dom/XMLDocument.h" +#include "nsCharsetSource.h" +#include "nsIXMLContentSink.h" +#include "nsPresContext.h" +#include "nsIContent.h" +#include "nsIDocShell.h" +#include "nsHTMLParts.h" +#include "nsCOMPtr.h" +#include "nsString.h" +#include "nsIURI.h" +#include "nsNetUtil.h" +#include "nsError.h" +#include "nsIPrincipal.h" +#include "nsLayoutCID.h" +#include "mozilla/dom/Attr.h" +#include "nsCExternalHandlerService.h" +#include "nsMimeTypes.h" +#include "nsContentUtils.h" +#include "nsThreadUtils.h" +#include "nsJSUtils.h" +#include "nsCRT.h" +#include "nsComponentManagerUtils.h" +#include "nsContentCreatorFunctions.h" +#include "nsContentPolicyUtils.h" +#include "nsIConsoleService.h" +#include "nsIScriptError.h" +#include "nsHTMLDocument.h" +#include "nsParser.h" +#include "mozilla/BasicEvents.h" +#include "mozilla/EventDispatcher.h" +#include "mozilla/Encoding.h" +#include "mozilla/dom/DocumentType.h" +#include "mozilla/dom/Element.h" +#include "mozilla/dom/DocGroup.h" +#include "mozilla/dom/XMLDocumentBinding.h" +#include "mozilla/dom/DocumentBinding.h" + +using namespace mozilla; +using namespace mozilla::dom; + +// ================================================================== +// = +// ================================================================== + +nsresult NS_NewDOMDocument(Document** aInstancePtrResult, + const nsAString& aNamespaceURI, + const nsAString& aQualifiedName, + DocumentType* aDoctype, nsIURI* aDocumentURI, + nsIURI* aBaseURI, nsIPrincipal* aPrincipal, + bool aLoadedAsData, nsIGlobalObject* aEventObject, + DocumentFlavor aFlavor) { + // Note: can't require that aDocumentURI/aBaseURI/aPrincipal be non-null, + // since at least one caller (XMLHttpRequest) doesn't have decent args to + // pass in. + + nsresult rv; + + *aInstancePtrResult = nullptr; + + nsCOMPtr<Document> d; + bool isHTML = false; + bool isXHTML = false; + if (aFlavor == DocumentFlavorSVG) { + rv = NS_NewSVGDocument(getter_AddRefs(d), aPrincipal, aPrincipal); + } else if (aFlavor == DocumentFlavorHTML) { + rv = NS_NewHTMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal); + isHTML = true; + } else if (aFlavor == DocumentFlavorXML) { + rv = NS_NewXMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal); + } else if (aFlavor == DocumentFlavorPlain) { + rv = NS_NewXMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal, + aLoadedAsData, true); + } else if (aDoctype) { + MOZ_ASSERT(aFlavor == DocumentFlavorLegacyGuess); + nsAutoString publicId, name; + aDoctype->GetPublicId(publicId); + if (publicId.IsEmpty()) { + aDoctype->GetName(name); + } + if (name.EqualsLiteral("html") || + publicId.EqualsLiteral("-//W3C//DTD HTML 4.01//EN") || + publicId.EqualsLiteral("-//W3C//DTD HTML 4.01 Frameset//EN") || + publicId.EqualsLiteral("-//W3C//DTD HTML 4.01 Transitional//EN") || + publicId.EqualsLiteral("-//W3C//DTD HTML 4.0//EN") || + publicId.EqualsLiteral("-//W3C//DTD HTML 4.0 Frameset//EN") || + publicId.EqualsLiteral("-//W3C//DTD HTML 4.0 Transitional//EN")) { + rv = NS_NewHTMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal); + isHTML = true; + } else if (publicId.EqualsLiteral("-//W3C//DTD XHTML 1.0 Strict//EN") || + publicId.EqualsLiteral( + "-//W3C//DTD XHTML 1.0 Transitional//EN") || + publicId.EqualsLiteral("-//W3C//DTD XHTML 1.0 Frameset//EN")) { + rv = NS_NewHTMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal); + isHTML = true; + isXHTML = true; + } else if (publicId.EqualsLiteral("-//W3C//DTD SVG 1.1//EN")) { + rv = NS_NewSVGDocument(getter_AddRefs(d), aPrincipal, aPrincipal); + } + // XXX Add support for XUL documents. + else { + rv = NS_NewXMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal); + } + } else { + MOZ_ASSERT(aFlavor == DocumentFlavorLegacyGuess); + rv = NS_NewXMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal); + } + + if (NS_FAILED(rv)) { + return rv; + } + + if (isHTML) { + d->SetCompatibilityMode(eCompatibility_FullStandards); + d->AsHTMLDocument()->SetIsXHTML(isXHTML); + } + d->SetLoadedAsData(aLoadedAsData, /* aConsiderForMemoryReporting */ true); + d->SetDocumentURI(aDocumentURI); + d->SetBaseURI(aBaseURI); + + // We need to set the script handling object after we set the principal such + // that the doc group is assigned correctly. + if (nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aEventObject)) { + d->SetScriptHandlingObject(sgo); + } else if (aEventObject) { + d->SetScopeObject(aEventObject); + } + + // XMLDocuments and documents "created in memory" get to be UTF-8 by default, + // unlike the legacy HTML mess + d->SetDocumentCharacterSet(UTF_8_ENCODING); + + if (aDoctype) { + ErrorResult result; + d->AppendChild(*aDoctype, result); + // Need to WouldReportJSException() if our callee can throw a JS + // exception (which it can) and we're neither propagating the + // error out nor unconditionally suppressing it. + result.WouldReportJSException(); + if (NS_WARN_IF(result.Failed())) { + return result.StealNSResult(); + } + } + + if (!aQualifiedName.IsEmpty()) { + ErrorResult result; + ElementCreationOptionsOrString options; + Unused << options.SetAsString(); + + nsCOMPtr<Element> root = + d->CreateElementNS(aNamespaceURI, aQualifiedName, options, result); + if (NS_WARN_IF(result.Failed())) { + return result.StealNSResult(); + } + + d->AppendChild(*root, result); + // Need to WouldReportJSException() if our callee can throw a JS + // exception (which it can) and we're neither propagating the + // error out nor unconditionally suppressing it. + result.WouldReportJSException(); + if (NS_WARN_IF(result.Failed())) { + return result.StealNSResult(); + } + } + + d.forget(aInstancePtrResult); + + return NS_OK; +} + +nsresult NS_NewXMLDocument(Document** aInstancePtrResult, + nsIPrincipal* aPrincipal, + nsIPrincipal* aPartitionedPrincipal, + bool aLoadedAsData, bool aIsPlainDocument) { + RefPtr<XMLDocument> doc = new XMLDocument(); + + nsresult rv = doc->Init(aPrincipal, aPartitionedPrincipal); + + if (NS_FAILED(rv)) { + *aInstancePtrResult = nullptr; + return rv; + } + + doc->SetLoadedAsData(aLoadedAsData, /* aConsiderForMemoryReporting */ true); + doc->mIsPlainDocument = aIsPlainDocument; + doc.forget(aInstancePtrResult); + + return NS_OK; +} + +namespace mozilla::dom { + +XMLDocument::XMLDocument(const char* aContentType) + : Document(aContentType), + mChannelIsPending(false), + mIsPlainDocument(false), + mSuppressParserErrorElement(false), + mSuppressParserErrorConsoleMessages(false) { + mType = eGenericXML; +} + +nsresult XMLDocument::Init(nsIPrincipal* aPrincipal, + nsIPrincipal* aPartitionedPrincipal) { + nsresult rv = Document::Init(aPrincipal, aPartitionedPrincipal); + NS_ENSURE_SUCCESS(rv, rv); + + return rv; +} + +void XMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) { + Document::Reset(aChannel, aLoadGroup); +} + +void XMLDocument::ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup, + nsIPrincipal* aPrincipal, + nsIPrincipal* aPartitionedPrincipal) { + if (mChannelIsPending) { + StopDocumentLoad(); + mChannel->CancelWithReason(NS_BINDING_ABORTED, + "XMLDocument::ResetToURI"_ns); + mChannelIsPending = false; + } + + Document::ResetToURI(aURI, aLoadGroup, aPrincipal, aPartitionedPrincipal); +} + +void XMLDocument::SetSuppressParserErrorElement(bool aSuppress) { + mSuppressParserErrorElement = aSuppress; +} + +bool XMLDocument::SuppressParserErrorElement() { + return mSuppressParserErrorElement; +} + +void XMLDocument::SetSuppressParserErrorConsoleMessages(bool aSuppress) { + mSuppressParserErrorConsoleMessages = aSuppress; +} + +bool XMLDocument::SuppressParserErrorConsoleMessages() { + return mSuppressParserErrorConsoleMessages; +} + +nsresult XMLDocument::StartDocumentLoad( + const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup, + nsISupports* aContainer, nsIStreamListener** aDocListener, bool aReset) { + nsresult rv = Document::StartDocumentLoad(aCommand, aChannel, aLoadGroup, + aContainer, aDocListener, aReset); + if (NS_FAILED(rv)) return rv; + + int32_t charsetSource = kCharsetFromDocTypeDefault; + NotNull<const Encoding*> encoding = UTF_8_ENCODING; + TryChannelCharset(aChannel, charsetSource, encoding, nullptr); + + nsCOMPtr<nsIURI> aUrl; + rv = aChannel->GetURI(getter_AddRefs(aUrl)); + if (NS_FAILED(rv)) return rv; + + mParser = new nsParser(); + + nsCOMPtr<nsIXMLContentSink> sink; + + nsCOMPtr<nsIDocShell> docShell; + if (aContainer) { + docShell = do_QueryInterface(aContainer); + NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE); + } + rv = NS_NewXMLContentSink(getter_AddRefs(sink), this, aUrl, docShell, + aChannel); + NS_ENSURE_SUCCESS(rv, rv); + + // Set the parser as the stream listener for the document loader... + rv = CallQueryInterface(mParser, aDocListener); + NS_ENSURE_SUCCESS(rv, rv); + + NS_ASSERTION(mChannel, "How can we not have a channel here?"); + mChannelIsPending = true; + + SetDocumentCharacterSet(encoding); + mParser->SetDocumentCharset(encoding, charsetSource); + mParser->SetCommand(aCommand); + mParser->SetContentSink(sink); + mParser->Parse(aUrl); + + return NS_OK; +} + +void XMLDocument::EndLoad() { + mChannelIsPending = false; + + mSynchronousDOMContentLoaded = mLoadedAsData; + Document::EndLoad(); + if (mSynchronousDOMContentLoaded) { + mSynchronousDOMContentLoaded = false; + Document::SetReadyStateInternal(Document::READYSTATE_COMPLETE); + // Generate a document load event for the case when an XML + // document was loaded as pure data without any presentation + // attached to it. + WidgetEvent event(true, eLoad); + EventDispatcher::Dispatch(this, nullptr, &event); + } +} + +/* virtual */ +void XMLDocument::DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const { + Document::DocAddSizeOfExcludingThis(aWindowSizes); +} + +// Document interface + +nsresult XMLDocument::Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const { + NS_ASSERTION(aNodeInfo->NodeInfoManager() == mNodeInfoManager, + "Can't import this document into another document!"); + + RefPtr<XMLDocument> clone = new XMLDocument(); + nsresult rv = CloneDocHelper(clone); + NS_ENSURE_SUCCESS(rv, rv); + + // State from XMLDocument + clone->mIsPlainDocument = mIsPlainDocument; + + clone.forget(aResult); + return NS_OK; +} + +JSObject* XMLDocument::WrapNode(JSContext* aCx, + JS::Handle<JSObject*> aGivenProto) { + if (mIsPlainDocument) { + return Document_Binding::Wrap(aCx, this, aGivenProto); + } + + return XMLDocument_Binding::Wrap(aCx, this, aGivenProto); +} + +} // namespace mozilla::dom diff --git a/dom/xml/XMLDocument.h b/dom/xml/XMLDocument.h new file mode 100644 index 0000000000..49349be632 --- /dev/null +++ b/dom/xml/XMLDocument.h @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef mozilla_dom_XMLDocument_h +#define mozilla_dom_XMLDocument_h + +#include "mozilla/Attributes.h" +#include "mozilla/dom/BindingDeclarations.h" +#include "mozilla/dom/Document.h" +#include "nsIScriptContext.h" + +class nsIURI; +class nsIChannel; + +namespace mozilla::dom { + +class XMLDocument : public Document { + public: + explicit XMLDocument(const char* aContentType = "application/xml"); + + NS_INLINE_DECL_REFCOUNTING_INHERITED(XMLDocument, Document) + + virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) override; + virtual void ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup, + nsIPrincipal* aPrincipal, + nsIPrincipal* aPartitionedPrincipal) override; + + virtual void SetSuppressParserErrorElement(bool aSuppress) override; + virtual bool SuppressParserErrorElement() override; + + virtual void SetSuppressParserErrorConsoleMessages(bool aSuppress) override; + virtual bool SuppressParserErrorConsoleMessages() override; + + virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* channel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener** aDocListener, + bool aReset = true) override; + + // TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230, bug 1535398) + MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual void EndLoad() override; + + virtual nsresult Init(nsIPrincipal* aPrincipal, + nsIPrincipal* aPartitionedPrincipal) override; + + virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; + + virtual void DocAddSizeOfExcludingThis( + nsWindowSizes& aWindowSizes) const override; + // DocAddSizeOfIncludingThis is inherited from Document. + + // .location is [Unforgeable], so we have to make it clear that the Document + // version applies to us (it's shadowed by the XPCOM thing on Document). + using Document::GetLocation; + + protected: + virtual ~XMLDocument() = default; + + virtual JSObject* WrapNode(JSContext* aCx, + JS::Handle<JSObject*> aGivenProto) override; + + friend nsresult(::NS_NewXMLDocument)(Document**, nsIPrincipal*, nsIPrincipal*, + bool, bool); + + // mChannelIsPending indicates whether we're currently asynchronously loading + // data from mChannel. It's set to true when we first find out about the + // channel (StartDocumentLoad) and set to false in EndLoad or if ResetToURI() + // is called. In the latter case our mChannel is also cancelled. Note that + // if this member is true, mChannel cannot be null. + bool mChannelIsPending; + + // If true. we're really a Document, not an XMLDocument + bool mIsPlainDocument; + + // If true, do not output <parsererror> elements. Per spec, XMLHttpRequest + // shouldn't output them, whereas DOMParser/others should (see bug 918703). + bool mSuppressParserErrorElement; + + // If true, do not log parsing errors to the web console (see bug 884693). + bool mSuppressParserErrorConsoleMessages; +}; + +} // namespace mozilla::dom + +#endif // mozilla_dom_XMLDocument_h diff --git a/dom/xml/XMLStylesheetProcessingInstruction.cpp b/dom/xml/XMLStylesheetProcessingInstruction.cpp new file mode 100644 index 0000000000..9f0d3f6156 --- /dev/null +++ b/dom/xml/XMLStylesheetProcessingInstruction.cpp @@ -0,0 +1,159 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#include "XMLStylesheetProcessingInstruction.h" + +#include "mozilla/dom/Document.h" +#include "mozilla/dom/FetchPriority.h" +#include "mozilla/dom/ReferrerInfo.h" +#include "nsContentUtils.h" +#include "nsNetUtil.h" + +namespace mozilla::dom { + +// nsISupports implementation + +NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0( + XMLStylesheetProcessingInstruction, ProcessingInstruction) + +NS_IMPL_CYCLE_COLLECTION_CLASS(XMLStylesheetProcessingInstruction) + +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED( + XMLStylesheetProcessingInstruction, ProcessingInstruction) + tmp->LinkStyle::Traverse(cb); +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END + +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED( + XMLStylesheetProcessingInstruction, ProcessingInstruction) + tmp->LinkStyle::Unlink(); +NS_IMPL_CYCLE_COLLECTION_UNLINK_END + +XMLStylesheetProcessingInstruction::~XMLStylesheetProcessingInstruction() = + default; + +// nsIContent + +nsresult XMLStylesheetProcessingInstruction::BindToTree(BindContext& aContext, + nsINode& aParent) { + nsresult rv = ProcessingInstruction::BindToTree(aContext, aParent); + NS_ENSURE_SUCCESS(rv, rv); + + void (XMLStylesheetProcessingInstruction::*update)() = + &XMLStylesheetProcessingInstruction::UpdateStyleSheetInternal; + nsContentUtils::AddScriptRunner(NewRunnableMethod( + "dom::XMLStylesheetProcessingInstruction::BindToTree", this, update)); + + return rv; +} + +void XMLStylesheetProcessingInstruction::UnbindFromTree(bool aNullParent) { + nsCOMPtr<Document> oldDoc = GetUncomposedDoc(); + + ProcessingInstruction::UnbindFromTree(aNullParent); + Unused << UpdateStyleSheetInternal(oldDoc, nullptr); +} + +// nsINode + +void XMLStylesheetProcessingInstruction::SetNodeValueInternal( + const nsAString& aNodeValue, ErrorResult& aError) { + CharacterData::SetNodeValueInternal(aNodeValue, aError); + if (!aError.Failed()) { + Unused << UpdateStyleSheetInternal(nullptr, nullptr, ForceUpdate::Yes); + } +} + +// LinkStyle + +void XMLStylesheetProcessingInstruction::GetCharset(nsAString& aCharset) { + if (!GetAttrValue(nsGkAtoms::charset, aCharset)) { + aCharset.Truncate(); + } +} + +void XMLStylesheetProcessingInstruction::OverrideBaseURI(nsIURI* aNewBaseURI) { + mOverriddenBaseURI = aNewBaseURI; +} + +Maybe<LinkStyle::SheetInfo> +XMLStylesheetProcessingInstruction::GetStyleSheetInfo() { + // xml-stylesheet PI is special only in prolog + if (!nsContentUtils::InProlog(this)) { + return Nothing(); + } + + nsAutoString href; + if (!GetAttrValue(nsGkAtoms::href, href)) { + return Nothing(); + } + + nsAutoString data; + GetData(data); + + nsAutoString title; + nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::title, title); + + nsAutoString alternateAttr; + nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::alternate, + alternateAttr); + + bool alternate = alternateAttr.EqualsLiteral("yes"); + if (alternate && title.IsEmpty()) { + // alternates must have title + return Nothing(); + } + + nsAutoString media; + nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::media, media); + + // Make sure the type handling here matches + // nsXMLContentSink::HandleProcessingInstruction + nsAutoString type; + nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::type, type); + + nsAutoString mimeType, notUsed; + nsContentUtils::SplitMimeType(type, mimeType, notUsed); + if (!mimeType.IsEmpty() && !mimeType.LowerCaseEqualsLiteral("text/css")) { + return Nothing(); + } + + Document* doc = OwnerDoc(); + nsIURI* baseURL = + mOverriddenBaseURI ? mOverriddenBaseURI.get() : doc->GetDocBaseURI(); + auto encoding = doc->GetDocumentCharacterSet(); + nsCOMPtr<nsIURI> uri; + NS_NewURI(getter_AddRefs(uri), href, encoding, baseURL); + + return Some(SheetInfo{ + *doc, + this, + uri.forget(), + nullptr, + MakeAndAddRef<ReferrerInfo>(*doc), + CORS_NONE, + title, + media, + /* integrity = */ u""_ns, + /* nonce = */ u""_ns, + alternate ? HasAlternateRel::Yes : HasAlternateRel::No, + IsInline::No, + IsExplicitlyEnabled::No, + FetchPriority::Auto, + }); +} + +already_AddRefed<CharacterData> +XMLStylesheetProcessingInstruction::CloneDataNode( + mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const { + nsAutoString data; + GetData(data); + RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo; + auto* nim = ni->NodeInfoManager(); + return do_AddRef(new (nim) + XMLStylesheetProcessingInstruction(ni.forget(), data)); +} + +} // namespace mozilla::dom diff --git a/dom/xml/XMLStylesheetProcessingInstruction.h b/dom/xml/XMLStylesheetProcessingInstruction.h new file mode 100644 index 0000000000..a6b3aa6978 --- /dev/null +++ b/dom/xml/XMLStylesheetProcessingInstruction.h @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef mozilla_dom_XMLStylesheetProcessingInstruction_h +#define mozilla_dom_XMLStylesheetProcessingInstruction_h + +#include "mozilla/Attributes.h" +#include "mozilla/Unused.h" +#include "mozilla/dom/LinkStyle.h" +#include "mozilla/dom/ProcessingInstruction.h" +#include "nsIURI.h" + +namespace mozilla::dom { + +class XMLStylesheetProcessingInstruction final : public ProcessingInstruction, + public LinkStyle { + public: + XMLStylesheetProcessingInstruction( + already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, + const nsAString& aData) + : ProcessingInstruction(std::move(aNodeInfo), aData) {} + + XMLStylesheetProcessingInstruction(nsNodeInfoManager* aNodeInfoManager, + const nsAString& aData) + : ProcessingInstruction( + aNodeInfoManager->GetNodeInfo( + nsGkAtoms::processingInstructionTagName, nullptr, + kNameSpaceID_None, PROCESSING_INSTRUCTION_NODE, + nsGkAtoms::xml_stylesheet), + aData) {} + + // CC + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLStylesheetProcessingInstruction, + ProcessingInstruction) + + // nsINode + virtual void SetNodeValueInternal(const nsAString& aNodeValue, + mozilla::ErrorResult& aError) override; + + // nsIContent + virtual nsresult BindToTree(BindContext&, nsINode& aParent) override; + virtual void UnbindFromTree(bool aNullParent = true) override; + + /** + * Tells this processing instruction to use a different base URI. This is used + * for proper loading of xml-stylesheet processing instructions in XUL + * overlays and is only currently used by nsXMLStylesheetPI. + * + * @param aNewBaseURI the new base URI, nullptr to use the default base URI. + */ + void OverrideBaseURI(nsIURI* aNewBaseURI); + + // LinkStyle + void GetCharset(nsAString& aCharset) override; + + virtual void SetData(const nsAString& aData, + mozilla::ErrorResult& rv) override { + CharacterData::SetData(aData, rv); + if (rv.Failed()) { + return; + } + Unused << UpdateStyleSheetInternal(nullptr, nullptr, ForceUpdate::Yes); + } + + protected: + virtual ~XMLStylesheetProcessingInstruction(); + + nsCOMPtr<nsIURI> mOverriddenBaseURI; + + nsIContent& AsContent() final { return *this; } + const LinkStyle* AsLinkStyle() const final { return this; } + Maybe<SheetInfo> GetStyleSheetInfo() final; + + already_AddRefed<CharacterData> CloneDataNode( + mozilla::dom::NodeInfo* aNodeInfo, bool aCloneText) const final; +}; + +} // namespace mozilla::dom + +#endif // mozilla_dom_XMLStylesheetProcessingInstruction_h diff --git a/dom/xml/crashtests/1038887.xhtml b/dom/xml/crashtests/1038887.xhtml new file mode 100644 index 0000000000..18b12083a9 --- /dev/null +++ b/dom/xml/crashtests/1038887.xhtml @@ -0,0 +1 @@ +<?xml-stylesheet type="text/xsl" href="http://notexistingurl"?><html xmlns="http://www.w3.org/1999/xhtml"></html> diff --git a/dom/xml/crashtests/136896-1.xml b/dom/xml/crashtests/136896-1.xml new file mode 100644 index 0000000000..a54f95393f --- /dev/null +++ b/dom/xml/crashtests/136896-1.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" standalone="yes"?>
+<!DOCTYPE SITES
+[
+ <!ELEMENT SITES (VERSION, SITE+)>
+ <!ELEMENT VERSION (#PCDATA)>
+ <!ELEMENT SITE (ID, NAME, MAXADDR, MAXALIASES, MAXQUOTA, TYPE, DOMAINS?, USERS?, ALIASES?)>
+ <!ELEMENT DOMAINS (DOMAIN*)>
+ <!ELEMENT DOMAIN (#PCDATA)>
+
+ <!ELEMENT USERS (USER*)>
+ <!ELEMENT USER (ID, NAME, ROA, ROC, QUOTA, TYPE)>
+
+ <!ELEMENT ALIASES (ALIAS*)>
+ <!ELEMENT ALIAS (LEFTPART, RIGHTPART)>
+
+ <!ELEMENT ID (#PCDATA)>
+ <!ELEMENT NAME (#PCDATA)>
+ <!ELEMENT MAXADDR (#PCDATA)>
+ <!ELEMENT MAXALIASES (#PCDATA)>
+ <!ELEMENT MAXQUOTA (#PCDATA)>
+ <!ELEMENT TYPE (#PCDATA)>
+
+ <!ELEMENT ROA (#PCDATA)>
+ <!ELEMENT ROC (#PCDATA)>
+ <!ELEMENT QUOTA (#PCDATA)>
+
+ <!ELEMENT LEFTPART (#PCDATA)>
+ <!ELEMENT RIGHTPART (#PCDATA)>
+]
+>
+<SITES>
+<VERSION>1</VERSION>
+<SITE>
+ <ID>60</ID>
+ <NAME>abtauchen</NAME>
+ <MAXADDR>1</MAXADDR>
+ <MAXALIASES>1</MAXALIASES>
+ <MAXQUOTA>10240</MAXQUOTA>
+ <TYPE>p</TYPE>
+ <DOMAINS>
+ <DOMAIN>abtauchen.at</DOMAIN>
+ <DOMAIN>abtauchen.com</DOMAIN>
+ <DOMAIN>abtauchen.net</DOMAIN>
+ </DOMAINS>
+ <USERS>
+ <USER>
+ <ID>83</ID>
+ <NAME>info</NAME>
+ <ROA>y</ROA>
+ <ROC>n</ROC>
+ <QUOTA>10240</QUOTA>
+ <TYPE>p</TYPE>
+ </USER>
+ </USERS>
+ <ALIASES>
+ <ALIAS>
+ <LEFTPART>*</LEFTPART>
+ <RIGHTPART>info</RIGHTPART>
+ </ALIAS>
+ </ALIASES>
+</SITE>
+</SITES>
\ No newline at end of file diff --git a/dom/xml/crashtests/1405878.xml b/dom/xml/crashtests/1405878.xml new file mode 100644 index 0000000000..12677ade93 --- /dev/null +++ b/dom/xml/crashtests/1405878.xml @@ -0,0 +1,11 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> + <body> + <select> + <script>document.documentElement.offsetHeight</script> + <option>Hello there</option> + </select> + <script> + document.querySelector("body").style.display = "inline"; + </script> + </body> +</html> diff --git a/dom/xml/crashtests/1523655.xml b/dom/xml/crashtests/1523655.xml new file mode 100644 index 0000000000..e905e9104d --- /dev/null +++ b/dom/xml/crashtests/1523655.xml @@ -0,0 +1,3 @@ +<body> + <!-- XML root element with an known, allow-to-attch-shadow-root HTML tag name in non-HTML namespace should not trigger a crash --> +</body> diff --git a/dom/xml/crashtests/185285-1.xml b/dom/xml/crashtests/185285-1.xml new file mode 100644 index 0000000000..9ab44d3356 --- /dev/null +++ b/dom/xml/crashtests/185285-1.xml @@ -0,0 +1,2 @@ +<link xmlns="http://www.w3.org/1999/xhtml" href="some.css" rel="stylesheet" /> +<x />
\ No newline at end of file diff --git a/dom/xml/crashtests/382636-1.xml b/dom/xml/crashtests/382636-1.xml new file mode 100644 index 0000000000..da5110ad05 --- /dev/null +++ b/dom/xml/crashtests/382636-1.xml @@ -0,0 +1,9 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +</head> +<body onload="document.cloneNode(true);"> + +<img src="tree.gif" /> + +</body> +</html>
\ No newline at end of file diff --git a/dom/xml/crashtests/382636-2.svg b/dom/xml/crashtests/382636-2.svg new file mode 100644 index 0000000000..2be0060eed --- /dev/null +++ b/dom/xml/crashtests/382636-2.svg @@ -0,0 +1,5 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="document.cloneNode(true);"> + +<image xlink:href="tree.gif" width="49" height="60" /> + +</svg> diff --git a/dom/xml/crashtests/382636-3.xhtml b/dom/xml/crashtests/382636-3.xhtml new file mode 100644 index 0000000000..da5110ad05 --- /dev/null +++ b/dom/xml/crashtests/382636-3.xhtml @@ -0,0 +1,9 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +</head> +<body onload="document.cloneNode(true);"> + +<img src="tree.gif" /> + +</body> +</html>
\ No newline at end of file diff --git a/dom/xml/crashtests/382636-4.xhtml b/dom/xml/crashtests/382636-4.xhtml new file mode 100644 index 0000000000..e1c65b9030 --- /dev/null +++ b/dom/xml/crashtests/382636-4.xhtml @@ -0,0 +1,5 @@ +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="try { document.cloneNode(true); } catch (e) { }"> + +<image src="tree.gif" width="49" height="60" style="-moz-box-flex: 0" /> + +</window> diff --git a/dom/xml/crashtests/420429.xhtml b/dom/xml/crashtests/420429.xhtml new file mode 100644 index 0000000000..e71af4ef21 --- /dev/null +++ b/dom/xml/crashtests/420429.xhtml @@ -0,0 +1,18 @@ +<?xml version="1.0"?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + onload="boom();"> + +<?xml-stylesheet?> + +<script type="text/javascript"> + +function boom() +{ + window.addEventListener("DOMCharacterDataModified", function(){}, false); + document.documentElement.cloneNode(true).getElementsByTagName("*").length; +} + +</script> + +</window> diff --git a/dom/xml/crashtests/431703-1.xhtml b/dom/xml/crashtests/431703-1.xhtml new file mode 100644 index 0000000000..622e4455cc --- /dev/null +++ b/dom/xml/crashtests/431703-1.xhtml @@ -0,0 +1,17 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<script> +<![CDATA[ + +function boom() +{ + document.body.innerHTML = '<circle xmlns="http://www.w3.org/2000/svg" onload=""/>'; +} + +]]> +</script> +</head> + +<body onload="boom();"></body> + +</html> diff --git a/dom/xml/crashtests/453278-frame.xml b/dom/xml/crashtests/453278-frame.xml new file mode 100644 index 0000000000..7ced674cc5 --- /dev/null +++ b/dom/xml/crashtests/453278-frame.xml @@ -0,0 +1,3 @@ +<xml xmlns:xlink="http://www.w3.org/1999/xlink"> +<xml xlink:href="#" xlink:actuate="onLoad" xlink:type="simple"/> +</xml> diff --git a/dom/xml/crashtests/453278.html b/dom/xml/crashtests/453278.html new file mode 100644 index 0000000000..f30ea3833e --- /dev/null +++ b/dom/xml/crashtests/453278.html @@ -0,0 +1,9 @@ +<html>
+<head>
+<title> Bug 453278 - Crash [@ nsContentUtils::TriggerLink] with xlink stuff in display: none iframe</title><style>
+</style>
+</head>
+<body>
+<iframe id="content" src="453278-frame.xml" style="display: none;"></iframe>
+</body>
+</html>
diff --git a/dom/xml/crashtests/803586.xhtml b/dom/xml/crashtests/803586.xhtml new file mode 100644 index 0000000000..002de07724 --- /dev/null +++ b/dom/xml/crashtests/803586.xhtml @@ -0,0 +1,8 @@ +<?xml-stylesheet href="foo.css" ?> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<script> +document.firstChild.nodeValue = null +</script> +</head> +</html> diff --git a/dom/xml/crashtests/994740-1.xhtml b/dom/xml/crashtests/994740-1.xhtml new file mode 100644 index 0000000000..4d71cef27f --- /dev/null +++ b/dom/xml/crashtests/994740-1.xhtml @@ -0,0 +1,15 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<script> +<![CDATA[ + +function boom() +{ + document.createElement("head").innerHTML = "<"; +} + +]]> +</script></head> + +<body onload="boom();"></body> +</html> diff --git a/dom/xml/crashtests/crashtests.list b/dom/xml/crashtests/crashtests.list new file mode 100644 index 0000000000..158342c84d --- /dev/null +++ b/dom/xml/crashtests/crashtests.list @@ -0,0 +1,14 @@ +load 136896-1.xml +load 185285-1.xml +load 382636-1.xml +load 382636-2.svg +load 382636-3.xhtml +load chrome://reftest/content/crashtests/dom/xml/crashtests/382636-4.xhtml # Throws (bug 455856) +load chrome://reftest/content/crashtests/dom/xml/crashtests/420429.xhtml +load 431703-1.xhtml +load 453278.html +load 803586.xhtml +load 994740-1.xhtml +load 1038887.xhtml +load 1405878.xml +load 1523655.xml diff --git a/dom/xml/crashtests/tree.gif b/dom/xml/crashtests/tree.gif Binary files differnew file mode 100644 index 0000000000..360897e910 --- /dev/null +++ b/dom/xml/crashtests/tree.gif diff --git a/dom/xml/htmlmathml-f.ent b/dom/xml/htmlmathml-f.ent new file mode 100644 index 0000000000..37b2599769 --- /dev/null +++ b/dom/xml/htmlmathml-f.ent @@ -0,0 +1,2164 @@ + +<!-- + Copyright 1998 - 2011 W3C. + + Use and distribution of this code are permitted under the terms of + either of the following two licences: + + 1) W3C Software Notice and License. + http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.html + + + 2) The license used for the WHATWG HTML specification, + which states, in full: + You are granted a license to use, reproduce and create derivative + works of this document. + + + Please report any errors to David Carlisle + via the public W3C list www-math@w3.org. + + + Public identifier: -//W3C//ENTITIES HTML MathML Set//EN//XML + System identifier: http://www.w3.org/2003/entities/2007/htmlmathml-f.ent + + The public identifier should always be used verbatim. + The system identifier may be changed to suit local requirements. + + Typical invocation: + + <!ENTITY % htmlmathml-f PUBLIC + "-//W3C//ENTITIES HTML MathML Set//EN//XML" + "http://www.w3.org/2003/entities/2007/htmlmathml-f.ent" + > + %htmlmathml-f; + + + +--> + +<!ENTITY AElig "Æ" ><!--LATIN CAPITAL LETTER AE --> +<!ENTITY AMP "&#38;" ><!--AMPERSAND --> +<!ENTITY Aacute "Á" ><!--LATIN CAPITAL LETTER A WITH ACUTE --> +<!ENTITY Abreve "Ă" ><!--LATIN CAPITAL LETTER A WITH BREVE --> +<!ENTITY Acirc "Â" ><!--LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> +<!ENTITY Acy "А" ><!--CYRILLIC CAPITAL LETTER A --> +<!ENTITY Afr "𝔄" ><!--MATHEMATICAL FRAKTUR CAPITAL A --> +<!ENTITY Agrave "À" ><!--LATIN CAPITAL LETTER A WITH GRAVE --> +<!ENTITY Alpha "Α" ><!--GREEK CAPITAL LETTER ALPHA --> +<!ENTITY Amacr "Ā" ><!--LATIN CAPITAL LETTER A WITH MACRON --> +<!ENTITY And "⩓" ><!--DOUBLE LOGICAL AND --> +<!ENTITY Aogon "Ą" ><!--LATIN CAPITAL LETTER A WITH OGONEK --> +<!ENTITY Aopf "𝔸" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL A --> +<!ENTITY ApplyFunction "⁡" ><!--FUNCTION APPLICATION --> +<!ENTITY Aring "Å" ><!--LATIN CAPITAL LETTER A WITH RING ABOVE --> +<!ENTITY Ascr "𝒜" ><!--MATHEMATICAL SCRIPT CAPITAL A --> +<!ENTITY Assign "≔" ><!--COLON EQUALS --> +<!ENTITY Atilde "Ã" ><!--LATIN CAPITAL LETTER A WITH TILDE --> +<!ENTITY Auml "Ä" ><!--LATIN CAPITAL LETTER A WITH DIAERESIS --> +<!ENTITY Backslash "∖" ><!--SET MINUS --> +<!ENTITY Barv "⫧" ><!--SHORT DOWN TACK WITH OVERBAR --> +<!ENTITY Barwed "⌆" ><!--PERSPECTIVE --> +<!ENTITY Bcy "Б" ><!--CYRILLIC CAPITAL LETTER BE --> +<!ENTITY Because "∵" ><!--BECAUSE --> +<!ENTITY Bernoullis "ℬ" ><!--SCRIPT CAPITAL B --> +<!ENTITY Beta "Β" ><!--GREEK CAPITAL LETTER BETA --> +<!ENTITY Bfr "𝔅" ><!--MATHEMATICAL FRAKTUR CAPITAL B --> +<!ENTITY Bopf "𝔹" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL B --> +<!ENTITY Breve "˘" ><!--BREVE --> +<!ENTITY Bscr "ℬ" ><!--SCRIPT CAPITAL B --> +<!ENTITY Bumpeq "≎" ><!--GEOMETRICALLY EQUIVALENT TO --> +<!ENTITY CHcy "Ч" ><!--CYRILLIC CAPITAL LETTER CHE --> +<!ENTITY COPY "©" ><!--COPYRIGHT SIGN --> +<!ENTITY Cacute "Ć" ><!--LATIN CAPITAL LETTER C WITH ACUTE --> +<!ENTITY Cap "⋒" ><!--DOUBLE INTERSECTION --> +<!ENTITY CapitalDifferentialD "ⅅ" ><!--DOUBLE-STRUCK ITALIC CAPITAL D --> +<!ENTITY Cayleys "ℭ" ><!--BLACK-LETTER CAPITAL C --> +<!ENTITY Ccaron "Č" ><!--LATIN CAPITAL LETTER C WITH CARON --> +<!ENTITY Ccedil "Ç" ><!--LATIN CAPITAL LETTER C WITH CEDILLA --> +<!ENTITY Ccirc "Ĉ" ><!--LATIN CAPITAL LETTER C WITH CIRCUMFLEX --> +<!ENTITY Cconint "∰" ><!--VOLUME INTEGRAL --> +<!ENTITY Cdot "Ċ" ><!--LATIN CAPITAL LETTER C WITH DOT ABOVE --> +<!ENTITY Cedilla "¸" ><!--CEDILLA --> +<!ENTITY CenterDot "·" ><!--MIDDLE DOT --> +<!ENTITY Cfr "ℭ" ><!--BLACK-LETTER CAPITAL C --> +<!ENTITY Chi "Χ" ><!--GREEK CAPITAL LETTER CHI --> +<!ENTITY CircleDot "⊙" ><!--CIRCLED DOT OPERATOR --> +<!ENTITY CircleMinus "⊖" ><!--CIRCLED MINUS --> +<!ENTITY CirclePlus "⊕" ><!--CIRCLED PLUS --> +<!ENTITY CircleTimes "⊗" ><!--CIRCLED TIMES --> +<!ENTITY ClockwiseContourIntegral "∲" ><!--CLOCKWISE CONTOUR INTEGRAL --> +<!ENTITY CloseCurlyDoubleQuote "”" ><!--RIGHT DOUBLE QUOTATION MARK --> +<!ENTITY CloseCurlyQuote "’" ><!--RIGHT SINGLE QUOTATION MARK --> +<!ENTITY Colon "∷" ><!--PROPORTION --> +<!ENTITY Colone "⩴" ><!--DOUBLE COLON EQUAL --> +<!ENTITY Congruent "≡" ><!--IDENTICAL TO --> +<!ENTITY Conint "∯" ><!--SURFACE INTEGRAL --> +<!ENTITY ContourIntegral "∮" ><!--CONTOUR INTEGRAL --> +<!ENTITY Copf "ℂ" ><!--DOUBLE-STRUCK CAPITAL C --> +<!ENTITY Coproduct "∐" ><!--N-ARY COPRODUCT --> +<!ENTITY CounterClockwiseContourIntegral "∳" ><!--ANTICLOCKWISE CONTOUR INTEGRAL --> +<!ENTITY Cross "⨯" ><!--VECTOR OR CROSS PRODUCT --> +<!ENTITY Cscr "𝒞" ><!--MATHEMATICAL SCRIPT CAPITAL C --> +<!ENTITY Cup "⋓" ><!--DOUBLE UNION --> +<!ENTITY CupCap "≍" ><!--EQUIVALENT TO --> +<!ENTITY DD "ⅅ" ><!--DOUBLE-STRUCK ITALIC CAPITAL D --> +<!ENTITY DDotrahd "⤑" ><!--RIGHTWARDS ARROW WITH DOTTED STEM --> +<!ENTITY DJcy "Ђ" ><!--CYRILLIC CAPITAL LETTER DJE --> +<!ENTITY DScy "Ѕ" ><!--CYRILLIC CAPITAL LETTER DZE --> +<!ENTITY DZcy "Џ" ><!--CYRILLIC CAPITAL LETTER DZHE --> +<!ENTITY Dagger "‡" ><!--DOUBLE DAGGER --> +<!ENTITY Darr "↡" ><!--DOWNWARDS TWO HEADED ARROW --> +<!ENTITY Dashv "⫤" ><!--VERTICAL BAR DOUBLE LEFT TURNSTILE --> +<!ENTITY Dcaron "Ď" ><!--LATIN CAPITAL LETTER D WITH CARON --> +<!ENTITY Dcy "Д" ><!--CYRILLIC CAPITAL LETTER DE --> +<!ENTITY Del "∇" ><!--NABLA --> +<!ENTITY Delta "Δ" ><!--GREEK CAPITAL LETTER DELTA --> +<!ENTITY Dfr "𝔇" ><!--MATHEMATICAL FRAKTUR CAPITAL D --> +<!ENTITY DiacriticalAcute "´" ><!--ACUTE ACCENT --> +<!ENTITY DiacriticalDot "˙" ><!--DOT ABOVE --> +<!ENTITY DiacriticalDoubleAcute "˝" ><!--DOUBLE ACUTE ACCENT --> +<!ENTITY DiacriticalGrave "`" ><!--GRAVE ACCENT --> +<!ENTITY DiacriticalTilde "˜" ><!--SMALL TILDE --> +<!ENTITY Diamond "⋄" ><!--DIAMOND OPERATOR --> +<!ENTITY DifferentialD "ⅆ" ><!--DOUBLE-STRUCK ITALIC SMALL D --> +<!ENTITY Dopf "𝔻" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL D --> +<!ENTITY Dot "¨" ><!--DIAERESIS --> +<!ENTITY DotDot "⃜" ><!--COMBINING FOUR DOTS ABOVE --> +<!ENTITY DotEqual "≐" ><!--APPROACHES THE LIMIT --> +<!ENTITY DoubleContourIntegral "∯" ><!--SURFACE INTEGRAL --> +<!ENTITY DoubleDot "¨" ><!--DIAERESIS --> +<!ENTITY DoubleDownArrow "⇓" ><!--DOWNWARDS DOUBLE ARROW --> +<!ENTITY DoubleLeftArrow "⇐" ><!--LEFTWARDS DOUBLE ARROW --> +<!ENTITY DoubleLeftRightArrow "⇔" ><!--LEFT RIGHT DOUBLE ARROW --> +<!ENTITY DoubleLeftTee "⫤" ><!--VERTICAL BAR DOUBLE LEFT TURNSTILE --> +<!ENTITY DoubleLongLeftArrow "⟸" ><!--LONG LEFTWARDS DOUBLE ARROW --> +<!ENTITY DoubleLongLeftRightArrow "⟺" ><!--LONG LEFT RIGHT DOUBLE ARROW --> +<!ENTITY DoubleLongRightArrow "⟹" ><!--LONG RIGHTWARDS DOUBLE ARROW --> +<!ENTITY DoubleRightArrow "⇒" ><!--RIGHTWARDS DOUBLE ARROW --> +<!ENTITY DoubleRightTee "⊨" ><!--TRUE --> +<!ENTITY DoubleUpArrow "⇑" ><!--UPWARDS DOUBLE ARROW --> +<!ENTITY DoubleUpDownArrow "⇕" ><!--UP DOWN DOUBLE ARROW --> +<!ENTITY DoubleVerticalBar "∥" ><!--PARALLEL TO --> +<!ENTITY DownArrow "↓" ><!--DOWNWARDS ARROW --> +<!ENTITY DownArrowBar "⤓" ><!--DOWNWARDS ARROW TO BAR --> +<!ENTITY DownArrowUpArrow "⇵" ><!--DOWNWARDS ARROW LEFTWARDS OF UPWARDS ARROW --> +<!ENTITY DownBreve "̑" ><!--COMBINING INVERTED BREVE --> +<!ENTITY DownLeftRightVector "⥐" ><!--LEFT BARB DOWN RIGHT BARB DOWN HARPOON --> +<!ENTITY DownLeftTeeVector "⥞" ><!--LEFTWARDS HARPOON WITH BARB DOWN FROM BAR --> +<!ENTITY DownLeftVector "↽" ><!--LEFTWARDS HARPOON WITH BARB DOWNWARDS --> +<!ENTITY DownLeftVectorBar "⥖" ><!--LEFTWARDS HARPOON WITH BARB DOWN TO BAR --> +<!ENTITY DownRightTeeVector "⥟" ><!--RIGHTWARDS HARPOON WITH BARB DOWN FROM BAR --> +<!ENTITY DownRightVector "⇁" ><!--RIGHTWARDS HARPOON WITH BARB DOWNWARDS --> +<!ENTITY DownRightVectorBar "⥗" ><!--RIGHTWARDS HARPOON WITH BARB DOWN TO BAR --> +<!ENTITY DownTee "⊤" ><!--DOWN TACK --> +<!ENTITY DownTeeArrow "↧" ><!--DOWNWARDS ARROW FROM BAR --> +<!ENTITY Downarrow "⇓" ><!--DOWNWARDS DOUBLE ARROW --> +<!ENTITY Dscr "𝒟" ><!--MATHEMATICAL SCRIPT CAPITAL D --> +<!ENTITY Dstrok "Đ" ><!--LATIN CAPITAL LETTER D WITH STROKE --> +<!ENTITY ENG "Ŋ" ><!--LATIN CAPITAL LETTER ENG --> +<!ENTITY ETH "Ð" ><!--LATIN CAPITAL LETTER ETH --> +<!ENTITY Eacute "É" ><!--LATIN CAPITAL LETTER E WITH ACUTE --> +<!ENTITY Ecaron "Ě" ><!--LATIN CAPITAL LETTER E WITH CARON --> +<!ENTITY Ecirc "Ê" ><!--LATIN CAPITAL LETTER E WITH CIRCUMFLEX --> +<!ENTITY Ecy "Э" ><!--CYRILLIC CAPITAL LETTER E --> +<!ENTITY Edot "Ė" ><!--LATIN CAPITAL LETTER E WITH DOT ABOVE --> +<!ENTITY Efr "𝔈" ><!--MATHEMATICAL FRAKTUR CAPITAL E --> +<!ENTITY Egrave "È" ><!--LATIN CAPITAL LETTER E WITH GRAVE --> +<!ENTITY Element "∈" ><!--ELEMENT OF --> +<!ENTITY Emacr "Ē" ><!--LATIN CAPITAL LETTER E WITH MACRON --> +<!ENTITY EmptySmallSquare "◻" ><!--WHITE MEDIUM SQUARE --> +<!ENTITY EmptyVerySmallSquare "▫" ><!--WHITE SMALL SQUARE --> +<!ENTITY Eogon "Ę" ><!--LATIN CAPITAL LETTER E WITH OGONEK --> +<!ENTITY Eopf "𝔼" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL E --> +<!ENTITY Epsilon "Ε" ><!--GREEK CAPITAL LETTER EPSILON --> +<!ENTITY Equal "⩵" ><!--TWO CONSECUTIVE EQUALS SIGNS --> +<!ENTITY EqualTilde "≂" ><!--MINUS TILDE --> +<!ENTITY Equilibrium "⇌" ><!--RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON --> +<!ENTITY Escr "ℰ" ><!--SCRIPT CAPITAL E --> +<!ENTITY Esim "⩳" ><!--EQUALS SIGN ABOVE TILDE OPERATOR --> +<!ENTITY Eta "Η" ><!--GREEK CAPITAL LETTER ETA --> +<!ENTITY Euml "Ë" ><!--LATIN CAPITAL LETTER E WITH DIAERESIS --> +<!ENTITY Exists "∃" ><!--THERE EXISTS --> +<!ENTITY ExponentialE "ⅇ" ><!--DOUBLE-STRUCK ITALIC SMALL E --> +<!ENTITY Fcy "Ф" ><!--CYRILLIC CAPITAL LETTER EF --> +<!ENTITY Ffr "𝔉" ><!--MATHEMATICAL FRAKTUR CAPITAL F --> +<!ENTITY FilledSmallSquare "◼" ><!--BLACK MEDIUM SQUARE --> +<!ENTITY FilledVerySmallSquare "▪" ><!--BLACK SMALL SQUARE --> +<!ENTITY Fopf "𝔽" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL F --> +<!ENTITY ForAll "∀" ><!--FOR ALL --> +<!ENTITY Fouriertrf "ℱ" ><!--SCRIPT CAPITAL F --> +<!ENTITY Fscr "ℱ" ><!--SCRIPT CAPITAL F --> +<!ENTITY GJcy "Ѓ" ><!--CYRILLIC CAPITAL LETTER GJE --> +<!ENTITY GT ">" ><!--GREATER-THAN SIGN --> +<!ENTITY Gamma "Γ" ><!--GREEK CAPITAL LETTER GAMMA --> +<!ENTITY Gammad "Ϝ" ><!--GREEK LETTER DIGAMMA --> +<!ENTITY Gbreve "Ğ" ><!--LATIN CAPITAL LETTER G WITH BREVE --> +<!ENTITY Gcedil "Ģ" ><!--LATIN CAPITAL LETTER G WITH CEDILLA --> +<!ENTITY Gcirc "Ĝ" ><!--LATIN CAPITAL LETTER G WITH CIRCUMFLEX --> +<!ENTITY Gcy "Г" ><!--CYRILLIC CAPITAL LETTER GHE --> +<!ENTITY Gdot "Ġ" ><!--LATIN CAPITAL LETTER G WITH DOT ABOVE --> +<!ENTITY Gfr "𝔊" ><!--MATHEMATICAL FRAKTUR CAPITAL G --> +<!ENTITY Gg "⋙" ><!--VERY MUCH GREATER-THAN --> +<!ENTITY Gopf "𝔾" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL G --> +<!ENTITY GreaterEqual "≥" ><!--GREATER-THAN OR EQUAL TO --> +<!ENTITY GreaterEqualLess "⋛" ><!--GREATER-THAN EQUAL TO OR LESS-THAN --> +<!ENTITY GreaterFullEqual "≧" ><!--GREATER-THAN OVER EQUAL TO --> +<!ENTITY GreaterGreater "⪢" ><!--DOUBLE NESTED GREATER-THAN --> +<!ENTITY GreaterLess "≷" ><!--GREATER-THAN OR LESS-THAN --> +<!ENTITY GreaterSlantEqual "⩾" ><!--GREATER-THAN OR SLANTED EQUAL TO --> +<!ENTITY GreaterTilde "≳" ><!--GREATER-THAN OR EQUIVALENT TO --> +<!ENTITY Gscr "𝒢" ><!--MATHEMATICAL SCRIPT CAPITAL G --> +<!ENTITY Gt "≫" ><!--MUCH GREATER-THAN --> +<!ENTITY HARDcy "Ъ" ><!--CYRILLIC CAPITAL LETTER HARD SIGN --> +<!ENTITY Hacek "ˇ" ><!--CARON --> +<!ENTITY Hat "^" ><!--CIRCUMFLEX ACCENT --> +<!ENTITY Hcirc "Ĥ" ><!--LATIN CAPITAL LETTER H WITH CIRCUMFLEX --> +<!ENTITY Hfr "ℌ" ><!--BLACK-LETTER CAPITAL H --> +<!ENTITY HilbertSpace "ℋ" ><!--SCRIPT CAPITAL H --> +<!ENTITY Hopf "ℍ" ><!--DOUBLE-STRUCK CAPITAL H --> +<!ENTITY HorizontalLine "─" ><!--BOX DRAWINGS LIGHT HORIZONTAL --> +<!ENTITY Hscr "ℋ" ><!--SCRIPT CAPITAL H --> +<!ENTITY Hstrok "Ħ" ><!--LATIN CAPITAL LETTER H WITH STROKE --> +<!ENTITY HumpDownHump "≎" ><!--GEOMETRICALLY EQUIVALENT TO --> +<!ENTITY HumpEqual "≏" ><!--DIFFERENCE BETWEEN --> +<!ENTITY IEcy "Е" ><!--CYRILLIC CAPITAL LETTER IE --> +<!ENTITY IJlig "IJ" ><!--LATIN CAPITAL LIGATURE IJ --> +<!ENTITY IOcy "Ё" ><!--CYRILLIC CAPITAL LETTER IO --> +<!ENTITY Iacute "Í" ><!--LATIN CAPITAL LETTER I WITH ACUTE --> +<!ENTITY Icirc "Î" ><!--LATIN CAPITAL LETTER I WITH CIRCUMFLEX --> +<!ENTITY Icy "И" ><!--CYRILLIC CAPITAL LETTER I --> +<!ENTITY Idot "İ" ><!--LATIN CAPITAL LETTER I WITH DOT ABOVE --> +<!ENTITY Ifr "ℑ" ><!--BLACK-LETTER CAPITAL I --> +<!ENTITY Igrave "Ì" ><!--LATIN CAPITAL LETTER I WITH GRAVE --> +<!ENTITY Im "ℑ" ><!--BLACK-LETTER CAPITAL I --> +<!ENTITY Imacr "Ī" ><!--LATIN CAPITAL LETTER I WITH MACRON --> +<!ENTITY ImaginaryI "ⅈ" ><!--DOUBLE-STRUCK ITALIC SMALL I --> +<!ENTITY Implies "⇒" ><!--RIGHTWARDS DOUBLE ARROW --> +<!ENTITY Int "∬" ><!--DOUBLE INTEGRAL --> +<!ENTITY Integral "∫" ><!--INTEGRAL --> +<!ENTITY Intersection "⋂" ><!--N-ARY INTERSECTION --> +<!ENTITY InvisibleComma "⁣" ><!--INVISIBLE SEPARATOR --> +<!ENTITY InvisibleTimes "⁢" ><!--INVISIBLE TIMES --> +<!ENTITY Iogon "Į" ><!--LATIN CAPITAL LETTER I WITH OGONEK --> +<!ENTITY Iopf "𝕀" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL I --> +<!ENTITY Iota "Ι" ><!--GREEK CAPITAL LETTER IOTA --> +<!ENTITY Iscr "ℐ" ><!--SCRIPT CAPITAL I --> +<!ENTITY Itilde "Ĩ" ><!--LATIN CAPITAL LETTER I WITH TILDE --> +<!ENTITY Iukcy "І" ><!--CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I --> +<!ENTITY Iuml "Ï" ><!--LATIN CAPITAL LETTER I WITH DIAERESIS --> +<!ENTITY Jcirc "Ĵ" ><!--LATIN CAPITAL LETTER J WITH CIRCUMFLEX --> +<!ENTITY Jcy "Й" ><!--CYRILLIC CAPITAL LETTER SHORT I --> +<!ENTITY Jfr "𝔍" ><!--MATHEMATICAL FRAKTUR CAPITAL J --> +<!ENTITY Jopf "𝕁" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL J --> +<!ENTITY Jscr "𝒥" ><!--MATHEMATICAL SCRIPT CAPITAL J --> +<!ENTITY Jsercy "Ј" ><!--CYRILLIC CAPITAL LETTER JE --> +<!ENTITY Jukcy "Є" ><!--CYRILLIC CAPITAL LETTER UKRAINIAN IE --> +<!ENTITY KHcy "Х" ><!--CYRILLIC CAPITAL LETTER HA --> +<!ENTITY KJcy "Ќ" ><!--CYRILLIC CAPITAL LETTER KJE --> +<!ENTITY Kappa "Κ" ><!--GREEK CAPITAL LETTER KAPPA --> +<!ENTITY Kcedil "Ķ" ><!--LATIN CAPITAL LETTER K WITH CEDILLA --> +<!ENTITY Kcy "К" ><!--CYRILLIC CAPITAL LETTER KA --> +<!ENTITY Kfr "𝔎" ><!--MATHEMATICAL FRAKTUR CAPITAL K --> +<!ENTITY Kopf "𝕂" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL K --> +<!ENTITY Kscr "𝒦" ><!--MATHEMATICAL SCRIPT CAPITAL K --> +<!ENTITY LJcy "Љ" ><!--CYRILLIC CAPITAL LETTER LJE --> +<!ENTITY LT "&#60;" ><!--LESS-THAN SIGN --> +<!ENTITY Lacute "Ĺ" ><!--LATIN CAPITAL LETTER L WITH ACUTE --> +<!ENTITY Lambda "Λ" ><!--GREEK CAPITAL LETTER LAMDA --> +<!ENTITY Lang "⟪" ><!--MATHEMATICAL LEFT DOUBLE ANGLE BRACKET --> +<!ENTITY Laplacetrf "ℒ" ><!--SCRIPT CAPITAL L --> +<!ENTITY Larr "↞" ><!--LEFTWARDS TWO HEADED ARROW --> +<!ENTITY Lcaron "Ľ" ><!--LATIN CAPITAL LETTER L WITH CARON --> +<!ENTITY Lcedil "Ļ" ><!--LATIN CAPITAL LETTER L WITH CEDILLA --> +<!ENTITY Lcy "Л" ><!--CYRILLIC CAPITAL LETTER EL --> +<!ENTITY LeftAngleBracket "⟨" ><!--MATHEMATICAL LEFT ANGLE BRACKET --> +<!ENTITY LeftArrow "←" ><!--LEFTWARDS ARROW --> +<!ENTITY LeftArrowBar "⇤" ><!--LEFTWARDS ARROW TO BAR --> +<!ENTITY LeftArrowRightArrow "⇆" ><!--LEFTWARDS ARROW OVER RIGHTWARDS ARROW --> +<!ENTITY LeftCeiling "⌈" ><!--LEFT CEILING --> +<!ENTITY LeftDoubleBracket "⟦" ><!--MATHEMATICAL LEFT WHITE SQUARE BRACKET --> +<!ENTITY LeftDownTeeVector "⥡" ><!--DOWNWARDS HARPOON WITH BARB LEFT FROM BAR --> +<!ENTITY LeftDownVector "⇃" ><!--DOWNWARDS HARPOON WITH BARB LEFTWARDS --> +<!ENTITY LeftDownVectorBar "⥙" ><!--DOWNWARDS HARPOON WITH BARB LEFT TO BAR --> +<!ENTITY LeftFloor "⌊" ><!--LEFT FLOOR --> +<!ENTITY LeftRightArrow "↔" ><!--LEFT RIGHT ARROW --> +<!ENTITY LeftRightVector "⥎" ><!--LEFT BARB UP RIGHT BARB UP HARPOON --> +<!ENTITY LeftTee "⊣" ><!--LEFT TACK --> +<!ENTITY LeftTeeArrow "↤" ><!--LEFTWARDS ARROW FROM BAR --> +<!ENTITY LeftTeeVector "⥚" ><!--LEFTWARDS HARPOON WITH BARB UP FROM BAR --> +<!ENTITY LeftTriangle "⊲" ><!--NORMAL SUBGROUP OF --> +<!ENTITY LeftTriangleBar "⧏" ><!--LEFT TRIANGLE BESIDE VERTICAL BAR --> +<!ENTITY LeftTriangleEqual "⊴" ><!--NORMAL SUBGROUP OF OR EQUAL TO --> +<!ENTITY LeftUpDownVector "⥑" ><!--UP BARB LEFT DOWN BARB LEFT HARPOON --> +<!ENTITY LeftUpTeeVector "⥠" ><!--UPWARDS HARPOON WITH BARB LEFT FROM BAR --> +<!ENTITY LeftUpVector "↿" ><!--UPWARDS HARPOON WITH BARB LEFTWARDS --> +<!ENTITY LeftUpVectorBar "⥘" ><!--UPWARDS HARPOON WITH BARB LEFT TO BAR --> +<!ENTITY LeftVector "↼" ><!--LEFTWARDS HARPOON WITH BARB UPWARDS --> +<!ENTITY LeftVectorBar "⥒" ><!--LEFTWARDS HARPOON WITH BARB UP TO BAR --> +<!ENTITY Leftarrow "⇐" ><!--LEFTWARDS DOUBLE ARROW --> +<!ENTITY Leftrightarrow "⇔" ><!--LEFT RIGHT DOUBLE ARROW --> +<!ENTITY LessEqualGreater "⋚" ><!--LESS-THAN EQUAL TO OR GREATER-THAN --> +<!ENTITY LessFullEqual "≦" ><!--LESS-THAN OVER EQUAL TO --> +<!ENTITY LessGreater "≶" ><!--LESS-THAN OR GREATER-THAN --> +<!ENTITY LessLess "⪡" ><!--DOUBLE NESTED LESS-THAN --> +<!ENTITY LessSlantEqual "⩽" ><!--LESS-THAN OR SLANTED EQUAL TO --> +<!ENTITY LessTilde "≲" ><!--LESS-THAN OR EQUIVALENT TO --> +<!ENTITY Lfr "𝔏" ><!--MATHEMATICAL FRAKTUR CAPITAL L --> +<!ENTITY Ll "⋘" ><!--VERY MUCH LESS-THAN --> +<!ENTITY Lleftarrow "⇚" ><!--LEFTWARDS TRIPLE ARROW --> +<!ENTITY Lmidot "Ŀ" ><!--LATIN CAPITAL LETTER L WITH MIDDLE DOT --> +<!ENTITY LongLeftArrow "⟵" ><!--LONG LEFTWARDS ARROW --> +<!ENTITY LongLeftRightArrow "⟷" ><!--LONG LEFT RIGHT ARROW --> +<!ENTITY LongRightArrow "⟶" ><!--LONG RIGHTWARDS ARROW --> +<!ENTITY Longleftarrow "⟸" ><!--LONG LEFTWARDS DOUBLE ARROW --> +<!ENTITY Longleftrightarrow "⟺" ><!--LONG LEFT RIGHT DOUBLE ARROW --> +<!ENTITY Longrightarrow "⟹" ><!--LONG RIGHTWARDS DOUBLE ARROW --> +<!ENTITY Lopf "𝕃" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL L --> +<!ENTITY LowerLeftArrow "↙" ><!--SOUTH WEST ARROW --> +<!ENTITY LowerRightArrow "↘" ><!--SOUTH EAST ARROW --> +<!ENTITY Lscr "ℒ" ><!--SCRIPT CAPITAL L --> +<!ENTITY Lsh "↰" ><!--UPWARDS ARROW WITH TIP LEFTWARDS --> +<!ENTITY Lstrok "Ł" ><!--LATIN CAPITAL LETTER L WITH STROKE --> +<!ENTITY Lt "≪" ><!--MUCH LESS-THAN --> +<!ENTITY Map "⤅" ><!--RIGHTWARDS TWO-HEADED ARROW FROM BAR --> +<!ENTITY Mcy "М" ><!--CYRILLIC CAPITAL LETTER EM --> +<!ENTITY MediumSpace " " ><!--MEDIUM MATHEMATICAL SPACE --> +<!ENTITY Mellintrf "ℳ" ><!--SCRIPT CAPITAL M --> +<!ENTITY Mfr "𝔐" ><!--MATHEMATICAL FRAKTUR CAPITAL M --> +<!ENTITY MinusPlus "∓" ><!--MINUS-OR-PLUS SIGN --> +<!ENTITY Mopf "𝕄" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL M --> +<!ENTITY Mscr "ℳ" ><!--SCRIPT CAPITAL M --> +<!ENTITY Mu "Μ" ><!--GREEK CAPITAL LETTER MU --> +<!ENTITY NJcy "Њ" ><!--CYRILLIC CAPITAL LETTER NJE --> +<!ENTITY Nacute "Ń" ><!--LATIN CAPITAL LETTER N WITH ACUTE --> +<!ENTITY Ncaron "Ň" ><!--LATIN CAPITAL LETTER N WITH CARON --> +<!ENTITY Ncedil "Ņ" ><!--LATIN CAPITAL LETTER N WITH CEDILLA --> +<!ENTITY Ncy "Н" ><!--CYRILLIC CAPITAL LETTER EN --> +<!ENTITY NegativeMediumSpace "​" ><!--ZERO WIDTH SPACE --> +<!ENTITY NegativeThickSpace "​" ><!--ZERO WIDTH SPACE --> +<!ENTITY NegativeThinSpace "​" ><!--ZERO WIDTH SPACE --> +<!ENTITY NegativeVeryThinSpace "​" ><!--ZERO WIDTH SPACE --> +<!ENTITY NestedGreaterGreater "≫" ><!--MUCH GREATER-THAN --> +<!ENTITY NestedLessLess "≪" ><!--MUCH LESS-THAN --> +<!ENTITY NewLine "
" ><!--LINE FEED (LF) --> +<!ENTITY Nfr "𝔑" ><!--MATHEMATICAL FRAKTUR CAPITAL N --> +<!ENTITY NoBreak "⁠" ><!--WORD JOINER --> +<!ENTITY NonBreakingSpace " " ><!--NO-BREAK SPACE --> +<!ENTITY Nopf "ℕ" ><!--DOUBLE-STRUCK CAPITAL N --> +<!ENTITY Not "⫬" ><!--DOUBLE STROKE NOT SIGN --> +<!ENTITY NotCongruent "≢" ><!--NOT IDENTICAL TO --> +<!ENTITY NotCupCap "≭" ><!--NOT EQUIVALENT TO --> +<!ENTITY NotDoubleVerticalBar "∦" ><!--NOT PARALLEL TO --> +<!ENTITY NotElement "∉" ><!--NOT AN ELEMENT OF --> +<!ENTITY NotEqual "≠" ><!--NOT EQUAL TO --> +<!ENTITY NotEqualTilde "≂̸" ><!--MINUS TILDE with slash --> +<!ENTITY NotExists "∄" ><!--THERE DOES NOT EXIST --> +<!ENTITY NotGreater "≯" ><!--NOT GREATER-THAN --> +<!ENTITY NotGreaterEqual "≱" ><!--NEITHER GREATER-THAN NOR EQUAL TO --> +<!ENTITY NotGreaterFullEqual "≧̸" ><!--GREATER-THAN OVER EQUAL TO with slash --> +<!ENTITY NotGreaterGreater "≫̸" ><!--MUCH GREATER THAN with slash --> +<!ENTITY NotGreaterLess "≹" ><!--NEITHER GREATER-THAN NOR LESS-THAN --> +<!ENTITY NotGreaterSlantEqual "⩾̸" ><!--GREATER-THAN OR SLANTED EQUAL TO with slash --> +<!ENTITY NotGreaterTilde "≵" ><!--NEITHER GREATER-THAN NOR EQUIVALENT TO --> +<!ENTITY NotHumpDownHump "≎̸" ><!--GEOMETRICALLY EQUIVALENT TO with slash --> +<!ENTITY NotHumpEqual "≏̸" ><!--DIFFERENCE BETWEEN with slash --> +<!ENTITY NotLeftTriangle "⋪" ><!--NOT NORMAL SUBGROUP OF --> +<!ENTITY NotLeftTriangleBar "⧏̸" ><!--LEFT TRIANGLE BESIDE VERTICAL BAR with slash --> +<!ENTITY NotLeftTriangleEqual "⋬" ><!--NOT NORMAL SUBGROUP OF OR EQUAL TO --> +<!ENTITY NotLess "≮" ><!--NOT LESS-THAN --> +<!ENTITY NotLessEqual "≰" ><!--NEITHER LESS-THAN NOR EQUAL TO --> +<!ENTITY NotLessGreater "≸" ><!--NEITHER LESS-THAN NOR GREATER-THAN --> +<!ENTITY NotLessLess "≪̸" ><!--MUCH LESS THAN with slash --> +<!ENTITY NotLessSlantEqual "⩽̸" ><!--LESS-THAN OR SLANTED EQUAL TO with slash --> +<!ENTITY NotLessTilde "≴" ><!--NEITHER LESS-THAN NOR EQUIVALENT TO --> +<!ENTITY NotNestedGreaterGreater "⪢̸" ><!--DOUBLE NESTED GREATER-THAN with slash --> +<!ENTITY NotNestedLessLess "⪡̸" ><!--DOUBLE NESTED LESS-THAN with slash --> +<!ENTITY NotPrecedes "⊀" ><!--DOES NOT PRECEDE --> +<!ENTITY NotPrecedesEqual "⪯̸" ><!--PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash --> +<!ENTITY NotPrecedesSlantEqual "⋠" ><!--DOES NOT PRECEDE OR EQUAL --> +<!ENTITY NotReverseElement "∌" ><!--DOES NOT CONTAIN AS MEMBER --> +<!ENTITY NotRightTriangle "⋫" ><!--DOES NOT CONTAIN AS NORMAL SUBGROUP --> +<!ENTITY NotRightTriangleBar "⧐̸" ><!--VERTICAL BAR BESIDE RIGHT TRIANGLE with slash --> +<!ENTITY NotRightTriangleEqual "⋭" ><!--DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL --> +<!ENTITY NotSquareSubset "⊏̸" ><!--SQUARE IMAGE OF with slash --> +<!ENTITY NotSquareSubsetEqual "⋢" ><!--NOT SQUARE IMAGE OF OR EQUAL TO --> +<!ENTITY NotSquareSuperset "⊐̸" ><!--SQUARE ORIGINAL OF with slash --> +<!ENTITY NotSquareSupersetEqual "⋣" ><!--NOT SQUARE ORIGINAL OF OR EQUAL TO --> +<!ENTITY NotSubset "⊂⃒" ><!--SUBSET OF with vertical line --> +<!ENTITY NotSubsetEqual "⊈" ><!--NEITHER A SUBSET OF NOR EQUAL TO --> +<!ENTITY NotSucceeds "⊁" ><!--DOES NOT SUCCEED --> +<!ENTITY NotSucceedsEqual "⪰̸" ><!--SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash --> +<!ENTITY NotSucceedsSlantEqual "⋡" ><!--DOES NOT SUCCEED OR EQUAL --> +<!ENTITY NotSucceedsTilde "≿̸" ><!--SUCCEEDS OR EQUIVALENT TO with slash --> +<!ENTITY NotSuperset "⊃⃒" ><!--SUPERSET OF with vertical line --> +<!ENTITY NotSupersetEqual "⊉" ><!--NEITHER A SUPERSET OF NOR EQUAL TO --> +<!ENTITY NotTilde "≁" ><!--NOT TILDE --> +<!ENTITY NotTildeEqual "≄" ><!--NOT ASYMPTOTICALLY EQUAL TO --> +<!ENTITY NotTildeFullEqual "≇" ><!--NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO --> +<!ENTITY NotTildeTilde "≉" ><!--NOT ALMOST EQUAL TO --> +<!ENTITY NotVerticalBar "∤" ><!--DOES NOT DIVIDE --> +<!ENTITY Nscr "𝒩" ><!--MATHEMATICAL SCRIPT CAPITAL N --> +<!ENTITY Ntilde "Ñ" ><!--LATIN CAPITAL LETTER N WITH TILDE --> +<!ENTITY Nu "Ν" ><!--GREEK CAPITAL LETTER NU --> +<!ENTITY OElig "Œ" ><!--LATIN CAPITAL LIGATURE OE --> +<!ENTITY Oacute "Ó" ><!--LATIN CAPITAL LETTER O WITH ACUTE --> +<!ENTITY Ocirc "Ô" ><!--LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> +<!ENTITY Ocy "О" ><!--CYRILLIC CAPITAL LETTER O --> +<!ENTITY Odblac "Ő" ><!--LATIN CAPITAL LETTER O WITH DOUBLE ACUTE --> +<!ENTITY Ofr "𝔒" ><!--MATHEMATICAL FRAKTUR CAPITAL O --> +<!ENTITY Ograve "Ò" ><!--LATIN CAPITAL LETTER O WITH GRAVE --> +<!ENTITY Omacr "Ō" ><!--LATIN CAPITAL LETTER O WITH MACRON --> +<!ENTITY Omega "Ω" ><!--GREEK CAPITAL LETTER OMEGA --> +<!ENTITY Omicron "Ο" ><!--GREEK CAPITAL LETTER OMICRON --> +<!ENTITY Oopf "𝕆" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL O --> +<!ENTITY OpenCurlyDoubleQuote "“" ><!--LEFT DOUBLE QUOTATION MARK --> +<!ENTITY OpenCurlyQuote "‘" ><!--LEFT SINGLE QUOTATION MARK --> +<!ENTITY Or "⩔" ><!--DOUBLE LOGICAL OR --> +<!ENTITY Oscr "𝒪" ><!--MATHEMATICAL SCRIPT CAPITAL O --> +<!ENTITY Oslash "Ø" ><!--LATIN CAPITAL LETTER O WITH STROKE --> +<!ENTITY Otilde "Õ" ><!--LATIN CAPITAL LETTER O WITH TILDE --> +<!ENTITY Otimes "⨷" ><!--MULTIPLICATION SIGN IN DOUBLE CIRCLE --> +<!ENTITY Ouml "Ö" ><!--LATIN CAPITAL LETTER O WITH DIAERESIS --> +<!ENTITY OverBar "‾" ><!--OVERLINE --> +<!ENTITY OverBrace "⏞" ><!--TOP CURLY BRACKET --> +<!ENTITY OverBracket "⎴" ><!--TOP SQUARE BRACKET --> +<!ENTITY OverParenthesis "⏜" ><!--TOP PARENTHESIS --> +<!ENTITY PartialD "∂" ><!--PARTIAL DIFFERENTIAL --> +<!ENTITY Pcy "П" ><!--CYRILLIC CAPITAL LETTER PE --> +<!ENTITY Pfr "𝔓" ><!--MATHEMATICAL FRAKTUR CAPITAL P --> +<!ENTITY Phi "Φ" ><!--GREEK CAPITAL LETTER PHI --> +<!ENTITY Pi "Π" ><!--GREEK CAPITAL LETTER PI --> +<!ENTITY PlusMinus "±" ><!--PLUS-MINUS SIGN --> +<!ENTITY Poincareplane "ℌ" ><!--BLACK-LETTER CAPITAL H --> +<!ENTITY Popf "ℙ" ><!--DOUBLE-STRUCK CAPITAL P --> +<!ENTITY Pr "⪻" ><!--DOUBLE PRECEDES --> +<!ENTITY Precedes "≺" ><!--PRECEDES --> +<!ENTITY PrecedesEqual "⪯" ><!--PRECEDES ABOVE SINGLE-LINE EQUALS SIGN --> +<!ENTITY PrecedesSlantEqual "≼" ><!--PRECEDES OR EQUAL TO --> +<!ENTITY PrecedesTilde "≾" ><!--PRECEDES OR EQUIVALENT TO --> +<!ENTITY Prime "″" ><!--DOUBLE PRIME --> +<!ENTITY Product "∏" ><!--N-ARY PRODUCT --> +<!ENTITY Proportion "∷" ><!--PROPORTION --> +<!ENTITY Proportional "∝" ><!--PROPORTIONAL TO --> +<!ENTITY Pscr "𝒫" ><!--MATHEMATICAL SCRIPT CAPITAL P --> +<!ENTITY Psi "Ψ" ><!--GREEK CAPITAL LETTER PSI --> +<!ENTITY QUOT """ ><!--QUOTATION MARK --> +<!ENTITY Qfr "𝔔" ><!--MATHEMATICAL FRAKTUR CAPITAL Q --> +<!ENTITY Qopf "ℚ" ><!--DOUBLE-STRUCK CAPITAL Q --> +<!ENTITY Qscr "𝒬" ><!--MATHEMATICAL SCRIPT CAPITAL Q --> +<!ENTITY RBarr "⤐" ><!--RIGHTWARDS TWO-HEADED TRIPLE DASH ARROW --> +<!ENTITY REG "®" ><!--REGISTERED SIGN --> +<!ENTITY Racute "Ŕ" ><!--LATIN CAPITAL LETTER R WITH ACUTE --> +<!ENTITY Rang "⟫" ><!--MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET --> +<!ENTITY Rarr "↠" ><!--RIGHTWARDS TWO HEADED ARROW --> +<!ENTITY Rarrtl "⤖" ><!--RIGHTWARDS TWO-HEADED ARROW WITH TAIL --> +<!ENTITY Rcaron "Ř" ><!--LATIN CAPITAL LETTER R WITH CARON --> +<!ENTITY Rcedil "Ŗ" ><!--LATIN CAPITAL LETTER R WITH CEDILLA --> +<!ENTITY Rcy "Р" ><!--CYRILLIC CAPITAL LETTER ER --> +<!ENTITY Re "ℜ" ><!--BLACK-LETTER CAPITAL R --> +<!ENTITY ReverseElement "∋" ><!--CONTAINS AS MEMBER --> +<!ENTITY ReverseEquilibrium "⇋" ><!--LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON --> +<!ENTITY ReverseUpEquilibrium "⥯" ><!--DOWNWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT --> +<!ENTITY Rfr "ℜ" ><!--BLACK-LETTER CAPITAL R --> +<!ENTITY Rho "Ρ" ><!--GREEK CAPITAL LETTER RHO --> +<!ENTITY RightAngleBracket "⟩" ><!--MATHEMATICAL RIGHT ANGLE BRACKET --> +<!ENTITY RightArrow "→" ><!--RIGHTWARDS ARROW --> +<!ENTITY RightArrowBar "⇥" ><!--RIGHTWARDS ARROW TO BAR --> +<!ENTITY RightArrowLeftArrow "⇄" ><!--RIGHTWARDS ARROW OVER LEFTWARDS ARROW --> +<!ENTITY RightCeiling "⌉" ><!--RIGHT CEILING --> +<!ENTITY RightDoubleBracket "⟧" ><!--MATHEMATICAL RIGHT WHITE SQUARE BRACKET --> +<!ENTITY RightDownTeeVector "⥝" ><!--DOWNWARDS HARPOON WITH BARB RIGHT FROM BAR --> +<!ENTITY RightDownVector "⇂" ><!--DOWNWARDS HARPOON WITH BARB RIGHTWARDS --> +<!ENTITY RightDownVectorBar "⥕" ><!--DOWNWARDS HARPOON WITH BARB RIGHT TO BAR --> +<!ENTITY RightFloor "⌋" ><!--RIGHT FLOOR --> +<!ENTITY RightTee "⊢" ><!--RIGHT TACK --> +<!ENTITY RightTeeArrow "↦" ><!--RIGHTWARDS ARROW FROM BAR --> +<!ENTITY RightTeeVector "⥛" ><!--RIGHTWARDS HARPOON WITH BARB UP FROM BAR --> +<!ENTITY RightTriangle "⊳" ><!--CONTAINS AS NORMAL SUBGROUP --> +<!ENTITY RightTriangleBar "⧐" ><!--VERTICAL BAR BESIDE RIGHT TRIANGLE --> +<!ENTITY RightTriangleEqual "⊵" ><!--CONTAINS AS NORMAL SUBGROUP OR EQUAL TO --> +<!ENTITY RightUpDownVector "⥏" ><!--UP BARB RIGHT DOWN BARB RIGHT HARPOON --> +<!ENTITY RightUpTeeVector "⥜" ><!--UPWARDS HARPOON WITH BARB RIGHT FROM BAR --> +<!ENTITY RightUpVector "↾" ><!--UPWARDS HARPOON WITH BARB RIGHTWARDS --> +<!ENTITY RightUpVectorBar "⥔" ><!--UPWARDS HARPOON WITH BARB RIGHT TO BAR --> +<!ENTITY RightVector "⇀" ><!--RIGHTWARDS HARPOON WITH BARB UPWARDS --> +<!ENTITY RightVectorBar "⥓" ><!--RIGHTWARDS HARPOON WITH BARB UP TO BAR --> +<!ENTITY Rightarrow "⇒" ><!--RIGHTWARDS DOUBLE ARROW --> +<!ENTITY Ropf "ℝ" ><!--DOUBLE-STRUCK CAPITAL R --> +<!ENTITY RoundImplies "⥰" ><!--RIGHT DOUBLE ARROW WITH ROUNDED HEAD --> +<!ENTITY Rrightarrow "⇛" ><!--RIGHTWARDS TRIPLE ARROW --> +<!ENTITY Rscr "ℛ" ><!--SCRIPT CAPITAL R --> +<!ENTITY Rsh "↱" ><!--UPWARDS ARROW WITH TIP RIGHTWARDS --> +<!ENTITY RuleDelayed "⧴" ><!--RULE-DELAYED --> +<!ENTITY SHCHcy "Щ" ><!--CYRILLIC CAPITAL LETTER SHCHA --> +<!ENTITY SHcy "Ш" ><!--CYRILLIC CAPITAL LETTER SHA --> +<!ENTITY SOFTcy "Ь" ><!--CYRILLIC CAPITAL LETTER SOFT SIGN --> +<!ENTITY Sacute "Ś" ><!--LATIN CAPITAL LETTER S WITH ACUTE --> +<!ENTITY Sc "⪼" ><!--DOUBLE SUCCEEDS --> +<!ENTITY Scaron "Š" ><!--LATIN CAPITAL LETTER S WITH CARON --> +<!ENTITY Scedil "Ş" ><!--LATIN CAPITAL LETTER S WITH CEDILLA --> +<!ENTITY Scirc "Ŝ" ><!--LATIN CAPITAL LETTER S WITH CIRCUMFLEX --> +<!ENTITY Scy "С" ><!--CYRILLIC CAPITAL LETTER ES --> +<!ENTITY Sfr "𝔖" ><!--MATHEMATICAL FRAKTUR CAPITAL S --> +<!ENTITY ShortDownArrow "↓" ><!--DOWNWARDS ARROW --> +<!ENTITY ShortLeftArrow "←" ><!--LEFTWARDS ARROW --> +<!ENTITY ShortRightArrow "→" ><!--RIGHTWARDS ARROW --> +<!ENTITY ShortUpArrow "↑" ><!--UPWARDS ARROW --> +<!ENTITY Sigma "Σ" ><!--GREEK CAPITAL LETTER SIGMA --> +<!ENTITY SmallCircle "∘" ><!--RING OPERATOR --> +<!ENTITY Sopf "𝕊" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL S --> +<!ENTITY Sqrt "√" ><!--SQUARE ROOT --> +<!ENTITY Square "□" ><!--WHITE SQUARE --> +<!ENTITY SquareIntersection "⊓" ><!--SQUARE CAP --> +<!ENTITY SquareSubset "⊏" ><!--SQUARE IMAGE OF --> +<!ENTITY SquareSubsetEqual "⊑" ><!--SQUARE IMAGE OF OR EQUAL TO --> +<!ENTITY SquareSuperset "⊐" ><!--SQUARE ORIGINAL OF --> +<!ENTITY SquareSupersetEqual "⊒" ><!--SQUARE ORIGINAL OF OR EQUAL TO --> +<!ENTITY SquareUnion "⊔" ><!--SQUARE CUP --> +<!ENTITY Sscr "𝒮" ><!--MATHEMATICAL SCRIPT CAPITAL S --> +<!ENTITY Star "⋆" ><!--STAR OPERATOR --> +<!ENTITY Sub "⋐" ><!--DOUBLE SUBSET --> +<!ENTITY Subset "⋐" ><!--DOUBLE SUBSET --> +<!ENTITY SubsetEqual "⊆" ><!--SUBSET OF OR EQUAL TO --> +<!ENTITY Succeeds "≻" ><!--SUCCEEDS --> +<!ENTITY SucceedsEqual "⪰" ><!--SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN --> +<!ENTITY SucceedsSlantEqual "≽" ><!--SUCCEEDS OR EQUAL TO --> +<!ENTITY SucceedsTilde "≿" ><!--SUCCEEDS OR EQUIVALENT TO --> +<!ENTITY SuchThat "∋" ><!--CONTAINS AS MEMBER --> +<!ENTITY Sum "∑" ><!--N-ARY SUMMATION --> +<!ENTITY Sup "⋑" ><!--DOUBLE SUPERSET --> +<!ENTITY Superset "⊃" ><!--SUPERSET OF --> +<!ENTITY SupersetEqual "⊇" ><!--SUPERSET OF OR EQUAL TO --> +<!ENTITY Supset "⋑" ><!--DOUBLE SUPERSET --> +<!ENTITY THORN "Þ" ><!--LATIN CAPITAL LETTER THORN --> +<!ENTITY TRADE "™" ><!--TRADE MARK SIGN --> +<!ENTITY TSHcy "Ћ" ><!--CYRILLIC CAPITAL LETTER TSHE --> +<!ENTITY TScy "Ц" ><!--CYRILLIC CAPITAL LETTER TSE --> +<!ENTITY Tab "	" ><!--CHARACTER TABULATION --> +<!ENTITY Tau "Τ" ><!--GREEK CAPITAL LETTER TAU --> +<!ENTITY Tcaron "Ť" ><!--LATIN CAPITAL LETTER T WITH CARON --> +<!ENTITY Tcedil "Ţ" ><!--LATIN CAPITAL LETTER T WITH CEDILLA --> +<!ENTITY Tcy "Т" ><!--CYRILLIC CAPITAL LETTER TE --> +<!ENTITY Tfr "𝔗" ><!--MATHEMATICAL FRAKTUR CAPITAL T --> +<!ENTITY Therefore "∴" ><!--THEREFORE --> +<!ENTITY Theta "Θ" ><!--GREEK CAPITAL LETTER THETA --> +<!ENTITY ThickSpace "  " ><!--space of width 5/18 em --> +<!ENTITY ThinSpace " " ><!--THIN SPACE --> +<!ENTITY Tilde "∼" ><!--TILDE OPERATOR --> +<!ENTITY TildeEqual "≃" ><!--ASYMPTOTICALLY EQUAL TO --> +<!ENTITY TildeFullEqual "≅" ><!--APPROXIMATELY EQUAL TO --> +<!ENTITY TildeTilde "≈" ><!--ALMOST EQUAL TO --> +<!ENTITY Topf "𝕋" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL T --> +<!ENTITY TripleDot "⃛" ><!--COMBINING THREE DOTS ABOVE --> +<!ENTITY Tscr "𝒯" ><!--MATHEMATICAL SCRIPT CAPITAL T --> +<!ENTITY Tstrok "Ŧ" ><!--LATIN CAPITAL LETTER T WITH STROKE --> +<!ENTITY Uacute "Ú" ><!--LATIN CAPITAL LETTER U WITH ACUTE --> +<!ENTITY Uarr "↟" ><!--UPWARDS TWO HEADED ARROW --> +<!ENTITY Uarrocir "⥉" ><!--UPWARDS TWO-HEADED ARROW FROM SMALL CIRCLE --> +<!ENTITY Ubrcy "Ў" ><!--CYRILLIC CAPITAL LETTER SHORT U --> +<!ENTITY Ubreve "Ŭ" ><!--LATIN CAPITAL LETTER U WITH BREVE --> +<!ENTITY Ucirc "Û" ><!--LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> +<!ENTITY Ucy "У" ><!--CYRILLIC CAPITAL LETTER U --> +<!ENTITY Udblac "Ű" ><!--LATIN CAPITAL LETTER U WITH DOUBLE ACUTE --> +<!ENTITY Ufr "𝔘" ><!--MATHEMATICAL FRAKTUR CAPITAL U --> +<!ENTITY Ugrave "Ù" ><!--LATIN CAPITAL LETTER U WITH GRAVE --> +<!ENTITY Umacr "Ū" ><!--LATIN CAPITAL LETTER U WITH MACRON --> +<!ENTITY UnderBar "_" ><!--LOW LINE --> +<!ENTITY UnderBrace "⏟" ><!--BOTTOM CURLY BRACKET --> +<!ENTITY UnderBracket "⎵" ><!--BOTTOM SQUARE BRACKET --> +<!ENTITY UnderParenthesis "⏝" ><!--BOTTOM PARENTHESIS --> +<!ENTITY Union "⋃" ><!--N-ARY UNION --> +<!ENTITY UnionPlus "⊎" ><!--MULTISET UNION --> +<!ENTITY Uogon "Ų" ><!--LATIN CAPITAL LETTER U WITH OGONEK --> +<!ENTITY Uopf "𝕌" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL U --> +<!ENTITY UpArrow "↑" ><!--UPWARDS ARROW --> +<!ENTITY UpArrowBar "⤒" ><!--UPWARDS ARROW TO BAR --> +<!ENTITY UpArrowDownArrow "⇅" ><!--UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW --> +<!ENTITY UpDownArrow "↕" ><!--UP DOWN ARROW --> +<!ENTITY UpEquilibrium "⥮" ><!--UPWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT --> +<!ENTITY UpTee "⊥" ><!--UP TACK --> +<!ENTITY UpTeeArrow "↥" ><!--UPWARDS ARROW FROM BAR --> +<!ENTITY Uparrow "⇑" ><!--UPWARDS DOUBLE ARROW --> +<!ENTITY Updownarrow "⇕" ><!--UP DOWN DOUBLE ARROW --> +<!ENTITY UpperLeftArrow "↖" ><!--NORTH WEST ARROW --> +<!ENTITY UpperRightArrow "↗" ><!--NORTH EAST ARROW --> +<!ENTITY Upsi "ϒ" ><!--GREEK UPSILON WITH HOOK SYMBOL --> +<!ENTITY Upsilon "Υ" ><!--GREEK CAPITAL LETTER UPSILON --> +<!ENTITY Uring "Ů" ><!--LATIN CAPITAL LETTER U WITH RING ABOVE --> +<!ENTITY Uscr "𝒰" ><!--MATHEMATICAL SCRIPT CAPITAL U --> +<!ENTITY Utilde "Ũ" ><!--LATIN CAPITAL LETTER U WITH TILDE --> +<!ENTITY Uuml "Ü" ><!--LATIN CAPITAL LETTER U WITH DIAERESIS --> +<!ENTITY VDash "⊫" ><!--DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE --> +<!ENTITY Vbar "⫫" ><!--DOUBLE UP TACK --> +<!ENTITY Vcy "В" ><!--CYRILLIC CAPITAL LETTER VE --> +<!ENTITY Vdash "⊩" ><!--FORCES --> +<!ENTITY Vdashl "⫦" ><!--LONG DASH FROM LEFT MEMBER OF DOUBLE VERTICAL --> +<!ENTITY Vee "⋁" ><!--N-ARY LOGICAL OR --> +<!ENTITY Verbar "‖" ><!--DOUBLE VERTICAL LINE --> +<!ENTITY Vert "‖" ><!--DOUBLE VERTICAL LINE --> +<!ENTITY VerticalBar "∣" ><!--DIVIDES --> +<!ENTITY VerticalLine "|" ><!--VERTICAL LINE --> +<!ENTITY VerticalSeparator "❘" ><!--LIGHT VERTICAL BAR --> +<!ENTITY VerticalTilde "≀" ><!--WREATH PRODUCT --> +<!ENTITY VeryThinSpace " " ><!--HAIR SPACE --> +<!ENTITY Vfr "𝔙" ><!--MATHEMATICAL FRAKTUR CAPITAL V --> +<!ENTITY Vopf "𝕍" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL V --> +<!ENTITY Vscr "𝒱" ><!--MATHEMATICAL SCRIPT CAPITAL V --> +<!ENTITY Vvdash "⊪" ><!--TRIPLE VERTICAL BAR RIGHT TURNSTILE --> +<!ENTITY Wcirc "Ŵ" ><!--LATIN CAPITAL LETTER W WITH CIRCUMFLEX --> +<!ENTITY Wedge "⋀" ><!--N-ARY LOGICAL AND --> +<!ENTITY Wfr "𝔚" ><!--MATHEMATICAL FRAKTUR CAPITAL W --> +<!ENTITY Wopf "𝕎" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL W --> +<!ENTITY Wscr "𝒲" ><!--MATHEMATICAL SCRIPT CAPITAL W --> +<!ENTITY Xfr "𝔛" ><!--MATHEMATICAL FRAKTUR CAPITAL X --> +<!ENTITY Xi "Ξ" ><!--GREEK CAPITAL LETTER XI --> +<!ENTITY Xopf "𝕏" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL X --> +<!ENTITY Xscr "𝒳" ><!--MATHEMATICAL SCRIPT CAPITAL X --> +<!ENTITY YAcy "Я" ><!--CYRILLIC CAPITAL LETTER YA --> +<!ENTITY YIcy "Ї" ><!--CYRILLIC CAPITAL LETTER YI --> +<!ENTITY YUcy "Ю" ><!--CYRILLIC CAPITAL LETTER YU --> +<!ENTITY Yacute "Ý" ><!--LATIN CAPITAL LETTER Y WITH ACUTE --> +<!ENTITY Ycirc "Ŷ" ><!--LATIN CAPITAL LETTER Y WITH CIRCUMFLEX --> +<!ENTITY Ycy "Ы" ><!--CYRILLIC CAPITAL LETTER YERU --> +<!ENTITY Yfr "𝔜" ><!--MATHEMATICAL FRAKTUR CAPITAL Y --> +<!ENTITY Yopf "𝕐" ><!--MATHEMATICAL DOUBLE-STRUCK CAPITAL Y --> +<!ENTITY Yscr "𝒴" ><!--MATHEMATICAL SCRIPT CAPITAL Y --> +<!ENTITY Yuml "Ÿ" ><!--LATIN CAPITAL LETTER Y WITH DIAERESIS --> +<!ENTITY ZHcy "Ж" ><!--CYRILLIC CAPITAL LETTER ZHE --> +<!ENTITY Zacute "Ź" ><!--LATIN CAPITAL LETTER Z WITH ACUTE --> +<!ENTITY Zcaron "Ž" ><!--LATIN CAPITAL LETTER Z WITH CARON --> +<!ENTITY Zcy "З" ><!--CYRILLIC CAPITAL LETTER ZE --> +<!ENTITY Zdot "Ż" ><!--LATIN CAPITAL LETTER Z WITH DOT ABOVE --> +<!ENTITY ZeroWidthSpace "​" ><!--ZERO WIDTH SPACE --> +<!ENTITY Zeta "Ζ" ><!--GREEK CAPITAL LETTER ZETA --> +<!ENTITY Zfr "ℨ" ><!--BLACK-LETTER CAPITAL Z --> +<!ENTITY Zopf "ℤ" ><!--DOUBLE-STRUCK CAPITAL Z --> +<!ENTITY Zscr "𝒵" ><!--MATHEMATICAL SCRIPT CAPITAL Z --> +<!ENTITY aacute "á" ><!--LATIN SMALL LETTER A WITH ACUTE --> +<!ENTITY abreve "ă" ><!--LATIN SMALL LETTER A WITH BREVE --> +<!ENTITY ac "∾" ><!--INVERTED LAZY S --> +<!ENTITY acE "∾̳" ><!--INVERTED LAZY S with double underline --> +<!ENTITY acd "∿" ><!--SINE WAVE --> +<!ENTITY acirc "â" ><!--LATIN SMALL LETTER A WITH CIRCUMFLEX --> +<!ENTITY acute "´" ><!--ACUTE ACCENT --> +<!ENTITY acy "а" ><!--CYRILLIC SMALL LETTER A --> +<!ENTITY aelig "æ" ><!--LATIN SMALL LETTER AE --> +<!ENTITY af "⁡" ><!--FUNCTION APPLICATION --> +<!ENTITY afr "𝔞" ><!--MATHEMATICAL FRAKTUR SMALL A --> +<!ENTITY agrave "à" ><!--LATIN SMALL LETTER A WITH GRAVE --> +<!ENTITY alefsym "ℵ" ><!--ALEF SYMBOL --> +<!ENTITY aleph "ℵ" ><!--ALEF SYMBOL --> +<!ENTITY alpha "α" ><!--GREEK SMALL LETTER ALPHA --> +<!ENTITY amacr "ā" ><!--LATIN SMALL LETTER A WITH MACRON --> +<!ENTITY amalg "⨿" ><!--AMALGAMATION OR COPRODUCT --> +<!ENTITY amp "&#38;" ><!--AMPERSAND --> +<!ENTITY and "∧" ><!--LOGICAL AND --> +<!ENTITY andand "⩕" ><!--TWO INTERSECTING LOGICAL AND --> +<!ENTITY andd "⩜" ><!--LOGICAL AND WITH HORIZONTAL DASH --> +<!ENTITY andslope "⩘" ><!--SLOPING LARGE AND --> +<!ENTITY andv "⩚" ><!--LOGICAL AND WITH MIDDLE STEM --> +<!ENTITY ang "∠" ><!--ANGLE --> +<!ENTITY ange "⦤" ><!--ANGLE WITH UNDERBAR --> +<!ENTITY angle "∠" ><!--ANGLE --> +<!ENTITY angmsd "∡" ><!--MEASURED ANGLE --> +<!ENTITY angmsdaa "⦨" ><!--MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND RIGHT --> +<!ENTITY angmsdab "⦩" ><!--MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND LEFT --> +<!ENTITY angmsdac "⦪" ><!--MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND RIGHT --> +<!ENTITY angmsdad "⦫" ><!--MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND LEFT --> +<!ENTITY angmsdae "⦬" ><!--MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND UP --> +<!ENTITY angmsdaf "⦭" ><!--MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND UP --> +<!ENTITY angmsdag "⦮" ><!--MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING RIGHT AND DOWN --> +<!ENTITY angmsdah "⦯" ><!--MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING LEFT AND DOWN --> +<!ENTITY angrt "∟" ><!--RIGHT ANGLE --> +<!ENTITY angrtvb "⊾" ><!--RIGHT ANGLE WITH ARC --> +<!ENTITY angrtvbd "⦝" ><!--MEASURED RIGHT ANGLE WITH DOT --> +<!ENTITY angsph "∢" ><!--SPHERICAL ANGLE --> +<!ENTITY angst "Å" ><!--LATIN CAPITAL LETTER A WITH RING ABOVE --> +<!ENTITY angzarr "⍼" ><!--RIGHT ANGLE WITH DOWNWARDS ZIGZAG ARROW --> +<!ENTITY aogon "ą" ><!--LATIN SMALL LETTER A WITH OGONEK --> +<!ENTITY aopf "𝕒" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL A --> +<!ENTITY ap "≈" ><!--ALMOST EQUAL TO --> +<!ENTITY apE "⩰" ><!--APPROXIMATELY EQUAL OR EQUAL TO --> +<!ENTITY apacir "⩯" ><!--ALMOST EQUAL TO WITH CIRCUMFLEX ACCENT --> +<!ENTITY ape "≊" ><!--ALMOST EQUAL OR EQUAL TO --> +<!ENTITY apid "≋" ><!--TRIPLE TILDE --> +<!ENTITY apos "'" ><!--APOSTROPHE --> +<!ENTITY approx "≈" ><!--ALMOST EQUAL TO --> +<!ENTITY approxeq "≊" ><!--ALMOST EQUAL OR EQUAL TO --> +<!ENTITY aring "å" ><!--LATIN SMALL LETTER A WITH RING ABOVE --> +<!ENTITY ascr "𝒶" ><!--MATHEMATICAL SCRIPT SMALL A --> +<!ENTITY ast "*" ><!--ASTERISK --> +<!ENTITY asymp "≈" ><!--ALMOST EQUAL TO --> +<!ENTITY asympeq "≍" ><!--EQUIVALENT TO --> +<!ENTITY atilde "ã" ><!--LATIN SMALL LETTER A WITH TILDE --> +<!ENTITY auml "ä" ><!--LATIN SMALL LETTER A WITH DIAERESIS --> +<!ENTITY awconint "∳" ><!--ANTICLOCKWISE CONTOUR INTEGRAL --> +<!ENTITY awint "⨑" ><!--ANTICLOCKWISE INTEGRATION --> +<!ENTITY bNot "⫭" ><!--REVERSED DOUBLE STROKE NOT SIGN --> +<!ENTITY backcong "≌" ><!--ALL EQUAL TO --> +<!ENTITY backepsilon "϶" ><!--GREEK REVERSED LUNATE EPSILON SYMBOL --> +<!ENTITY backprime "‵" ><!--REVERSED PRIME --> +<!ENTITY backsim "∽" ><!--REVERSED TILDE --> +<!ENTITY backsimeq "⋍" ><!--REVERSED TILDE EQUALS --> +<!ENTITY barvee "⊽" ><!--NOR --> +<!ENTITY barwed "⌅" ><!--PROJECTIVE --> +<!ENTITY barwedge "⌅" ><!--PROJECTIVE --> +<!ENTITY bbrk "⎵" ><!--BOTTOM SQUARE BRACKET --> +<!ENTITY bbrktbrk "⎶" ><!--BOTTOM SQUARE BRACKET OVER TOP SQUARE BRACKET --> +<!ENTITY bcong "≌" ><!--ALL EQUAL TO --> +<!ENTITY bcy "б" ><!--CYRILLIC SMALL LETTER BE --> +<!ENTITY bdquo "„" ><!--DOUBLE LOW-9 QUOTATION MARK --> +<!ENTITY becaus "∵" ><!--BECAUSE --> +<!ENTITY because "∵" ><!--BECAUSE --> +<!ENTITY bemptyv "⦰" ><!--REVERSED EMPTY SET --> +<!ENTITY bepsi "϶" ><!--GREEK REVERSED LUNATE EPSILON SYMBOL --> +<!ENTITY bernou "ℬ" ><!--SCRIPT CAPITAL B --> +<!ENTITY beta "β" ><!--GREEK SMALL LETTER BETA --> +<!ENTITY beth "ℶ" ><!--BET SYMBOL --> +<!ENTITY between "≬" ><!--BETWEEN --> +<!ENTITY bfr "𝔟" ><!--MATHEMATICAL FRAKTUR SMALL B --> +<!ENTITY bigcap "⋂" ><!--N-ARY INTERSECTION --> +<!ENTITY bigcirc "◯" ><!--LARGE CIRCLE --> +<!ENTITY bigcup "⋃" ><!--N-ARY UNION --> +<!ENTITY bigodot "⨀" ><!--N-ARY CIRCLED DOT OPERATOR --> +<!ENTITY bigoplus "⨁" ><!--N-ARY CIRCLED PLUS OPERATOR --> +<!ENTITY bigotimes "⨂" ><!--N-ARY CIRCLED TIMES OPERATOR --> +<!ENTITY bigsqcup "⨆" ><!--N-ARY SQUARE UNION OPERATOR --> +<!ENTITY bigstar "★" ><!--BLACK STAR --> +<!ENTITY bigtriangledown "▽" ><!--WHITE DOWN-POINTING TRIANGLE --> +<!ENTITY bigtriangleup "△" ><!--WHITE UP-POINTING TRIANGLE --> +<!ENTITY biguplus "⨄" ><!--N-ARY UNION OPERATOR WITH PLUS --> +<!ENTITY bigvee "⋁" ><!--N-ARY LOGICAL OR --> +<!ENTITY bigwedge "⋀" ><!--N-ARY LOGICAL AND --> +<!ENTITY bkarow "⤍" ><!--RIGHTWARDS DOUBLE DASH ARROW --> +<!ENTITY blacklozenge "⧫" ><!--BLACK LOZENGE --> +<!ENTITY blacksquare "▪" ><!--BLACK SMALL SQUARE --> +<!ENTITY blacktriangle "▴" ><!--BLACK UP-POINTING SMALL TRIANGLE --> +<!ENTITY blacktriangledown "▾" ><!--BLACK DOWN-POINTING SMALL TRIANGLE --> +<!ENTITY blacktriangleleft "◂" ><!--BLACK LEFT-POINTING SMALL TRIANGLE --> +<!ENTITY blacktriangleright "▸" ><!--BLACK RIGHT-POINTING SMALL TRIANGLE --> +<!ENTITY blank "␣" ><!--OPEN BOX --> +<!ENTITY blk12 "▒" ><!--MEDIUM SHADE --> +<!ENTITY blk14 "░" ><!--LIGHT SHADE --> +<!ENTITY blk34 "▓" ><!--DARK SHADE --> +<!ENTITY block "█" ><!--FULL BLOCK --> +<!ENTITY bne "=⃥" ><!--EQUALS SIGN with reverse slash --> +<!ENTITY bnequiv "≡⃥" ><!--IDENTICAL TO with reverse slash --> +<!ENTITY bnot "⌐" ><!--REVERSED NOT SIGN --> +<!ENTITY bopf "𝕓" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL B --> +<!ENTITY bot "⊥" ><!--UP TACK --> +<!ENTITY bottom "⊥" ><!--UP TACK --> +<!ENTITY bowtie "⋈" ><!--BOWTIE --> +<!ENTITY boxDL "╗" ><!--BOX DRAWINGS DOUBLE DOWN AND LEFT --> +<!ENTITY boxDR "╔" ><!--BOX DRAWINGS DOUBLE DOWN AND RIGHT --> +<!ENTITY boxDl "╖" ><!--BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE --> +<!ENTITY boxDr "╓" ><!--BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE --> +<!ENTITY boxH "═" ><!--BOX DRAWINGS DOUBLE HORIZONTAL --> +<!ENTITY boxHD "╦" ><!--BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL --> +<!ENTITY boxHU "╩" ><!--BOX DRAWINGS DOUBLE UP AND HORIZONTAL --> +<!ENTITY boxHd "╤" ><!--BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE --> +<!ENTITY boxHu "╧" ><!--BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE --> +<!ENTITY boxUL "╝" ><!--BOX DRAWINGS DOUBLE UP AND LEFT --> +<!ENTITY boxUR "╚" ><!--BOX DRAWINGS DOUBLE UP AND RIGHT --> +<!ENTITY boxUl "╜" ><!--BOX DRAWINGS UP DOUBLE AND LEFT SINGLE --> +<!ENTITY boxUr "╙" ><!--BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE --> +<!ENTITY boxV "║" ><!--BOX DRAWINGS DOUBLE VERTICAL --> +<!ENTITY boxVH "╬" ><!--BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL --> +<!ENTITY boxVL "╣" ><!--BOX DRAWINGS DOUBLE VERTICAL AND LEFT --> +<!ENTITY boxVR "╠" ><!--BOX DRAWINGS DOUBLE VERTICAL AND RIGHT --> +<!ENTITY boxVh "╫" ><!--BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE --> +<!ENTITY boxVl "╢" ><!--BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE --> +<!ENTITY boxVr "╟" ><!--BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE --> +<!ENTITY boxbox "⧉" ><!--TWO JOINED SQUARES --> +<!ENTITY boxdL "╕" ><!--BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE --> +<!ENTITY boxdR "╒" ><!--BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE --> +<!ENTITY boxdl "┐" ><!--BOX DRAWINGS LIGHT DOWN AND LEFT --> +<!ENTITY boxdr "┌" ><!--BOX DRAWINGS LIGHT DOWN AND RIGHT --> +<!ENTITY boxh "─" ><!--BOX DRAWINGS LIGHT HORIZONTAL --> +<!ENTITY boxhD "╥" ><!--BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE --> +<!ENTITY boxhU "╨" ><!--BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE --> +<!ENTITY boxhd "┬" ><!--BOX DRAWINGS LIGHT DOWN AND HORIZONTAL --> +<!ENTITY boxhu "┴" ><!--BOX DRAWINGS LIGHT UP AND HORIZONTAL --> +<!ENTITY boxminus "⊟" ><!--SQUARED MINUS --> +<!ENTITY boxplus "⊞" ><!--SQUARED PLUS --> +<!ENTITY boxtimes "⊠" ><!--SQUARED TIMES --> +<!ENTITY boxuL "╛" ><!--BOX DRAWINGS UP SINGLE AND LEFT DOUBLE --> +<!ENTITY boxuR "╘" ><!--BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE --> +<!ENTITY boxul "┘" ><!--BOX DRAWINGS LIGHT UP AND LEFT --> +<!ENTITY boxur "└" ><!--BOX DRAWINGS LIGHT UP AND RIGHT --> +<!ENTITY boxv "│" ><!--BOX DRAWINGS LIGHT VERTICAL --> +<!ENTITY boxvH "╪" ><!--BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE --> +<!ENTITY boxvL "╡" ><!--BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE --> +<!ENTITY boxvR "╞" ><!--BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE --> +<!ENTITY boxvh "┼" ><!--BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL --> +<!ENTITY boxvl "┤" ><!--BOX DRAWINGS LIGHT VERTICAL AND LEFT --> +<!ENTITY boxvr "├" ><!--BOX DRAWINGS LIGHT VERTICAL AND RIGHT --> +<!ENTITY bprime "‵" ><!--REVERSED PRIME --> +<!ENTITY breve "˘" ><!--BREVE --> +<!ENTITY brvbar "¦" ><!--BROKEN BAR --> +<!ENTITY bscr "𝒷" ><!--MATHEMATICAL SCRIPT SMALL B --> +<!ENTITY bsemi "⁏" ><!--REVERSED SEMICOLON --> +<!ENTITY bsim "∽" ><!--REVERSED TILDE --> +<!ENTITY bsime "⋍" ><!--REVERSED TILDE EQUALS --> +<!ENTITY bsol "\" ><!--REVERSE SOLIDUS --> +<!ENTITY bsolb "⧅" ><!--SQUARED FALLING DIAGONAL SLASH --> +<!ENTITY bsolhsub "⟈" ><!--REVERSE SOLIDUS PRECEDING SUBSET --> +<!ENTITY bull "•" ><!--BULLET --> +<!ENTITY bullet "•" ><!--BULLET --> +<!ENTITY bump "≎" ><!--GEOMETRICALLY EQUIVALENT TO --> +<!ENTITY bumpE "⪮" ><!--EQUALS SIGN WITH BUMPY ABOVE --> +<!ENTITY bumpe "≏" ><!--DIFFERENCE BETWEEN --> +<!ENTITY bumpeq "≏" ><!--DIFFERENCE BETWEEN --> +<!ENTITY cacute "ć" ><!--LATIN SMALL LETTER C WITH ACUTE --> +<!ENTITY cap "∩" ><!--INTERSECTION --> +<!ENTITY capand "⩄" ><!--INTERSECTION WITH LOGICAL AND --> +<!ENTITY capbrcup "⩉" ><!--INTERSECTION ABOVE BAR ABOVE UNION --> +<!ENTITY capcap "⩋" ><!--INTERSECTION BESIDE AND JOINED WITH INTERSECTION --> +<!ENTITY capcup "⩇" ><!--INTERSECTION ABOVE UNION --> +<!ENTITY capdot "⩀" ><!--INTERSECTION WITH DOT --> +<!ENTITY caps "∩︀" ><!--INTERSECTION with serifs --> +<!ENTITY caret "⁁" ><!--CARET INSERTION POINT --> +<!ENTITY caron "ˇ" ><!--CARON --> +<!ENTITY ccaps "⩍" ><!--CLOSED INTERSECTION WITH SERIFS --> +<!ENTITY ccaron "č" ><!--LATIN SMALL LETTER C WITH CARON --> +<!ENTITY ccedil "ç" ><!--LATIN SMALL LETTER C WITH CEDILLA --> +<!ENTITY ccirc "ĉ" ><!--LATIN SMALL LETTER C WITH CIRCUMFLEX --> +<!ENTITY ccups "⩌" ><!--CLOSED UNION WITH SERIFS --> +<!ENTITY ccupssm "⩐" ><!--CLOSED UNION WITH SERIFS AND SMASH PRODUCT --> +<!ENTITY cdot "ċ" ><!--LATIN SMALL LETTER C WITH DOT ABOVE --> +<!ENTITY cedil "¸" ><!--CEDILLA --> +<!ENTITY cemptyv "⦲" ><!--EMPTY SET WITH SMALL CIRCLE ABOVE --> +<!ENTITY cent "¢" ><!--CENT SIGN --> +<!ENTITY centerdot "·" ><!--MIDDLE DOT --> +<!ENTITY cfr "𝔠" ><!--MATHEMATICAL FRAKTUR SMALL C --> +<!ENTITY chcy "ч" ><!--CYRILLIC SMALL LETTER CHE --> +<!ENTITY check "✓" ><!--CHECK MARK --> +<!ENTITY checkmark "✓" ><!--CHECK MARK --> +<!ENTITY chi "χ" ><!--GREEK SMALL LETTER CHI --> +<!ENTITY cir "○" ><!--WHITE CIRCLE --> +<!ENTITY cirE "⧃" ><!--CIRCLE WITH TWO HORIZONTAL STROKES TO THE RIGHT --> +<!ENTITY circ "ˆ" ><!--MODIFIER LETTER CIRCUMFLEX ACCENT --> +<!ENTITY circeq "≗" ><!--RING EQUAL TO --> +<!ENTITY circlearrowleft "↺" ><!--ANTICLOCKWISE OPEN CIRCLE ARROW --> +<!ENTITY circlearrowright "↻" ><!--CLOCKWISE OPEN CIRCLE ARROW --> +<!ENTITY circledR "®" ><!--REGISTERED SIGN --> +<!ENTITY circledS "Ⓢ" ><!--CIRCLED LATIN CAPITAL LETTER S --> +<!ENTITY circledast "⊛" ><!--CIRCLED ASTERISK OPERATOR --> +<!ENTITY circledcirc "⊚" ><!--CIRCLED RING OPERATOR --> +<!ENTITY circleddash "⊝" ><!--CIRCLED DASH --> +<!ENTITY cire "≗" ><!--RING EQUAL TO --> +<!ENTITY cirfnint "⨐" ><!--CIRCULATION FUNCTION --> +<!ENTITY cirmid "⫯" ><!--VERTICAL LINE WITH CIRCLE ABOVE --> +<!ENTITY cirscir "⧂" ><!--CIRCLE WITH SMALL CIRCLE TO THE RIGHT --> +<!ENTITY clubs "♣" ><!--BLACK CLUB SUIT --> +<!ENTITY clubsuit "♣" ><!--BLACK CLUB SUIT --> +<!ENTITY colon ":" ><!--COLON --> +<!ENTITY colone "≔" ><!--COLON EQUALS --> +<!ENTITY coloneq "≔" ><!--COLON EQUALS --> +<!ENTITY comma "," ><!--COMMA --> +<!ENTITY commat "@" ><!--COMMERCIAL AT --> +<!ENTITY comp "∁" ><!--COMPLEMENT --> +<!ENTITY compfn "∘" ><!--RING OPERATOR --> +<!ENTITY complement "∁" ><!--COMPLEMENT --> +<!ENTITY complexes "ℂ" ><!--DOUBLE-STRUCK CAPITAL C --> +<!ENTITY cong "≅" ><!--APPROXIMATELY EQUAL TO --> +<!ENTITY congdot "⩭" ><!--CONGRUENT WITH DOT ABOVE --> +<!ENTITY conint "∮" ><!--CONTOUR INTEGRAL --> +<!ENTITY copf "𝕔" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL C --> +<!ENTITY coprod "∐" ><!--N-ARY COPRODUCT --> +<!ENTITY copy "©" ><!--COPYRIGHT SIGN --> +<!ENTITY copysr "℗" ><!--SOUND RECORDING COPYRIGHT --> +<!ENTITY crarr "↵" ><!--DOWNWARDS ARROW WITH CORNER LEFTWARDS --> +<!ENTITY cross "✗" ><!--BALLOT X --> +<!ENTITY cscr "𝒸" ><!--MATHEMATICAL SCRIPT SMALL C --> +<!ENTITY csub "⫏" ><!--CLOSED SUBSET --> +<!ENTITY csube "⫑" ><!--CLOSED SUBSET OR EQUAL TO --> +<!ENTITY csup "⫐" ><!--CLOSED SUPERSET --> +<!ENTITY csupe "⫒" ><!--CLOSED SUPERSET OR EQUAL TO --> +<!ENTITY ctdot "⋯" ><!--MIDLINE HORIZONTAL ELLIPSIS --> +<!ENTITY cudarrl "⤸" ><!--RIGHT-SIDE ARC CLOCKWISE ARROW --> +<!ENTITY cudarrr "⤵" ><!--ARROW POINTING RIGHTWARDS THEN CURVING DOWNWARDS --> +<!ENTITY cuepr "⋞" ><!--EQUAL TO OR PRECEDES --> +<!ENTITY cuesc "⋟" ><!--EQUAL TO OR SUCCEEDS --> +<!ENTITY cularr "↶" ><!--ANTICLOCKWISE TOP SEMICIRCLE ARROW --> +<!ENTITY cularrp "⤽" ><!--TOP ARC ANTICLOCKWISE ARROW WITH PLUS --> +<!ENTITY cup "∪" ><!--UNION --> +<!ENTITY cupbrcap "⩈" ><!--UNION ABOVE BAR ABOVE INTERSECTION --> +<!ENTITY cupcap "⩆" ><!--UNION ABOVE INTERSECTION --> +<!ENTITY cupcup "⩊" ><!--UNION BESIDE AND JOINED WITH UNION --> +<!ENTITY cupdot "⊍" ><!--MULTISET MULTIPLICATION --> +<!ENTITY cupor "⩅" ><!--UNION WITH LOGICAL OR --> +<!ENTITY cups "∪︀" ><!--UNION with serifs --> +<!ENTITY curarr "↷" ><!--CLOCKWISE TOP SEMICIRCLE ARROW --> +<!ENTITY curarrm "⤼" ><!--TOP ARC CLOCKWISE ARROW WITH MINUS --> +<!ENTITY curlyeqprec "⋞" ><!--EQUAL TO OR PRECEDES --> +<!ENTITY curlyeqsucc "⋟" ><!--EQUAL TO OR SUCCEEDS --> +<!ENTITY curlyvee "⋎" ><!--CURLY LOGICAL OR --> +<!ENTITY curlywedge "⋏" ><!--CURLY LOGICAL AND --> +<!ENTITY curren "¤" ><!--CURRENCY SIGN --> +<!ENTITY curvearrowleft "↶" ><!--ANTICLOCKWISE TOP SEMICIRCLE ARROW --> +<!ENTITY curvearrowright "↷" ><!--CLOCKWISE TOP SEMICIRCLE ARROW --> +<!ENTITY cuvee "⋎" ><!--CURLY LOGICAL OR --> +<!ENTITY cuwed "⋏" ><!--CURLY LOGICAL AND --> +<!ENTITY cwconint "∲" ><!--CLOCKWISE CONTOUR INTEGRAL --> +<!ENTITY cwint "∱" ><!--CLOCKWISE INTEGRAL --> +<!ENTITY cylcty "⌭" ><!--CYLINDRICITY --> +<!ENTITY dArr "⇓" ><!--DOWNWARDS DOUBLE ARROW --> +<!ENTITY dHar "⥥" ><!--DOWNWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT --> +<!ENTITY dagger "†" ><!--DAGGER --> +<!ENTITY daleth "ℸ" ><!--DALET SYMBOL --> +<!ENTITY darr "↓" ><!--DOWNWARDS ARROW --> +<!ENTITY dash "‐" ><!--HYPHEN --> +<!ENTITY dashv "⊣" ><!--LEFT TACK --> +<!ENTITY dbkarow "⤏" ><!--RIGHTWARDS TRIPLE DASH ARROW --> +<!ENTITY dblac "˝" ><!--DOUBLE ACUTE ACCENT --> +<!ENTITY dcaron "ď" ><!--LATIN SMALL LETTER D WITH CARON --> +<!ENTITY dcy "д" ><!--CYRILLIC SMALL LETTER DE --> +<!ENTITY dd "ⅆ" ><!--DOUBLE-STRUCK ITALIC SMALL D --> +<!ENTITY ddagger "‡" ><!--DOUBLE DAGGER --> +<!ENTITY ddarr "⇊" ><!--DOWNWARDS PAIRED ARROWS --> +<!ENTITY ddotseq "⩷" ><!--EQUALS SIGN WITH TWO DOTS ABOVE AND TWO DOTS BELOW --> +<!ENTITY deg "°" ><!--DEGREE SIGN --> +<!ENTITY delta "δ" ><!--GREEK SMALL LETTER DELTA --> +<!ENTITY demptyv "⦱" ><!--EMPTY SET WITH OVERBAR --> +<!ENTITY dfisht "⥿" ><!--DOWN FISH TAIL --> +<!ENTITY dfr "𝔡" ><!--MATHEMATICAL FRAKTUR SMALL D --> +<!ENTITY dharl "⇃" ><!--DOWNWARDS HARPOON WITH BARB LEFTWARDS --> +<!ENTITY dharr "⇂" ><!--DOWNWARDS HARPOON WITH BARB RIGHTWARDS --> +<!ENTITY diam "⋄" ><!--DIAMOND OPERATOR --> +<!ENTITY diamond "⋄" ><!--DIAMOND OPERATOR --> +<!ENTITY diamondsuit "♦" ><!--BLACK DIAMOND SUIT --> +<!ENTITY diams "♦" ><!--BLACK DIAMOND SUIT --> +<!ENTITY die "¨" ><!--DIAERESIS --> +<!ENTITY digamma "ϝ" ><!--GREEK SMALL LETTER DIGAMMA --> +<!ENTITY disin "⋲" ><!--ELEMENT OF WITH LONG HORIZONTAL STROKE --> +<!ENTITY div "÷" ><!--DIVISION SIGN --> +<!ENTITY divide "÷" ><!--DIVISION SIGN --> +<!ENTITY divideontimes "⋇" ><!--DIVISION TIMES --> +<!ENTITY divonx "⋇" ><!--DIVISION TIMES --> +<!ENTITY djcy "ђ" ><!--CYRILLIC SMALL LETTER DJE --> +<!ENTITY dlcorn "⌞" ><!--BOTTOM LEFT CORNER --> +<!ENTITY dlcrop "⌍" ><!--BOTTOM LEFT CROP --> +<!ENTITY dollar "$" ><!--DOLLAR SIGN --> +<!ENTITY dopf "𝕕" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL D --> +<!ENTITY dot "˙" ><!--DOT ABOVE --> +<!ENTITY doteq "≐" ><!--APPROACHES THE LIMIT --> +<!ENTITY doteqdot "≑" ><!--GEOMETRICALLY EQUAL TO --> +<!ENTITY dotminus "∸" ><!--DOT MINUS --> +<!ENTITY dotplus "∔" ><!--DOT PLUS --> +<!ENTITY dotsquare "⊡" ><!--SQUARED DOT OPERATOR --> +<!ENTITY doublebarwedge "⌆" ><!--PERSPECTIVE --> +<!ENTITY downarrow "↓" ><!--DOWNWARDS ARROW --> +<!ENTITY downdownarrows "⇊" ><!--DOWNWARDS PAIRED ARROWS --> +<!ENTITY downharpoonleft "⇃" ><!--DOWNWARDS HARPOON WITH BARB LEFTWARDS --> +<!ENTITY downharpoonright "⇂" ><!--DOWNWARDS HARPOON WITH BARB RIGHTWARDS --> +<!ENTITY drbkarow "⤐" ><!--RIGHTWARDS TWO-HEADED TRIPLE DASH ARROW --> +<!ENTITY drcorn "⌟" ><!--BOTTOM RIGHT CORNER --> +<!ENTITY drcrop "⌌" ><!--BOTTOM RIGHT CROP --> +<!ENTITY dscr "𝒹" ><!--MATHEMATICAL SCRIPT SMALL D --> +<!ENTITY dscy "ѕ" ><!--CYRILLIC SMALL LETTER DZE --> +<!ENTITY dsol "⧶" ><!--SOLIDUS WITH OVERBAR --> +<!ENTITY dstrok "đ" ><!--LATIN SMALL LETTER D WITH STROKE --> +<!ENTITY dtdot "⋱" ><!--DOWN RIGHT DIAGONAL ELLIPSIS --> +<!ENTITY dtri "▿" ><!--WHITE DOWN-POINTING SMALL TRIANGLE --> +<!ENTITY dtrif "▾" ><!--BLACK DOWN-POINTING SMALL TRIANGLE --> +<!ENTITY duarr "⇵" ><!--DOWNWARDS ARROW LEFTWARDS OF UPWARDS ARROW --> +<!ENTITY duhar "⥯" ><!--DOWNWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT --> +<!ENTITY dwangle "⦦" ><!--OBLIQUE ANGLE OPENING UP --> +<!ENTITY dzcy "џ" ><!--CYRILLIC SMALL LETTER DZHE --> +<!ENTITY dzigrarr "⟿" ><!--LONG RIGHTWARDS SQUIGGLE ARROW --> +<!ENTITY eDDot "⩷" ><!--EQUALS SIGN WITH TWO DOTS ABOVE AND TWO DOTS BELOW --> +<!ENTITY eDot "≑" ><!--GEOMETRICALLY EQUAL TO --> +<!ENTITY eacute "é" ><!--LATIN SMALL LETTER E WITH ACUTE --> +<!ENTITY easter "⩮" ><!--EQUALS WITH ASTERISK --> +<!ENTITY ecaron "ě" ><!--LATIN SMALL LETTER E WITH CARON --> +<!ENTITY ecir "≖" ><!--RING IN EQUAL TO --> +<!ENTITY ecirc "ê" ><!--LATIN SMALL LETTER E WITH CIRCUMFLEX --> +<!ENTITY ecolon "≕" ><!--EQUALS COLON --> +<!ENTITY ecy "э" ><!--CYRILLIC SMALL LETTER E --> +<!ENTITY edot "ė" ><!--LATIN SMALL LETTER E WITH DOT ABOVE --> +<!ENTITY ee "ⅇ" ><!--DOUBLE-STRUCK ITALIC SMALL E --> +<!ENTITY efDot "≒" ><!--APPROXIMATELY EQUAL TO OR THE IMAGE OF --> +<!ENTITY efr "𝔢" ><!--MATHEMATICAL FRAKTUR SMALL E --> +<!ENTITY eg "⪚" ><!--DOUBLE-LINE EQUAL TO OR GREATER-THAN --> +<!ENTITY egrave "è" ><!--LATIN SMALL LETTER E WITH GRAVE --> +<!ENTITY egs "⪖" ><!--SLANTED EQUAL TO OR GREATER-THAN --> +<!ENTITY egsdot "⪘" ><!--SLANTED EQUAL TO OR GREATER-THAN WITH DOT INSIDE --> +<!ENTITY el "⪙" ><!--DOUBLE-LINE EQUAL TO OR LESS-THAN --> +<!ENTITY elinters "⏧" ><!--ELECTRICAL INTERSECTION --> +<!ENTITY ell "ℓ" ><!--SCRIPT SMALL L --> +<!ENTITY els "⪕" ><!--SLANTED EQUAL TO OR LESS-THAN --> +<!ENTITY elsdot "⪗" ><!--SLANTED EQUAL TO OR LESS-THAN WITH DOT INSIDE --> +<!ENTITY emacr "ē" ><!--LATIN SMALL LETTER E WITH MACRON --> +<!ENTITY empty "∅" ><!--EMPTY SET --> +<!ENTITY emptyset "∅" ><!--EMPTY SET --> +<!ENTITY emptyv "∅" ><!--EMPTY SET --> +<!ENTITY emsp " " ><!--EM SPACE --> +<!ENTITY emsp13 " " ><!--THREE-PER-EM SPACE --> +<!ENTITY emsp14 " " ><!--FOUR-PER-EM SPACE --> +<!ENTITY eng "ŋ" ><!--LATIN SMALL LETTER ENG --> +<!ENTITY ensp " " ><!--EN SPACE --> +<!ENTITY eogon "ę" ><!--LATIN SMALL LETTER E WITH OGONEK --> +<!ENTITY eopf "𝕖" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL E --> +<!ENTITY epar "⋕" ><!--EQUAL AND PARALLEL TO --> +<!ENTITY eparsl "⧣" ><!--EQUALS SIGN AND SLANTED PARALLEL --> +<!ENTITY eplus "⩱" ><!--EQUALS SIGN ABOVE PLUS SIGN --> +<!ENTITY epsi "ε" ><!--GREEK SMALL LETTER EPSILON --> +<!ENTITY epsilon "ε" ><!--GREEK SMALL LETTER EPSILON --> +<!ENTITY epsiv "ϵ" ><!--GREEK LUNATE EPSILON SYMBOL --> +<!ENTITY eqcirc "≖" ><!--RING IN EQUAL TO --> +<!ENTITY eqcolon "≕" ><!--EQUALS COLON --> +<!ENTITY eqsim "≂" ><!--MINUS TILDE --> +<!ENTITY eqslantgtr "⪖" ><!--SLANTED EQUAL TO OR GREATER-THAN --> +<!ENTITY eqslantless "⪕" ><!--SLANTED EQUAL TO OR LESS-THAN --> +<!ENTITY equals "=" ><!--EQUALS SIGN --> +<!ENTITY equest "≟" ><!--QUESTIONED EQUAL TO --> +<!ENTITY equiv "≡" ><!--IDENTICAL TO --> +<!ENTITY equivDD "⩸" ><!--EQUIVALENT WITH FOUR DOTS ABOVE --> +<!ENTITY eqvparsl "⧥" ><!--IDENTICAL TO AND SLANTED PARALLEL --> +<!ENTITY erDot "≓" ><!--IMAGE OF OR APPROXIMATELY EQUAL TO --> +<!ENTITY erarr "⥱" ><!--EQUALS SIGN ABOVE RIGHTWARDS ARROW --> +<!ENTITY escr "ℯ" ><!--SCRIPT SMALL E --> +<!ENTITY esdot "≐" ><!--APPROACHES THE LIMIT --> +<!ENTITY esim "≂" ><!--MINUS TILDE --> +<!ENTITY eta "η" ><!--GREEK SMALL LETTER ETA --> +<!ENTITY eth "ð" ><!--LATIN SMALL LETTER ETH --> +<!ENTITY euml "ë" ><!--LATIN SMALL LETTER E WITH DIAERESIS --> +<!ENTITY euro "€" ><!--EURO SIGN --> +<!ENTITY excl "!" ><!--EXCLAMATION MARK --> +<!ENTITY exist "∃" ><!--THERE EXISTS --> +<!ENTITY expectation "ℰ" ><!--SCRIPT CAPITAL E --> +<!ENTITY exponentiale "ⅇ" ><!--DOUBLE-STRUCK ITALIC SMALL E --> +<!ENTITY fallingdotseq "≒" ><!--APPROXIMATELY EQUAL TO OR THE IMAGE OF --> +<!ENTITY fcy "ф" ><!--CYRILLIC SMALL LETTER EF --> +<!ENTITY female "♀" ><!--FEMALE SIGN --> +<!ENTITY ffilig "ffi" ><!--LATIN SMALL LIGATURE FFI --> +<!ENTITY fflig "ff" ><!--LATIN SMALL LIGATURE FF --> +<!ENTITY ffllig "ffl" ><!--LATIN SMALL LIGATURE FFL --> +<!ENTITY ffr "𝔣" ><!--MATHEMATICAL FRAKTUR SMALL F --> +<!ENTITY filig "fi" ><!--LATIN SMALL LIGATURE FI --> +<!ENTITY fjlig "fj" ><!--fj ligature --> +<!ENTITY flat "♭" ><!--MUSIC FLAT SIGN --> +<!ENTITY fllig "fl" ><!--LATIN SMALL LIGATURE FL --> +<!ENTITY fltns "▱" ><!--WHITE PARALLELOGRAM --> +<!ENTITY fnof "ƒ" ><!--LATIN SMALL LETTER F WITH HOOK --> +<!ENTITY fopf "𝕗" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL F --> +<!ENTITY forall "∀" ><!--FOR ALL --> +<!ENTITY fork "⋔" ><!--PITCHFORK --> +<!ENTITY forkv "⫙" ><!--ELEMENT OF OPENING DOWNWARDS --> +<!ENTITY fpartint "⨍" ><!--FINITE PART INTEGRAL --> +<!ENTITY frac12 "½" ><!--VULGAR FRACTION ONE HALF --> +<!ENTITY frac13 "⅓" ><!--VULGAR FRACTION ONE THIRD --> +<!ENTITY frac14 "¼" ><!--VULGAR FRACTION ONE QUARTER --> +<!ENTITY frac15 "⅕" ><!--VULGAR FRACTION ONE FIFTH --> +<!ENTITY frac16 "⅙" ><!--VULGAR FRACTION ONE SIXTH --> +<!ENTITY frac18 "⅛" ><!--VULGAR FRACTION ONE EIGHTH --> +<!ENTITY frac23 "⅔" ><!--VULGAR FRACTION TWO THIRDS --> +<!ENTITY frac25 "⅖" ><!--VULGAR FRACTION TWO FIFTHS --> +<!ENTITY frac34 "¾" ><!--VULGAR FRACTION THREE QUARTERS --> +<!ENTITY frac35 "⅗" ><!--VULGAR FRACTION THREE FIFTHS --> +<!ENTITY frac38 "⅜" ><!--VULGAR FRACTION THREE EIGHTHS --> +<!ENTITY frac45 "⅘" ><!--VULGAR FRACTION FOUR FIFTHS --> +<!ENTITY frac56 "⅚" ><!--VULGAR FRACTION FIVE SIXTHS --> +<!ENTITY frac58 "⅝" ><!--VULGAR FRACTION FIVE EIGHTHS --> +<!ENTITY frac78 "⅞" ><!--VULGAR FRACTION SEVEN EIGHTHS --> +<!ENTITY frasl "⁄" ><!--FRACTION SLASH --> +<!ENTITY frown "⌢" ><!--FROWN --> +<!ENTITY fscr "𝒻" ><!--MATHEMATICAL SCRIPT SMALL F --> +<!ENTITY gE "≧" ><!--GREATER-THAN OVER EQUAL TO --> +<!ENTITY gEl "⪌" ><!--GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN --> +<!ENTITY gacute "ǵ" ><!--LATIN SMALL LETTER G WITH ACUTE --> +<!ENTITY gamma "γ" ><!--GREEK SMALL LETTER GAMMA --> +<!ENTITY gammad "ϝ" ><!--GREEK SMALL LETTER DIGAMMA --> +<!ENTITY gap "⪆" ><!--GREATER-THAN OR APPROXIMATE --> +<!ENTITY gbreve "ğ" ><!--LATIN SMALL LETTER G WITH BREVE --> +<!ENTITY gcirc "ĝ" ><!--LATIN SMALL LETTER G WITH CIRCUMFLEX --> +<!ENTITY gcy "г" ><!--CYRILLIC SMALL LETTER GHE --> +<!ENTITY gdot "ġ" ><!--LATIN SMALL LETTER G WITH DOT ABOVE --> +<!ENTITY ge "≥" ><!--GREATER-THAN OR EQUAL TO --> +<!ENTITY gel "⋛" ><!--GREATER-THAN EQUAL TO OR LESS-THAN --> +<!ENTITY geq "≥" ><!--GREATER-THAN OR EQUAL TO --> +<!ENTITY geqq "≧" ><!--GREATER-THAN OVER EQUAL TO --> +<!ENTITY geqslant "⩾" ><!--GREATER-THAN OR SLANTED EQUAL TO --> +<!ENTITY ges "⩾" ><!--GREATER-THAN OR SLANTED EQUAL TO --> +<!ENTITY gescc "⪩" ><!--GREATER-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL --> +<!ENTITY gesdot "⪀" ><!--GREATER-THAN OR SLANTED EQUAL TO WITH DOT INSIDE --> +<!ENTITY gesdoto "⪂" ><!--GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE --> +<!ENTITY gesdotol "⪄" ><!--GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE LEFT --> +<!ENTITY gesl "⋛︀" ><!--GREATER-THAN slanted EQUAL TO OR LESS-THAN --> +<!ENTITY gesles "⪔" ><!--GREATER-THAN ABOVE SLANTED EQUAL ABOVE LESS-THAN ABOVE SLANTED EQUAL --> +<!ENTITY gfr "𝔤" ><!--MATHEMATICAL FRAKTUR SMALL G --> +<!ENTITY gg "≫" ><!--MUCH GREATER-THAN --> +<!ENTITY ggg "⋙" ><!--VERY MUCH GREATER-THAN --> +<!ENTITY gimel "ℷ" ><!--GIMEL SYMBOL --> +<!ENTITY gjcy "ѓ" ><!--CYRILLIC SMALL LETTER GJE --> +<!ENTITY gl "≷" ><!--GREATER-THAN OR LESS-THAN --> +<!ENTITY glE "⪒" ><!--GREATER-THAN ABOVE LESS-THAN ABOVE DOUBLE-LINE EQUAL --> +<!ENTITY gla "⪥" ><!--GREATER-THAN BESIDE LESS-THAN --> +<!ENTITY glj "⪤" ><!--GREATER-THAN OVERLAPPING LESS-THAN --> +<!ENTITY gnE "≩" ><!--GREATER-THAN BUT NOT EQUAL TO --> +<!ENTITY gnap "⪊" ><!--GREATER-THAN AND NOT APPROXIMATE --> +<!ENTITY gnapprox "⪊" ><!--GREATER-THAN AND NOT APPROXIMATE --> +<!ENTITY gne "⪈" ><!--GREATER-THAN AND SINGLE-LINE NOT EQUAL TO --> +<!ENTITY gneq "⪈" ><!--GREATER-THAN AND SINGLE-LINE NOT EQUAL TO --> +<!ENTITY gneqq "≩" ><!--GREATER-THAN BUT NOT EQUAL TO --> +<!ENTITY gnsim "⋧" ><!--GREATER-THAN BUT NOT EQUIVALENT TO --> +<!ENTITY gopf "𝕘" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL G --> +<!ENTITY grave "`" ><!--GRAVE ACCENT --> +<!ENTITY gscr "ℊ" ><!--SCRIPT SMALL G --> +<!ENTITY gsim "≳" ><!--GREATER-THAN OR EQUIVALENT TO --> +<!ENTITY gsime "⪎" ><!--GREATER-THAN ABOVE SIMILAR OR EQUAL --> +<!ENTITY gsiml "⪐" ><!--GREATER-THAN ABOVE SIMILAR ABOVE LESS-THAN --> +<!ENTITY gt ">" ><!--GREATER-THAN SIGN --> +<!ENTITY gtcc "⪧" ><!--GREATER-THAN CLOSED BY CURVE --> +<!ENTITY gtcir "⩺" ><!--GREATER-THAN WITH CIRCLE INSIDE --> +<!ENTITY gtdot "⋗" ><!--GREATER-THAN WITH DOT --> +<!ENTITY gtlPar "⦕" ><!--DOUBLE LEFT ARC GREATER-THAN BRACKET --> +<!ENTITY gtquest "⩼" ><!--GREATER-THAN WITH QUESTION MARK ABOVE --> +<!ENTITY gtrapprox "⪆" ><!--GREATER-THAN OR APPROXIMATE --> +<!ENTITY gtrarr "⥸" ><!--GREATER-THAN ABOVE RIGHTWARDS ARROW --> +<!ENTITY gtrdot "⋗" ><!--GREATER-THAN WITH DOT --> +<!ENTITY gtreqless "⋛" ><!--GREATER-THAN EQUAL TO OR LESS-THAN --> +<!ENTITY gtreqqless "⪌" ><!--GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN --> +<!ENTITY gtrless "≷" ><!--GREATER-THAN OR LESS-THAN --> +<!ENTITY gtrsim "≳" ><!--GREATER-THAN OR EQUIVALENT TO --> +<!ENTITY gvertneqq "≩︀" ><!--GREATER-THAN BUT NOT EQUAL TO - with vertical stroke --> +<!ENTITY gvnE "≩︀" ><!--GREATER-THAN BUT NOT EQUAL TO - with vertical stroke --> +<!ENTITY hArr "⇔" ><!--LEFT RIGHT DOUBLE ARROW --> +<!ENTITY hairsp " " ><!--HAIR SPACE --> +<!ENTITY half "½" ><!--VULGAR FRACTION ONE HALF --> +<!ENTITY hamilt "ℋ" ><!--SCRIPT CAPITAL H --> +<!ENTITY hardcy "ъ" ><!--CYRILLIC SMALL LETTER HARD SIGN --> +<!ENTITY harr "↔" ><!--LEFT RIGHT ARROW --> +<!ENTITY harrcir "⥈" ><!--LEFT RIGHT ARROW THROUGH SMALL CIRCLE --> +<!ENTITY harrw "↭" ><!--LEFT RIGHT WAVE ARROW --> +<!ENTITY hbar "ℏ" ><!--PLANCK CONSTANT OVER TWO PI --> +<!ENTITY hcirc "ĥ" ><!--LATIN SMALL LETTER H WITH CIRCUMFLEX --> +<!ENTITY hearts "♥" ><!--BLACK HEART SUIT --> +<!ENTITY heartsuit "♥" ><!--BLACK HEART SUIT --> +<!ENTITY hellip "…" ><!--HORIZONTAL ELLIPSIS --> +<!ENTITY hercon "⊹" ><!--HERMITIAN CONJUGATE MATRIX --> +<!ENTITY hfr "𝔥" ><!--MATHEMATICAL FRAKTUR SMALL H --> +<!ENTITY hksearow "⤥" ><!--SOUTH EAST ARROW WITH HOOK --> +<!ENTITY hkswarow "⤦" ><!--SOUTH WEST ARROW WITH HOOK --> +<!ENTITY hoarr "⇿" ><!--LEFT RIGHT OPEN-HEADED ARROW --> +<!ENTITY homtht "∻" ><!--HOMOTHETIC --> +<!ENTITY hookleftarrow "↩" ><!--LEFTWARDS ARROW WITH HOOK --> +<!ENTITY hookrightarrow "↪" ><!--RIGHTWARDS ARROW WITH HOOK --> +<!ENTITY hopf "𝕙" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL H --> +<!ENTITY horbar "―" ><!--HORIZONTAL BAR --> +<!ENTITY hscr "𝒽" ><!--MATHEMATICAL SCRIPT SMALL H --> +<!ENTITY hslash "ℏ" ><!--PLANCK CONSTANT OVER TWO PI --> +<!ENTITY hstrok "ħ" ><!--LATIN SMALL LETTER H WITH STROKE --> +<!ENTITY hybull "⁃" ><!--HYPHEN BULLET --> +<!ENTITY hyphen "‐" ><!--HYPHEN --> +<!ENTITY iacute "í" ><!--LATIN SMALL LETTER I WITH ACUTE --> +<!ENTITY ic "⁣" ><!--INVISIBLE SEPARATOR --> +<!ENTITY icirc "î" ><!--LATIN SMALL LETTER I WITH CIRCUMFLEX --> +<!ENTITY icy "и" ><!--CYRILLIC SMALL LETTER I --> +<!ENTITY iecy "е" ><!--CYRILLIC SMALL LETTER IE --> +<!ENTITY iexcl "¡" ><!--INVERTED EXCLAMATION MARK --> +<!ENTITY iff "⇔" ><!--LEFT RIGHT DOUBLE ARROW --> +<!ENTITY ifr "𝔦" ><!--MATHEMATICAL FRAKTUR SMALL I --> +<!ENTITY igrave "ì" ><!--LATIN SMALL LETTER I WITH GRAVE --> +<!ENTITY ii "ⅈ" ><!--DOUBLE-STRUCK ITALIC SMALL I --> +<!ENTITY iiiint "⨌" ><!--QUADRUPLE INTEGRAL OPERATOR --> +<!ENTITY iiint "∭" ><!--TRIPLE INTEGRAL --> +<!ENTITY iinfin "⧜" ><!--INCOMPLETE INFINITY --> +<!ENTITY iiota "℩" ><!--TURNED GREEK SMALL LETTER IOTA --> +<!ENTITY ijlig "ij" ><!--LATIN SMALL LIGATURE IJ --> +<!ENTITY imacr "ī" ><!--LATIN SMALL LETTER I WITH MACRON --> +<!ENTITY image "ℑ" ><!--BLACK-LETTER CAPITAL I --> +<!ENTITY imagline "ℐ" ><!--SCRIPT CAPITAL I --> +<!ENTITY imagpart "ℑ" ><!--BLACK-LETTER CAPITAL I --> +<!ENTITY imath "ı" ><!--LATIN SMALL LETTER DOTLESS I --> +<!ENTITY imof "⊷" ><!--IMAGE OF --> +<!ENTITY imped "Ƶ" ><!--LATIN CAPITAL LETTER Z WITH STROKE --> +<!ENTITY in "∈" ><!--ELEMENT OF --> +<!ENTITY incare "℅" ><!--CARE OF --> +<!ENTITY infin "∞" ><!--INFINITY --> +<!ENTITY infintie "⧝" ><!--TIE OVER INFINITY --> +<!ENTITY inodot "ı" ><!--LATIN SMALL LETTER DOTLESS I --> +<!ENTITY int "∫" ><!--INTEGRAL --> +<!ENTITY intcal "⊺" ><!--INTERCALATE --> +<!ENTITY integers "ℤ" ><!--DOUBLE-STRUCK CAPITAL Z --> +<!ENTITY intercal "⊺" ><!--INTERCALATE --> +<!ENTITY intlarhk "⨗" ><!--INTEGRAL WITH LEFTWARDS ARROW WITH HOOK --> +<!ENTITY intprod "⨼" ><!--INTERIOR PRODUCT --> +<!ENTITY iocy "ё" ><!--CYRILLIC SMALL LETTER IO --> +<!ENTITY iogon "į" ><!--LATIN SMALL LETTER I WITH OGONEK --> +<!ENTITY iopf "𝕚" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL I --> +<!ENTITY iota "ι" ><!--GREEK SMALL LETTER IOTA --> +<!ENTITY iprod "⨼" ><!--INTERIOR PRODUCT --> +<!ENTITY iquest "¿" ><!--INVERTED QUESTION MARK --> +<!ENTITY iscr "𝒾" ><!--MATHEMATICAL SCRIPT SMALL I --> +<!ENTITY isin "∈" ><!--ELEMENT OF --> +<!ENTITY isinE "⋹" ><!--ELEMENT OF WITH TWO HORIZONTAL STROKES --> +<!ENTITY isindot "⋵" ><!--ELEMENT OF WITH DOT ABOVE --> +<!ENTITY isins "⋴" ><!--SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE --> +<!ENTITY isinsv "⋳" ><!--ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE --> +<!ENTITY isinv "∈" ><!--ELEMENT OF --> +<!ENTITY it "⁢" ><!--INVISIBLE TIMES --> +<!ENTITY itilde "ĩ" ><!--LATIN SMALL LETTER I WITH TILDE --> +<!ENTITY iukcy "і" ><!--CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I --> +<!ENTITY iuml "ï" ><!--LATIN SMALL LETTER I WITH DIAERESIS --> +<!ENTITY jcirc "ĵ" ><!--LATIN SMALL LETTER J WITH CIRCUMFLEX --> +<!ENTITY jcy "й" ><!--CYRILLIC SMALL LETTER SHORT I --> +<!ENTITY jfr "𝔧" ><!--MATHEMATICAL FRAKTUR SMALL J --> +<!ENTITY jmath "ȷ" ><!--LATIN SMALL LETTER DOTLESS J --> +<!ENTITY jopf "𝕛" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL J --> +<!ENTITY jscr "𝒿" ><!--MATHEMATICAL SCRIPT SMALL J --> +<!ENTITY jsercy "ј" ><!--CYRILLIC SMALL LETTER JE --> +<!ENTITY jukcy "є" ><!--CYRILLIC SMALL LETTER UKRAINIAN IE --> +<!ENTITY kappa "κ" ><!--GREEK SMALL LETTER KAPPA --> +<!ENTITY kappav "ϰ" ><!--GREEK KAPPA SYMBOL --> +<!ENTITY kcedil "ķ" ><!--LATIN SMALL LETTER K WITH CEDILLA --> +<!ENTITY kcy "к" ><!--CYRILLIC SMALL LETTER KA --> +<!ENTITY kfr "𝔨" ><!--MATHEMATICAL FRAKTUR SMALL K --> +<!ENTITY kgreen "ĸ" ><!--LATIN SMALL LETTER KRA --> +<!ENTITY khcy "х" ><!--CYRILLIC SMALL LETTER HA --> +<!ENTITY kjcy "ќ" ><!--CYRILLIC SMALL LETTER KJE --> +<!ENTITY kopf "𝕜" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL K --> +<!ENTITY kscr "𝓀" ><!--MATHEMATICAL SCRIPT SMALL K --> +<!ENTITY lAarr "⇚" ><!--LEFTWARDS TRIPLE ARROW --> +<!ENTITY lArr "⇐" ><!--LEFTWARDS DOUBLE ARROW --> +<!ENTITY lAtail "⤛" ><!--LEFTWARDS DOUBLE ARROW-TAIL --> +<!ENTITY lBarr "⤎" ><!--LEFTWARDS TRIPLE DASH ARROW --> +<!ENTITY lE "≦" ><!--LESS-THAN OVER EQUAL TO --> +<!ENTITY lEg "⪋" ><!--LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN --> +<!ENTITY lHar "⥢" ><!--LEFTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB DOWN --> +<!ENTITY lacute "ĺ" ><!--LATIN SMALL LETTER L WITH ACUTE --> +<!ENTITY laemptyv "⦴" ><!--EMPTY SET WITH LEFT ARROW ABOVE --> +<!ENTITY lagran "ℒ" ><!--SCRIPT CAPITAL L --> +<!ENTITY lambda "λ" ><!--GREEK SMALL LETTER LAMDA --> +<!ENTITY lang "⟨" ><!--MATHEMATICAL LEFT ANGLE BRACKET --> +<!ENTITY langd "⦑" ><!--LEFT ANGLE BRACKET WITH DOT --> +<!ENTITY langle "⟨" ><!--MATHEMATICAL LEFT ANGLE BRACKET --> +<!ENTITY lap "⪅" ><!--LESS-THAN OR APPROXIMATE --> +<!ENTITY laquo "«" ><!--LEFT-POINTING DOUBLE ANGLE QUOTATION MARK --> +<!ENTITY larr "←" ><!--LEFTWARDS ARROW --> +<!ENTITY larrb "⇤" ><!--LEFTWARDS ARROW TO BAR --> +<!ENTITY larrbfs "⤟" ><!--LEFTWARDS ARROW FROM BAR TO BLACK DIAMOND --> +<!ENTITY larrfs "⤝" ><!--LEFTWARDS ARROW TO BLACK DIAMOND --> +<!ENTITY larrhk "↩" ><!--LEFTWARDS ARROW WITH HOOK --> +<!ENTITY larrlp "↫" ><!--LEFTWARDS ARROW WITH LOOP --> +<!ENTITY larrpl "⤹" ><!--LEFT-SIDE ARC ANTICLOCKWISE ARROW --> +<!ENTITY larrsim "⥳" ><!--LEFTWARDS ARROW ABOVE TILDE OPERATOR --> +<!ENTITY larrtl "↢" ><!--LEFTWARDS ARROW WITH TAIL --> +<!ENTITY lat "⪫" ><!--LARGER THAN --> +<!ENTITY latail "⤙" ><!--LEFTWARDS ARROW-TAIL --> +<!ENTITY late "⪭" ><!--LARGER THAN OR EQUAL TO --> +<!ENTITY lates "⪭︀" ><!--LARGER THAN OR slanted EQUAL --> +<!ENTITY lbarr "⤌" ><!--LEFTWARDS DOUBLE DASH ARROW --> +<!ENTITY lbbrk "❲" ><!--LIGHT LEFT TORTOISE SHELL BRACKET ORNAMENT --> +<!ENTITY lbrace "{" ><!--LEFT CURLY BRACKET --> +<!ENTITY lbrack "[" ><!--LEFT SQUARE BRACKET --> +<!ENTITY lbrke "⦋" ><!--LEFT SQUARE BRACKET WITH UNDERBAR --> +<!ENTITY lbrksld "⦏" ><!--LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER --> +<!ENTITY lbrkslu "⦍" ><!--LEFT SQUARE BRACKET WITH TICK IN TOP CORNER --> +<!ENTITY lcaron "ľ" ><!--LATIN SMALL LETTER L WITH CARON --> +<!ENTITY lcedil "ļ" ><!--LATIN SMALL LETTER L WITH CEDILLA --> +<!ENTITY lceil "⌈" ><!--LEFT CEILING --> +<!ENTITY lcub "{" ><!--LEFT CURLY BRACKET --> +<!ENTITY lcy "л" ><!--CYRILLIC SMALL LETTER EL --> +<!ENTITY ldca "⤶" ><!--ARROW POINTING DOWNWARDS THEN CURVING LEFTWARDS --> +<!ENTITY ldquo "“" ><!--LEFT DOUBLE QUOTATION MARK --> +<!ENTITY ldquor "„" ><!--DOUBLE LOW-9 QUOTATION MARK --> +<!ENTITY ldrdhar "⥧" ><!--LEFTWARDS HARPOON WITH BARB DOWN ABOVE RIGHTWARDS HARPOON WITH BARB DOWN --> +<!ENTITY ldrushar "⥋" ><!--LEFT BARB DOWN RIGHT BARB UP HARPOON --> +<!ENTITY ldsh "↲" ><!--DOWNWARDS ARROW WITH TIP LEFTWARDS --> +<!ENTITY le "≤" ><!--LESS-THAN OR EQUAL TO --> +<!ENTITY leftarrow "←" ><!--LEFTWARDS ARROW --> +<!ENTITY leftarrowtail "↢" ><!--LEFTWARDS ARROW WITH TAIL --> +<!ENTITY leftharpoondown "↽" ><!--LEFTWARDS HARPOON WITH BARB DOWNWARDS --> +<!ENTITY leftharpoonup "↼" ><!--LEFTWARDS HARPOON WITH BARB UPWARDS --> +<!ENTITY leftleftarrows "⇇" ><!--LEFTWARDS PAIRED ARROWS --> +<!ENTITY leftrightarrow "↔" ><!--LEFT RIGHT ARROW --> +<!ENTITY leftrightarrows "⇆" ><!--LEFTWARDS ARROW OVER RIGHTWARDS ARROW --> +<!ENTITY leftrightharpoons "⇋" ><!--LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON --> +<!ENTITY leftrightsquigarrow "↭" ><!--LEFT RIGHT WAVE ARROW --> +<!ENTITY leftthreetimes "⋋" ><!--LEFT SEMIDIRECT PRODUCT --> +<!ENTITY leg "⋚" ><!--LESS-THAN EQUAL TO OR GREATER-THAN --> +<!ENTITY leq "≤" ><!--LESS-THAN OR EQUAL TO --> +<!ENTITY leqq "≦" ><!--LESS-THAN OVER EQUAL TO --> +<!ENTITY leqslant "⩽" ><!--LESS-THAN OR SLANTED EQUAL TO --> +<!ENTITY les "⩽" ><!--LESS-THAN OR SLANTED EQUAL TO --> +<!ENTITY lescc "⪨" ><!--LESS-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL --> +<!ENTITY lesdot "⩿" ><!--LESS-THAN OR SLANTED EQUAL TO WITH DOT INSIDE --> +<!ENTITY lesdoto "⪁" ><!--LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE --> +<!ENTITY lesdotor "⪃" ><!--LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE RIGHT --> +<!ENTITY lesg "⋚︀" ><!--LESS-THAN slanted EQUAL TO OR GREATER-THAN --> +<!ENTITY lesges "⪓" ><!--LESS-THAN ABOVE SLANTED EQUAL ABOVE GREATER-THAN ABOVE SLANTED EQUAL --> +<!ENTITY lessapprox "⪅" ><!--LESS-THAN OR APPROXIMATE --> +<!ENTITY lessdot "⋖" ><!--LESS-THAN WITH DOT --> +<!ENTITY lesseqgtr "⋚" ><!--LESS-THAN EQUAL TO OR GREATER-THAN --> +<!ENTITY lesseqqgtr "⪋" ><!--LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN --> +<!ENTITY lessgtr "≶" ><!--LESS-THAN OR GREATER-THAN --> +<!ENTITY lesssim "≲" ><!--LESS-THAN OR EQUIVALENT TO --> +<!ENTITY lfisht "⥼" ><!--LEFT FISH TAIL --> +<!ENTITY lfloor "⌊" ><!--LEFT FLOOR --> +<!ENTITY lfr "𝔩" ><!--MATHEMATICAL FRAKTUR SMALL L --> +<!ENTITY lg "≶" ><!--LESS-THAN OR GREATER-THAN --> +<!ENTITY lgE "⪑" ><!--LESS-THAN ABOVE GREATER-THAN ABOVE DOUBLE-LINE EQUAL --> +<!ENTITY lhard "↽" ><!--LEFTWARDS HARPOON WITH BARB DOWNWARDS --> +<!ENTITY lharu "↼" ><!--LEFTWARDS HARPOON WITH BARB UPWARDS --> +<!ENTITY lharul "⥪" ><!--LEFTWARDS HARPOON WITH BARB UP ABOVE LONG DASH --> +<!ENTITY lhblk "▄" ><!--LOWER HALF BLOCK --> +<!ENTITY ljcy "љ" ><!--CYRILLIC SMALL LETTER LJE --> +<!ENTITY ll "≪" ><!--MUCH LESS-THAN --> +<!ENTITY llarr "⇇" ><!--LEFTWARDS PAIRED ARROWS --> +<!ENTITY llcorner "⌞" ><!--BOTTOM LEFT CORNER --> +<!ENTITY llhard "⥫" ><!--LEFTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH --> +<!ENTITY lltri "◺" ><!--LOWER LEFT TRIANGLE --> +<!ENTITY lmidot "ŀ" ><!--LATIN SMALL LETTER L WITH MIDDLE DOT --> +<!ENTITY lmoust "⎰" ><!--UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION --> +<!ENTITY lmoustache "⎰" ><!--UPPER LEFT OR LOWER RIGHT CURLY BRACKET SECTION --> +<!ENTITY lnE "≨" ><!--LESS-THAN BUT NOT EQUAL TO --> +<!ENTITY lnap "⪉" ><!--LESS-THAN AND NOT APPROXIMATE --> +<!ENTITY lnapprox "⪉" ><!--LESS-THAN AND NOT APPROXIMATE --> +<!ENTITY lne "⪇" ><!--LESS-THAN AND SINGLE-LINE NOT EQUAL TO --> +<!ENTITY lneq "⪇" ><!--LESS-THAN AND SINGLE-LINE NOT EQUAL TO --> +<!ENTITY lneqq "≨" ><!--LESS-THAN BUT NOT EQUAL TO --> +<!ENTITY lnsim "⋦" ><!--LESS-THAN BUT NOT EQUIVALENT TO --> +<!ENTITY loang "⟬" ><!--MATHEMATICAL LEFT WHITE TORTOISE SHELL BRACKET --> +<!ENTITY loarr "⇽" ><!--LEFTWARDS OPEN-HEADED ARROW --> +<!ENTITY lobrk "⟦" ><!--MATHEMATICAL LEFT WHITE SQUARE BRACKET --> +<!ENTITY longleftarrow "⟵" ><!--LONG LEFTWARDS ARROW --> +<!ENTITY longleftrightarrow "⟷" ><!--LONG LEFT RIGHT ARROW --> +<!ENTITY longmapsto "⟼" ><!--LONG RIGHTWARDS ARROW FROM BAR --> +<!ENTITY longrightarrow "⟶" ><!--LONG RIGHTWARDS ARROW --> +<!ENTITY looparrowleft "↫" ><!--LEFTWARDS ARROW WITH LOOP --> +<!ENTITY looparrowright "↬" ><!--RIGHTWARDS ARROW WITH LOOP --> +<!ENTITY lopar "⦅" ><!--LEFT WHITE PARENTHESIS --> +<!ENTITY lopf "𝕝" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL L --> +<!ENTITY loplus "⨭" ><!--PLUS SIGN IN LEFT HALF CIRCLE --> +<!ENTITY lotimes "⨴" ><!--MULTIPLICATION SIGN IN LEFT HALF CIRCLE --> +<!ENTITY lowast "∗" ><!--ASTERISK OPERATOR --> +<!ENTITY lowbar "_" ><!--LOW LINE --> +<!ENTITY loz "◊" ><!--LOZENGE --> +<!ENTITY lozenge "◊" ><!--LOZENGE --> +<!ENTITY lozf "⧫" ><!--BLACK LOZENGE --> +<!ENTITY lpar "(" ><!--LEFT PARENTHESIS --> +<!ENTITY lparlt "⦓" ><!--LEFT ARC LESS-THAN BRACKET --> +<!ENTITY lrarr "⇆" ><!--LEFTWARDS ARROW OVER RIGHTWARDS ARROW --> +<!ENTITY lrcorner "⌟" ><!--BOTTOM RIGHT CORNER --> +<!ENTITY lrhar "⇋" ><!--LEFTWARDS HARPOON OVER RIGHTWARDS HARPOON --> +<!ENTITY lrhard "⥭" ><!--RIGHTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH --> +<!ENTITY lrm "‎" ><!--LEFT-TO-RIGHT MARK --> +<!ENTITY lrtri "⊿" ><!--RIGHT TRIANGLE --> +<!ENTITY lsaquo "‹" ><!--SINGLE LEFT-POINTING ANGLE QUOTATION MARK --> +<!ENTITY lscr "𝓁" ><!--MATHEMATICAL SCRIPT SMALL L --> +<!ENTITY lsh "↰" ><!--UPWARDS ARROW WITH TIP LEFTWARDS --> +<!ENTITY lsim "≲" ><!--LESS-THAN OR EQUIVALENT TO --> +<!ENTITY lsime "⪍" ><!--LESS-THAN ABOVE SIMILAR OR EQUAL --> +<!ENTITY lsimg "⪏" ><!--LESS-THAN ABOVE SIMILAR ABOVE GREATER-THAN --> +<!ENTITY lsqb "[" ><!--LEFT SQUARE BRACKET --> +<!ENTITY lsquo "‘" ><!--LEFT SINGLE QUOTATION MARK --> +<!ENTITY lsquor "‚" ><!--SINGLE LOW-9 QUOTATION MARK --> +<!ENTITY lstrok "ł" ><!--LATIN SMALL LETTER L WITH STROKE --> +<!ENTITY lt "&#60;" ><!--LESS-THAN SIGN --> +<!ENTITY ltcc "⪦" ><!--LESS-THAN CLOSED BY CURVE --> +<!ENTITY ltcir "⩹" ><!--LESS-THAN WITH CIRCLE INSIDE --> +<!ENTITY ltdot "⋖" ><!--LESS-THAN WITH DOT --> +<!ENTITY lthree "⋋" ><!--LEFT SEMIDIRECT PRODUCT --> +<!ENTITY ltimes "⋉" ><!--LEFT NORMAL FACTOR SEMIDIRECT PRODUCT --> +<!ENTITY ltlarr "⥶" ><!--LESS-THAN ABOVE LEFTWARDS ARROW --> +<!ENTITY ltquest "⩻" ><!--LESS-THAN WITH QUESTION MARK ABOVE --> +<!ENTITY ltrPar "⦖" ><!--DOUBLE RIGHT ARC LESS-THAN BRACKET --> +<!ENTITY ltri "◃" ><!--WHITE LEFT-POINTING SMALL TRIANGLE --> +<!ENTITY ltrie "⊴" ><!--NORMAL SUBGROUP OF OR EQUAL TO --> +<!ENTITY ltrif "◂" ><!--BLACK LEFT-POINTING SMALL TRIANGLE --> +<!ENTITY lurdshar "⥊" ><!--LEFT BARB UP RIGHT BARB DOWN HARPOON --> +<!ENTITY luruhar "⥦" ><!--LEFTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB UP --> +<!ENTITY lvertneqq "≨︀" ><!--LESS-THAN BUT NOT EQUAL TO - with vertical stroke --> +<!ENTITY lvnE "≨︀" ><!--LESS-THAN BUT NOT EQUAL TO - with vertical stroke --> +<!ENTITY mDDot "∺" ><!--GEOMETRIC PROPORTION --> +<!ENTITY macr "¯" ><!--MACRON --> +<!ENTITY male "♂" ><!--MALE SIGN --> +<!ENTITY malt "✠" ><!--MALTESE CROSS --> +<!ENTITY maltese "✠" ><!--MALTESE CROSS --> +<!ENTITY map "↦" ><!--RIGHTWARDS ARROW FROM BAR --> +<!ENTITY mapsto "↦" ><!--RIGHTWARDS ARROW FROM BAR --> +<!ENTITY mapstodown "↧" ><!--DOWNWARDS ARROW FROM BAR --> +<!ENTITY mapstoleft "↤" ><!--LEFTWARDS ARROW FROM BAR --> +<!ENTITY mapstoup "↥" ><!--UPWARDS ARROW FROM BAR --> +<!ENTITY marker "▮" ><!--BLACK VERTICAL RECTANGLE --> +<!ENTITY mcomma "⨩" ><!--MINUS SIGN WITH COMMA ABOVE --> +<!ENTITY mcy "м" ><!--CYRILLIC SMALL LETTER EM --> +<!ENTITY mdash "—" ><!--EM DASH --> +<!ENTITY measuredangle "∡" ><!--MEASURED ANGLE --> +<!ENTITY mfr "𝔪" ><!--MATHEMATICAL FRAKTUR SMALL M --> +<!ENTITY mho "℧" ><!--INVERTED OHM SIGN --> +<!ENTITY micro "µ" ><!--MICRO SIGN --> +<!ENTITY mid "∣" ><!--DIVIDES --> +<!ENTITY midast "*" ><!--ASTERISK --> +<!ENTITY midcir "⫰" ><!--VERTICAL LINE WITH CIRCLE BELOW --> +<!ENTITY middot "·" ><!--MIDDLE DOT --> +<!ENTITY minus "−" ><!--MINUS SIGN --> +<!ENTITY minusb "⊟" ><!--SQUARED MINUS --> +<!ENTITY minusd "∸" ><!--DOT MINUS --> +<!ENTITY minusdu "⨪" ><!--MINUS SIGN WITH DOT BELOW --> +<!ENTITY mlcp "⫛" ><!--TRANSVERSAL INTERSECTION --> +<!ENTITY mldr "…" ><!--HORIZONTAL ELLIPSIS --> +<!ENTITY mnplus "∓" ><!--MINUS-OR-PLUS SIGN --> +<!ENTITY models "⊧" ><!--MODELS --> +<!ENTITY mopf "𝕞" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL M --> +<!ENTITY mp "∓" ><!--MINUS-OR-PLUS SIGN --> +<!ENTITY mscr "𝓂" ><!--MATHEMATICAL SCRIPT SMALL M --> +<!ENTITY mstpos "∾" ><!--INVERTED LAZY S --> +<!ENTITY mu "μ" ><!--GREEK SMALL LETTER MU --> +<!ENTITY multimap "⊸" ><!--MULTIMAP --> +<!ENTITY mumap "⊸" ><!--MULTIMAP --> +<!ENTITY nGg "⋙̸" ><!--VERY MUCH GREATER-THAN with slash --> +<!ENTITY nGt "≫⃒" ><!--MUCH GREATER THAN with vertical line --> +<!ENTITY nGtv "≫̸" ><!--MUCH GREATER THAN with slash --> +<!ENTITY nLeftarrow "⇍" ><!--LEFTWARDS DOUBLE ARROW WITH STROKE --> +<!ENTITY nLeftrightarrow "⇎" ><!--LEFT RIGHT DOUBLE ARROW WITH STROKE --> +<!ENTITY nLl "⋘̸" ><!--VERY MUCH LESS-THAN with slash --> +<!ENTITY nLt "≪⃒" ><!--MUCH LESS THAN with vertical line --> +<!ENTITY nLtv "≪̸" ><!--MUCH LESS THAN with slash --> +<!ENTITY nRightarrow "⇏" ><!--RIGHTWARDS DOUBLE ARROW WITH STROKE --> +<!ENTITY nVDash "⊯" ><!--NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE --> +<!ENTITY nVdash "⊮" ><!--DOES NOT FORCE --> +<!ENTITY nabla "∇" ><!--NABLA --> +<!ENTITY nacute "ń" ><!--LATIN SMALL LETTER N WITH ACUTE --> +<!ENTITY nang "∠⃒" ><!--ANGLE with vertical line --> +<!ENTITY nap "≉" ><!--NOT ALMOST EQUAL TO --> +<!ENTITY napE "⩰̸" ><!--APPROXIMATELY EQUAL OR EQUAL TO with slash --> +<!ENTITY napid "≋̸" ><!--TRIPLE TILDE with slash --> +<!ENTITY napos "ʼn" ><!--LATIN SMALL LETTER N PRECEDED BY APOSTROPHE --> +<!ENTITY napprox "≉" ><!--NOT ALMOST EQUAL TO --> +<!ENTITY natur "♮" ><!--MUSIC NATURAL SIGN --> +<!ENTITY natural "♮" ><!--MUSIC NATURAL SIGN --> +<!ENTITY naturals "ℕ" ><!--DOUBLE-STRUCK CAPITAL N --> +<!ENTITY nbsp " " ><!--NO-BREAK SPACE --> +<!ENTITY nbump "≎̸" ><!--GEOMETRICALLY EQUIVALENT TO with slash --> +<!ENTITY nbumpe "≏̸" ><!--DIFFERENCE BETWEEN with slash --> +<!ENTITY ncap "⩃" ><!--INTERSECTION WITH OVERBAR --> +<!ENTITY ncaron "ň" ><!--LATIN SMALL LETTER N WITH CARON --> +<!ENTITY ncedil "ņ" ><!--LATIN SMALL LETTER N WITH CEDILLA --> +<!ENTITY ncong "≇" ><!--NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO --> +<!ENTITY ncongdot "⩭̸" ><!--CONGRUENT WITH DOT ABOVE with slash --> +<!ENTITY ncup "⩂" ><!--UNION WITH OVERBAR --> +<!ENTITY ncy "н" ><!--CYRILLIC SMALL LETTER EN --> +<!ENTITY ndash "–" ><!--EN DASH --> +<!ENTITY ne "≠" ><!--NOT EQUAL TO --> +<!ENTITY neArr "⇗" ><!--NORTH EAST DOUBLE ARROW --> +<!ENTITY nearhk "⤤" ><!--NORTH EAST ARROW WITH HOOK --> +<!ENTITY nearr "↗" ><!--NORTH EAST ARROW --> +<!ENTITY nearrow "↗" ><!--NORTH EAST ARROW --> +<!ENTITY nedot "≐̸" ><!--APPROACHES THE LIMIT with slash --> +<!ENTITY nequiv "≢" ><!--NOT IDENTICAL TO --> +<!ENTITY nesear "⤨" ><!--NORTH EAST ARROW AND SOUTH EAST ARROW --> +<!ENTITY nesim "≂̸" ><!--MINUS TILDE with slash --> +<!ENTITY nexist "∄" ><!--THERE DOES NOT EXIST --> +<!ENTITY nexists "∄" ><!--THERE DOES NOT EXIST --> +<!ENTITY nfr "𝔫" ><!--MATHEMATICAL FRAKTUR SMALL N --> +<!ENTITY ngE "≧̸" ><!--GREATER-THAN OVER EQUAL TO with slash --> +<!ENTITY nge "≱" ><!--NEITHER GREATER-THAN NOR EQUAL TO --> +<!ENTITY ngeq "≱" ><!--NEITHER GREATER-THAN NOR EQUAL TO --> +<!ENTITY ngeqq "≧̸" ><!--GREATER-THAN OVER EQUAL TO with slash --> +<!ENTITY ngeqslant "⩾̸" ><!--GREATER-THAN OR SLANTED EQUAL TO with slash --> +<!ENTITY nges "⩾̸" ><!--GREATER-THAN OR SLANTED EQUAL TO with slash --> +<!ENTITY ngsim "≵" ><!--NEITHER GREATER-THAN NOR EQUIVALENT TO --> +<!ENTITY ngt "≯" ><!--NOT GREATER-THAN --> +<!ENTITY ngtr "≯" ><!--NOT GREATER-THAN --> +<!ENTITY nhArr "⇎" ><!--LEFT RIGHT DOUBLE ARROW WITH STROKE --> +<!ENTITY nharr "↮" ><!--LEFT RIGHT ARROW WITH STROKE --> +<!ENTITY nhpar "⫲" ><!--PARALLEL WITH HORIZONTAL STROKE --> +<!ENTITY ni "∋" ><!--CONTAINS AS MEMBER --> +<!ENTITY nis "⋼" ><!--SMALL CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE --> +<!ENTITY nisd "⋺" ><!--CONTAINS WITH LONG HORIZONTAL STROKE --> +<!ENTITY niv "∋" ><!--CONTAINS AS MEMBER --> +<!ENTITY njcy "њ" ><!--CYRILLIC SMALL LETTER NJE --> +<!ENTITY nlArr "⇍" ><!--LEFTWARDS DOUBLE ARROW WITH STROKE --> +<!ENTITY nlE "≦̸" ><!--LESS-THAN OVER EQUAL TO with slash --> +<!ENTITY nlarr "↚" ><!--LEFTWARDS ARROW WITH STROKE --> +<!ENTITY nldr "‥" ><!--TWO DOT LEADER --> +<!ENTITY nle "≰" ><!--NEITHER LESS-THAN NOR EQUAL TO --> +<!ENTITY nleftarrow "↚" ><!--LEFTWARDS ARROW WITH STROKE --> +<!ENTITY nleftrightarrow "↮" ><!--LEFT RIGHT ARROW WITH STROKE --> +<!ENTITY nleq "≰" ><!--NEITHER LESS-THAN NOR EQUAL TO --> +<!ENTITY nleqq "≦̸" ><!--LESS-THAN OVER EQUAL TO with slash --> +<!ENTITY nleqslant "⩽̸" ><!--LESS-THAN OR SLANTED EQUAL TO with slash --> +<!ENTITY nles "⩽̸" ><!--LESS-THAN OR SLANTED EQUAL TO with slash --> +<!ENTITY nless "≮" ><!--NOT LESS-THAN --> +<!ENTITY nlsim "≴" ><!--NEITHER LESS-THAN NOR EQUIVALENT TO --> +<!ENTITY nlt "≮" ><!--NOT LESS-THAN --> +<!ENTITY nltri "⋪" ><!--NOT NORMAL SUBGROUP OF --> +<!ENTITY nltrie "⋬" ><!--NOT NORMAL SUBGROUP OF OR EQUAL TO --> +<!ENTITY nmid "∤" ><!--DOES NOT DIVIDE --> +<!ENTITY nopf "𝕟" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL N --> +<!ENTITY not "¬" ><!--NOT SIGN --> +<!ENTITY notin "∉" ><!--NOT AN ELEMENT OF --> +<!ENTITY notinE "⋹̸" ><!--ELEMENT OF WITH TWO HORIZONTAL STROKES with slash --> +<!ENTITY notindot "⋵̸" ><!--ELEMENT OF WITH DOT ABOVE with slash --> +<!ENTITY notinva "∉" ><!--NOT AN ELEMENT OF --> +<!ENTITY notinvb "⋷" ><!--SMALL ELEMENT OF WITH OVERBAR --> +<!ENTITY notinvc "⋶" ><!--ELEMENT OF WITH OVERBAR --> +<!ENTITY notni "∌" ><!--DOES NOT CONTAIN AS MEMBER --> +<!ENTITY notniva "∌" ><!--DOES NOT CONTAIN AS MEMBER --> +<!ENTITY notnivb "⋾" ><!--SMALL CONTAINS WITH OVERBAR --> +<!ENTITY notnivc "⋽" ><!--CONTAINS WITH OVERBAR --> +<!ENTITY npar "∦" ><!--NOT PARALLEL TO --> +<!ENTITY nparallel "∦" ><!--NOT PARALLEL TO --> +<!ENTITY nparsl "⫽⃥" ><!--DOUBLE SOLIDUS OPERATOR with reverse slash --> +<!ENTITY npart "∂̸" ><!--PARTIAL DIFFERENTIAL with slash --> +<!ENTITY npolint "⨔" ><!--LINE INTEGRATION NOT INCLUDING THE POLE --> +<!ENTITY npr "⊀" ><!--DOES NOT PRECEDE --> +<!ENTITY nprcue "⋠" ><!--DOES NOT PRECEDE OR EQUAL --> +<!ENTITY npre "⪯̸" ><!--PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash --> +<!ENTITY nprec "⊀" ><!--DOES NOT PRECEDE --> +<!ENTITY npreceq "⪯̸" ><!--PRECEDES ABOVE SINGLE-LINE EQUALS SIGN with slash --> +<!ENTITY nrArr "⇏" ><!--RIGHTWARDS DOUBLE ARROW WITH STROKE --> +<!ENTITY nrarr "↛" ><!--RIGHTWARDS ARROW WITH STROKE --> +<!ENTITY nrarrc "⤳̸" ><!--WAVE ARROW POINTING DIRECTLY RIGHT with slash --> +<!ENTITY nrarrw "↝̸" ><!--RIGHTWARDS WAVE ARROW with slash --> +<!ENTITY nrightarrow "↛" ><!--RIGHTWARDS ARROW WITH STROKE --> +<!ENTITY nrtri "⋫" ><!--DOES NOT CONTAIN AS NORMAL SUBGROUP --> +<!ENTITY nrtrie "⋭" ><!--DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL --> +<!ENTITY nsc "⊁" ><!--DOES NOT SUCCEED --> +<!ENTITY nsccue "⋡" ><!--DOES NOT SUCCEED OR EQUAL --> +<!ENTITY nsce "⪰̸" ><!--SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash --> +<!ENTITY nscr "𝓃" ><!--MATHEMATICAL SCRIPT SMALL N --> +<!ENTITY nshortmid "∤" ><!--DOES NOT DIVIDE --> +<!ENTITY nshortparallel "∦" ><!--NOT PARALLEL TO --> +<!ENTITY nsim "≁" ><!--NOT TILDE --> +<!ENTITY nsime "≄" ><!--NOT ASYMPTOTICALLY EQUAL TO --> +<!ENTITY nsimeq "≄" ><!--NOT ASYMPTOTICALLY EQUAL TO --> +<!ENTITY nsmid "∤" ><!--DOES NOT DIVIDE --> +<!ENTITY nspar "∦" ><!--NOT PARALLEL TO --> +<!ENTITY nsqsube "⋢" ><!--NOT SQUARE IMAGE OF OR EQUAL TO --> +<!ENTITY nsqsupe "⋣" ><!--NOT SQUARE ORIGINAL OF OR EQUAL TO --> +<!ENTITY nsub "⊄" ><!--NOT A SUBSET OF --> +<!ENTITY nsubE "⫅̸" ><!--SUBSET OF ABOVE EQUALS SIGN with slash --> +<!ENTITY nsube "⊈" ><!--NEITHER A SUBSET OF NOR EQUAL TO --> +<!ENTITY nsubset "⊂⃒" ><!--SUBSET OF with vertical line --> +<!ENTITY nsubseteq "⊈" ><!--NEITHER A SUBSET OF NOR EQUAL TO --> +<!ENTITY nsubseteqq "⫅̸" ><!--SUBSET OF ABOVE EQUALS SIGN with slash --> +<!ENTITY nsucc "⊁" ><!--DOES NOT SUCCEED --> +<!ENTITY nsucceq "⪰̸" ><!--SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN with slash --> +<!ENTITY nsup "⊅" ><!--NOT A SUPERSET OF --> +<!ENTITY nsupE "⫆̸" ><!--SUPERSET OF ABOVE EQUALS SIGN with slash --> +<!ENTITY nsupe "⊉" ><!--NEITHER A SUPERSET OF NOR EQUAL TO --> +<!ENTITY nsupset "⊃⃒" ><!--SUPERSET OF with vertical line --> +<!ENTITY nsupseteq "⊉" ><!--NEITHER A SUPERSET OF NOR EQUAL TO --> +<!ENTITY nsupseteqq "⫆̸" ><!--SUPERSET OF ABOVE EQUALS SIGN with slash --> +<!ENTITY ntgl "≹" ><!--NEITHER GREATER-THAN NOR LESS-THAN --> +<!ENTITY ntilde "ñ" ><!--LATIN SMALL LETTER N WITH TILDE --> +<!ENTITY ntlg "≸" ><!--NEITHER LESS-THAN NOR GREATER-THAN --> +<!ENTITY ntriangleleft "⋪" ><!--NOT NORMAL SUBGROUP OF --> +<!ENTITY ntrianglelefteq "⋬" ><!--NOT NORMAL SUBGROUP OF OR EQUAL TO --> +<!ENTITY ntriangleright "⋫" ><!--DOES NOT CONTAIN AS NORMAL SUBGROUP --> +<!ENTITY ntrianglerighteq "⋭" ><!--DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL --> +<!ENTITY nu "ν" ><!--GREEK SMALL LETTER NU --> +<!ENTITY num "#" ><!--NUMBER SIGN --> +<!ENTITY numero "№" ><!--NUMERO SIGN --> +<!ENTITY numsp " " ><!--FIGURE SPACE --> +<!ENTITY nvDash "⊭" ><!--NOT TRUE --> +<!ENTITY nvHarr "⤄" ><!--LEFT RIGHT DOUBLE ARROW WITH VERTICAL STROKE --> +<!ENTITY nvap "≍⃒" ><!--EQUIVALENT TO with vertical line --> +<!ENTITY nvdash "⊬" ><!--DOES NOT PROVE --> +<!ENTITY nvge "≥⃒" ><!--GREATER-THAN OR EQUAL TO with vertical line --> +<!ENTITY nvgt ">⃒" ><!--GREATER-THAN SIGN with vertical line --> +<!ENTITY nvinfin "⧞" ><!--INFINITY NEGATED WITH VERTICAL BAR --> +<!ENTITY nvlArr "⤂" ><!--LEFTWARDS DOUBLE ARROW WITH VERTICAL STROKE --> +<!ENTITY nvle "≤⃒" ><!--LESS-THAN OR EQUAL TO with vertical line --> +<!ENTITY nvlt "&#x0003C;⃒" ><!--LESS-THAN SIGN with vertical line --> +<!ENTITY nvltrie "⊴⃒" ><!--NORMAL SUBGROUP OF OR EQUAL TO with vertical line --> +<!ENTITY nvrArr "⤃" ><!--RIGHTWARDS DOUBLE ARROW WITH VERTICAL STROKE --> +<!ENTITY nvrtrie "⊵⃒" ><!--CONTAINS AS NORMAL SUBGROUP OR EQUAL TO with vertical line --> +<!ENTITY nvsim "∼⃒" ><!--TILDE OPERATOR with vertical line --> +<!ENTITY nwArr "⇖" ><!--NORTH WEST DOUBLE ARROW --> +<!ENTITY nwarhk "⤣" ><!--NORTH WEST ARROW WITH HOOK --> +<!ENTITY nwarr "↖" ><!--NORTH WEST ARROW --> +<!ENTITY nwarrow "↖" ><!--NORTH WEST ARROW --> +<!ENTITY nwnear "⤧" ><!--NORTH WEST ARROW AND NORTH EAST ARROW --> +<!ENTITY oS "Ⓢ" ><!--CIRCLED LATIN CAPITAL LETTER S --> +<!ENTITY oacute "ó" ><!--LATIN SMALL LETTER O WITH ACUTE --> +<!ENTITY oast "⊛" ><!--CIRCLED ASTERISK OPERATOR --> +<!ENTITY ocir "⊚" ><!--CIRCLED RING OPERATOR --> +<!ENTITY ocirc "ô" ><!--LATIN SMALL LETTER O WITH CIRCUMFLEX --> +<!ENTITY ocy "о" ><!--CYRILLIC SMALL LETTER O --> +<!ENTITY odash "⊝" ><!--CIRCLED DASH --> +<!ENTITY odblac "ő" ><!--LATIN SMALL LETTER O WITH DOUBLE ACUTE --> +<!ENTITY odiv "⨸" ><!--CIRCLED DIVISION SIGN --> +<!ENTITY odot "⊙" ><!--CIRCLED DOT OPERATOR --> +<!ENTITY odsold "⦼" ><!--CIRCLED ANTICLOCKWISE-ROTATED DIVISION SIGN --> +<!ENTITY oelig "œ" ><!--LATIN SMALL LIGATURE OE --> +<!ENTITY ofcir "⦿" ><!--CIRCLED BULLET --> +<!ENTITY ofr "𝔬" ><!--MATHEMATICAL FRAKTUR SMALL O --> +<!ENTITY ogon "˛" ><!--OGONEK --> +<!ENTITY ograve "ò" ><!--LATIN SMALL LETTER O WITH GRAVE --> +<!ENTITY ogt "⧁" ><!--CIRCLED GREATER-THAN --> +<!ENTITY ohbar "⦵" ><!--CIRCLE WITH HORIZONTAL BAR --> +<!ENTITY ohm "Ω" ><!--GREEK CAPITAL LETTER OMEGA --> +<!ENTITY oint "∮" ><!--CONTOUR INTEGRAL --> +<!ENTITY olarr "↺" ><!--ANTICLOCKWISE OPEN CIRCLE ARROW --> +<!ENTITY olcir "⦾" ><!--CIRCLED WHITE BULLET --> +<!ENTITY olcross "⦻" ><!--CIRCLE WITH SUPERIMPOSED X --> +<!ENTITY oline "‾" ><!--OVERLINE --> +<!ENTITY olt "⧀" ><!--CIRCLED LESS-THAN --> +<!ENTITY omacr "ō" ><!--LATIN SMALL LETTER O WITH MACRON --> +<!ENTITY omega "ω" ><!--GREEK SMALL LETTER OMEGA --> +<!ENTITY omicron "ο" ><!--GREEK SMALL LETTER OMICRON --> +<!ENTITY omid "⦶" ><!--CIRCLED VERTICAL BAR --> +<!ENTITY ominus "⊖" ><!--CIRCLED MINUS --> +<!ENTITY oopf "𝕠" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL O --> +<!ENTITY opar "⦷" ><!--CIRCLED PARALLEL --> +<!ENTITY operp "⦹" ><!--CIRCLED PERPENDICULAR --> +<!ENTITY oplus "⊕" ><!--CIRCLED PLUS --> +<!ENTITY or "∨" ><!--LOGICAL OR --> +<!ENTITY orarr "↻" ><!--CLOCKWISE OPEN CIRCLE ARROW --> +<!ENTITY ord "⩝" ><!--LOGICAL OR WITH HORIZONTAL DASH --> +<!ENTITY order "ℴ" ><!--SCRIPT SMALL O --> +<!ENTITY orderof "ℴ" ><!--SCRIPT SMALL O --> +<!ENTITY ordf "ª" ><!--FEMININE ORDINAL INDICATOR --> +<!ENTITY ordm "º" ><!--MASCULINE ORDINAL INDICATOR --> +<!ENTITY origof "⊶" ><!--ORIGINAL OF --> +<!ENTITY oror "⩖" ><!--TWO INTERSECTING LOGICAL OR --> +<!ENTITY orslope "⩗" ><!--SLOPING LARGE OR --> +<!ENTITY orv "⩛" ><!--LOGICAL OR WITH MIDDLE STEM --> +<!ENTITY oscr "ℴ" ><!--SCRIPT SMALL O --> +<!ENTITY oslash "ø" ><!--LATIN SMALL LETTER O WITH STROKE --> +<!ENTITY osol "⊘" ><!--CIRCLED DIVISION SLASH --> +<!ENTITY otilde "õ" ><!--LATIN SMALL LETTER O WITH TILDE --> +<!ENTITY otimes "⊗" ><!--CIRCLED TIMES --> +<!ENTITY otimesas "⨶" ><!--CIRCLED MULTIPLICATION SIGN WITH CIRCUMFLEX ACCENT --> +<!ENTITY ouml "ö" ><!--LATIN SMALL LETTER O WITH DIAERESIS --> +<!ENTITY ovbar "⌽" ><!--APL FUNCTIONAL SYMBOL CIRCLE STILE --> +<!ENTITY par "∥" ><!--PARALLEL TO --> +<!ENTITY para "¶" ><!--PILCROW SIGN --> +<!ENTITY parallel "∥" ><!--PARALLEL TO --> +<!ENTITY parsim "⫳" ><!--PARALLEL WITH TILDE OPERATOR --> +<!ENTITY parsl "⫽" ><!--DOUBLE SOLIDUS OPERATOR --> +<!ENTITY part "∂" ><!--PARTIAL DIFFERENTIAL --> +<!ENTITY pcy "п" ><!--CYRILLIC SMALL LETTER PE --> +<!ENTITY percnt "%" ><!--PERCENT SIGN --> +<!ENTITY period "." ><!--FULL STOP --> +<!ENTITY permil "‰" ><!--PER MILLE SIGN --> +<!ENTITY perp "⊥" ><!--UP TACK --> +<!ENTITY pertenk "‱" ><!--PER TEN THOUSAND SIGN --> +<!ENTITY pfr "𝔭" ><!--MATHEMATICAL FRAKTUR SMALL P --> +<!ENTITY phi "φ" ><!--GREEK SMALL LETTER PHI --> +<!ENTITY phiv "ϕ" ><!--GREEK PHI SYMBOL --> +<!ENTITY phmmat "ℳ" ><!--SCRIPT CAPITAL M --> +<!ENTITY phone "☎" ><!--BLACK TELEPHONE --> +<!ENTITY pi "π" ><!--GREEK SMALL LETTER PI --> +<!ENTITY pitchfork "⋔" ><!--PITCHFORK --> +<!ENTITY piv "ϖ" ><!--GREEK PI SYMBOL --> +<!ENTITY planck "ℏ" ><!--PLANCK CONSTANT OVER TWO PI --> +<!ENTITY planckh "ℎ" ><!--PLANCK CONSTANT --> +<!ENTITY plankv "ℏ" ><!--PLANCK CONSTANT OVER TWO PI --> +<!ENTITY plus "+" ><!--PLUS SIGN --> +<!ENTITY plusacir "⨣" ><!--PLUS SIGN WITH CIRCUMFLEX ACCENT ABOVE --> +<!ENTITY plusb "⊞" ><!--SQUARED PLUS --> +<!ENTITY pluscir "⨢" ><!--PLUS SIGN WITH SMALL CIRCLE ABOVE --> +<!ENTITY plusdo "∔" ><!--DOT PLUS --> +<!ENTITY plusdu "⨥" ><!--PLUS SIGN WITH DOT BELOW --> +<!ENTITY pluse "⩲" ><!--PLUS SIGN ABOVE EQUALS SIGN --> +<!ENTITY plusmn "±" ><!--PLUS-MINUS SIGN --> +<!ENTITY plussim "⨦" ><!--PLUS SIGN WITH TILDE BELOW --> +<!ENTITY plustwo "⨧" ><!--PLUS SIGN WITH SUBSCRIPT TWO --> +<!ENTITY pm "±" ><!--PLUS-MINUS SIGN --> +<!ENTITY pointint "⨕" ><!--INTEGRAL AROUND A POINT OPERATOR --> +<!ENTITY popf "𝕡" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL P --> +<!ENTITY pound "£" ><!--POUND SIGN --> +<!ENTITY pr "≺" ><!--PRECEDES --> +<!ENTITY prE "⪳" ><!--PRECEDES ABOVE EQUALS SIGN --> +<!ENTITY prap "⪷" ><!--PRECEDES ABOVE ALMOST EQUAL TO --> +<!ENTITY prcue "≼" ><!--PRECEDES OR EQUAL TO --> +<!ENTITY pre "⪯" ><!--PRECEDES ABOVE SINGLE-LINE EQUALS SIGN --> +<!ENTITY prec "≺" ><!--PRECEDES --> +<!ENTITY precapprox "⪷" ><!--PRECEDES ABOVE ALMOST EQUAL TO --> +<!ENTITY preccurlyeq "≼" ><!--PRECEDES OR EQUAL TO --> +<!ENTITY preceq "⪯" ><!--PRECEDES ABOVE SINGLE-LINE EQUALS SIGN --> +<!ENTITY precnapprox "⪹" ><!--PRECEDES ABOVE NOT ALMOST EQUAL TO --> +<!ENTITY precneqq "⪵" ><!--PRECEDES ABOVE NOT EQUAL TO --> +<!ENTITY precnsim "⋨" ><!--PRECEDES BUT NOT EQUIVALENT TO --> +<!ENTITY precsim "≾" ><!--PRECEDES OR EQUIVALENT TO --> +<!ENTITY prime "′" ><!--PRIME --> +<!ENTITY primes "ℙ" ><!--DOUBLE-STRUCK CAPITAL P --> +<!ENTITY prnE "⪵" ><!--PRECEDES ABOVE NOT EQUAL TO --> +<!ENTITY prnap "⪹" ><!--PRECEDES ABOVE NOT ALMOST EQUAL TO --> +<!ENTITY prnsim "⋨" ><!--PRECEDES BUT NOT EQUIVALENT TO --> +<!ENTITY prod "∏" ><!--N-ARY PRODUCT --> +<!ENTITY profalar "⌮" ><!--ALL AROUND-PROFILE --> +<!ENTITY profline "⌒" ><!--ARC --> +<!ENTITY profsurf "⌓" ><!--SEGMENT --> +<!ENTITY prop "∝" ><!--PROPORTIONAL TO --> +<!ENTITY propto "∝" ><!--PROPORTIONAL TO --> +<!ENTITY prsim "≾" ><!--PRECEDES OR EQUIVALENT TO --> +<!ENTITY prurel "⊰" ><!--PRECEDES UNDER RELATION --> +<!ENTITY pscr "𝓅" ><!--MATHEMATICAL SCRIPT SMALL P --> +<!ENTITY psi "ψ" ><!--GREEK SMALL LETTER PSI --> +<!ENTITY puncsp " " ><!--PUNCTUATION SPACE --> +<!ENTITY qfr "𝔮" ><!--MATHEMATICAL FRAKTUR SMALL Q --> +<!ENTITY qint "⨌" ><!--QUADRUPLE INTEGRAL OPERATOR --> +<!ENTITY qopf "𝕢" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL Q --> +<!ENTITY qprime "⁗" ><!--QUADRUPLE PRIME --> +<!ENTITY qscr "𝓆" ><!--MATHEMATICAL SCRIPT SMALL Q --> +<!ENTITY quaternions "ℍ" ><!--DOUBLE-STRUCK CAPITAL H --> +<!ENTITY quatint "⨖" ><!--QUATERNION INTEGRAL OPERATOR --> +<!ENTITY quest "?" ><!--QUESTION MARK --> +<!ENTITY questeq "≟" ><!--QUESTIONED EQUAL TO --> +<!ENTITY quot """ ><!--QUOTATION MARK --> +<!ENTITY rAarr "⇛" ><!--RIGHTWARDS TRIPLE ARROW --> +<!ENTITY rArr "⇒" ><!--RIGHTWARDS DOUBLE ARROW --> +<!ENTITY rAtail "⤜" ><!--RIGHTWARDS DOUBLE ARROW-TAIL --> +<!ENTITY rBarr "⤏" ><!--RIGHTWARDS TRIPLE DASH ARROW --> +<!ENTITY rHar "⥤" ><!--RIGHTWARDS HARPOON WITH BARB UP ABOVE RIGHTWARDS HARPOON WITH BARB DOWN --> +<!ENTITY race "∽̱" ><!--REVERSED TILDE with underline --> +<!ENTITY racute "ŕ" ><!--LATIN SMALL LETTER R WITH ACUTE --> +<!ENTITY radic "√" ><!--SQUARE ROOT --> +<!ENTITY raemptyv "⦳" ><!--EMPTY SET WITH RIGHT ARROW ABOVE --> +<!ENTITY rang "⟩" ><!--MATHEMATICAL RIGHT ANGLE BRACKET --> +<!ENTITY rangd "⦒" ><!--RIGHT ANGLE BRACKET WITH DOT --> +<!ENTITY range "⦥" ><!--REVERSED ANGLE WITH UNDERBAR --> +<!ENTITY rangle "⟩" ><!--MATHEMATICAL RIGHT ANGLE BRACKET --> +<!ENTITY raquo "»" ><!--RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK --> +<!ENTITY rarr "→" ><!--RIGHTWARDS ARROW --> +<!ENTITY rarrap "⥵" ><!--RIGHTWARDS ARROW ABOVE ALMOST EQUAL TO --> +<!ENTITY rarrb "⇥" ><!--RIGHTWARDS ARROW TO BAR --> +<!ENTITY rarrbfs "⤠" ><!--RIGHTWARDS ARROW FROM BAR TO BLACK DIAMOND --> +<!ENTITY rarrc "⤳" ><!--WAVE ARROW POINTING DIRECTLY RIGHT --> +<!ENTITY rarrfs "⤞" ><!--RIGHTWARDS ARROW TO BLACK DIAMOND --> +<!ENTITY rarrhk "↪" ><!--RIGHTWARDS ARROW WITH HOOK --> +<!ENTITY rarrlp "↬" ><!--RIGHTWARDS ARROW WITH LOOP --> +<!ENTITY rarrpl "⥅" ><!--RIGHTWARDS ARROW WITH PLUS BELOW --> +<!ENTITY rarrsim "⥴" ><!--RIGHTWARDS ARROW ABOVE TILDE OPERATOR --> +<!ENTITY rarrtl "↣" ><!--RIGHTWARDS ARROW WITH TAIL --> +<!ENTITY rarrw "↝" ><!--RIGHTWARDS WAVE ARROW --> +<!ENTITY ratail "⤚" ><!--RIGHTWARDS ARROW-TAIL --> +<!ENTITY ratio "∶" ><!--RATIO --> +<!ENTITY rationals "ℚ" ><!--DOUBLE-STRUCK CAPITAL Q --> +<!ENTITY rbarr "⤍" ><!--RIGHTWARDS DOUBLE DASH ARROW --> +<!ENTITY rbbrk "❳" ><!--LIGHT RIGHT TORTOISE SHELL BRACKET ORNAMENT --> +<!ENTITY rbrace "}" ><!--RIGHT CURLY BRACKET --> +<!ENTITY rbrack "]" ><!--RIGHT SQUARE BRACKET --> +<!ENTITY rbrke "⦌" ><!--RIGHT SQUARE BRACKET WITH UNDERBAR --> +<!ENTITY rbrksld "⦎" ><!--RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER --> +<!ENTITY rbrkslu "⦐" ><!--RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER --> +<!ENTITY rcaron "ř" ><!--LATIN SMALL LETTER R WITH CARON --> +<!ENTITY rcedil "ŗ" ><!--LATIN SMALL LETTER R WITH CEDILLA --> +<!ENTITY rceil "⌉" ><!--RIGHT CEILING --> +<!ENTITY rcub "}" ><!--RIGHT CURLY BRACKET --> +<!ENTITY rcy "р" ><!--CYRILLIC SMALL LETTER ER --> +<!ENTITY rdca "⤷" ><!--ARROW POINTING DOWNWARDS THEN CURVING RIGHTWARDS --> +<!ENTITY rdldhar "⥩" ><!--RIGHTWARDS HARPOON WITH BARB DOWN ABOVE LEFTWARDS HARPOON WITH BARB DOWN --> +<!ENTITY rdquo "”" ><!--RIGHT DOUBLE QUOTATION MARK --> +<!ENTITY rdquor "”" ><!--RIGHT DOUBLE QUOTATION MARK --> +<!ENTITY rdsh "↳" ><!--DOWNWARDS ARROW WITH TIP RIGHTWARDS --> +<!ENTITY real "ℜ" ><!--BLACK-LETTER CAPITAL R --> +<!ENTITY realine "ℛ" ><!--SCRIPT CAPITAL R --> +<!ENTITY realpart "ℜ" ><!--BLACK-LETTER CAPITAL R --> +<!ENTITY reals "ℝ" ><!--DOUBLE-STRUCK CAPITAL R --> +<!ENTITY rect "▭" ><!--WHITE RECTANGLE --> +<!ENTITY reg "®" ><!--REGISTERED SIGN --> +<!ENTITY rfisht "⥽" ><!--RIGHT FISH TAIL --> +<!ENTITY rfloor "⌋" ><!--RIGHT FLOOR --> +<!ENTITY rfr "𝔯" ><!--MATHEMATICAL FRAKTUR SMALL R --> +<!ENTITY rhard "⇁" ><!--RIGHTWARDS HARPOON WITH BARB DOWNWARDS --> +<!ENTITY rharu "⇀" ><!--RIGHTWARDS HARPOON WITH BARB UPWARDS --> +<!ENTITY rharul "⥬" ><!--RIGHTWARDS HARPOON WITH BARB UP ABOVE LONG DASH --> +<!ENTITY rho "ρ" ><!--GREEK SMALL LETTER RHO --> +<!ENTITY rhov "ϱ" ><!--GREEK RHO SYMBOL --> +<!ENTITY rightarrow "→" ><!--RIGHTWARDS ARROW --> +<!ENTITY rightarrowtail "↣" ><!--RIGHTWARDS ARROW WITH TAIL --> +<!ENTITY rightharpoondown "⇁" ><!--RIGHTWARDS HARPOON WITH BARB DOWNWARDS --> +<!ENTITY rightharpoonup "⇀" ><!--RIGHTWARDS HARPOON WITH BARB UPWARDS --> +<!ENTITY rightleftarrows "⇄" ><!--RIGHTWARDS ARROW OVER LEFTWARDS ARROW --> +<!ENTITY rightleftharpoons "⇌" ><!--RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON --> +<!ENTITY rightrightarrows "⇉" ><!--RIGHTWARDS PAIRED ARROWS --> +<!ENTITY rightsquigarrow "↝" ><!--RIGHTWARDS WAVE ARROW --> +<!ENTITY rightthreetimes "⋌" ><!--RIGHT SEMIDIRECT PRODUCT --> +<!ENTITY ring "˚" ><!--RING ABOVE --> +<!ENTITY risingdotseq "≓" ><!--IMAGE OF OR APPROXIMATELY EQUAL TO --> +<!ENTITY rlarr "⇄" ><!--RIGHTWARDS ARROW OVER LEFTWARDS ARROW --> +<!ENTITY rlhar "⇌" ><!--RIGHTWARDS HARPOON OVER LEFTWARDS HARPOON --> +<!ENTITY rlm "‏" ><!--RIGHT-TO-LEFT MARK --> +<!ENTITY rmoust "⎱" ><!--UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION --> +<!ENTITY rmoustache "⎱" ><!--UPPER RIGHT OR LOWER LEFT CURLY BRACKET SECTION --> +<!ENTITY rnmid "⫮" ><!--DOES NOT DIVIDE WITH REVERSED NEGATION SLASH --> +<!ENTITY roang "⟭" ><!--MATHEMATICAL RIGHT WHITE TORTOISE SHELL BRACKET --> +<!ENTITY roarr "⇾" ><!--RIGHTWARDS OPEN-HEADED ARROW --> +<!ENTITY robrk "⟧" ><!--MATHEMATICAL RIGHT WHITE SQUARE BRACKET --> +<!ENTITY ropar "⦆" ><!--RIGHT WHITE PARENTHESIS --> +<!ENTITY ropf "𝕣" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL R --> +<!ENTITY roplus "⨮" ><!--PLUS SIGN IN RIGHT HALF CIRCLE --> +<!ENTITY rotimes "⨵" ><!--MULTIPLICATION SIGN IN RIGHT HALF CIRCLE --> +<!ENTITY rpar ")" ><!--RIGHT PARENTHESIS --> +<!ENTITY rpargt "⦔" ><!--RIGHT ARC GREATER-THAN BRACKET --> +<!ENTITY rppolint "⨒" ><!--LINE INTEGRATION WITH RECTANGULAR PATH AROUND POLE --> +<!ENTITY rrarr "⇉" ><!--RIGHTWARDS PAIRED ARROWS --> +<!ENTITY rsaquo "›" ><!--SINGLE RIGHT-POINTING ANGLE QUOTATION MARK --> +<!ENTITY rscr "𝓇" ><!--MATHEMATICAL SCRIPT SMALL R --> +<!ENTITY rsh "↱" ><!--UPWARDS ARROW WITH TIP RIGHTWARDS --> +<!ENTITY rsqb "]" ><!--RIGHT SQUARE BRACKET --> +<!ENTITY rsquo "’" ><!--RIGHT SINGLE QUOTATION MARK --> +<!ENTITY rsquor "’" ><!--RIGHT SINGLE QUOTATION MARK --> +<!ENTITY rthree "⋌" ><!--RIGHT SEMIDIRECT PRODUCT --> +<!ENTITY rtimes "⋊" ><!--RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT --> +<!ENTITY rtri "▹" ><!--WHITE RIGHT-POINTING SMALL TRIANGLE --> +<!ENTITY rtrie "⊵" ><!--CONTAINS AS NORMAL SUBGROUP OR EQUAL TO --> +<!ENTITY rtrif "▸" ><!--BLACK RIGHT-POINTING SMALL TRIANGLE --> +<!ENTITY rtriltri "⧎" ><!--RIGHT TRIANGLE ABOVE LEFT TRIANGLE --> +<!ENTITY ruluhar "⥨" ><!--RIGHTWARDS HARPOON WITH BARB UP ABOVE LEFTWARDS HARPOON WITH BARB UP --> +<!ENTITY rx "℞" ><!--PRESCRIPTION TAKE --> +<!ENTITY sacute "ś" ><!--LATIN SMALL LETTER S WITH ACUTE --> +<!ENTITY sbquo "‚" ><!--SINGLE LOW-9 QUOTATION MARK --> +<!ENTITY sc "≻" ><!--SUCCEEDS --> +<!ENTITY scE "⪴" ><!--SUCCEEDS ABOVE EQUALS SIGN --> +<!ENTITY scap "⪸" ><!--SUCCEEDS ABOVE ALMOST EQUAL TO --> +<!ENTITY scaron "š" ><!--LATIN SMALL LETTER S WITH CARON --> +<!ENTITY sccue "≽" ><!--SUCCEEDS OR EQUAL TO --> +<!ENTITY sce "⪰" ><!--SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN --> +<!ENTITY scedil "ş" ><!--LATIN SMALL LETTER S WITH CEDILLA --> +<!ENTITY scirc "ŝ" ><!--LATIN SMALL LETTER S WITH CIRCUMFLEX --> +<!ENTITY scnE "⪶" ><!--SUCCEEDS ABOVE NOT EQUAL TO --> +<!ENTITY scnap "⪺" ><!--SUCCEEDS ABOVE NOT ALMOST EQUAL TO --> +<!ENTITY scnsim "⋩" ><!--SUCCEEDS BUT NOT EQUIVALENT TO --> +<!ENTITY scpolint "⨓" ><!--LINE INTEGRATION WITH SEMICIRCULAR PATH AROUND POLE --> +<!ENTITY scsim "≿" ><!--SUCCEEDS OR EQUIVALENT TO --> +<!ENTITY scy "с" ><!--CYRILLIC SMALL LETTER ES --> +<!ENTITY sdot "⋅" ><!--DOT OPERATOR --> +<!ENTITY sdotb "⊡" ><!--SQUARED DOT OPERATOR --> +<!ENTITY sdote "⩦" ><!--EQUALS SIGN WITH DOT BELOW --> +<!ENTITY seArr "⇘" ><!--SOUTH EAST DOUBLE ARROW --> +<!ENTITY searhk "⤥" ><!--SOUTH EAST ARROW WITH HOOK --> +<!ENTITY searr "↘" ><!--SOUTH EAST ARROW --> +<!ENTITY searrow "↘" ><!--SOUTH EAST ARROW --> +<!ENTITY sect "§" ><!--SECTION SIGN --> +<!ENTITY semi ";" ><!--SEMICOLON --> +<!ENTITY seswar "⤩" ><!--SOUTH EAST ARROW AND SOUTH WEST ARROW --> +<!ENTITY setminus "∖" ><!--SET MINUS --> +<!ENTITY setmn "∖" ><!--SET MINUS --> +<!ENTITY sext "✶" ><!--SIX POINTED BLACK STAR --> +<!ENTITY sfr "𝔰" ><!--MATHEMATICAL FRAKTUR SMALL S --> +<!ENTITY sfrown "⌢" ><!--FROWN --> +<!ENTITY sharp "♯" ><!--MUSIC SHARP SIGN --> +<!ENTITY shchcy "щ" ><!--CYRILLIC SMALL LETTER SHCHA --> +<!ENTITY shcy "ш" ><!--CYRILLIC SMALL LETTER SHA --> +<!ENTITY shortmid "∣" ><!--DIVIDES --> +<!ENTITY shortparallel "∥" ><!--PARALLEL TO --> +<!ENTITY shy "­" ><!--SOFT HYPHEN --> +<!ENTITY sigma "σ" ><!--GREEK SMALL LETTER SIGMA --> +<!ENTITY sigmaf "ς" ><!--GREEK SMALL LETTER FINAL SIGMA --> +<!ENTITY sigmav "ς" ><!--GREEK SMALL LETTER FINAL SIGMA --> +<!ENTITY sim "∼" ><!--TILDE OPERATOR --> +<!ENTITY simdot "⩪" ><!--TILDE OPERATOR WITH DOT ABOVE --> +<!ENTITY sime "≃" ><!--ASYMPTOTICALLY EQUAL TO --> +<!ENTITY simeq "≃" ><!--ASYMPTOTICALLY EQUAL TO --> +<!ENTITY simg "⪞" ><!--SIMILAR OR GREATER-THAN --> +<!ENTITY simgE "⪠" ><!--SIMILAR ABOVE GREATER-THAN ABOVE EQUALS SIGN --> +<!ENTITY siml "⪝" ><!--SIMILAR OR LESS-THAN --> +<!ENTITY simlE "⪟" ><!--SIMILAR ABOVE LESS-THAN ABOVE EQUALS SIGN --> +<!ENTITY simne "≆" ><!--APPROXIMATELY BUT NOT ACTUALLY EQUAL TO --> +<!ENTITY simplus "⨤" ><!--PLUS SIGN WITH TILDE ABOVE --> +<!ENTITY simrarr "⥲" ><!--TILDE OPERATOR ABOVE RIGHTWARDS ARROW --> +<!ENTITY slarr "←" ><!--LEFTWARDS ARROW --> +<!ENTITY smallsetminus "∖" ><!--SET MINUS --> +<!ENTITY smashp "⨳" ><!--SMASH PRODUCT --> +<!ENTITY smeparsl "⧤" ><!--EQUALS SIGN AND SLANTED PARALLEL WITH TILDE ABOVE --> +<!ENTITY smid "∣" ><!--DIVIDES --> +<!ENTITY smile "⌣" ><!--SMILE --> +<!ENTITY smt "⪪" ><!--SMALLER THAN --> +<!ENTITY smte "⪬" ><!--SMALLER THAN OR EQUAL TO --> +<!ENTITY smtes "⪬︀" ><!--SMALLER THAN OR slanted EQUAL --> +<!ENTITY softcy "ь" ><!--CYRILLIC SMALL LETTER SOFT SIGN --> +<!ENTITY sol "/" ><!--SOLIDUS --> +<!ENTITY solb "⧄" ><!--SQUARED RISING DIAGONAL SLASH --> +<!ENTITY solbar "⌿" ><!--APL FUNCTIONAL SYMBOL SLASH BAR --> +<!ENTITY sopf "𝕤" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL S --> +<!ENTITY spades "♠" ><!--BLACK SPADE SUIT --> +<!ENTITY spadesuit "♠" ><!--BLACK SPADE SUIT --> +<!ENTITY spar "∥" ><!--PARALLEL TO --> +<!ENTITY sqcap "⊓" ><!--SQUARE CAP --> +<!ENTITY sqcaps "⊓︀" ><!--SQUARE CAP with serifs --> +<!ENTITY sqcup "⊔" ><!--SQUARE CUP --> +<!ENTITY sqcups "⊔︀" ><!--SQUARE CUP with serifs --> +<!ENTITY sqsub "⊏" ><!--SQUARE IMAGE OF --> +<!ENTITY sqsube "⊑" ><!--SQUARE IMAGE OF OR EQUAL TO --> +<!ENTITY sqsubset "⊏" ><!--SQUARE IMAGE OF --> +<!ENTITY sqsubseteq "⊑" ><!--SQUARE IMAGE OF OR EQUAL TO --> +<!ENTITY sqsup "⊐" ><!--SQUARE ORIGINAL OF --> +<!ENTITY sqsupe "⊒" ><!--SQUARE ORIGINAL OF OR EQUAL TO --> +<!ENTITY sqsupset "⊐" ><!--SQUARE ORIGINAL OF --> +<!ENTITY sqsupseteq "⊒" ><!--SQUARE ORIGINAL OF OR EQUAL TO --> +<!ENTITY squ "□" ><!--WHITE SQUARE --> +<!ENTITY square "□" ><!--WHITE SQUARE --> +<!ENTITY squarf "▪" ><!--BLACK SMALL SQUARE --> +<!ENTITY squf "▪" ><!--BLACK SMALL SQUARE --> +<!ENTITY srarr "→" ><!--RIGHTWARDS ARROW --> +<!ENTITY sscr "𝓈" ><!--MATHEMATICAL SCRIPT SMALL S --> +<!ENTITY ssetmn "∖" ><!--SET MINUS --> +<!ENTITY ssmile "⌣" ><!--SMILE --> +<!ENTITY sstarf "⋆" ><!--STAR OPERATOR --> +<!ENTITY star "☆" ><!--WHITE STAR --> +<!ENTITY starf "★" ><!--BLACK STAR --> +<!ENTITY straightepsilon "ϵ" ><!--GREEK LUNATE EPSILON SYMBOL --> +<!ENTITY straightphi "ϕ" ><!--GREEK PHI SYMBOL --> +<!ENTITY strns "¯" ><!--MACRON --> +<!ENTITY sub "⊂" ><!--SUBSET OF --> +<!ENTITY subE "⫅" ><!--SUBSET OF ABOVE EQUALS SIGN --> +<!ENTITY subdot "⪽" ><!--SUBSET WITH DOT --> +<!ENTITY sube "⊆" ><!--SUBSET OF OR EQUAL TO --> +<!ENTITY subedot "⫃" ><!--SUBSET OF OR EQUAL TO WITH DOT ABOVE --> +<!ENTITY submult "⫁" ><!--SUBSET WITH MULTIPLICATION SIGN BELOW --> +<!ENTITY subnE "⫋" ><!--SUBSET OF ABOVE NOT EQUAL TO --> +<!ENTITY subne "⊊" ><!--SUBSET OF WITH NOT EQUAL TO --> +<!ENTITY subplus "⪿" ><!--SUBSET WITH PLUS SIGN BELOW --> +<!ENTITY subrarr "⥹" ><!--SUBSET ABOVE RIGHTWARDS ARROW --> +<!ENTITY subset "⊂" ><!--SUBSET OF --> +<!ENTITY subseteq "⊆" ><!--SUBSET OF OR EQUAL TO --> +<!ENTITY subseteqq "⫅" ><!--SUBSET OF ABOVE EQUALS SIGN --> +<!ENTITY subsetneq "⊊" ><!--SUBSET OF WITH NOT EQUAL TO --> +<!ENTITY subsetneqq "⫋" ><!--SUBSET OF ABOVE NOT EQUAL TO --> +<!ENTITY subsim "⫇" ><!--SUBSET OF ABOVE TILDE OPERATOR --> +<!ENTITY subsub "⫕" ><!--SUBSET ABOVE SUBSET --> +<!ENTITY subsup "⫓" ><!--SUBSET ABOVE SUPERSET --> +<!ENTITY succ "≻" ><!--SUCCEEDS --> +<!ENTITY succapprox "⪸" ><!--SUCCEEDS ABOVE ALMOST EQUAL TO --> +<!ENTITY succcurlyeq "≽" ><!--SUCCEEDS OR EQUAL TO --> +<!ENTITY succeq "⪰" ><!--SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN --> +<!ENTITY succnapprox "⪺" ><!--SUCCEEDS ABOVE NOT ALMOST EQUAL TO --> +<!ENTITY succneqq "⪶" ><!--SUCCEEDS ABOVE NOT EQUAL TO --> +<!ENTITY succnsim "⋩" ><!--SUCCEEDS BUT NOT EQUIVALENT TO --> +<!ENTITY succsim "≿" ><!--SUCCEEDS OR EQUIVALENT TO --> +<!ENTITY sum "∑" ><!--N-ARY SUMMATION --> +<!ENTITY sung "♪" ><!--EIGHTH NOTE --> +<!ENTITY sup "⊃" ><!--SUPERSET OF --> +<!ENTITY sup1 "¹" ><!--SUPERSCRIPT ONE --> +<!ENTITY sup2 "²" ><!--SUPERSCRIPT TWO --> +<!ENTITY sup3 "³" ><!--SUPERSCRIPT THREE --> +<!ENTITY supE "⫆" ><!--SUPERSET OF ABOVE EQUALS SIGN --> +<!ENTITY supdot "⪾" ><!--SUPERSET WITH DOT --> +<!ENTITY supdsub "⫘" ><!--SUPERSET BESIDE AND JOINED BY DASH WITH SUBSET --> +<!ENTITY supe "⊇" ><!--SUPERSET OF OR EQUAL TO --> +<!ENTITY supedot "⫄" ><!--SUPERSET OF OR EQUAL TO WITH DOT ABOVE --> +<!ENTITY suphsol "⟉" ><!--SUPERSET PRECEDING SOLIDUS --> +<!ENTITY suphsub "⫗" ><!--SUPERSET BESIDE SUBSET --> +<!ENTITY suplarr "⥻" ><!--SUPERSET ABOVE LEFTWARDS ARROW --> +<!ENTITY supmult "⫂" ><!--SUPERSET WITH MULTIPLICATION SIGN BELOW --> +<!ENTITY supnE "⫌" ><!--SUPERSET OF ABOVE NOT EQUAL TO --> +<!ENTITY supne "⊋" ><!--SUPERSET OF WITH NOT EQUAL TO --> +<!ENTITY supplus "⫀" ><!--SUPERSET WITH PLUS SIGN BELOW --> +<!ENTITY supset "⊃" ><!--SUPERSET OF --> +<!ENTITY supseteq "⊇" ><!--SUPERSET OF OR EQUAL TO --> +<!ENTITY supseteqq "⫆" ><!--SUPERSET OF ABOVE EQUALS SIGN --> +<!ENTITY supsetneq "⊋" ><!--SUPERSET OF WITH NOT EQUAL TO --> +<!ENTITY supsetneqq "⫌" ><!--SUPERSET OF ABOVE NOT EQUAL TO --> +<!ENTITY supsim "⫈" ><!--SUPERSET OF ABOVE TILDE OPERATOR --> +<!ENTITY supsub "⫔" ><!--SUPERSET ABOVE SUBSET --> +<!ENTITY supsup "⫖" ><!--SUPERSET ABOVE SUPERSET --> +<!ENTITY swArr "⇙" ><!--SOUTH WEST DOUBLE ARROW --> +<!ENTITY swarhk "⤦" ><!--SOUTH WEST ARROW WITH HOOK --> +<!ENTITY swarr "↙" ><!--SOUTH WEST ARROW --> +<!ENTITY swarrow "↙" ><!--SOUTH WEST ARROW --> +<!ENTITY swnwar "⤪" ><!--SOUTH WEST ARROW AND NORTH WEST ARROW --> +<!ENTITY szlig "ß" ><!--LATIN SMALL LETTER SHARP S --> +<!ENTITY target "⌖" ><!--POSITION INDICATOR --> +<!ENTITY tau "τ" ><!--GREEK SMALL LETTER TAU --> +<!ENTITY tbrk "⎴" ><!--TOP SQUARE BRACKET --> +<!ENTITY tcaron "ť" ><!--LATIN SMALL LETTER T WITH CARON --> +<!ENTITY tcedil "ţ" ><!--LATIN SMALL LETTER T WITH CEDILLA --> +<!ENTITY tcy "т" ><!--CYRILLIC SMALL LETTER TE --> +<!ENTITY tdot "⃛" ><!--COMBINING THREE DOTS ABOVE --> +<!ENTITY telrec "⌕" ><!--TELEPHONE RECORDER --> +<!ENTITY tfr "𝔱" ><!--MATHEMATICAL FRAKTUR SMALL T --> +<!ENTITY there4 "∴" ><!--THEREFORE --> +<!ENTITY therefore "∴" ><!--THEREFORE --> +<!ENTITY theta "θ" ><!--GREEK SMALL LETTER THETA --> +<!ENTITY thetasym "ϑ" ><!--GREEK THETA SYMBOL --> +<!ENTITY thetav "ϑ" ><!--GREEK THETA SYMBOL --> +<!ENTITY thickapprox "≈" ><!--ALMOST EQUAL TO --> +<!ENTITY thicksim "∼" ><!--TILDE OPERATOR --> +<!ENTITY thinsp " " ><!--THIN SPACE --> +<!ENTITY thkap "≈" ><!--ALMOST EQUAL TO --> +<!ENTITY thksim "∼" ><!--TILDE OPERATOR --> +<!ENTITY thorn "þ" ><!--LATIN SMALL LETTER THORN --> +<!ENTITY tilde "˜" ><!--SMALL TILDE --> +<!ENTITY times "×" ><!--MULTIPLICATION SIGN --> +<!ENTITY timesb "⊠" ><!--SQUARED TIMES --> +<!ENTITY timesbar "⨱" ><!--MULTIPLICATION SIGN WITH UNDERBAR --> +<!ENTITY timesd "⨰" ><!--MULTIPLICATION SIGN WITH DOT ABOVE --> +<!ENTITY tint "∭" ><!--TRIPLE INTEGRAL --> +<!ENTITY toea "⤨" ><!--NORTH EAST ARROW AND SOUTH EAST ARROW --> +<!ENTITY top "⊤" ><!--DOWN TACK --> +<!ENTITY topbot "⌶" ><!--APL FUNCTIONAL SYMBOL I-BEAM --> +<!ENTITY topcir "⫱" ><!--DOWN TACK WITH CIRCLE BELOW --> +<!ENTITY topf "𝕥" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL T --> +<!ENTITY topfork "⫚" ><!--PITCHFORK WITH TEE TOP --> +<!ENTITY tosa "⤩" ><!--SOUTH EAST ARROW AND SOUTH WEST ARROW --> +<!ENTITY tprime "‴" ><!--TRIPLE PRIME --> +<!ENTITY trade "™" ><!--TRADE MARK SIGN --> +<!ENTITY triangle "▵" ><!--WHITE UP-POINTING SMALL TRIANGLE --> +<!ENTITY triangledown "▿" ><!--WHITE DOWN-POINTING SMALL TRIANGLE --> +<!ENTITY triangleleft "◃" ><!--WHITE LEFT-POINTING SMALL TRIANGLE --> +<!ENTITY trianglelefteq "⊴" ><!--NORMAL SUBGROUP OF OR EQUAL TO --> +<!ENTITY triangleq "≜" ><!--DELTA EQUAL TO --> +<!ENTITY triangleright "▹" ><!--WHITE RIGHT-POINTING SMALL TRIANGLE --> +<!ENTITY trianglerighteq "⊵" ><!--CONTAINS AS NORMAL SUBGROUP OR EQUAL TO --> +<!ENTITY tridot "◬" ><!--WHITE UP-POINTING TRIANGLE WITH DOT --> +<!ENTITY trie "≜" ><!--DELTA EQUAL TO --> +<!ENTITY triminus "⨺" ><!--MINUS SIGN IN TRIANGLE --> +<!ENTITY triplus "⨹" ><!--PLUS SIGN IN TRIANGLE --> +<!ENTITY trisb "⧍" ><!--TRIANGLE WITH SERIFS AT BOTTOM --> +<!ENTITY tritime "⨻" ><!--MULTIPLICATION SIGN IN TRIANGLE --> +<!ENTITY trpezium "⏢" ><!--WHITE TRAPEZIUM --> +<!ENTITY tscr "𝓉" ><!--MATHEMATICAL SCRIPT SMALL T --> +<!ENTITY tscy "ц" ><!--CYRILLIC SMALL LETTER TSE --> +<!ENTITY tshcy "ћ" ><!--CYRILLIC SMALL LETTER TSHE --> +<!ENTITY tstrok "ŧ" ><!--LATIN SMALL LETTER T WITH STROKE --> +<!ENTITY twixt "≬" ><!--BETWEEN --> +<!ENTITY twoheadleftarrow "↞" ><!--LEFTWARDS TWO HEADED ARROW --> +<!ENTITY twoheadrightarrow "↠" ><!--RIGHTWARDS TWO HEADED ARROW --> +<!ENTITY uArr "⇑" ><!--UPWARDS DOUBLE ARROW --> +<!ENTITY uHar "⥣" ><!--UPWARDS HARPOON WITH BARB LEFT BESIDE UPWARDS HARPOON WITH BARB RIGHT --> +<!ENTITY uacute "ú" ><!--LATIN SMALL LETTER U WITH ACUTE --> +<!ENTITY uarr "↑" ><!--UPWARDS ARROW --> +<!ENTITY ubrcy "ў" ><!--CYRILLIC SMALL LETTER SHORT U --> +<!ENTITY ubreve "ŭ" ><!--LATIN SMALL LETTER U WITH BREVE --> +<!ENTITY ucirc "û" ><!--LATIN SMALL LETTER U WITH CIRCUMFLEX --> +<!ENTITY ucy "у" ><!--CYRILLIC SMALL LETTER U --> +<!ENTITY udarr "⇅" ><!--UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW --> +<!ENTITY udblac "ű" ><!--LATIN SMALL LETTER U WITH DOUBLE ACUTE --> +<!ENTITY udhar "⥮" ><!--UPWARDS HARPOON WITH BARB LEFT BESIDE DOWNWARDS HARPOON WITH BARB RIGHT --> +<!ENTITY ufisht "⥾" ><!--UP FISH TAIL --> +<!ENTITY ufr "𝔲" ><!--MATHEMATICAL FRAKTUR SMALL U --> +<!ENTITY ugrave "ù" ><!--LATIN SMALL LETTER U WITH GRAVE --> +<!ENTITY uharl "↿" ><!--UPWARDS HARPOON WITH BARB LEFTWARDS --> +<!ENTITY uharr "↾" ><!--UPWARDS HARPOON WITH BARB RIGHTWARDS --> +<!ENTITY uhblk "▀" ><!--UPPER HALF BLOCK --> +<!ENTITY ulcorn "⌜" ><!--TOP LEFT CORNER --> +<!ENTITY ulcorner "⌜" ><!--TOP LEFT CORNER --> +<!ENTITY ulcrop "⌏" ><!--TOP LEFT CROP --> +<!ENTITY ultri "◸" ><!--UPPER LEFT TRIANGLE --> +<!ENTITY umacr "ū" ><!--LATIN SMALL LETTER U WITH MACRON --> +<!ENTITY uml "¨" ><!--DIAERESIS --> +<!ENTITY uogon "ų" ><!--LATIN SMALL LETTER U WITH OGONEK --> +<!ENTITY uopf "𝕦" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL U --> +<!ENTITY uparrow "↑" ><!--UPWARDS ARROW --> +<!ENTITY updownarrow "↕" ><!--UP DOWN ARROW --> +<!ENTITY upharpoonleft "↿" ><!--UPWARDS HARPOON WITH BARB LEFTWARDS --> +<!ENTITY upharpoonright "↾" ><!--UPWARDS HARPOON WITH BARB RIGHTWARDS --> +<!ENTITY uplus "⊎" ><!--MULTISET UNION --> +<!ENTITY upsi "υ" ><!--GREEK SMALL LETTER UPSILON --> +<!ENTITY upsih "ϒ" ><!--GREEK UPSILON WITH HOOK SYMBOL --> +<!ENTITY upsilon "υ" ><!--GREEK SMALL LETTER UPSILON --> +<!ENTITY upuparrows "⇈" ><!--UPWARDS PAIRED ARROWS --> +<!ENTITY urcorn "⌝" ><!--TOP RIGHT CORNER --> +<!ENTITY urcorner "⌝" ><!--TOP RIGHT CORNER --> +<!ENTITY urcrop "⌎" ><!--TOP RIGHT CROP --> +<!ENTITY uring "ů" ><!--LATIN SMALL LETTER U WITH RING ABOVE --> +<!ENTITY urtri "◹" ><!--UPPER RIGHT TRIANGLE --> +<!ENTITY uscr "𝓊" ><!--MATHEMATICAL SCRIPT SMALL U --> +<!ENTITY utdot "⋰" ><!--UP RIGHT DIAGONAL ELLIPSIS --> +<!ENTITY utilde "ũ" ><!--LATIN SMALL LETTER U WITH TILDE --> +<!ENTITY utri "▵" ><!--WHITE UP-POINTING SMALL TRIANGLE --> +<!ENTITY utrif "▴" ><!--BLACK UP-POINTING SMALL TRIANGLE --> +<!ENTITY uuarr "⇈" ><!--UPWARDS PAIRED ARROWS --> +<!ENTITY uuml "ü" ><!--LATIN SMALL LETTER U WITH DIAERESIS --> +<!ENTITY uwangle "⦧" ><!--OBLIQUE ANGLE OPENING DOWN --> +<!ENTITY vArr "⇕" ><!--UP DOWN DOUBLE ARROW --> +<!ENTITY vBar "⫨" ><!--SHORT UP TACK WITH UNDERBAR --> +<!ENTITY vBarv "⫩" ><!--SHORT UP TACK ABOVE SHORT DOWN TACK --> +<!ENTITY vDash "⊨" ><!--TRUE --> +<!ENTITY vangrt "⦜" ><!--RIGHT ANGLE VARIANT WITH SQUARE --> +<!ENTITY varepsilon "ϵ" ><!--GREEK LUNATE EPSILON SYMBOL --> +<!ENTITY varkappa "ϰ" ><!--GREEK KAPPA SYMBOL --> +<!ENTITY varnothing "∅" ><!--EMPTY SET --> +<!ENTITY varphi "ϕ" ><!--GREEK PHI SYMBOL --> +<!ENTITY varpi "ϖ" ><!--GREEK PI SYMBOL --> +<!ENTITY varpropto "∝" ><!--PROPORTIONAL TO --> +<!ENTITY varr "↕" ><!--UP DOWN ARROW --> +<!ENTITY varrho "ϱ" ><!--GREEK RHO SYMBOL --> +<!ENTITY varsigma "ς" ><!--GREEK SMALL LETTER FINAL SIGMA --> +<!ENTITY varsubsetneq "⊊︀" ><!--SUBSET OF WITH NOT EQUAL TO - variant with stroke through bottom members --> +<!ENTITY varsubsetneqq "⫋︀" ><!--SUBSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members --> +<!ENTITY varsupsetneq "⊋︀" ><!--SUPERSET OF WITH NOT EQUAL TO - variant with stroke through bottom members --> +<!ENTITY varsupsetneqq "⫌︀" ><!--SUPERSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members --> +<!ENTITY vartheta "ϑ" ><!--GREEK THETA SYMBOL --> +<!ENTITY vartriangleleft "⊲" ><!--NORMAL SUBGROUP OF --> +<!ENTITY vartriangleright "⊳" ><!--CONTAINS AS NORMAL SUBGROUP --> +<!ENTITY vcy "в" ><!--CYRILLIC SMALL LETTER VE --> +<!ENTITY vdash "⊢" ><!--RIGHT TACK --> +<!ENTITY vee "∨" ><!--LOGICAL OR --> +<!ENTITY veebar "⊻" ><!--XOR --> +<!ENTITY veeeq "≚" ><!--EQUIANGULAR TO --> +<!ENTITY vellip "⋮" ><!--VERTICAL ELLIPSIS --> +<!ENTITY verbar "|" ><!--VERTICAL LINE --> +<!ENTITY vert "|" ><!--VERTICAL LINE --> +<!ENTITY vfr "𝔳" ><!--MATHEMATICAL FRAKTUR SMALL V --> +<!ENTITY vltri "⊲" ><!--NORMAL SUBGROUP OF --> +<!ENTITY vnsub "⊂⃒" ><!--SUBSET OF with vertical line --> +<!ENTITY vnsup "⊃⃒" ><!--SUPERSET OF with vertical line --> +<!ENTITY vopf "𝕧" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL V --> +<!ENTITY vprop "∝" ><!--PROPORTIONAL TO --> +<!ENTITY vrtri "⊳" ><!--CONTAINS AS NORMAL SUBGROUP --> +<!ENTITY vscr "𝓋" ><!--MATHEMATICAL SCRIPT SMALL V --> +<!ENTITY vsubnE "⫋︀" ><!--SUBSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members --> +<!ENTITY vsubne "⊊︀" ><!--SUBSET OF WITH NOT EQUAL TO - variant with stroke through bottom members --> +<!ENTITY vsupnE "⫌︀" ><!--SUPERSET OF ABOVE NOT EQUAL TO - variant with stroke through bottom members --> +<!ENTITY vsupne "⊋︀" ><!--SUPERSET OF WITH NOT EQUAL TO - variant with stroke through bottom members --> +<!ENTITY vzigzag "⦚" ><!--VERTICAL ZIGZAG LINE --> +<!ENTITY wcirc "ŵ" ><!--LATIN SMALL LETTER W WITH CIRCUMFLEX --> +<!ENTITY wedbar "⩟" ><!--LOGICAL AND WITH UNDERBAR --> +<!ENTITY wedge "∧" ><!--LOGICAL AND --> +<!ENTITY wedgeq "≙" ><!--ESTIMATES --> +<!ENTITY weierp "℘" ><!--SCRIPT CAPITAL P --> +<!ENTITY wfr "𝔴" ><!--MATHEMATICAL FRAKTUR SMALL W --> +<!ENTITY wopf "𝕨" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL W --> +<!ENTITY wp "℘" ><!--SCRIPT CAPITAL P --> +<!ENTITY wr "≀" ><!--WREATH PRODUCT --> +<!ENTITY wreath "≀" ><!--WREATH PRODUCT --> +<!ENTITY wscr "𝓌" ><!--MATHEMATICAL SCRIPT SMALL W --> +<!ENTITY xcap "⋂" ><!--N-ARY INTERSECTION --> +<!ENTITY xcirc "◯" ><!--LARGE CIRCLE --> +<!ENTITY xcup "⋃" ><!--N-ARY UNION --> +<!ENTITY xdtri "▽" ><!--WHITE DOWN-POINTING TRIANGLE --> +<!ENTITY xfr "𝔵" ><!--MATHEMATICAL FRAKTUR SMALL X --> +<!ENTITY xhArr "⟺" ><!--LONG LEFT RIGHT DOUBLE ARROW --> +<!ENTITY xharr "⟷" ><!--LONG LEFT RIGHT ARROW --> +<!ENTITY xi "ξ" ><!--GREEK SMALL LETTER XI --> +<!ENTITY xlArr "⟸" ><!--LONG LEFTWARDS DOUBLE ARROW --> +<!ENTITY xlarr "⟵" ><!--LONG LEFTWARDS ARROW --> +<!ENTITY xmap "⟼" ><!--LONG RIGHTWARDS ARROW FROM BAR --> +<!ENTITY xnis "⋻" ><!--CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE --> +<!ENTITY xodot "⨀" ><!--N-ARY CIRCLED DOT OPERATOR --> +<!ENTITY xopf "𝕩" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL X --> +<!ENTITY xoplus "⨁" ><!--N-ARY CIRCLED PLUS OPERATOR --> +<!ENTITY xotime "⨂" ><!--N-ARY CIRCLED TIMES OPERATOR --> +<!ENTITY xrArr "⟹" ><!--LONG RIGHTWARDS DOUBLE ARROW --> +<!ENTITY xrarr "⟶" ><!--LONG RIGHTWARDS ARROW --> +<!ENTITY xscr "𝓍" ><!--MATHEMATICAL SCRIPT SMALL X --> +<!ENTITY xsqcup "⨆" ><!--N-ARY SQUARE UNION OPERATOR --> +<!ENTITY xuplus "⨄" ><!--N-ARY UNION OPERATOR WITH PLUS --> +<!ENTITY xutri "△" ><!--WHITE UP-POINTING TRIANGLE --> +<!ENTITY xvee "⋁" ><!--N-ARY LOGICAL OR --> +<!ENTITY xwedge "⋀" ><!--N-ARY LOGICAL AND --> +<!ENTITY yacute "ý" ><!--LATIN SMALL LETTER Y WITH ACUTE --> +<!ENTITY yacy "я" ><!--CYRILLIC SMALL LETTER YA --> +<!ENTITY ycirc "ŷ" ><!--LATIN SMALL LETTER Y WITH CIRCUMFLEX --> +<!ENTITY ycy "ы" ><!--CYRILLIC SMALL LETTER YERU --> +<!ENTITY yen "¥" ><!--YEN SIGN --> +<!ENTITY yfr "𝔶" ><!--MATHEMATICAL FRAKTUR SMALL Y --> +<!ENTITY yicy "ї" ><!--CYRILLIC SMALL LETTER YI --> +<!ENTITY yopf "𝕪" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL Y --> +<!ENTITY yscr "𝓎" ><!--MATHEMATICAL SCRIPT SMALL Y --> +<!ENTITY yucy "ю" ><!--CYRILLIC SMALL LETTER YU --> +<!ENTITY yuml "ÿ" ><!--LATIN SMALL LETTER Y WITH DIAERESIS --> +<!ENTITY zacute "ź" ><!--LATIN SMALL LETTER Z WITH ACUTE --> +<!ENTITY zcaron "ž" ><!--LATIN SMALL LETTER Z WITH CARON --> +<!ENTITY zcy "з" ><!--CYRILLIC SMALL LETTER ZE --> +<!ENTITY zdot "ż" ><!--LATIN SMALL LETTER Z WITH DOT ABOVE --> +<!ENTITY zeetrf "ℨ" ><!--BLACK-LETTER CAPITAL Z --> +<!ENTITY zeta "ζ" ><!--GREEK SMALL LETTER ZETA --> +<!ENTITY zfr "𝔷" ><!--MATHEMATICAL FRAKTUR SMALL Z --> +<!ENTITY zhcy "ж" ><!--CYRILLIC SMALL LETTER ZHE --> +<!ENTITY zigrarr "⇝" ><!--RIGHTWARDS SQUIGGLE ARROW --> +<!ENTITY zopf "𝕫" ><!--MATHEMATICAL DOUBLE-STRUCK SMALL Z --> +<!ENTITY zscr "𝓏" ><!--MATHEMATICAL SCRIPT SMALL Z --> +<!ENTITY zwj "‍" ><!--ZERO WIDTH JOINER --> +<!ENTITY zwnj "‌" ><!--ZERO WIDTH NON-JOINER --> diff --git a/dom/xml/moz.build b/dom/xml/moz.build new file mode 100644 index 0000000000..c79eedb00f --- /dev/null +++ b/dom/xml/moz.build @@ -0,0 +1,51 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +with Files("**"): + BUG_COMPONENT = ("Core", "XML") + +DIRS += ["resources"] + +MOCHITEST_MANIFESTS += ["test/mochitest.toml"] + +EXPORTS += [ + "nsIXMLContentSink.h", +] + +EXPORTS.mozilla.dom += [ + "CDATASection.h", + "nsXMLElement.h", + "ProcessingInstruction.h", + "XMLDocument.h", + "XMLStylesheetProcessingInstruction.h", +] + +UNIFIED_SOURCES += [ + "CDATASection.cpp", + "nsXMLContentSink.cpp", + "nsXMLElement.cpp", + "nsXMLFragmentContentSink.cpp", + "nsXMLPrettyPrinter.cpp", + "ProcessingInstruction.cpp", + "XMLDocument.cpp", + "XMLStylesheetProcessingInstruction.cpp", +] + +FINAL_LIBRARY = "xul" + +LOCAL_INCLUDES += [ + "/caps", + "/dom/base", + "/dom/html", + "/dom/xslt/base", + "/dom/xul", + "/layout/style", + "/parser/htmlparser", +] + +RESOURCE_FILES.dtd += [ + "htmlmathml-f.ent", +] diff --git a/dom/xml/nsIXMLContentSink.h b/dom/xml/nsIXMLContentSink.h new file mode 100644 index 0000000000..eba9b356f0 --- /dev/null +++ b/dom/xml/nsIXMLContentSink.h @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ +#ifndef nsIXMLContentSink_h___ +#define nsIXMLContentSink_h___ + +#include "nsIContentSink.h" +#include "nsISupports.h" + +class nsIURI; +class nsIChannel; +namespace mozilla::dom { +class Document; +} // namespace mozilla::dom + +#define NS_IXMLCONTENT_SINK_IID \ + { \ + 0x63fedea0, 0x9b0f, 0x4d64, { \ + 0x9b, 0xa5, 0x37, 0xc6, 0x99, 0x73, 0x29, 0x35 \ + } \ + } + +/** + * This interface represents a content sink for generic XML files. + * The goal of this sink is to deal with XML documents that do not + * have pre-built semantics, though it may also be implemented for + * cases in which semantics are hard-wired. + * + * The expectation is that the parser has already performed + * well-formedness and validity checking. + * + * XXX The expectation is that entity expansion will be done by the sink + * itself. This would require, however, that the sink has the ability + * to query the parser for entity replacement text. + * + * XXX This interface does not contain a mechanism for the sink to + * get specific schema/DTD information from the parser. This information + * may be necessary for entity expansion. It is also necessary for + * building the DOM portions that relate to the schema. + * + * XXX This interface does not deal with the presence of an external + * subset. It seems possible that this could be dealt with completely + * at the parser level. + */ + +class nsIXMLContentSink : public nsIContentSink { + public: + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXMLCONTENT_SINK_IID) + virtual bool IsPrettyPrintXML() const { return false; } + virtual bool IsPrettyPrintHasSpecialRoot() const { return false; } +}; + +NS_DEFINE_STATIC_IID_ACCESSOR(nsIXMLContentSink, NS_IXMLCONTENT_SINK_IID) + +nsresult NS_NewXMLContentSink(nsIXMLContentSink** aInstancePtrResult, + mozilla::dom::Document* aDoc, nsIURI* aURL, + nsISupports* aContainer, nsIChannel* aChannel); + +#endif // nsIXMLContentSink_h___ diff --git a/dom/xml/nsXMLContentSink.cpp b/dom/xml/nsXMLContentSink.cpp new file mode 100644 index 0000000000..5dbae6339c --- /dev/null +++ b/dom/xml/nsXMLContentSink.cpp @@ -0,0 +1,1568 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#include "nsCOMPtr.h" +#include "nsXMLContentSink.h" +#include "nsIParser.h" +#include "mozilla/dom/Document.h" +#include "nsIContent.h" +#include "nsIURI.h" +#include "nsNetUtil.h" +#include "nsHTMLParts.h" +#include "nsCRT.h" +#include "mozilla/StyleSheetInlines.h" +#include "mozilla/css/Loader.h" +#include "nsGkAtoms.h" +#include "nsContentUtils.h" +#include "nsDocElementCreatedNotificationRunner.h" +#include "nsIDocShell.h" +#include "nsIScriptContext.h" +#include "nsNameSpaceManager.h" +#include "nsIScriptSecurityManager.h" +#include "nsIDocumentViewer.h" +#include "prtime.h" +#include "mozilla/Logging.h" +#include "nsRect.h" +#include "nsIScriptElement.h" +#include "nsReadableUtils.h" +#include "nsUnicharUtils.h" +#include "nsIChannel.h" +#include "nsXMLPrettyPrinter.h" +#include "nsNodeInfoManager.h" +#include "nsContentCreatorFunctions.h" +#include "nsIContentPolicy.h" +#include "nsContentPolicyUtils.h" +#include "nsError.h" +#include "nsIScriptGlobalObject.h" +#include "mozAutoDocUpdate.h" +#include "nsMimeTypes.h" +#include "nsHtml5SVGLoadDispatcher.h" +#include "nsTextNode.h" +#include "mozilla/dom/CustomElementRegistry.h" +#include "mozilla/dom/CDATASection.h" +#include "mozilla/dom/Comment.h" +#include "mozilla/dom/DocGroup.h" +#include "mozilla/dom/DocumentType.h" +#include "mozilla/dom/Element.h" +#include "mozilla/dom/HTMLTemplateElement.h" +#include "mozilla/dom/MutationObservers.h" +#include "mozilla/dom/NameSpaceConstants.h" +#include "mozilla/dom/ProcessingInstruction.h" +#include "mozilla/dom/ScriptLoader.h" +#include "mozilla/dom/txMozillaXSLTProcessor.h" +#include "mozilla/CycleCollectedJSContext.h" +#include "mozilla/LoadInfo.h" +#include "mozilla/UseCounter.h" +#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin + +using namespace mozilla; +using namespace mozilla::dom; + +// XXX Open Issues: +// 1) what's not allowed - We need to figure out which HTML tags +// (prefixed with a HTML namespace qualifier) are explicitly not +// allowed (if any). +// 2) factoring code with nsHTMLContentSink - There's some amount of +// common code between this and the HTML content sink. This will +// increase as we support more and more HTML elements. How can code +// from the code be factored? + +nsresult NS_NewXMLContentSink(nsIXMLContentSink** aResult, Document* aDoc, + nsIURI* aURI, nsISupports* aContainer, + nsIChannel* aChannel) { + MOZ_ASSERT(nullptr != aResult, "null ptr"); + if (nullptr == aResult) { + return NS_ERROR_NULL_POINTER; + } + RefPtr<nsXMLContentSink> it = new nsXMLContentSink(); + + nsresult rv = it->Init(aDoc, aURI, aContainer, aChannel); + NS_ENSURE_SUCCESS(rv, rv); + + it.forget(aResult); + return NS_OK; +} + +nsXMLContentSink::nsXMLContentSink() + : mState(eXMLContentSinkState_InProlog), + mTextLength(0), + mNotifyLevel(0), + mPrettyPrintXML(true), + mPrettyPrintHasSpecialRoot(0), + mPrettyPrintHasFactoredElements(0), + mPrettyPrinting(0), + mPreventScriptExecution(0) { + PodArrayZero(mText); +} + +nsXMLContentSink::~nsXMLContentSink() = default; + +nsresult nsXMLContentSink::Init(Document* aDoc, nsIURI* aURI, + nsISupports* aContainer, nsIChannel* aChannel) { + nsresult rv = nsContentSink::Init(aDoc, aURI, aContainer, aChannel); + NS_ENSURE_SUCCESS(rv, rv); + + aDoc->AddObserver(this); + mIsDocumentObserver = true; + + if (!mDocShell) { + mPrettyPrintXML = false; + } + + mState = eXMLContentSinkState_InProlog; + mDocElement = nullptr; + + return NS_OK; +} + +inline void ImplCycleCollectionTraverse( + nsCycleCollectionTraversalCallback& aCallback, + nsXMLContentSink::StackNode& aField, const char* aName, + uint32_t aFlags = 0) { + ImplCycleCollectionTraverse(aCallback, aField.mContent, aName, aFlags); +} + +inline void ImplCycleCollectionUnlink(nsXMLContentSink::StackNode& aField) { + ImplCycleCollectionUnlink(aField.mContent); +} + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXMLContentSink) + NS_INTERFACE_MAP_ENTRY(nsIContentSink) + NS_INTERFACE_MAP_ENTRY(nsIXMLContentSink) + NS_INTERFACE_MAP_ENTRY(nsIExpatSink) + NS_INTERFACE_MAP_ENTRY(nsITransformObserver) +NS_INTERFACE_MAP_END_INHERITING(nsContentSink) + +NS_IMPL_ADDREF_INHERITED(nsXMLContentSink, nsContentSink) +NS_IMPL_RELEASE_INHERITED(nsXMLContentSink, nsContentSink) + +NS_IMPL_CYCLE_COLLECTION_INHERITED(nsXMLContentSink, nsContentSink, + mCurrentHead, mDocElement, mLastTextNode, + mContentStack, mDocumentChildren) + +// nsIContentSink +NS_IMETHODIMP +nsXMLContentSink::WillParse(void) { return WillParseImpl(); } + +NS_IMETHODIMP +nsXMLContentSink::WillBuildModel(nsDTDMode aDTDMode) { + WillBuildModelImpl(); + + // Notify document that the load is beginning + mDocument->BeginLoad(); + + // Check for correct load-command for maybe prettyprinting + if (mPrettyPrintXML) { + nsAutoCString command; + GetParser()->GetCommand(command); + if (!command.EqualsLiteral("view")) { + mPrettyPrintXML = false; + } + } + + return NS_OK; +} + +bool nsXMLContentSink::CanStillPrettyPrint() { + return mPrettyPrintXML && + (!mPrettyPrintHasFactoredElements || mPrettyPrintHasSpecialRoot); +} + +nsresult nsXMLContentSink::MaybePrettyPrint() { + if (!CanStillPrettyPrint()) { + mPrettyPrintXML = false; + + return NS_OK; + } + + { + // Try to perform a microtask checkpoint; this avoids always breaking + // pretty-printing if webextensions insert new content right after the + // document loads. + nsAutoMicroTask mt; + } + + // stop observing in order to avoid crashing when replacing content + mDocument->RemoveObserver(this); + mIsDocumentObserver = false; + + // Reenable the CSSLoader so that the prettyprinting stylesheets can load + if (mCSSLoader) { + mCSSLoader->SetEnabled(true); + } + + RefPtr<nsXMLPrettyPrinter> printer; + nsresult rv = NS_NewXMLPrettyPrinter(getter_AddRefs(printer)); + NS_ENSURE_SUCCESS(rv, rv); + + bool isPrettyPrinting; + rv = printer->PrettyPrint(mDocument, &isPrettyPrinting); + NS_ENSURE_SUCCESS(rv, rv); + + mPrettyPrinting = isPrettyPrinting; + return NS_OK; +} + +static void CheckXSLTParamPI(ProcessingInstruction* aPi, + nsIDocumentTransformer* aProcessor, + nsINode* aSource) { + nsAutoString target, data; + aPi->GetTarget(target); + + // Check for namespace declarations + if (target.EqualsLiteral("xslt-param-namespace")) { + aPi->GetData(data); + nsAutoString prefix, namespaceAttr; + nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::prefix, prefix); + if (!prefix.IsEmpty() && nsContentUtils::GetPseudoAttributeValue( + data, nsGkAtoms::_namespace, namespaceAttr)) { + aProcessor->AddXSLTParamNamespace(prefix, namespaceAttr); + } + } + + // Check for actual parameters + else if (target.EqualsLiteral("xslt-param")) { + aPi->GetData(data); + nsAutoString name, namespaceAttr, select, value; + nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::name, name); + nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::_namespace, + namespaceAttr); + if (!nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::select, + select)) { + select.SetIsVoid(true); + } + if (!nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::value, + value)) { + value.SetIsVoid(true); + } + if (!name.IsEmpty()) { + aProcessor->AddXSLTParam(name, namespaceAttr, select, value, aSource); + } + } +} + +NS_IMETHODIMP +nsXMLContentSink::DidBuildModel(bool aTerminated) { + if (!mParser) { + // If mParser is null, this parse has already been terminated and must + // not been terminated again. However, Document may still think that + // the parse has not been terminated and call back into here in the case + // where the XML parser has finished but the XSLT transform associated + // with the document has not. + return NS_OK; + } + + FlushTags(); + + DidBuildModelImpl(aTerminated); + + if (mXSLTProcessor) { + // stop observing in order to avoid crashing when replacing content + mDocument->RemoveObserver(this); + mIsDocumentObserver = false; + + ErrorResult rv; + RefPtr<DocumentFragment> source = mDocument->CreateDocumentFragment(); + for (nsIContent* child : mDocumentChildren) { + // XPath data model doesn't have DocumentType nodes. + if (child->NodeType() != nsINode::DOCUMENT_TYPE_NODE) { + source->AppendChild(*child, rv); + if (rv.Failed()) { + return rv.StealNSResult(); + } + } + } + + // Check for xslt-param and xslt-param-namespace PIs + for (nsIContent* child : mDocumentChildren) { + if (auto pi = ProcessingInstruction::FromNode(child)) { + CheckXSLTParamPI(pi, mXSLTProcessor, source); + } else if (child->IsElement()) { + // Only honor PIs in the prolog + break; + } + } + + mXSLTProcessor->SetSourceContentModel(source); + // Since the processor now holds a reference to us we drop our reference + // to it to avoid owning cycles + mXSLTProcessor = nullptr; + } else { + // Kick off layout for non-XSLT transformed documents. + + // Check if we want to prettyprint + MaybePrettyPrint(); + + bool startLayout = true; + + if (mPrettyPrinting) { + NS_ASSERTION(!mPendingSheetCount, "Shouldn't have pending sheets here!"); + + // We're pretty-printing now. See whether we should wait up on + // stylesheet loads + if (mDocument->CSSLoader()->HasPendingLoads()) { + mDocument->CSSLoader()->AddObserver(this); + // wait for those sheets to load + startLayout = false; + } + } + + if (startLayout) { + StartLayout(false); + + ScrollToRef(); + } + + mDocument->RemoveObserver(this); + mIsDocumentObserver = false; + + mDocument->EndLoad(); + + DropParserAndPerfHint(); + } + + return NS_OK; +} + +nsresult nsXMLContentSink::OnDocumentCreated(Document* aSourceDocument, + Document* aResultDocument) { + aResultDocument->SetDocWriteDisabled(true); + + nsCOMPtr<nsIDocumentViewer> viewer; + mDocShell->GetDocViewer(getter_AddRefs(viewer)); + // Make sure that we haven't loaded a new document into the contentviewer + // after starting the XSLT transform. + if (viewer && viewer->GetDocument() == aSourceDocument) { + return viewer->SetDocumentInternal(aResultDocument, true); + } + return NS_OK; +} + +nsresult nsXMLContentSink::OnTransformDone(Document* aSourceDocument, + nsresult aResult, + Document* aResultDocument) { + MOZ_ASSERT(aResultDocument, + "Don't notify about transform end without a document."); + + mDocumentChildren.Clear(); + + nsCOMPtr<nsIDocumentViewer> viewer; + mDocShell->GetDocViewer(getter_AddRefs(viewer)); + + RefPtr<Document> originalDocument = mDocument; + bool blockingOnload = mIsBlockingOnload; + + // Make sure that we haven't loaded a new document into the contentviewer + // after starting the XSLT transform. + if (viewer && (viewer->GetDocument() == aSourceDocument || + viewer->GetDocument() == aResultDocument)) { + if (NS_FAILED(aResult)) { + // Transform failed. + aResultDocument->SetMayStartLayout(false); + // We have an error document. + viewer->SetDocument(aResultDocument); + } + + if (!mRunsToCompletion) { + // This BlockOnload call corresponds to the UnblockOnload call in + // nsContentSink::DropParserAndPerfHint. + aResultDocument->BlockOnload(); + mIsBlockingOnload = true; + } + // Transform succeeded, or it failed and we have an error document to + // display. + mDocument = aResultDocument; + aResultDocument->SetDocWriteDisabled(false); + + // Notify document observers that all the content has been stuck + // into the document. + // XXX do we need to notify for things like PIs? Or just the + // documentElement? + nsIContent* rootElement = mDocument->GetRootElement(); + if (rootElement) { + NS_ASSERTION(mDocument->ComputeIndexOf(rootElement).isSome(), + "rootElement not in doc?"); + mDocument->BeginUpdate(); + MutationObservers::NotifyContentInserted(mDocument, rootElement); + mDocument->EndUpdate(); + } + + // Start the layout process + StartLayout(false); + + ScrollToRef(); + } + + originalDocument->EndLoad(); + if (blockingOnload) { + // This UnblockOnload call corresponds to the BlockOnload call in + // nsContentSink::WillBuildModelImpl. + originalDocument->UnblockOnload(true); + } + + DropParserAndPerfHint(); + + // By this point, the result document has been set in the content viewer. But + // the content viewer does not call Destroy on the original document, so we + // won't end up reporting document use counters. It's possible we should be + // detaching the document from the window, but for now, we call + // ReportDocumentUseCounters on the original document here, to avoid + // assertions in ~Document about not having reported them. + originalDocument->ReportDocumentUseCounters(); + + return NS_OK; +} + +NS_IMETHODIMP +nsXMLContentSink::StyleSheetLoaded(StyleSheet* aSheet, bool aWasDeferred, + nsresult aStatus) { + if (!mPrettyPrinting) { + return nsContentSink::StyleSheetLoaded(aSheet, aWasDeferred, aStatus); + } + + if (!mDocument->CSSLoader()->HasPendingLoads()) { + mDocument->CSSLoader()->RemoveObserver(this); + StartLayout(false); + ScrollToRef(); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsXMLContentSink::WillInterrupt(void) { return WillInterruptImpl(); } + +void nsXMLContentSink::WillResume() { WillResumeImpl(); } + +NS_IMETHODIMP +nsXMLContentSink::SetParser(nsParserBase* aParser) { + MOZ_ASSERT(aParser, "Should have a parser here!"); + mParser = aParser; + return NS_OK; +} + +static bool FindIsAttrValue(const char16_t** aAtts, const char16_t** aResult) { + RefPtr<nsAtom> prefix, localName; + for (; *aAtts; aAtts += 2) { + int32_t nameSpaceID; + nsContentUtils::SplitExpatName(aAtts[0], getter_AddRefs(prefix), + getter_AddRefs(localName), &nameSpaceID); + if (nameSpaceID == kNameSpaceID_None && localName == nsGkAtoms::is) { + *aResult = aAtts[1]; + + return true; + } + } + + return false; +} + +nsresult nsXMLContentSink::CreateElement( + const char16_t** aAtts, uint32_t aAttsCount, + mozilla::dom::NodeInfo* aNodeInfo, uint32_t aLineNumber, + uint32_t aColumnNumber, nsIContent** aResult, bool* aAppendContent, + FromParser aFromParser) { + NS_ASSERTION(aNodeInfo, "can't create element without nodeinfo"); + + *aResult = nullptr; + *aAppendContent = true; + nsresult rv = NS_OK; + + RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo; + RefPtr<Element> element; + + // https://html.spec.whatwg.org/#create-an-element-for-the-token + // Step 5: Let is be the value of the "is" attribute in the given token, if + // such an attribute exists, or null otherwise. + const char16_t* is = nullptr; + RefPtr<nsAtom> isAtom; + uint32_t namespaceID = ni->NamespaceID(); + bool isXHTMLOrXUL = + namespaceID == kNameSpaceID_XHTML || namespaceID == kNameSpaceID_XUL; + if (isXHTMLOrXUL && FindIsAttrValue(aAtts, &is)) { + isAtom = NS_AtomizeMainThread(nsDependentString(is)); + } + + // Step 6: Let definition be the result of looking up a custom element + // definition given document, given namespace, local name, and is. + // Step 7: If definition is non-null and the parser was not created as part of + // the HTML fragment parsing algorithm, then let will execute script be true. + // Otherwise, let it be false. + // + // Note that the check that the parser was not created as part of the HTML + // fragment parsing algorithm is done by the check for a non-null mDocument. + CustomElementDefinition* customElementDefinition = nullptr; + nsAtom* nameAtom = ni->NameAtom(); + if (mDocument && !mDocument->IsLoadedAsData() && isXHTMLOrXUL && + (isAtom || nsContentUtils::IsCustomElementName(nameAtom, namespaceID))) { + nsAtom* typeAtom = is ? isAtom.get() : nameAtom; + + MOZ_ASSERT(nameAtom->Equals(ni->LocalName())); + customElementDefinition = nsContentUtils::LookupCustomElementDefinition( + mDocument, nameAtom, namespaceID, typeAtom); + } + + if (customElementDefinition) { + // Since we are possibly going to run a script for the custom element + // constructor, we should first flush any remaining elements. + FlushTags(); + { nsAutoMicroTask mt; } + + Maybe<AutoCEReaction> autoCEReaction; + if (auto* docGroup = mDocument->GetDocGroup()) { + autoCEReaction.emplace(docGroup->CustomElementReactionsStack(), nullptr); + } + rv = NS_NewElement(getter_AddRefs(element), ni.forget(), aFromParser, + isAtom, customElementDefinition); + } else { + rv = NS_NewElement(getter_AddRefs(element), ni.forget(), aFromParser, + isAtom); + } + NS_ENSURE_SUCCESS(rv, rv); + + if (aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_XHTML) || + aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_SVG)) { + if (nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(element)) { + sele->SetScriptLineNumber(aLineNumber); + sele->SetScriptColumnNumber( + JS::ColumnNumberOneOrigin::fromZeroOrigin(aColumnNumber)); + sele->SetCreatorParser(GetParser()); + } else { + MOZ_ASSERT(nsNameSpaceManager::GetInstance()->mSVGDisabled, + "Node didn't QI to script, but SVG wasn't disabled."); + } + } + + // XHTML needs some special attention + if (aNodeInfo->NamespaceEquals(kNameSpaceID_XHTML)) { + mPrettyPrintHasFactoredElements = true; + } else { + // If we care, find out if we just used a special factory. + if (!mPrettyPrintHasFactoredElements && !mPrettyPrintHasSpecialRoot && + mPrettyPrintXML) { + mPrettyPrintHasFactoredElements = + nsNameSpaceManager::GetInstance()->HasElementCreator( + aNodeInfo->NamespaceID()); + } + + if (!aNodeInfo->NamespaceEquals(kNameSpaceID_SVG)) { + element.forget(aResult); + return NS_OK; + } + } + + if (auto* linkStyle = LinkStyle::FromNode(*element)) { + if (aFromParser) { + linkStyle->DisableUpdates(); + } + if (!aNodeInfo->Equals(nsGkAtoms::link, kNameSpaceID_XHTML)) { + linkStyle->SetLineNumber(aFromParser ? aLineNumber : 0); + linkStyle->SetColumnNumber(aFromParser ? aColumnNumber + 1 : 1); + } + } + + element.forget(aResult); + return NS_OK; +} + +nsresult nsXMLContentSink::CloseElement(nsIContent* aContent) { + NS_ASSERTION(aContent, "missing element to close"); + + mozilla::dom::NodeInfo* nodeInfo = aContent->NodeInfo(); + + // Some HTML nodes need DoneAddingChildren() called to initialize + // properly (eg form state restoration). + if (nsIContent::RequiresDoneAddingChildren(nodeInfo->NamespaceID(), + nodeInfo->NameAtom())) { + aContent->DoneAddingChildren(HaveNotifiedForCurrentContent()); + } + + if (IsMonolithicContainer(nodeInfo)) { + mInMonolithicContainer--; + } + + if (!nodeInfo->NamespaceEquals(kNameSpaceID_XHTML) && + !nodeInfo->NamespaceEquals(kNameSpaceID_SVG)) { + return NS_OK; + } + + if (nodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_XHTML) || + nodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_SVG)) { + nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(aContent); + if (!sele) { + MOZ_ASSERT(nsNameSpaceManager::GetInstance()->mSVGDisabled, + "Node didn't QI to script, but SVG wasn't disabled."); + return NS_OK; + } + + if (mPreventScriptExecution) { + sele->PreventExecution(); + return NS_OK; + } + + // Always check the clock in nsContentSink right after a script + StopDeflecting(); + + // Flush any previously parsed elements before executing a script, in order + // to prevent a script that adds a mutation observer from observing that + // script element being adding to the tree. + FlushTags(); + + // Now tell the script that it's ready to go. This may execute the script + // or return true, or neither if the script doesn't need executing. + bool block = sele->AttemptToExecute(); + if (mParser) { + if (block) { + GetParser()->BlockParser(); + } + + // If the parser got blocked, make sure to return the appropriate rv. + // I'm not sure if this is actually needed or not. + if (!mParser->IsParserEnabled()) { + block = true; + } + } + + return block ? NS_ERROR_HTMLPARSER_BLOCK : NS_OK; + } + + nsresult rv = NS_OK; + if (auto* linkStyle = LinkStyle::FromNode(*aContent)) { + auto updateOrError = linkStyle->EnableUpdatesAndUpdateStyleSheet( + mRunsToCompletion ? nullptr : this); + if (updateOrError.isErr()) { + rv = updateOrError.unwrapErr(); + } else if (updateOrError.unwrap().ShouldBlock() && !mRunsToCompletion) { + ++mPendingSheetCount; + mScriptLoader->AddParserBlockingScriptExecutionBlocker(); + } + } + + return rv; +} + +nsresult nsXMLContentSink::AddContentAsLeaf(nsIContent* aContent) { + nsresult result = NS_OK; + + if (mState == eXMLContentSinkState_InProlog) { + NS_ASSERTION(mDocument, "Fragments have no prolog"); + mDocumentChildren.AppendElement(aContent); + } else if (mState == eXMLContentSinkState_InEpilog) { + NS_ASSERTION(mDocument, "Fragments have no epilog"); + if (mXSLTProcessor) { + mDocumentChildren.AppendElement(aContent); + } else { + mDocument->AppendChildTo(aContent, false, IgnoreErrors()); + } + } else { + nsCOMPtr<nsIContent> parent = GetCurrentContent(); + + if (parent) { + ErrorResult rv; + parent->AppendChildTo(aContent, false, rv); + result = rv.StealNSResult(); + } + } + return result; +} + +// Create an XML parser and an XSL content sink and start parsing +// the XSL stylesheet located at the given URI. +nsresult nsXMLContentSink::LoadXSLStyleSheet(nsIURI* aUrl) { + nsCOMPtr<nsIDocumentTransformer> processor = new txMozillaXSLTProcessor(); + mDocument->SetUseCounter(eUseCounter_custom_XSLStylesheet); + + processor->SetTransformObserver(this); + + if (NS_SUCCEEDED(processor->LoadStyleSheet(aUrl, mDocument))) { + mXSLTProcessor.swap(processor); + } + + // Intentionally ignore errors here, we should continue loading the + // XML document whether we're able to load the XSLT stylesheet or + // not. + + return NS_OK; +} + +nsresult nsXMLContentSink::ProcessStyleLinkFromHeader( + const nsAString& aHref, bool aAlternate, const nsAString& aTitle, + const nsAString& aIntegrity, const nsAString& aType, + const nsAString& aMedia, const nsAString& aReferrerPolicy, + const nsAString& aFetchPriority) { + mPrettyPrintXML = false; + + nsAutoCString cmd; + if (mParser) GetParser()->GetCommand(cmd); + if (cmd.EqualsASCII(kLoadAsData)) + return NS_OK; // Do not load stylesheets when loading as data + + bool wasXSLT; + nsresult rv = MaybeProcessXSLTLink(nullptr, aHref, aAlternate, aType, aType, + aMedia, aReferrerPolicy, &wasXSLT); + NS_ENSURE_SUCCESS(rv, rv); + if (wasXSLT) { + // We're done here. + return NS_OK; + } + + // Otherwise fall through to nsContentSink to handle CSS Link headers. + return nsContentSink::ProcessStyleLinkFromHeader( + aHref, aAlternate, aTitle, aIntegrity, aType, aMedia, aReferrerPolicy, + aFetchPriority); +} + +nsresult nsXMLContentSink::MaybeProcessXSLTLink( + ProcessingInstruction* aProcessingInstruction, const nsAString& aHref, + bool aAlternate, const nsAString& aTitle, const nsAString& aType, + const nsAString& aMedia, const nsAString& aReferrerPolicy, bool* aWasXSLT) { + bool wasXSLT = aType.LowerCaseEqualsLiteral(TEXT_XSL) || + aType.LowerCaseEqualsLiteral(APPLICATION_XSLT_XML) || + aType.LowerCaseEqualsLiteral(TEXT_XML) || + aType.LowerCaseEqualsLiteral(APPLICATION_XML); + + if (aWasXSLT) { + *aWasXSLT = wasXSLT; + } + + if (!wasXSLT) { + return NS_OK; + } + + if (aAlternate) { + // don't load alternate XSLT + return NS_OK; + } + // LoadXSLStyleSheet needs a mDocShell. + if (!mDocShell) { + return NS_OK; + } + + nsCOMPtr<nsIURI> url; + nsresult rv = NS_NewURI(getter_AddRefs(url), aHref, nullptr, + mDocument->GetDocBaseURI()); + NS_ENSURE_SUCCESS(rv, rv); + + // Do security check + nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager(); + rv = secMan->CheckLoadURIWithPrincipal(mDocument->NodePrincipal(), url, + nsIScriptSecurityManager::ALLOW_CHROME, + mDocument->InnerWindowID()); + NS_ENSURE_SUCCESS(rv, NS_OK); + + nsCOMPtr<nsILoadInfo> secCheckLoadInfo = + new net::LoadInfo(mDocument->NodePrincipal(), // loading principal + mDocument->NodePrincipal(), // triggering principal + aProcessingInstruction, + nsILoadInfo::SEC_ONLY_FOR_EXPLICIT_CONTENTSEC_CHECK, + nsIContentPolicy::TYPE_XSLT); + + // Do content policy check + int16_t decision = nsIContentPolicy::ACCEPT; + rv = NS_CheckContentLoadPolicy(url, secCheckLoadInfo, &decision, + nsContentUtils::GetContentPolicy()); + + NS_ENSURE_SUCCESS(rv, rv); + + if (NS_CP_REJECTED(decision)) { + return NS_OK; + } + + return LoadXSLStyleSheet(url); +} + +void nsXMLContentSink::SetDocumentCharset(NotNull<const Encoding*> aEncoding) { + if (mDocument) { + mDocument->SetDocumentCharacterSet(aEncoding); + } +} + +nsISupports* nsXMLContentSink::GetTarget() { return ToSupports(mDocument); } + +bool nsXMLContentSink::IsScriptExecuting() { return IsScriptExecutingImpl(); } + +nsresult nsXMLContentSink::FlushText(bool aReleaseTextNode) { + nsresult rv = NS_OK; + + if (mTextLength != 0) { + if (mLastTextNode) { + bool notify = HaveNotifiedForCurrentContent(); + // We could probably always increase mInNotification here since + // if AppendText doesn't notify it shouldn't trigger evil code. + // But just in case it does, we don't want to mask any notifications. + if (notify) { + ++mInNotification; + } + rv = mLastTextNode->AppendText(mText, mTextLength, notify); + if (notify) { + --mInNotification; + } + + mTextLength = 0; + } else { + RefPtr<nsTextNode> textContent = + new (mNodeInfoManager) nsTextNode(mNodeInfoManager); + + mLastTextNode = textContent; + + // Set the text in the text node + textContent->SetText(mText, mTextLength, false); + mTextLength = 0; + + // Add text to its parent + rv = AddContentAsLeaf(textContent); + } + } + + if (aReleaseTextNode) { + mLastTextNode = nullptr; + } + + return rv; +} + +nsIContent* nsXMLContentSink::GetCurrentContent() { + if (mContentStack.Length() == 0) { + return nullptr; + } + return GetCurrentStackNode()->mContent; +} + +nsXMLContentSink::StackNode* nsXMLContentSink::GetCurrentStackNode() { + int32_t count = mContentStack.Length(); + return count != 0 ? &mContentStack[count - 1] : nullptr; +} + +nsresult nsXMLContentSink::PushContent(nsIContent* aContent) { + MOZ_ASSERT(aContent, "Null content being pushed!"); + StackNode* sn = mContentStack.AppendElement(); + NS_ENSURE_TRUE(sn, NS_ERROR_OUT_OF_MEMORY); + + nsIContent* contentToPush = aContent; + + // When an XML parser would append a node to a template element, it + // must instead append it to the template element's template contents. + if (contentToPush->IsHTMLElement(nsGkAtoms::_template)) { + HTMLTemplateElement* templateElement = + static_cast<HTMLTemplateElement*>(contentToPush); + contentToPush = templateElement->Content(); + } + + sn->mContent = contentToPush; + sn->mNumFlushed = 0; + return NS_OK; +} + +void nsXMLContentSink::PopContent() { + if (mContentStack.IsEmpty()) { + NS_WARNING("Popping empty stack"); + return; + } + + mContentStack.RemoveLastElement(); +} + +bool nsXMLContentSink::HaveNotifiedForCurrentContent() const { + uint32_t stackLength = mContentStack.Length(); + if (stackLength) { + const StackNode& stackNode = mContentStack[stackLength - 1]; + nsIContent* parent = stackNode.mContent; + return stackNode.mNumFlushed == parent->GetChildCount(); + } + return true; +} + +void nsXMLContentSink::MaybeStartLayout(bool aIgnorePendingSheets) { + // XXXbz if aIgnorePendingSheets is true, what should we do when + // mXSLTProcessor or CanStillPrettyPrint()? + if (mLayoutStarted || mXSLTProcessor || CanStillPrettyPrint()) { + return; + } + StartLayout(aIgnorePendingSheets); +} + +//////////////////////////////////////////////////////////////////////// + +bool nsXMLContentSink::SetDocElement(int32_t aNameSpaceID, nsAtom* aTagName, + nsIContent* aContent) { + if (mDocElement) return false; + + mDocElement = aContent; + + if (mXSLTProcessor) { + mDocumentChildren.AppendElement(aContent); + return true; + } + + if (!mDocumentChildren.IsEmpty()) { + for (nsIContent* child : mDocumentChildren) { + mDocument->AppendChildTo(child, false, IgnoreErrors()); + } + mDocumentChildren.Clear(); + } + + // check for root elements that needs special handling for + // prettyprinting + if (aNameSpaceID == kNameSpaceID_XSLT && + (aTagName == nsGkAtoms::stylesheet || aTagName == nsGkAtoms::transform)) { + mPrettyPrintHasSpecialRoot = true; + if (mPrettyPrintXML) { + // In this case, disable script execution, stylesheet + // loading, and auto XLinks since we plan to prettyprint. + mDocument->ScriptLoader()->SetEnabled(false); + if (mCSSLoader) { + mCSSLoader->SetEnabled(false); + } + } + } + + IgnoredErrorResult rv; + mDocument->AppendChildTo(mDocElement, NotifyForDocElement(), rv); + if (rv.Failed()) { + // If we return false here, the caller will bail out because it won't + // find a parent content node to append to, which is fine. + return false; + } + + return true; +} + +NS_IMETHODIMP +nsXMLContentSink::HandleStartElement(const char16_t* aName, + const char16_t** aAtts, + uint32_t aAttsCount, uint32_t aLineNumber, + uint32_t aColumnNumber) { + return HandleStartElement(aName, aAtts, aAttsCount, aLineNumber, + aColumnNumber, true); +} + +nsresult nsXMLContentSink::HandleStartElement( + const char16_t* aName, const char16_t** aAtts, uint32_t aAttsCount, + uint32_t aLineNumber, uint32_t aColumnNumber, bool aInterruptable) { + MOZ_ASSERT(aAttsCount % 2 == 0, "incorrect aAttsCount"); + // Adjust aAttsCount so it's the actual number of attributes + aAttsCount /= 2; + + nsresult result = NS_OK; + bool appendContent = true; + nsCOMPtr<nsIContent> content; + + // XXX Hopefully the parser will flag this before we get + // here. If we're in the epilog, there should be no + // new elements + MOZ_ASSERT(eXMLContentSinkState_InEpilog != mState); + + FlushText(); + DidAddContent(); + + mState = eXMLContentSinkState_InDocumentElement; + + int32_t nameSpaceID; + RefPtr<nsAtom> prefix, localName; + nsContentUtils::SplitExpatName(aName, getter_AddRefs(prefix), + getter_AddRefs(localName), &nameSpaceID); + + if (!OnOpenContainer(aAtts, aAttsCount, nameSpaceID, localName, + aLineNumber)) { + return NS_OK; + } + + RefPtr<mozilla::dom::NodeInfo> nodeInfo; + nodeInfo = mNodeInfoManager->GetNodeInfo(localName, prefix, nameSpaceID, + nsINode::ELEMENT_NODE); + + result = CreateElement(aAtts, aAttsCount, nodeInfo, aLineNumber, + aColumnNumber, getter_AddRefs(content), &appendContent, + FROM_PARSER_NETWORK); + NS_ENSURE_SUCCESS(result, result); + + // Have to do this before we push the new content on the stack... and have to + // do that before we set attributes, call BindToTree, etc. Ideally we'd push + // on the stack inside CreateElement (which is effectively what the HTML sink + // does), but that's hard with all the subclass overrides going on. + nsCOMPtr<nsIContent> parent = GetCurrentContent(); + + result = PushContent(content); + NS_ENSURE_SUCCESS(result, result); + + // Set the attributes on the new content element + result = AddAttributes(aAtts, content->AsElement()); + + if (NS_OK == result) { + // Store the element + if (!SetDocElement(nameSpaceID, localName, content) && appendContent) { + NS_ENSURE_TRUE(parent, NS_ERROR_UNEXPECTED); + + parent->AppendChildTo(content, false, IgnoreErrors()); + } + } + + // Some HTML nodes need DoneCreatingElement() called to initialize + // properly (eg form state restoration). + if (nsIContent::RequiresDoneCreatingElement(nodeInfo->NamespaceID(), + nodeInfo->NameAtom())) { + content->DoneCreatingElement(); + } + + if (nodeInfo->NamespaceID() == kNameSpaceID_XHTML && + nodeInfo->NameAtom() == nsGkAtoms::head && !mCurrentHead) { + mCurrentHead = content; + } + + if (IsMonolithicContainer(nodeInfo)) { + mInMonolithicContainer++; + } + + if (!mXSLTProcessor) { + if (content == mDocElement) { + nsContentUtils::AddScriptRunner( + new nsDocElementCreatedNotificationRunner(mDocument)); + + if (aInterruptable && NS_SUCCEEDED(result) && mParser && + !mParser->IsParserEnabled()) { + return NS_ERROR_HTMLPARSER_BLOCK; + } + } else if (!mCurrentHead) { + // This isn't the root and we're not inside an XHTML <head>. + // Might need to start layout + MaybeStartLayout(false); + } + } + + return aInterruptable && NS_SUCCEEDED(result) ? DidProcessATokenImpl() + : result; +} + +NS_IMETHODIMP +nsXMLContentSink::HandleEndElement(const char16_t* aName) { + return HandleEndElement(aName, true); +} + +nsresult nsXMLContentSink::HandleEndElement(const char16_t* aName, + bool aInterruptable) { + nsresult result = NS_OK; + + // XXX Hopefully the parser will flag this before we get + // here. If we're in the prolog or epilog, there should be + // no close tags for elements. + MOZ_ASSERT(eXMLContentSinkState_InDocumentElement == mState); + + FlushText(); + + StackNode* sn = GetCurrentStackNode(); + if (!sn) { + return NS_ERROR_UNEXPECTED; + } + + nsCOMPtr<nsIContent> content; + sn->mContent.swap(content); + uint32_t numFlushed = sn->mNumFlushed; + + PopContent(); + NS_ASSERTION(content, "failed to pop content"); +#ifdef DEBUG + // Check that we're closing the right thing + RefPtr<nsAtom> debugNameSpacePrefix, debugTagAtom; + int32_t debugNameSpaceID; + nsContentUtils::SplitExpatName(aName, getter_AddRefs(debugNameSpacePrefix), + getter_AddRefs(debugTagAtom), + &debugNameSpaceID); + // Check if we are closing a template element because template + // elements do not get pushed on the stack, the template + // element content is pushed instead. + bool isTemplateElement = debugTagAtom == nsGkAtoms::_template && + debugNameSpaceID == kNameSpaceID_XHTML; + NS_ASSERTION( + content->NodeInfo()->Equals(debugTagAtom, debugNameSpaceID) || + (debugNameSpaceID == kNameSpaceID_MathML && + content->NodeInfo()->NamespaceID() == kNameSpaceID_disabled_MathML && + content->NodeInfo()->Equals(debugTagAtom)) || + (debugNameSpaceID == kNameSpaceID_SVG && + content->NodeInfo()->NamespaceID() == kNameSpaceID_disabled_SVG && + content->NodeInfo()->Equals(debugTagAtom)) || + isTemplateElement, + "Wrong element being closed"); +#endif + + // Make sure to notify on our kids before we call out to any other code that + // might reenter us and call FlushTags, in a state in which we've already + // popped "content" from the stack but haven't notified on its kids yet. + int32_t stackLen = mContentStack.Length(); + if (mNotifyLevel >= stackLen) { + if (numFlushed < content->GetChildCount()) { + NotifyAppend(content, numFlushed); + } + mNotifyLevel = stackLen - 1; + } + + result = CloseElement(content); + + if (mCurrentHead == content) { + mCurrentHead = nullptr; + } + + if (mDocElement == content) { + // XXXbz for roots that don't want to be appended on open, we + // probably need to deal here.... (and stop appending them on open). + mState = eXMLContentSinkState_InEpilog; + + mDocument->OnParsingCompleted(); + + // We might have had no occasion to start layout yet. Do so now. + MaybeStartLayout(false); + } + + DidAddContent(); + + if (content->IsSVGElement(nsGkAtoms::svg)) { + FlushTags(); + nsCOMPtr<nsIRunnable> event = new nsHtml5SVGLoadDispatcher(content); + if (NS_FAILED(content->OwnerDoc()->Dispatch(event.forget()))) { + NS_WARNING("failed to dispatch svg load dispatcher"); + } + } + + return aInterruptable && NS_SUCCEEDED(result) ? DidProcessATokenImpl() + : result; +} + +NS_IMETHODIMP +nsXMLContentSink::HandleComment(const char16_t* aName) { + FlushText(); + + RefPtr<Comment> comment = new (mNodeInfoManager) Comment(mNodeInfoManager); + comment->SetText(nsDependentString(aName), false); + nsresult rv = AddContentAsLeaf(comment); + DidAddContent(); + + return NS_SUCCEEDED(rv) ? DidProcessATokenImpl() : rv; +} + +NS_IMETHODIMP +nsXMLContentSink::HandleCDataSection(const char16_t* aData, uint32_t aLength) { + // XSLT doesn't differentiate between text and cdata and wants adjacent + // textnodes merged, so add as text. + if (mXSLTProcessor) { + return AddText(aData, aLength); + } + + FlushText(); + + RefPtr<CDATASection> cdata = + new (mNodeInfoManager) CDATASection(mNodeInfoManager); + cdata->SetText(aData, aLength, false); + nsresult rv = AddContentAsLeaf(cdata); + DidAddContent(); + + return NS_SUCCEEDED(rv) ? DidProcessATokenImpl() : rv; +} + +NS_IMETHODIMP +nsXMLContentSink::HandleDoctypeDecl(const nsAString& aSubset, + const nsAString& aName, + const nsAString& aSystemId, + const nsAString& aPublicId, + nsISupports* aCatalogData) { + FlushText(); + + NS_ASSERTION(mDocument, "Shouldn't get here from a document fragment"); + + RefPtr<nsAtom> name = NS_Atomize(aName); + NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY); + + // Create a new doctype node + RefPtr<DocumentType> docType = NS_NewDOMDocumentType( + mNodeInfoManager, name, aPublicId, aSystemId, aSubset); + + MOZ_ASSERT(!aCatalogData, + "Need to add back support for catalog style " + "sheets"); + + mDocumentChildren.AppendElement(docType); + DidAddContent(); + return DidProcessATokenImpl(); +} + +NS_IMETHODIMP +nsXMLContentSink::HandleCharacterData(const char16_t* aData, uint32_t aLength) { + return HandleCharacterData(aData, aLength, true); +} + +nsresult nsXMLContentSink::HandleCharacterData(const char16_t* aData, + uint32_t aLength, + bool aInterruptable) { + nsresult rv = NS_OK; + if (aData && mState != eXMLContentSinkState_InProlog && + mState != eXMLContentSinkState_InEpilog) { + rv = AddText(aData, aLength); + } + return aInterruptable && NS_SUCCEEDED(rv) ? DidProcessATokenImpl() : rv; +} + +NS_IMETHODIMP +nsXMLContentSink::HandleProcessingInstruction(const char16_t* aTarget, + const char16_t* aData) { + FlushText(); + + const nsDependentString target(aTarget); + const nsDependentString data(aData); + + RefPtr<ProcessingInstruction> node = + NS_NewXMLProcessingInstruction(mNodeInfoManager, target, data); + + auto* linkStyle = LinkStyle::FromNode(*node); + if (linkStyle) { + linkStyle->DisableUpdates(); + mPrettyPrintXML = false; + } + + nsresult rv = AddContentAsLeaf(node); + NS_ENSURE_SUCCESS(rv, rv); + DidAddContent(); + + if (linkStyle) { + // This is an xml-stylesheet processing instruction... but it might not be + // a CSS one if the type is set to something else. + auto updateOrError = linkStyle->EnableUpdatesAndUpdateStyleSheet( + mRunsToCompletion ? nullptr : this); + if (updateOrError.isErr()) { + return updateOrError.unwrapErr(); + } + + auto update = updateOrError.unwrap(); + if (update.WillNotify()) { + // Successfully started a stylesheet load + if (update.ShouldBlock() && !mRunsToCompletion) { + ++mPendingSheetCount; + mScriptLoader->AddParserBlockingScriptExecutionBlocker(); + } + return NS_OK; + } + } + + // Check whether this is a CSS stylesheet PI. Make sure the type + // handling here matches + // XMLStylesheetProcessingInstruction::GetStyleSheetInfo. + nsAutoString type; + nsContentUtils::GetPseudoAttributeValue(data, nsGkAtoms::type, type); + nsAutoString mimeType, notUsed; + nsContentUtils::SplitMimeType(type, mimeType, notUsed); + + if (mState != eXMLContentSinkState_InProlog || + !target.EqualsLiteral("xml-stylesheet") || mimeType.IsEmpty() || + mimeType.LowerCaseEqualsLiteral("text/css")) { + // Either not a useful stylesheet PI, or a CSS stylesheet PI that + // got handled above by the "ssle" bits. We're done here. + return DidProcessATokenImpl(); + } + + // If it's not a CSS stylesheet PI... + nsAutoString href, title, media; + bool isAlternate = false; + + // If there was no href, we can't do anything with this PI + if (!ParsePIData(data, href, title, media, isAlternate)) { + return DidProcessATokenImpl(); + } + + // <?xml-stylesheet?> processing instructions don't have a referrerpolicy + // pseudo-attribute, so we pass in an empty string + rv = + MaybeProcessXSLTLink(node, href, isAlternate, title, type, media, u""_ns); + return NS_SUCCEEDED(rv) ? DidProcessATokenImpl() : rv; +} + +/* static */ +bool nsXMLContentSink::ParsePIData(const nsString& aData, nsString& aHref, + nsString& aTitle, nsString& aMedia, + bool& aIsAlternate) { + // If there was no href, we can't do anything with this PI + if (!nsContentUtils::GetPseudoAttributeValue(aData, nsGkAtoms::href, aHref)) { + return false; + } + + nsContentUtils::GetPseudoAttributeValue(aData, nsGkAtoms::title, aTitle); + + nsContentUtils::GetPseudoAttributeValue(aData, nsGkAtoms::media, aMedia); + + nsAutoString alternate; + nsContentUtils::GetPseudoAttributeValue(aData, nsGkAtoms::alternate, + alternate); + + aIsAlternate = alternate.EqualsLiteral("yes"); + + return true; +} + +NS_IMETHODIMP +nsXMLContentSink::HandleXMLDeclaration(const char16_t* aVersion, + const char16_t* aEncoding, + int32_t aStandalone) { + mDocument->SetXMLDeclaration(aVersion, aEncoding, aStandalone); + + return DidProcessATokenImpl(); +} + +NS_IMETHODIMP +nsXMLContentSink::ReportError(const char16_t* aErrorText, + const char16_t* aSourceText, + nsIScriptError* aError, bool* _retval) { + MOZ_ASSERT(aError && aSourceText && aErrorText, "Check arguments!!!"); + nsresult rv = NS_OK; + + // The expat driver should report the error. We're just cleaning up the mess. + *_retval = true; + + mPrettyPrintXML = false; + + mState = eXMLContentSinkState_InProlog; + + // XXX need to stop scripts here -- hsivonen + + // stop observing in order to avoid crashing when removing content + mDocument->RemoveObserver(this); + mIsDocumentObserver = false; + + // Clear the current content + mDocumentChildren.Clear(); + while (mDocument->GetLastChild()) { + mDocument->GetLastChild()->Remove(); + } + mDocElement = nullptr; + + // Clear any buffered-up text we have. It's enough to set the length to 0. + // The buffer itself is allocated when we're created and deleted in our + // destructor, so don't mess with it. + mTextLength = 0; + + if (mXSLTProcessor) { + // Get rid of the XSLT processor. + mXSLTProcessor->CancelLoads(); + mXSLTProcessor = nullptr; + } + + // release the nodes on stack + mContentStack.Clear(); + mNotifyLevel = 0; + + // return leaving the document empty if we're asked to not add a <parsererror> + // root node + if (mDocument->SuppressParserErrorElement()) { + return NS_OK; + } + + // prepare to set <parsererror> as the document root + rv = HandleProcessingInstruction( + u"xml-stylesheet", + u"href=\"chrome://global/locale/intl.css\" type=\"text/css\""); + NS_ENSURE_SUCCESS(rv, rv); + + const char16_t* noAtts[] = {0, 0}; + + constexpr auto errorNs = + u"http://www.mozilla.org/newlayout/xml/parsererror.xml"_ns; + + nsAutoString parsererror(errorNs); + parsererror.Append((char16_t)0xFFFF); + parsererror.AppendLiteral("parsererror"); + + rv = HandleStartElement(parsererror.get(), noAtts, 0, (uint32_t)-1, 0); + NS_ENSURE_SUCCESS(rv, rv); + + rv = HandleCharacterData(aErrorText, NS_strlen(aErrorText), false); + NS_ENSURE_SUCCESS(rv, rv); + + nsAutoString sourcetext(errorNs); + sourcetext.Append((char16_t)0xFFFF); + sourcetext.AppendLiteral("sourcetext"); + + rv = HandleStartElement(sourcetext.get(), noAtts, 0, (uint32_t)-1, 0); + NS_ENSURE_SUCCESS(rv, rv); + + rv = HandleCharacterData(aSourceText, NS_strlen(aSourceText), false); + NS_ENSURE_SUCCESS(rv, rv); + + rv = HandleEndElement(sourcetext.get(), false); + NS_ENSURE_SUCCESS(rv, rv); + + rv = HandleEndElement(parsererror.get(), false); + NS_ENSURE_SUCCESS(rv, rv); + + FlushTags(); + + return NS_OK; +} + +nsresult nsXMLContentSink::AddAttributes(const char16_t** aAtts, + Element* aContent) { + // Add tag attributes to the content attributes + RefPtr<nsAtom> prefix, localName; + while (*aAtts) { + int32_t nameSpaceID; + nsContentUtils::SplitExpatName(aAtts[0], getter_AddRefs(prefix), + getter_AddRefs(localName), &nameSpaceID); + + // Add attribute to content + aContent->SetAttr(nameSpaceID, localName, prefix, + nsDependentString(aAtts[1]), false); + aAtts += 2; + } + + return NS_OK; +} + +#define NS_ACCUMULATION_BUFFER_SIZE 4096 + +nsresult nsXMLContentSink::AddText(const char16_t* aText, int32_t aLength) { + // Copy data from string into our buffer; flush buffer when it fills up. + int32_t offset = 0; + while (0 != aLength) { + int32_t amount = NS_ACCUMULATION_BUFFER_SIZE - mTextLength; + if (0 == amount) { + nsresult rv = FlushText(false); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + MOZ_ASSERT(mTextLength == 0); + amount = NS_ACCUMULATION_BUFFER_SIZE; + } + + if (amount > aLength) { + amount = aLength; + } + memcpy(&mText[mTextLength], &aText[offset], sizeof(char16_t) * amount); + mTextLength += amount; + offset += amount; + aLength -= amount; + } + + return NS_OK; +} + +void nsXMLContentSink::InitialTranslationCompleted() { StartLayout(false); } + +void nsXMLContentSink::FlushPendingNotifications(FlushType aType) { + // Only flush tags if we're not doing the notification ourselves + // (since we aren't reentrant) + if (!mInNotification) { + if (mIsDocumentObserver) { + // Only flush if we're still a document observer (so that our child + // counts should be correct). + if (aType >= FlushType::ContentAndNotify) { + FlushTags(); + } else { + FlushText(false); + } + } + if (aType >= FlushType::EnsurePresShellInitAndFrames) { + // Make sure that layout has started so that the reflow flush + // will actually happen. + MaybeStartLayout(true); + } + } +} + +/** + * NOTE!! Forked from SinkContext. Please keep in sync. + * + * Flush all elements that have been seen so far such that + * they are visible in the tree. Specifically, make sure + * that they are all added to their respective parents. + * Also, do notification at the top for all content that + * has been newly added so that the frame tree is complete. + */ +nsresult nsXMLContentSink::FlushTags() { + mDeferredFlushTags = false; + uint32_t oldUpdates = mUpdatesInNotification; + + mUpdatesInNotification = 0; + ++mInNotification; + { + // Scope so we call EndUpdate before we decrease mInNotification + mozAutoDocUpdate updateBatch(mDocument, true); + + // Don't release last text node in case we need to add to it again + FlushText(false); + + // Start from the base of the stack (growing downward) and do + // a notification from the node that is closest to the root of + // tree for any content that has been added. + + int32_t stackPos; + int32_t stackLen = mContentStack.Length(); + bool flushed = false; + uint32_t childCount; + nsIContent* content; + + for (stackPos = 0; stackPos < stackLen; ++stackPos) { + content = mContentStack[stackPos].mContent; + childCount = content->GetChildCount(); + + if (!flushed && (mContentStack[stackPos].mNumFlushed < childCount)) { + NotifyAppend(content, mContentStack[stackPos].mNumFlushed); + flushed = true; + } + + mContentStack[stackPos].mNumFlushed = childCount; + } + mNotifyLevel = stackLen - 1; + } + --mInNotification; + + if (mUpdatesInNotification > 1) { + UpdateChildCounts(); + } + + mUpdatesInNotification = oldUpdates; + return NS_OK; +} + +/** + * NOTE!! Forked from SinkContext. Please keep in sync. + */ +void nsXMLContentSink::UpdateChildCounts() { + // Start from the top of the stack (growing upwards) and see if any + // new content has been appended. If so, we recognize that reflows + // have been generated for it and we should make sure that no + // further reflows occur. Note that we have to include stackPos == 0 + // to properly notify on kids of <html>. + int32_t stackLen = mContentStack.Length(); + int32_t stackPos = stackLen - 1; + while (stackPos >= 0) { + StackNode& node = mContentStack[stackPos]; + node.mNumFlushed = node.mContent->GetChildCount(); + + stackPos--; + } + mNotifyLevel = stackLen - 1; +} + +bool nsXMLContentSink::IsMonolithicContainer( + mozilla::dom::NodeInfo* aNodeInfo) { + return ((aNodeInfo->NamespaceID() == kNameSpaceID_XHTML && + (aNodeInfo->NameAtom() == nsGkAtoms::tr || + aNodeInfo->NameAtom() == nsGkAtoms::select || + aNodeInfo->NameAtom() == nsGkAtoms::object)) || + (aNodeInfo->NamespaceID() == kNameSpaceID_MathML && + (aNodeInfo->NameAtom() == nsGkAtoms::math))); +} + +void nsXMLContentSink::ContinueInterruptedParsingIfEnabled() { + if (mParser && mParser->IsParserEnabled()) { + GetParser()->ContinueInterruptedParsing(); + } +} + +void nsXMLContentSink::ContinueInterruptedParsingAsync() { + nsCOMPtr<nsIRunnable> ev = NewRunnableMethod( + "nsXMLContentSink::ContinueInterruptedParsingIfEnabled", this, + &nsXMLContentSink::ContinueInterruptedParsingIfEnabled); + mDocument->Dispatch(ev.forget()); +} + +nsIParser* nsXMLContentSink::GetParser() { + return static_cast<nsIParser*>(mParser.get()); +} diff --git a/dom/xml/nsXMLContentSink.h b/dom/xml/nsXMLContentSink.h new file mode 100644 index 0000000000..e19fae9265 --- /dev/null +++ b/dom/xml/nsXMLContentSink.h @@ -0,0 +1,219 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef nsXMLContentSink_h__ +#define nsXMLContentSink_h__ + +#include "js/ColumnNumber.h" // JS::ColumnNumberOneOrigin +#include "mozilla/Attributes.h" +#include "nsContentSink.h" +#include "nsIXMLContentSink.h" +#include "nsIExpatSink.h" +#include "nsIDocumentTransformer.h" +#include "nsTArray.h" +#include "nsCOMPtr.h" +#include "nsCRT.h" +#include "nsCycleCollectionParticipant.h" +#include "nsIDTD.h" +#include "mozilla/dom/FromParser.h" + +class nsIURI; +class nsIContent; +class nsIParser; +class nsTextNode; + +namespace mozilla::dom { +class NodeInfo; +class ProcessingInstruction; +} // namespace mozilla::dom + +enum XMLContentSinkState { + eXMLContentSinkState_InProlog, + eXMLContentSinkState_InDocumentElement, + eXMLContentSinkState_InEpilog +}; + +class nsXMLContentSink : public nsContentSink, + public nsIXMLContentSink, + public nsITransformObserver, + public nsIExpatSink { + public: + struct StackNode { + nsCOMPtr<nsIContent> mContent; + uint32_t mNumFlushed; + }; + + nsXMLContentSink(); + + nsresult Init(mozilla::dom::Document* aDoc, nsIURI* aURL, + nsISupports* aContainer, nsIChannel* aChannel); + + // nsISupports + NS_DECL_ISUPPORTS_INHERITED + + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXMLContentSink, nsContentSink) + + NS_DECL_NSIEXPATSINK + + // nsIContentSink + NS_IMETHOD WillParse(void) override; + NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) override; + NS_IMETHOD DidBuildModel(bool aTerminated) override; + NS_IMETHOD WillInterrupt(void) override; + void WillResume() override; + NS_IMETHOD SetParser(nsParserBase* aParser) override; + virtual void InitialTranslationCompleted() override; + virtual void FlushPendingNotifications(mozilla::FlushType aType) override; + virtual void SetDocumentCharset(NotNull<const Encoding*> aEncoding) override; + virtual nsISupports* GetTarget() override; + virtual bool IsScriptExecuting() override; + virtual void ContinueInterruptedParsingAsync() override; + bool IsPrettyPrintXML() const override { return mPrettyPrintXML; } + bool IsPrettyPrintHasSpecialRoot() const override { + return mPrettyPrintHasSpecialRoot; + } + + // nsITransformObserver + nsresult OnDocumentCreated(mozilla::dom::Document* aSourceDocument, + mozilla::dom::Document* aResultDocument) override; + nsresult OnTransformDone(mozilla::dom::Document* aSourceDocument, + nsresult aResult, + mozilla::dom::Document* aResultDocument) override; + + // nsICSSLoaderObserver + NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet, bool aWasDeferred, + nsresult aStatus) override; + static bool ParsePIData(const nsString& aData, nsString& aHref, + nsString& aTitle, nsString& aMedia, + bool& aIsAlternate); + + protected: + virtual ~nsXMLContentSink(); + + nsIParser* GetParser(); + + void ContinueInterruptedParsingIfEnabled(); + + // Start layout. If aIgnorePendingSheets is true, this will happen even if + // we still have stylesheet loads pending. Otherwise, we'll wait until the + // stylesheets are all done loading. + virtual void MaybeStartLayout(bool aIgnorePendingSheets); + + virtual nsresult AddAttributes(const char16_t** aNode, + mozilla::dom::Element* aElement); + nsresult AddText(const char16_t* aString, int32_t aLength); + + virtual bool OnOpenContainer(const char16_t** aAtts, uint32_t aAttsCount, + int32_t aNameSpaceID, nsAtom* aTagName, + uint32_t aLineNumber) { + return true; + } + // Set the given content as the root element for the created document + // don't set if root element was already set. + // return TRUE if this call set the root element + virtual bool SetDocElement(int32_t aNameSpaceID, nsAtom* aTagName, + nsIContent* aContent); + virtual bool NotifyForDocElement() { return true; } + virtual nsresult CreateElement(const char16_t** aAtts, uint32_t aAttsCount, + mozilla::dom::NodeInfo* aNodeInfo, + uint32_t aLineNumber, uint32_t aColumnNumber, + nsIContent** aResult, bool* aAppendContent, + mozilla::dom::FromParser aFromParser); + + // aParent is allowed to be null here if this is the root content + // being closed + virtual nsresult CloseElement(nsIContent* aContent); + + virtual nsresult FlushText(bool aReleaseTextNode = true); + + nsresult AddContentAsLeaf(nsIContent* aContent); + + nsIContent* GetCurrentContent(); + StackNode* GetCurrentStackNode(); + nsresult PushContent(nsIContent* aContent); + void PopContent(); + bool HaveNotifiedForCurrentContent() const; + + nsresult FlushTags() override; + + void UpdateChildCounts() override; + + void DidAddContent() { + if (!mXSLTProcessor && IsTimeToNotify()) { + FlushTags(); + } + } + + // nsContentSink override + virtual nsresult ProcessStyleLinkFromHeader( + const nsAString& aHref, bool aAlternate, const nsAString& aTitle, + const nsAString& aIntegrity, const nsAString& aType, + const nsAString& aMedia, const nsAString& aReferrerPolicy, + const nsAString& aFetchPriority) override; + + // Try to handle an XSLT style link. If NS_OK is returned and aWasXSLT is not + // null, *aWasXSLT will be set to whether we processed this link as XSLT. + // + // aProcessingInstruction can be null if this information comes from a Link + // header; otherwise it will be the xml-styleshset XML PI that the loading + // information comes from. + virtual nsresult MaybeProcessXSLTLink( + mozilla::dom::ProcessingInstruction* aProcessingInstruction, + const nsAString& aHref, bool aAlternate, const nsAString& aTitle, + const nsAString& aType, const nsAString& aMedia, + const nsAString& aReferrerPolicy, bool* aWasXSLT = nullptr); + + nsresult LoadXSLStyleSheet(nsIURI* aUrl); + + bool CanStillPrettyPrint(); + + nsresult MaybePrettyPrint(); + + bool IsMonolithicContainer(mozilla::dom::NodeInfo* aNodeInfo); + + nsresult HandleStartElement(const char16_t* aName, const char16_t** aAtts, + uint32_t aAttsCount, uint32_t aLineNumber, + uint32_t aColumnNumber, bool aInterruptable); + nsresult HandleEndElement(const char16_t* aName, bool aInterruptable); + nsresult HandleCharacterData(const char16_t* aData, uint32_t aLength, + bool aInterruptable); + + nsCOMPtr<nsIContent> mDocElement; + nsCOMPtr<nsIContent> mCurrentHead; // When set, we're in an XHTML <haed> + + XMLContentSinkState mState; + + // The length of the valid data in mText. + int32_t mTextLength; + + int32_t mNotifyLevel; + RefPtr<nsTextNode> mLastTextNode; + + uint8_t mPrettyPrintXML : 1; + uint8_t mPrettyPrintHasSpecialRoot : 1; + uint8_t mPrettyPrintHasFactoredElements : 1; + uint8_t mPrettyPrinting : 1; // True if we called PrettyPrint() and it + // decided we should in fact prettyprint. + // True to call prevent script execution in the fragment mode. + uint8_t mPreventScriptExecution : 1; + + nsTArray<StackNode> mContentStack; + + nsCOMPtr<nsIDocumentTransformer> mXSLTProcessor; + + // Holds the children in the prolog until the root element is added, after + // which they're inserted in the document. However, if we're doing an XSLT + // transform this will actually hold all the children of the source document, + // until the transform is finished. After the transform is finished we'll just + // discard the children. + nsTArray<nsCOMPtr<nsIContent>> mDocumentChildren; + + static const int NS_ACCUMULATION_BUFFER_SIZE = 4096; + // Our currently accumulated text that we have not flushed to a textnode yet. + char16_t mText[NS_ACCUMULATION_BUFFER_SIZE]; +}; + +#endif // nsXMLContentSink_h__ diff --git a/dom/xml/nsXMLElement.cpp b/dom/xml/nsXMLElement.cpp new file mode 100644 index 0000000000..ef51715d1b --- /dev/null +++ b/dom/xml/nsXMLElement.cpp @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#include "nsXMLElement.h" +#include "mozilla/dom/ElementBinding.h" +#include "mozilla/dom/ElementInlines.h" +#include "nsContentUtils.h" // nsAutoScriptBlocker + +using namespace mozilla; +using namespace mozilla::dom; + +nsresult NS_NewXMLElement( + Element** aInstancePtrResult, + already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) { + RefPtr<mozilla::dom::NodeInfo> nodeInfo(std::move(aNodeInfo)); + auto* nim = nodeInfo->NodeInfoManager(); + RefPtr<nsXMLElement> it = new (nim) nsXMLElement(nodeInfo.forget()); + + it.forget(aInstancePtrResult); + return NS_OK; +} + +JSObject* nsXMLElement::WrapNode(JSContext* aCx, + JS::Handle<JSObject*> aGivenProto) { + return Element_Binding::Wrap(aCx, this, aGivenProto); +} + +void nsXMLElement::UnbindFromTree(bool aNullParent) { + nsAtom* property; + switch (GetPseudoElementType()) { + case PseudoStyleType::marker: + property = nsGkAtoms::markerPseudoProperty; + break; + case PseudoStyleType::before: + property = nsGkAtoms::beforePseudoProperty; + break; + case PseudoStyleType::after: + property = nsGkAtoms::afterPseudoProperty; + break; + default: + property = nullptr; + } + if (property) { + MOZ_ASSERT(GetParent()); + MOZ_ASSERT(GetParent()->IsElement()); + GetParent()->RemoveProperty(property); + } + Element::UnbindFromTree(aNullParent); +} + +NS_IMPL_ELEMENT_CLONE(nsXMLElement) diff --git a/dom/xml/nsXMLElement.h b/dom/xml/nsXMLElement.h new file mode 100644 index 0000000000..e401965fff --- /dev/null +++ b/dom/xml/nsXMLElement.h @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef nsXMLElement_h___ +#define nsXMLElement_h___ + +#include "mozilla/Attributes.h" +#include "mozilla/dom/Element.h" +#include "mozilla/dom/DOMRect.h" + +class nsXMLElement : public mozilla::dom::Element { + public: + explicit nsXMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) + : mozilla::dom::Element(std::move(aNodeInfo)) {} + + // nsISupports + NS_INLINE_DECL_REFCOUNTING_INHERITED(nsXMLElement, mozilla::dom::Element) + + // nsINode interface methods + virtual nsresult Clone(mozilla::dom::NodeInfo*, + nsINode** aResult) const override; + + virtual void UnbindFromTree(bool aNullParent = true) override; + + protected: + virtual ~nsXMLElement() = default; + + virtual JSObject* WrapNode(JSContext* aCx, + JS::Handle<JSObject*> aGivenProto) override; +}; + +#endif // nsXMLElement_h___ diff --git a/dom/xml/nsXMLFragmentContentSink.cpp b/dom/xml/nsXMLFragmentContentSink.cpp new file mode 100644 index 0000000000..14aeffd924 --- /dev/null +++ b/dom/xml/nsXMLFragmentContentSink.cpp @@ -0,0 +1,374 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#include "nsCOMPtr.h" +#include "nsXMLContentSink.h" +#include "nsIFragmentContentSink.h" +#include "nsIXMLContentSink.h" +#include "nsContentSink.h" +#include "nsIExpatSink.h" +#include "nsIDTD.h" +#include "mozilla/dom/Document.h" +#include "nsIContent.h" +#include "nsGkAtoms.h" +#include "mozilla/dom/NodeInfo.h" +#include "nsContentCreatorFunctions.h" +#include "nsError.h" +#include "nsIDocShell.h" +#include "nsIScriptError.h" +#include "nsTHashtable.h" +#include "nsHashKeys.h" +#include "nsTArray.h" +#include "nsCycleCollectionParticipant.h" +#include "mozilla/css/Loader.h" +#include "mozilla/dom/DocumentFragment.h" +#include "mozilla/dom/ProcessingInstruction.h" +#include "mozilla/dom/ScriptLoader.h" + +using namespace mozilla::dom; + +class nsXMLFragmentContentSink : public nsXMLContentSink, + public nsIFragmentContentSink { + public: + nsXMLFragmentContentSink(); + + // nsISupports + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXMLFragmentContentSink, + nsXMLContentSink) + + // nsIExpatSink + NS_IMETHOD HandleDoctypeDecl(const nsAString& aSubset, const nsAString& aName, + const nsAString& aSystemId, + const nsAString& aPublicId, + nsISupports* aCatalogData) override; + NS_IMETHOD HandleProcessingInstruction(const char16_t* aTarget, + const char16_t* aData) override; + NS_IMETHOD HandleXMLDeclaration(const char16_t* aVersion, + const char16_t* aEncoding, + int32_t aStandalone) override; + NS_IMETHOD ReportError(const char16_t* aErrorText, + const char16_t* aSourceText, nsIScriptError* aError, + bool* aRetval) override; + + // nsIContentSink + NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode) override; + NS_IMETHOD DidBuildModel(bool aTerminated) override; + virtual void SetDocumentCharset(NotNull<const Encoding*> aEncoding) override; + virtual nsISupports* GetTarget() override; + NS_IMETHOD DidProcessATokenImpl(); + + // nsIXMLContentSink + + // nsIFragmentContentSink + NS_IMETHOD FinishFragmentParsing(DocumentFragment** aFragment) override; + NS_IMETHOD SetTargetDocument(Document* aDocument) override; + NS_IMETHOD WillBuildContent() override; + NS_IMETHOD DidBuildContent() override; + NS_IMETHOD IgnoreFirstContainer() override; + NS_IMETHOD SetPreventScriptExecution(bool aPreventScriptExecution) override; + + protected: + virtual ~nsXMLFragmentContentSink(); + + virtual bool SetDocElement(int32_t aNameSpaceID, nsAtom* aTagName, + nsIContent* aContent) override; + virtual nsresult CreateElement(const char16_t** aAtts, uint32_t aAttsCount, + mozilla::dom::NodeInfo* aNodeInfo, + uint32_t aLineNumber, uint32_t aColumnNumber, + nsIContent** aResult, bool* aAppendContent, + mozilla::dom::FromParser aFromParser) override; + virtual nsresult CloseElement(nsIContent* aContent) override; + + virtual void MaybeStartLayout(bool aIgnorePendingSheets) override; + + // nsContentSink overrides + virtual nsresult ProcessStyleLinkFromHeader( + const nsAString& aHref, bool aAlternate, const nsAString& aTitle, + const nsAString& aIntegrity, const nsAString& aType, + const nsAString& aMedia, const nsAString& aReferrerPolicy, + const nsAString& aFetchPriority) override; + + // nsXMLContentSink overrides + virtual nsresult MaybeProcessXSLTLink( + ProcessingInstruction* aProcessingInstruction, const nsAString& aHref, + bool aAlternate, const nsAString& aTitle, const nsAString& aType, + const nsAString& aMedia, const nsAString& aReferrerPolicy, + bool* aWasXSLT = nullptr) override; + + nsCOMPtr<Document> mTargetDocument; + // the fragment + RefPtr<DocumentFragment> mRoot; + bool mParseError; +}; + +static nsresult NewXMLFragmentContentSinkHelper( + nsIFragmentContentSink** aResult) { + nsXMLFragmentContentSink* it = new nsXMLFragmentContentSink(); + + NS_ADDREF(*aResult = it); + + return NS_OK; +} + +nsresult NS_NewXMLFragmentContentSink(nsIFragmentContentSink** aResult) { + return NewXMLFragmentContentSinkHelper(aResult); +} + +nsXMLFragmentContentSink::nsXMLFragmentContentSink() : mParseError(false) { + mRunsToCompletion = true; +} + +nsXMLFragmentContentSink::~nsXMLFragmentContentSink() = default; + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXMLFragmentContentSink) + NS_INTERFACE_MAP_ENTRY(nsIFragmentContentSink) +NS_INTERFACE_MAP_END_INHERITING(nsXMLContentSink) + +NS_IMPL_ADDREF_INHERITED(nsXMLFragmentContentSink, nsXMLContentSink) +NS_IMPL_RELEASE_INHERITED(nsXMLFragmentContentSink, nsXMLContentSink) + +NS_IMPL_CYCLE_COLLECTION_INHERITED(nsXMLFragmentContentSink, nsXMLContentSink, + mTargetDocument, mRoot) + +NS_IMETHODIMP +nsXMLFragmentContentSink::WillBuildModel(nsDTDMode aDTDMode) { + if (mRoot) { + return NS_OK; + } + + mState = eXMLContentSinkState_InDocumentElement; + + NS_ASSERTION(mTargetDocument, "Need a document!"); + + mRoot = new (mNodeInfoManager) DocumentFragment(mNodeInfoManager); + + return NS_OK; +} + +NS_IMETHODIMP +nsXMLFragmentContentSink::DidBuildModel(bool aTerminated) { + // Drop our reference to the parser to get rid of a circular + // reference. + mParser = nullptr; + + return NS_OK; +} + +void nsXMLFragmentContentSink::SetDocumentCharset( + NotNull<const Encoding*> aEncoding) { + MOZ_ASSERT_UNREACHABLE("fragments shouldn't set charset"); +} + +nsISupports* nsXMLFragmentContentSink::GetTarget() { + return ToSupports(mTargetDocument); +} + +//////////////////////////////////////////////////////////////////////// + +bool nsXMLFragmentContentSink::SetDocElement(int32_t aNameSpaceID, + nsAtom* aTagName, + nsIContent* aContent) { + // this is a fragment, not a document + return false; +} + +nsresult nsXMLFragmentContentSink::CreateElement( + const char16_t** aAtts, uint32_t aAttsCount, + mozilla::dom::NodeInfo* aNodeInfo, uint32_t aLineNumber, + uint32_t aColumnNumber, nsIContent** aResult, bool* aAppendContent, + FromParser /*aFromParser*/) { + // Claim to not be coming from parser, since we don't do any of the + // fancy CloseElement stuff. + nsresult rv = nsXMLContentSink::CreateElement( + aAtts, aAttsCount, aNodeInfo, aLineNumber, aColumnNumber, aResult, + aAppendContent, NOT_FROM_PARSER); + + // When we aren't grabbing all of the content we, never open a doc + // element, we run into trouble on the first element, so we don't append, + // and simply push this onto the content stack. + if (mContentStack.Length() == 0) { + *aAppendContent = false; + } + + return rv; +} + +nsresult nsXMLFragmentContentSink::CloseElement(nsIContent* aContent) { + // don't do fancy stuff in nsXMLContentSink + if (mPreventScriptExecution && (aContent->IsHTMLElement(nsGkAtoms::script) || + aContent->IsSVGElement(nsGkAtoms::script))) { + nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(aContent); + if (sele) { + sele->PreventExecution(); + } else { + NS_ASSERTION(nsNameSpaceManager::GetInstance()->mSVGDisabled, + "Script did QI correctly, but wasn't a disabled SVG!"); + } + } + return NS_OK; +} + +void nsXMLFragmentContentSink::MaybeStartLayout(bool aIgnorePendingSheets) {} + +//////////////////////////////////////////////////////////////////////// + +NS_IMETHODIMP +nsXMLFragmentContentSink::HandleDoctypeDecl(const nsAString& aSubset, + const nsAString& aName, + const nsAString& aSystemId, + const nsAString& aPublicId, + nsISupports* aCatalogData) { + MOZ_ASSERT_UNREACHABLE("fragments shouldn't have doctype declarations"); + + return NS_OK; +} + +NS_IMETHODIMP +nsXMLFragmentContentSink::HandleProcessingInstruction(const char16_t* aTarget, + const char16_t* aData) { + FlushText(); + + const nsDependentString target(aTarget); + const nsDependentString data(aData); + + RefPtr<ProcessingInstruction> node = + NS_NewXMLProcessingInstruction(mNodeInfoManager, target, data); + + // no special processing here. that should happen when the fragment moves + // into the document + return AddContentAsLeaf(node); +} + +NS_IMETHODIMP +nsXMLFragmentContentSink::HandleXMLDeclaration(const char16_t* aVersion, + const char16_t* aEncoding, + int32_t aStandalone) { + MOZ_ASSERT_UNREACHABLE("fragments shouldn't have XML declarations"); + return NS_OK; +} + +NS_IMETHODIMP +nsXMLFragmentContentSink::ReportError(const char16_t* aErrorText, + const char16_t* aSourceText, + nsIScriptError* aError, bool* _retval) { + MOZ_ASSERT(aError && aSourceText && aErrorText, "Check arguments!!!"); + + // The expat driver should report the error. + *_retval = true; + + mParseError = true; + +#ifdef DEBUG + // Report the error to stderr. + fprintf(stderr, "\n%s\n%s\n\n", NS_LossyConvertUTF16toASCII(aErrorText).get(), + NS_LossyConvertUTF16toASCII(aSourceText).get()); +#endif + + // The following code is similar to the cleanup in + // nsXMLContentSink::ReportError() + mState = eXMLContentSinkState_InProlog; + + // Clear the current content + while (mRoot->GetLastChild()) { + mRoot->GetLastChild()->Remove(); + } + + // Clear any buffered-up text we have. It's enough to set the length to 0. + // The buffer itself is allocated when we're created and deleted in our + // destructor, so don't mess with it. + mTextLength = 0; + + return NS_OK; +} + +nsresult nsXMLFragmentContentSink::ProcessStyleLinkFromHeader( + const nsAString& aHref, bool aAlternate, const nsAString& aTitle, + const nsAString& aIntegrity, const nsAString& aType, + const nsAString& aMedia, const nsAString& aReferrerPolicy, + const nsAString& aFetchPriority) + +{ + MOZ_ASSERT_UNREACHABLE("Shouldn't have headers for a fragment sink"); + return NS_OK; +} + +nsresult nsXMLFragmentContentSink::MaybeProcessXSLTLink( + ProcessingInstruction* aProcessingInstruction, const nsAString& aHref, + bool aAlternate, const nsAString& aTitle, const nsAString& aType, + const nsAString& aMedia, const nsAString& aReferrerPolicy, bool* aWasXSLT) { + MOZ_ASSERT(!aWasXSLT, "Our one caller doesn't care about whether we're XSLT"); + return NS_OK; +} + +//////////////////////////////////////////////////////////////////////// + +NS_IMETHODIMP +nsXMLFragmentContentSink::FinishFragmentParsing(DocumentFragment** aFragment) { + mTargetDocument = nullptr; + mNodeInfoManager = nullptr; + mScriptLoader = nullptr; + mCSSLoader = nullptr; + mContentStack.Clear(); + mDocumentURI = nullptr; + mDocShell = nullptr; + mDocElement = nullptr; + mCurrentHead = nullptr; + if (mParseError) { + // XXX PARSE_ERR from DOM3 Load and Save would be more appropriate + mRoot = nullptr; + mParseError = false; + *aFragment = nullptr; + return NS_ERROR_DOM_SYNTAX_ERR; + } + + mRoot.forget(aFragment); + return NS_OK; +} + +NS_IMETHODIMP +nsXMLFragmentContentSink::SetTargetDocument(Document* aTargetDocument) { + NS_ENSURE_ARG_POINTER(aTargetDocument); + + mTargetDocument = aTargetDocument; + mNodeInfoManager = aTargetDocument->NodeInfoManager(); + + return NS_OK; +} + +NS_IMETHODIMP +nsXMLFragmentContentSink::WillBuildContent() { + PushContent(mRoot); + + return NS_OK; +} + +NS_IMETHODIMP +nsXMLFragmentContentSink::DidBuildContent() { + // Note: we need to FlushText() here because if we don't, we might not get + // an end element to do it for us, so make sure. + if (!mParseError) { + FlushText(); + } + PopContent(); + + return NS_OK; +} + +NS_IMETHODIMP +nsXMLFragmentContentSink::DidProcessATokenImpl() { return NS_OK; } + +NS_IMETHODIMP +nsXMLFragmentContentSink::IgnoreFirstContainer() { + MOZ_ASSERT_UNREACHABLE("XML isn't as broken as HTML"); + return NS_ERROR_FAILURE; +} + +NS_IMETHODIMP +nsXMLFragmentContentSink::SetPreventScriptExecution(bool aPrevent) { + mPreventScriptExecution = aPrevent; + return NS_OK; +} diff --git a/dom/xml/nsXMLPrettyPrinter.cpp b/dom/xml/nsXMLPrettyPrinter.cpp new file mode 100644 index 0000000000..4a386e92fb --- /dev/null +++ b/dom/xml/nsXMLPrettyPrinter.cpp @@ -0,0 +1,189 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. */ + +#include "nsXMLPrettyPrinter.h" +#include "nsContentUtils.h" +#include "nsICSSDeclaration.h" +#include "nsSyncLoadService.h" +#include "nsPIDOMWindow.h" +#include "nsNetUtil.h" +#include "mozilla/dom/Element.h" +#include "mozilla/dom/ShadowRoot.h" +#include "mozilla/Preferences.h" +#include "mozilla/dom/Document.h" +#include "nsVariant.h" +#include "mozilla/dom/CustomEvent.h" +#include "mozilla/dom/DocumentFragment.h" +#include "mozilla/dom/DocumentL10n.h" +#include "mozilla/dom/ScriptSettings.h" +#include "mozilla/dom/ToJSValue.h" +#include "mozilla/dom/txMozillaXSLTProcessor.h" + +using namespace mozilla; +using namespace mozilla::dom; + +NS_IMPL_ISUPPORTS(nsXMLPrettyPrinter, nsIDocumentObserver, nsIMutationObserver) + +nsXMLPrettyPrinter::nsXMLPrettyPrinter() + : mDocument(nullptr), mUnhookPending(false) {} + +nsXMLPrettyPrinter::~nsXMLPrettyPrinter() { + NS_ASSERTION(!mDocument, "we shouldn't be referencing the document still"); +} + +nsresult nsXMLPrettyPrinter::PrettyPrint(Document* aDocument, + bool* aDidPrettyPrint) { + *aDidPrettyPrint = false; + + // check the pref + if (!Preferences::GetBool("layout.xml.prettyprint", true)) { + return NS_OK; + } + + // Find the root element + RefPtr<Element> rootElement = aDocument->GetRootElement(); + NS_ENSURE_TRUE(rootElement, NS_ERROR_UNEXPECTED); + + // nsXMLContentSink should not ask us to pretty print an XML doc that comes + // with a CanAttachShadowDOM() == true root element, but just in case: + if (rootElement->CanAttachShadowDOM()) { + MOZ_DIAGNOSTIC_ASSERT(false, "We shouldn't be getting this root element"); + return NS_ERROR_UNEXPECTED; + } + + // Ok, we should prettyprint. Let's do it! + *aDidPrettyPrint = true; + nsresult rv = NS_OK; + + // Load the XSLT + nsCOMPtr<nsIURI> xslUri; + rv = NS_NewURI(getter_AddRefs(xslUri), + "chrome://global/content/xml/XMLPrettyPrint.xsl"_ns); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr<Document> xslDocument; + rv = nsSyncLoadService::LoadDocument( + xslUri, nsIContentPolicy::TYPE_XSLT, nsContentUtils::GetSystemPrincipal(), + nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL, nullptr, + aDocument->CookieJarSettings(), true, ReferrerPolicy::_empty, + getter_AddRefs(xslDocument)); + NS_ENSURE_SUCCESS(rv, rv); + + // Transform the document + RefPtr<txMozillaXSLTProcessor> transformer = new txMozillaXSLTProcessor(); + ErrorResult err; + transformer->ImportStylesheet(*xslDocument, err); + if (NS_WARN_IF(err.Failed())) { + return err.StealNSResult(); + } + + RefPtr<DocumentFragment> resultFragment = + transformer->TransformToFragment(*aDocument, *aDocument, err); + if (NS_WARN_IF(err.Failed())) { + return err.StealNSResult(); + } + + // Attach an UA Widget Shadow Root on it. + rootElement->AttachAndSetUAShadowRoot(Element::NotifyUAWidgetSetup::No); + RefPtr<ShadowRoot> shadowRoot = rootElement->GetShadowRoot(); + MOZ_RELEASE_ASSERT(shadowRoot && shadowRoot->IsUAWidget(), + "There should be a UA Shadow Root here."); + + // Append the document fragment to the shadow dom. + shadowRoot->AppendChild(*resultFragment, err); + if (NS_WARN_IF(err.Failed())) { + return err.StealNSResult(); + } + + // Create a DocumentL10n, as the XML document is not allowed to have one. + // Make it sync so that the test for bug 590812 does not require a setTimeout. + RefPtr<DocumentL10n> l10n = DocumentL10n::Create(aDocument, true); + NS_ENSURE_TRUE(l10n, NS_ERROR_UNEXPECTED); + l10n->AddResourceId("dom/XMLPrettyPrint.ftl"_ns); + + // Localize the shadow DOM header + Element* l10nRoot = shadowRoot->GetElementById(u"header"_ns); + NS_ENSURE_TRUE(l10nRoot, NS_ERROR_UNEXPECTED); + l10n->SetRootInfo(l10nRoot); + l10n->ConnectRoot(*l10nRoot, true, err); + if (NS_WARN_IF(err.Failed())) { + return err.StealNSResult(); + } + RefPtr<Promise> promise = l10n->TranslateRoots(err); + if (NS_WARN_IF(err.Failed())) { + return err.StealNSResult(); + } + + // Observe the document so we know when to switch to "normal" view + aDocument->AddObserver(this); + mDocument = aDocument; + + NS_ADDREF_THIS(); + + return NS_OK; +} + +void nsXMLPrettyPrinter::MaybeUnhook(nsIContent* aContent) { + // If aContent is null, the document-node was modified. + // If it is not null but in the shadow tree or the <scrollbar> NACs, + // the change was in the generated content, and it should be ignored. + bool isGeneratedContent = + aContent && + (aContent->IsInNativeAnonymousSubtree() || aContent->IsInShadowTree()); + + if (!isGeneratedContent && !mUnhookPending) { + // Can't blindly to mUnhookPending after AddScriptRunner, + // since AddScriptRunner _could_ in theory run us + // synchronously + mUnhookPending = true; + nsContentUtils::AddScriptRunner(NewRunnableMethod( + "nsXMLPrettyPrinter::Unhook", this, &nsXMLPrettyPrinter::Unhook)); + } +} + +void nsXMLPrettyPrinter::Unhook() { + mDocument->RemoveObserver(this); + nsCOMPtr<Element> element = mDocument->GetDocumentElement(); + + if (element) { + // Remove the shadow root + element->UnattachShadow(); + } + + mDocument = nullptr; + + NS_RELEASE_THIS(); +} + +void nsXMLPrettyPrinter::AttributeChanged(Element* aElement, + int32_t aNameSpaceID, + nsAtom* aAttribute, int32_t aModType, + const nsAttrValue* aOldValue) { + MaybeUnhook(aElement); +} + +void nsXMLPrettyPrinter::ContentAppended(nsIContent* aFirstNewContent) { + MaybeUnhook(aFirstNewContent->GetParent()); +} + +void nsXMLPrettyPrinter::ContentInserted(nsIContent* aChild) { + MaybeUnhook(aChild->GetParent()); +} + +void nsXMLPrettyPrinter::ContentRemoved(nsIContent* aChild, + nsIContent* aPreviousSibling) { + MaybeUnhook(aChild->GetParent()); +} + +void nsXMLPrettyPrinter::NodeWillBeDestroyed(nsINode* aNode) { + mDocument = nullptr; + NS_RELEASE_THIS(); +} + +nsresult NS_NewXMLPrettyPrinter(nsXMLPrettyPrinter** aPrinter) { + *aPrinter = new nsXMLPrettyPrinter; + NS_ADDREF(*aPrinter); + return NS_OK; +} diff --git a/dom/xml/nsXMLPrettyPrinter.h b/dom/xml/nsXMLPrettyPrinter.h new file mode 100644 index 0000000000..04835666dd --- /dev/null +++ b/dom/xml/nsXMLPrettyPrinter.h @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. */ + +#ifndef nsXMLPrettyPrinter_h__ +#define nsXMLPrettyPrinter_h__ + +#include "nsStubDocumentObserver.h" +#include "nsCOMPtr.h" + +class nsXMLPrettyPrinter : public nsStubDocumentObserver { + public: + nsXMLPrettyPrinter(); + + NS_DECL_ISUPPORTS + + // nsIMutationObserver + NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED + NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED + NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED + NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED + NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED + + /** + * This will prettyprint the document if the document is loaded in a + * displayed window. + * + * @param aDocument document to prettyprint + * @param [out] aDidPrettyPrint if true, and error not returned, actually + * went ahead with prettyprinting the document. + */ + nsresult PrettyPrint(mozilla::dom::Document* aDocument, + bool* aDidPrettyPrint); + + /** + * Unhook the prettyprinter + */ + void Unhook(); + + private: + virtual ~nsXMLPrettyPrinter(); + + /** + * Signals for unhooking by setting mUnhookPending if the node changed is + * not in the shadow root tree nor in anonymous content. + * + * @param aContent content that has changed + */ + void MaybeUnhook(nsIContent* aContent); + + mozilla::dom::Document* + mDocument; // weak. Set as long as we're observing the document + bool mUnhookPending; +}; + +nsresult NS_NewXMLPrettyPrinter(nsXMLPrettyPrinter** aPrinter); + +#endif // nsXMLPrettyPrinter_h__ diff --git a/dom/xml/resources/XMLPrettyPrint.css b/dom/xml/resources/XMLPrettyPrint.css new file mode 100644 index 0000000000..845833c46f --- /dev/null +++ b/dom/xml/resources/XMLPrettyPrint.css @@ -0,0 +1,58 @@ +@charset "UTF-8"; +/* 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/. */ + +@import url("resource://content-accessible/viewsource.css"); + +:host { + color-scheme: light dark; +} + +#header { + background-color: #ccc; + border-bottom: 3px solid black; + padding: 0.5em; + margin-bottom: 1em; +} + +@media (prefers-color-scheme: dark) { + #header { + background-color: #333; + border-color: #555; + } +} + +#tree, +.expandable-children { + margin-inline-start: 1em; +} + +.expandable-body { + display: inline-block; +} + +.expandable-body[open] { + display: block; +} + +.expandable-opening { + list-style: '+' outside; +} + +[open] > .expandable-opening { + list-style-type: '−'; +} + +.expandable-opening::marker { + cursor: pointer; + padding-inline-end: 2px; + /* Don't want to inherit the styling from pi and comment elements */ + color: buttontext; + font: initial; +} + +.comment { + font-family: monospace; + white-space: pre; +} diff --git a/dom/xml/resources/XMLPrettyPrint.xsl b/dom/xml/resources/XMLPrettyPrint.xsl new file mode 100644 index 0000000000..b23296cf0d --- /dev/null +++ b/dom/xml/resources/XMLPrettyPrint.xsl @@ -0,0 +1,133 @@ +<?xml version="1.0"?> +<!-- 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/. --> + +<!DOCTYPE overlay> + +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns="http://www.w3.org/1999/xhtml"> + + <xsl:output method="xml"/> + + <xsl:template match="/"> + <div id="top"> + <link rel="stylesheet" href="chrome://global/content/xml/XMLPrettyPrint.css"/> + <div id="header"> + <p data-l10n-id="xml-nostylesheet"></p> + </div> + <main id="tree" class="highlight"> + <xsl:apply-templates/> + </main> + </div> + </xsl:template> + + <xsl:template match="*"> + <div> + <xsl:text><</xsl:text> + <span class="start-tag"><xsl:value-of select="name(.)"/></span> + <xsl:apply-templates select="@*"/> + <xsl:text>/></xsl:text> + </div> + </xsl:template> + + <xsl:template match="*[node()]"> + <div> + <xsl:text><</xsl:text> + <span class="start-tag"><xsl:value-of select="name(.)"/></span> + <xsl:apply-templates select="@*"/> + <xsl:text>></xsl:text> + + <span class="text"><xsl:value-of select="."/></span> + + <xsl:text></</xsl:text> + <span class="end-tag"><xsl:value-of select="name(.)"/></span> + <xsl:text>></xsl:text> + </div> + </xsl:template> + + <xsl:template match="*[* or processing-instruction() or comment() or string-length(.) > 50]"> + <div> + <details open="" class="expandable-body"> + <summary class="expandable-opening"> + <xsl:text><</xsl:text> + <span class="start-tag"><xsl:value-of select="name(.)"/></span> + <xsl:apply-templates select="@*"/> + <xsl:text>></xsl:text> + </summary> + + <div class="expandable-children"><xsl:apply-templates/></div> + + </details> + <span class="expandable-closing"> + <xsl:text></</xsl:text> + <span class="end-tag"><xsl:value-of select="name(.)"/></span> + <xsl:text>></xsl:text> + </span> + </div> + </xsl:template> + + <xsl:template match="@*"> + <xsl:text> </xsl:text> + <span class="attribute-name"><xsl:value-of select="name(.)"/></span> + <xsl:text>=</xsl:text> + <span class="attribute-value">"<xsl:value-of select="."/>"</span> + </xsl:template> + + <xsl:template match="text()"> + <xsl:if test="normalize-space(.)"> + <xsl:value-of select="."/> + </xsl:if> + </xsl:template> + + <xsl:template match="processing-instruction()"> + <div class="pi"> + <xsl:text><?</xsl:text> + <xsl:value-of select="name(.)"/> + <xsl:text> </xsl:text> + <xsl:value-of select="."/> + <xsl:text>?></xsl:text> + </div> + </xsl:template> + + <xsl:template match="processing-instruction()[string-length(.) > 50]"> + <div class="pi"> + <details open="" class="expandable-body"> + <summary class="expandable-opening"> + <xsl:text><?</xsl:text> + <xsl:value-of select="name(.)"/> + </summary> + <div class="expandable-children"><xsl:value-of select="."/></div> + </details> + <span class="expandable-closing"> + <xsl:text>?></xsl:text> + </span> + </div> + </xsl:template> + + <xsl:template match="comment()"> + <div class="comment"> + <xsl:text><!--</xsl:text> + <xsl:value-of select="."/> + <xsl:text>--></xsl:text> + </div> + </xsl:template> + + <xsl:template match="comment()[string-length(.) > 50]"> + <div class="comment"> + <details open="" class="expandable-body"> + <summary class="expandable-opening"> + <xsl:text><!--</xsl:text> + </summary> + <div class="expandable-children"> + <xsl:value-of select="."/> + </div> + </details> + <span class="expandable-closing"> + <xsl:text>--></xsl:text> + </span> + </div> + </xsl:template> + +</xsl:stylesheet> diff --git a/dom/xml/resources/jar.mn b/dom/xml/resources/jar.mn new file mode 100644 index 0000000000..14fc365a3e --- /dev/null +++ b/dom/xml/resources/jar.mn @@ -0,0 +1,7 @@ +# 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/. + +toolkit.jar: + content/global/xml/XMLPrettyPrint.css (XMLPrettyPrint.css) + content/global/xml/XMLPrettyPrint.xsl (XMLPrettyPrint.xsl) diff --git a/dom/xml/resources/moz.build b/dom/xml/resources/moz.build new file mode 100644 index 0000000000..d988c0ff9b --- /dev/null +++ b/dom/xml/resources/moz.build @@ -0,0 +1,7 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +JAR_MANIFESTS += ["jar.mn"] diff --git a/dom/xml/test/file_bug293347.xml b/dom/xml/test/file_bug293347.xml new file mode 100644 index 0000000000..d041450e2f --- /dev/null +++ b/dom/xml/test/file_bug293347.xml @@ -0,0 +1,2 @@ +<?xml-stylesheet type="text/xsl" href="file_bug293347xslt.xml"?> +<doc/>
\ No newline at end of file diff --git a/dom/xml/test/file_bug293347xslt.xml b/dom/xml/test/file_bug293347xslt.xml new file mode 100644 index 0000000000..44df7749e0 --- /dev/null +++ b/dom/xml/test/file_bug293347xslt.xml @@ -0,0 +1,19 @@ +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:template match="/doc"> + <html> + <body> + <div></div> + <div> + <script> + didThrow = false; + try { + document.write("shrimp"); + } catch (e) { + didThrow = true; + } + </script> + </div> + </body> + </html> + </xsl:template> +</xsl:stylesheet> diff --git a/dom/xml/test/file_bug343870.xml b/dom/xml/test/file_bug343870.xml new file mode 100644 index 0000000000..cf9c60544c --- /dev/null +++ b/dom/xml/test/file_bug343870.xml @@ -0,0 +1,6 @@ +<?xml version='1.0' encoding='utf-8'?> +<html xmlns='http://www.w3.org/1999/xhtml'> +<p id='lf'> +</p><p id='cr'> +</p><p id='crlf'> +</p><p id='escapedcr'> </p></html> diff --git a/dom/xml/test/file_bug691215.xml b/dom/xml/test/file_bug691215.xml new file mode 100644 index 0000000000..37ae932348 --- /dev/null +++ b/dom/xml/test/file_bug691215.xml @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<root/> diff --git a/dom/xml/test/mochitest.toml b/dom/xml/test/mochitest.toml new file mode 100644 index 0000000000..487c4c5720 --- /dev/null +++ b/dom/xml/test/mochitest.toml @@ -0,0 +1,21 @@ +[DEFAULT] +support-files = [ + "file_bug293347.xml", + "file_bug293347xslt.xml", + "file_bug343870.xml", + "file_bug691215.xml", +] + +["test_bug232004.xhtml"] + +["test_bug293347.html"] + +["test_bug343870.xhtml"] + +["test_bug355213.xhtml"] + +["test_bug691215.html"] +skip-if = [ + "http2", + "http3", +] diff --git a/dom/xml/test/old/books/bethlehem.gif b/dom/xml/test/old/books/bethlehem.gif Binary files differnew file mode 100644 index 0000000000..db41f52fb4 --- /dev/null +++ b/dom/xml/test/old/books/bethlehem.gif diff --git a/dom/xml/test/old/books/bill.gif b/dom/xml/test/old/books/bill.gif Binary files differnew file mode 100644 index 0000000000..4b00f890cb --- /dev/null +++ b/dom/xml/test/old/books/bill.gif diff --git a/dom/xml/test/old/books/books.js b/dom/xml/test/old/books/books.js new file mode 100644 index 0000000000..8ae17d8a47 --- /dev/null +++ b/dom/xml/test/old/books/books.js @@ -0,0 +1,90 @@ +// An inefficient, but effective bubble sort +function sort(collection, key) { + var i, j; + var count = collection.length; + var parent, child; + + for (i = count - 1; i >= 0; i--) { + for (j = 1; j <= i; j++) { + if (collection[j - 1][key] > collection[j][key]) { + // Move the item both in the local array and + // in the tree + child = collection[j]; + parent = child.parentNode; + + collection[j] = collection[j - 1]; + collection[j - 1] = child; + + parent.removeChild(child); + parent.insertBefore(child, collection[j]); + } + } + } +} + +// Set user properties on the nodes in the collection +// based on information found in its children. For example, +// make a property "Author" based on the content of the +// "Author" element found in the childNode list of the node. +// This makes later sorting more efficient +function collectInfo(nodes, propNames) { + var i, j, k; + var ncount = nodes.length; + var pcount = propNames.length; + + for (i = 0; i < ncount; i++) { + var node = nodes[i]; + var childNodes = node.childNodes; + var ccount = childNodes.length; + + for (j = 0; j < ccount; j++) { + var child = childNodes[j]; + + if (child.nodeType == Node.ELEMENT_NODE) { + var tagName = child.tagName; + + for (k = 0; k < pcount; k++) { + var prop = propNames[k]; + if (prop == tagName) { + node[prop] = child.firstChild.data; + } + } + } + } + } +} + +var enabled = true; +function toggleStyleSheet() { + if (enabled) { + document.styleSheets[2].disabled = true; + } else { + document.styleSheets[2].disabled = false; + } + + enabled = !enabled; +} + +// XXX This is a workaround for a bug where +// changing the disabled state of a stylesheet can't +// be done in an event handler. For now, we do it +// in a zero-delay timeout. +function initiateToggle() { + setTimeout(toggleStyleSheet, 0); +} + +var sortableProps = ["Author", "Title", "ISBN"]; +var books = []; + +// We uppercase the tagName as a workaround for a bug +// that loses the original case of the tag. +var bookset = document.getElementsByTagName("Book"); + +// We need to create a "non-live" array to operate on. Since +// we'll be moving things around in this array, we can't use +// the read-only, live one returned by getElementsByTagName. +for (var i = 0; i < bookset.length; i++) { + books[i] = bookset[i]; +} + +collectInfo(books, sortableProps); diff --git a/dom/xml/test/old/books/books.xml b/dom/xml/test/old/books/books.xml new file mode 100644 index 0000000000..2067487d8d --- /dev/null +++ b/dom/xml/test/old/books/books.xml @@ -0,0 +1,103 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="common.css" type="text/css"?> +<?xml-stylesheet href="classic.css" type="text/css"?> +<?xml-stylesheet href="list.css" type="text/css"?> + +<!DOCTYPE SearchResult> + +<SearchResult xmlns:html="http://www.w3.org/1999/xhtml" + xmlns:xlink="http://www.w3.org/1999/xlink"> + +<Header> + <Toolbar> + <html:form> + <Label>Sort by:</Label> + <html:input type="button" id="Author" onclick="sort(books,this.id)" value="Author"/> + <html:input type="button" id="Title" onclick="sort(books,this.id)" value="Title"/> + <html:input type="button" id="ISBN" onclick="sort(books,this.id)" value="ISBN #"/> + <html:input type="button" id="toggle" value="Toggle Style" onclick="initiateToggle(); return false;"/> + </html:form> + </Toolbar> + + <SearchTitle>Amazon.com Search Results for: the keywords include "Road"</SearchTitle> +</Header> + +<BookSet> + + <Book> + <BookCover><html:img src="kerouac.gif" width="100" height="140"/></BookCover> + <Title xlink:type="simple" xlink:show="replace" xlink:href="http://www.amazon.com/exec/obidos/ASIN/0140042598/002-5969498-2733628">On the Road</Title> + <Author>Kerouac, Jack</Author> + <ISBN>0140042598</ISBN> + <Synopsis> +On The Road, the most famous of Jack Kerouac's works, is not only the soul of the Beat movement and literature, but one of the most important novels of the century. Like nearly all of Kerouac's writing, On The Road is thinly fictionalized autobiography, filled with a cast made of Kerouac's real life friends, lovers, and fellow travelers. Narrated by Sal Paradise, one of Kerouac's alter-egos, On the Road is a cross-country bohemian odyssey that not only influenced writing in the years since its 1957 publication but penetrated into the deepest levels of American thought and culture. + </Synopsis> + <ListPrice>$12.95</ListPrice> + <Price>$10.36</Price> + </Book> + + <Book> + <BookCover><html:img src="bill.gif" width="100" height="140" /></BookCover> + <Title xlink:type="simple" xlink:show="replace" xlink:href="http://www.amazon.com/exec/obidos/ASIN/0140260404/002-5969498-2733628">The Road Ahead</Title> + <Author>Gates, Bill</Author> + <ISBN>666666666</ISBN> + <Synopsis> +In a study, the founder of Microsoft presents his vision for the future in which he sees the digital technologies of the coming years changing the way we buy, work, learn, and communicate. But he doesn't mention XML! + </Synopsis> + <ListPrice>$15.95</ListPrice> + <Price>$12.76</Price> + </Book> + + <Book> + <BookCover><html:img src="welville.gif" width="100" height="140" /></BookCover> + <Title xlink:type="simple" xlink:show="replace" xlink:href="http://www.amazon.com/exec/obidos/ASIN/0140167188/002-5969498-2733628">The Road to Wellville</Title> + <Author>Boyle, T. Coraghessan</Author> + <ISBN>0140167188</ISBN> + <Synopsis> +A snobbish wife and her henpecked husband travel to Dr. Kellogg's spa in turn-of-the-century Battle Creek, where the youth-crazed affluent succumb to quackery. By the author of East is East. + </Synopsis> + <ListPrice>$12.95</ListPrice> + <Price>$10.36</Price> + </Book> + + <Book> + <BookCover><html:img src="road.gif" width="100" height="140" /></BookCover> + <Title xlink:type="simple" xlink:show="replace" xlink:href="http://www.amazon.com/exec/obidos/ASIN/1562512625/002-5969498-2733628">AAA Road Atlas 1999</Title> + <Author>A. A. A.</Author> + <ISBN>1562512625</ISBN> + <Synopsis> +The definitive road atlas to the United States, Canada and Mexico. + </Synopsis> + <ListPrice>$9.95</ListPrice> + <Price>$9.95</Price> + </Book> + + <Book> + <BookCover><html:img src="bethlehem.gif" width="100" height="140" /></BookCover> + <Title xlink:type="simple" xlink:show="replace" xlink:href="http://www.amazon.com/exec/obidos/ASIN/0449219143/002-5969498-2733628">Bethlehem Road</Title> + <Author>Perry, Anne</Author> + <ISBN>0449219143</ISBN> + <Synopsis> +He might be elegant, but there's no mistaking it--the gentleman tied to the lamppost on Westminster Bridge is definitely dead. Before Inspector Thomas Pitt can even speculate on why anyone should want to kill the eminent M.P., Sir Lockwood, a colleague of his, meets the same fate at the same spot. The public is outraged, and clever Charlotte Pitt, Thomas's well-born wife, helps her hard-pressed husband by scouting society's drawing rooms for clues to these appalling crimes. Meanwhile, another victim is being stalked.... + </Synopsis> + <ListPrice>$6.99</ListPrice> + <Price>$5.59</Price> + </Book> + + <Book> + <BookCover><html:img src="charing.gif" width="100" height="140" /></BookCover> + <Title xlink:type="simple" xlink:show="replace" xlink:href="http://www.amazon.com/exec/obidos/ASIN/0140143505/002-5969498-2733628">84 Charing Cross Road</Title> + <Author>Hanff, Helene</Author> + <ISBN>0140143505</ISBN> + <Synopsis> +84, Charing Cross Road is a charming record of bibliophilia, cultural difference, and imaginative sympathy. For 20 years, an outspoken New York writer and a rather more restrained London bookseller carried on an increasingly touching correspondence... + </Synopsis> + <ListPrice>$9.95</ListPrice> + <Price>$7.96</Price> + </Book> + +</BookSet> + +<html:script src="books.js" /> + +</SearchResult> diff --git a/dom/xml/test/old/books/charing.gif b/dom/xml/test/old/books/charing.gif Binary files differnew file mode 100644 index 0000000000..9a63fb0b27 --- /dev/null +++ b/dom/xml/test/old/books/charing.gif diff --git a/dom/xml/test/old/books/classic.css b/dom/xml/test/old/books/classic.css new file mode 100644 index 0000000000..1ebc92f6e8 --- /dev/null +++ b/dom/xml/test/old/books/classic.css @@ -0,0 +1,78 @@ + + +BookSet { + display: block; +} + +Book { + float: left; + display: block; + width: 300px; + background-color: #f1f1f1; + border: 1px solid #cccccc; + margin-right: 8px; + margin-top: 8px; +} + +BookCover { + display: inline; + float: left; + margin-right: 10px; + padding: 5px; + width: 100px; + height: 140px; +} + +Title { + display: block; + font-weight: bold; + color: blue; + text-decoration: underline; + cursor: pointer; +} + +Author { + display: block; + font-style: italic; +} + +Synopsis { + display: block; + overflow: scroll; + height: 100px; + width: 155px; + padding: 3px; + background-color: #ddddff; +} + + +ListPrice { + display: block; + text-align: right; + padding-right: 15px; + text-decoration: line-through; +} + + +Price { + display: block; + color: rgb(20,100,0); + text-align:right; + padding-right: 15px; + font-weight: bold; +} + + +Price:before { + content: "Our Price: "; +} + +ISBN { + display: block; + font-family: monospace; + font-size: 8pt; +} + + + + diff --git a/dom/xml/test/old/books/common.css b/dom/xml/test/old/books/common.css new file mode 100644 index 0000000000..d63f09585d --- /dev/null +++ b/dom/xml/test/old/books/common.css @@ -0,0 +1,43 @@ +SearchResult { + display: block; + margin-top: 8px; + margin-left: 8px; +} + +Header { + width: 612px; + display: block; +} + +SearchTitle { + display: block; + width: 280px; + border-bottom: thin solid black; + padding-bottom: 6px; + margin-bottom: 12px; +} + +SearchTitle:first-line { + font-family: Verdana, Sans-Serif; + color: #cc6600; + font-size: 14pt; +} + +Toolbar { + font-family: Verdana, Sans-Serif; + float: right; + font-size: 7pt; + display: block; + border: ridge #ddddff 4px; + width: 220px; + margin-right: 0px; + text-align: center; +} + +Label { + font-weight: bold; +} + +input { + margin-top: 2px; +}
\ No newline at end of file diff --git a/dom/xml/test/old/books/kerouac.gif b/dom/xml/test/old/books/kerouac.gif Binary files differnew file mode 100644 index 0000000000..df2b371d07 --- /dev/null +++ b/dom/xml/test/old/books/kerouac.gif diff --git a/dom/xml/test/old/books/list.css b/dom/xml/test/old/books/list.css new file mode 100644 index 0000000000..3b5d408915 --- /dev/null +++ b/dom/xml/test/old/books/list.css @@ -0,0 +1,61 @@ + +BookSet { + display: block; +} + +Book { + display: list-item; + float: none; + border: none; + background: inherit; +} + +BookCover { + display: none; +} + +Title { + display: block; + font-weight: bold; + color: blue; + text-decoration: underline; + cursor: pointer; +} + +Author { + display: block; + font-style: italic; +} + +Synopsis { + display: none; +} + + +ListPrice { + display: none; + text-align: right; + padding-right: 15px; + text-decoration: line-through; +} + + +Price { + display: block; + color: rgb(20,100,0); + font-weight: bold; + text-align:left; +} + + +Price:before { + content: "Our Price: "; +} + +ISBN { + display: block; + font-family: monospace; + font-size: 8pt; +} + + diff --git a/dom/xml/test/old/books/road.gif b/dom/xml/test/old/books/road.gif Binary files differnew file mode 100644 index 0000000000..5ba7920c7e --- /dev/null +++ b/dom/xml/test/old/books/road.gif diff --git a/dom/xml/test/old/books/welville.gif b/dom/xml/test/old/books/welville.gif Binary files differnew file mode 100644 index 0000000000..7ff24a99ec --- /dev/null +++ b/dom/xml/test/old/books/welville.gif diff --git a/dom/xml/test/old/docbook.css b/dom/xml/test/old/docbook.css new file mode 100644 index 0000000000..562c8d2133 --- /dev/null +++ b/dom/xml/test/old/docbook.css @@ -0,0 +1,621 @@ +/* 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/. */ + +Book { + display: block; + padding-left: 8px; + padding-top: 8px; + font-family: Courier; + font-size: 10pt; +} + +Abbrev { + display: block; +} + +Affiliation { + font-style: italic; +} + +Appendix Title { + font-weight: bold; + font-family: Arial; + font-size: 24pt; + margin-bottom: 10pt; + display: block; +} + +Para Author { + display: inline; +} + +Author { + display: block; +} + +AuthorGroup { + font-size: 12pt; + margin-top: 25pt; + display: block; + font-weight: bold; +} + +BiblioDiv Title { + font-style: italic; +} + +Blockquote { + display: block; + margin-top: 3pt; + margin-left: 30pt; +} + +Book Title { + font-weight: bold; + font-family: Arial; + font-size: 18pt; + margin-bottom: 10pt; + display: block; +} + +BookInfo { + display: block; + margin-bottom: 30pt; +} + +BridgeHead { + display: block; + font-size: 16pt; + font-weight: bold; + color: teal; +} + +Caution { + font-weight: bold; + color: red; +} + +Caution:before { + content: "Caution:"; +} + +Chapter { + display: block; + margin-bottom: 25pt; +} + +Chapter Title { + font-weight: bold; + font-family: Arial; + font-size: 20pt; + margin-bottom: 10pt; + display: block; +} + +CiteTitle { + font-style: italic; +} + +CmdSynopsis { + display: block; +} + +CO { + display: block; +} + +Command { + font-style: italic; +} + +Comment { + display: block; +} + +ComputerOutput { + font-family: monospace; +} + +Copyright { + display: block; +} + +Para CorpAuthor { + display: inline; +} + +CorpAuthor { + display: block; +} + +Email { + font-style: italic; +} + +Editor { + display: block; +} + +Emphasis { + font-style: italic; +} + +ErrorType { + font-family: monospace; +} + +Example { + display: block; + margin-top: 10pt; + margin-bottom: 10pt; +} + +Example Title { + display: block; + font-weight: bold; + font-size: 14pt; +} + +Figure Title { + font-family: Arial; + font-size: 10pt; + font-style: italic; + font-weight: bold; + display: block; +} + +Filename { + font-style: italic; +} + +Figure { + display: block; + margin-top: 10pt; +} + +FirstTerm { + font-style: italic; +} + +ForeignPhrase { + font-style: italic; +} + +FormalPara { + display: block; +} + +FormalPara Title { + display: block; + font-weight: bold; +} + +FuncSynopsis { + display: block; +} + +FuncSynopsisInfo { + display: block; + white-space: pre; +} + +Function { + font-family: monospace; + white-space: pre; +} + +Glossary { + display: block; +} + +GlossDef { + display: block; + margin-left: 15pt; +} + +GlossList { + display: block; +} + +GlossSee { + display: block; + margin-left: 15pt; +} + +GlossTerm { + display: block; + font-weight: bold; +} + +InformalTable { + display: block; + margin-top: 10pt; + margin-bottom: 10pt; +} + +Interface { + font-family: Arial; +} + +ISBN { + display: block; + font-size: 10pt; +} + +ItemizedList { + display: block; + margin-top: 5pt; + margin-left: 20pt; +} + +LineAnnotation { + font-style: italic; +} + +Link { + color: blue; + text-decoration: underline; +} + +ListItem { + margin-left: 25pt; + display: list-item; +} + +Literal { + font-family: monospace; +} + +LiteralLayout { + white-space: pre; + display: block; +} + +Member { + display: block; + margin-left: 15pt; +} + +OLink { + display: block; + font-size: 12pt; +} + +Option { + font-family: monospace; +} + +OrderedList { + margin-top: 5pt; + margin-left: 20pt; + margin-bottom: 10pt; + display: block; + list-style-type: decimal; +} + +OrderedList Para { + display: block; + margin-top: 15pt; +} + +Para OtherCredit { + display: inline; +} + +OtherCredit { + display: block; +} + +Para { + display: block; + margin-top: 8pt; +} + +Para LiteralLayout { + display: block; + margin-top: 4pt; + margin-left: 10pt; + white-space: pre; +} + +Para Screen { + margin-top: 7pt; + margin-left: 10pt; + margin-bottom: 7pt; + display: block; +} + +Parameter { + font-family: monospace; +} + +Part Title { + font-size: 24pt; + display: block; + font-weight: bold; +} + +Preface { + display: block; + margin-top: 10pt; +} + +Procedure { + display: block; +} + +ProgramListing { + display: block; + white-space: pre; + font-family: monospace; +} + +ProgramListingCO { + display: block; + white-space: pre; + font-family: monospace; +} + +PublisherName { + font-family: Times, New, Roman; + font-size: 20pt; + margin-top: 15pt; + margin-bottom: 15pt; + display: block; +} + +RefEntry { + display: block; +} + +RefEntryTitle { + display: block; + font-size: 20pt; + font-weight: bold; +} + +RefName { + font-weight: bold; +} + +RefNameDiv { + display: block; +} + +RefSect1 { + display: block; + margin-top: 10pt; +} + +RefSect1 Title { + font-size: 14pt; +} + +RefSect1Info { + display: block; + font-size: small; +} + +RefSect2 { + display: block; + margin-top: 10pt; +} + +RefSect2 Title { + font-size: 14pt; +} + +RefSect2Info { + display: block; + font-size: small; +} + +RefSect3 { + display: block; + margin-top: 10pt; +} + +RefSect3 Title { + font-size: 14pt; +} + +RefSect3Info { + display: block; + font-size: small; +} + +RefSynopsisDiv { + display: block; + margin-top: 15pt; +} + +RefSynopsisDiv Title { + display: block; + font-size: 18pt; +} + +Replaceable { + font-family: Arial; + font-style: italic; +} + +Screen { + display: block; + margin-left: 20pt; + margin-bottom: 10pt; + white-space: pre; +} + +ScreenCO { + white-space: pre; +} + +ScreenShot { + white-space: pre; +} + +Sect1 { + display: block; + margin-top: 16pt; +} + +Sect1 Title { + font-family: Arial; + font-size: 20pt; + font-weight: bold; + display: block; +} + +Sect2 { + display: block; + margin-top: 15pt; +} + +Sect2 Title { + font-family: Arial; + font-size: 14pt; + font-weight: bold; + display: block; +} + +Sect3 { + display: block; + margin-top: 15pt; +} + +Sect3 Title { + font-family: Arial; + font-size: 14pt; + font-weight: bold; + display: block; +} + +SegListItem { + display: block; +} + +SegmentedList { + display: block; +} + +SegmentedList Title { + display: block; + font-weight: bold; +} + +Sidebar { + display: block; + margin-top: 15pt; + margin-left: 30pt; + font-family: Arial; + font-size: 9pt; +} + +Step { + display: block; +} + +Step Title { + display: block; + font-style: italic; +} + +Subscript { + font-size: 5pt; + vertical-align: sub; +} + +Subtitle { + font-family: Arial; + font-size: 20pt; + font-weight: bold; + display: block; + text-align: center; +} + +Superscript { + font-size: 5pt; + vertical-align: super; +} + +Synopsis { + display: block; + white-space: pre; +} + +SystemItem { + font-family: monospace; +} + +Table { + display: block; + margin-top: 10pt; +} + +Table Title { + font-family: Arial; + font-size: 10pt; + font-style: italic; + font-weight: bold; +} + +Term { + font-weight: bold; +} + +Title { + font-family: Arial; + font-size: 20pt; + font-weight: bold; + display: block; + text-align: center; +} + +TitleAbbrev { + font-family: Arial; + font-size: 14pt; + font-weight: bold; + display: block; +} + +ULink { + color: blue; + text-decoration: underline; + cursor: pointer; +} + +UserInput { + font-family: monospace; + font-weight: bold; +} + +VariableList Title { + font-weight: bold; + display: block; +} + +VarListEntry { + display: block; + margin-top: 10pt; +} + +VarListEntry Term { + display: block; + font-style: italic; +} + +Warning { + font-weight: bold; + color: fuchsia; +} + +Warning:before { + content: "Warning:"; +} + + +Year { + font-family: serif; + font-weight: bold; +} diff --git a/dom/xml/test/old/docbooktest.xml b/dom/xml/test/old/docbooktest.xml new file mode 100644 index 0000000000..d47c3cb12e --- /dev/null +++ b/dom/xml/test/old/docbooktest.xml @@ -0,0 +1,126 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="docbook.css" type="text/css"?> +<!DOCTYPE Book SYSTEM "docbook.dtd"> +<Book xmlns:xlink="http://www.w3.org/1999/xlink"> +<Title>SoftQuad +Inc.</Title> +<p xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml"> +<h:img src="flamer.gif"/> +<img src="flamer.gif"/> +<button><b>some text</b></button> +</p> +<BookInfo> <BookBiblio> <Title>Demo Product Documentation</Title> +<AuthorGroup><CorpAuthor>SoftQuad Inc.</CorpAuthor></AuthorGroup> +</BookBiblio> </BookInfo> <Preface> <Title><Anchor +Id="SDK3"/>Element Overview</Title> +<BridgeHead>Introduction to Elements</BridgeHead> +<Para>By far the vast majority of objects (apart from text) that authors +encounter when traversing a document are Element nodes. </Para> </Preface> +<Part> <Title><Anchor Id="SDK273"/>Element Interfaces</Title> +<Chapter Label="1"> <Title><Anchor Id="SDK274"/>Elements and +Attributes</Title> +<Sect1> <Title><Anchor Id="SDK279"/>Introduction to Attributes +</Title> +<Para>Elements may have attributes associated with them; since the Element +interface inherits from Node, the generic Node interface method +<Function>getAttributes</Function> may be used to retrieve the set of all +attributes for an element. </Para> +<Para>There are methods on the Element interface to retrieve either an Attr +object by name or an attribute value by name. In XML, where an attribute value +may contain entity references, an Attr object should be retrieved to examine +the possibly fairly complex sub-tree representing the attribute value. On the +other hand, in HTML, where all attributes have simple string values, methods to +directly access an attribute value can safely be used as a convenience. </Para> + +<Para>Before you can access an Attribute, you must first gain access to the +associated Element.</Para> </Sect1> +<Sect1> <Title><Anchor Id="SDK378"/>Setting the Attribute +Values</Title> +<Para>Attr objects inherit the Node interface, but since they are not actually +child nodes of the element they describe, the DOM does not consider them part +of the document tree. Thus, the Node attributes parentNode, previousSibling, +and nextSibling have a null value for Attr objects. The DOM takes the view that +attributes are properties of elements rather than having a separate identity +from the elements they are associated with; this should make it more efficient +to implement such features as default attributes associated with all elements +of a given type. Furthermore, Attr nodes may not be immediate children of a +DocumentFragment. However, they can be associated with Element nodes contained +within a DocumentFragment. In short, users and implementors of the DOM need to +be aware that Attr nodes have some things in common with other objects +inheriting the Node interface, but they also are quite distinct. </Para> +<Para>The attribute's effective value is determined as follows:</Para> +<ItemizedList Mark="Bullet"> <ListItem> +<Para>If this attribute has been explicitly assigned any value, that value is +the attribute's effective value</Para></ListItem> <ListItem> +<Para>Otherwise, if there is a declaration for this attribute, and that +declaration includes a default value, then that default value is the +attribute's effective value</Para></ListItem> <ListItem> +<Para>Otherwise, the attribute does not exist on this element in the structure +model until it has been explicitly added.</Para></ListItem> </ItemizedList> +<Para>In XML, where the value of an attribute can contain entity references, +the child nodes of the Attr node provide a representation in which entity +references are not expanded. These child nodes may be either Text or +EntityReference nodes. Because the attribute type may be unknown, there are no +tokenized attribute values. </Para> +<Para>The following topics describe DOM attributes: </Para> +<ItemizedList Mark="Bullet"> <ListItem> +<Para> +<ULink xlink:type="simple" xlink:show="replace" + xlink:href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-637646024">Interface +Attr</ULink> </Para></ListItem> <ListItem> +<Para> +<ULink xlink:type="simple" xlink:show="new" + xlink:href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-745549614"> +Interface Element</ULink> </Para></ListItem> </ItemizedList> </Sect1></Chapter> + +<Chapter Label="26" Role="funcref"> <Title><Anchor +Id="SDK48"/>DOM Level 1 Core: Element Functions</Title> +<RefEntry> <RefMeta><RefEntryTitle> <Anchor Id="setAttribute"/>setAttribute +</RefEntryTitle></RefMeta> <RefNameDiv> <RefName>setAttribute</RefName> +<RefPurpose>Sets the Attributes on the associated Element object</RefPurpose> +<RefClass>Fundamental</RefClass> </RefNameDiv> <RefSynopsisDiv> <Title> +<Anchor Id="SDK85"/>Syntax</Title> +<RefSect2> <Title>OMG IDL</Title> +<Synopsis><Type>void</Type> <Function>setAttribute</Function> (in +<Type>DOMString</Type> <Parameter>name</Parameter>, in <Type>DOMString</Type> +<Parameter>value</Parameter>) raises (<ErrorType>DOMException</ErrorType>); +</Synopsis></RefSect2><RefSect2> <Title><Anchor Id="SDK86"/>Java</Title> +<Synopsis><Type>public void</Type> <Function>setAttribute</Function> ( +<Type>String</Type> <Parameter>name</Parameter>, <Type>String</Type> +<Parameter>value</Parameter>) throws (<ErrorType>DOMException</ErrorType>); +</Synopsis> </RefSect2><RefSect2> <Title><Anchor Id="SDK87"/>ECMA Script +</Title> +<Synopsis> <Function>setAttribute</Function> (<Parameter>name, value +</Parameter>)</Synopsis> </RefSect2></RefSynopsisDiv><RefSect1> <Title> +<Anchor Id="SDK88"/>Parameters</Title> +<VariableList> <VarListEntry><Term> <Parameter>name</Parameter></Term> +<ListItem> +<Para>(IN) The name of the attribute to create or alter.</Para> </ListItem> +</VarListEntry><VarListEntry><Term> <Parameter>value</Parameter></Term> +<ListItem> +<Para>(IN) Value to set in string form</Para> </ListItem></VarListEntry> +</VariableList></RefSect1><RefSect1> <Title><Anchor Id="SDK89"/>Exceptions +</Title> +<Para>These are the applicable exceptions. </Para> <InformalTable> <TGroup cols="2"> +<colspec colname="1" colnum="1" colwidth="0.630in"/> +<colspec colname="2" colnum="2" colwidth="5.203in"/> <tbody> +<row> <entry colname="1"> +<Para>INVALID_CHARACTER_ERR</Para></entry> <entry colname="2"> +<Para>Raised if the specified name contains an invalid character.</Para> +</entry></row> <row> <entry colname="1"> +<Para> NO_MODIFICATION_ALLOWED_ERR</Para></entry> <entry colname="2"> +<Para>Raised if this node is readonly.</Para></entry> </row> +</tbody> +</TGroup></InformalTable></RefSect1><RefSect1> <Title><Anchor +Id="SDK90"/>Remarks</Title> +<Para> <Function>setAttribute</Function> adds a new attribute. If an attribute +with that name is already present in the element, its value is changed to be +that of the value parameter. This value is a simple string, it is not parsed as +it is being set. So any markup (such as syntax to be recognized as an entity +reference) is treated as literal text, and needs to be appropriately escaped by +the implementation when it is written out.</Para> +<Para> In order to assign an attribute value that contains entity references, +the user must create an Attr node plus any Text and EntityReference nodes, +build the appropriate subtree, and use <Function>setAttributeNode</Function> to +assign it as the value of an attribute. </Para> </RefSect1></RefEntry> +</Chapter></Part></Book> diff --git a/dom/xml/test/old/flamer.gif b/dom/xml/test/old/flamer.gif Binary files differnew file mode 100644 index 0000000000..5a05df583f --- /dev/null +++ b/dom/xml/test/old/flamer.gif diff --git a/dom/xml/test/old/script.xml b/dom/xml/test/old/script.xml new file mode 100644 index 0000000000..f21d30d973 --- /dev/null +++ b/dom/xml/test/old/script.xml @@ -0,0 +1,67 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="docbook.css" type="text/css"?> +<!DOCTYPE Book System "file:///E|/Program%20Files/SoftQuad/XMetaL/Rules/docbook.dtd"> +<Book xmlns:html="http://www.w3.org/1999/xhtml"> + <Title>The Book</Title> + <Chapter> + <Title>Chapter 1.</Title> + <Para>Yada yada <html:img src="mzcolor.gif"/> yada.</Para> + </Chapter> + <html:script> +<![CDATA[ +function list(node) +{ + var type = node.nodeType; + if (type == Node.ELEMENT_NODE) { + + // open tag + dump("\<" + node.tagName); + + // dump the attributes if any + attributes = node.attributes; + if (null != attributes) { + var countAttrs = attributes.length; + var index = 0; + while(index < countAttrs) { + att = attributes[index]; + if (null != att) { + dump(" " + att.name + "=" + att.value); + } + index++; + } + } + + // recursively dump the children + if (node.hasChildNodes()) { + // close tag + dump(">"); + + // get the children + var children = node.childNodes; + var length = children.length; + var count = 0; + while(count < length) { + child = children[count]; + list(child); + count++; + } + dump("</" + node.tagName + ">"); + } + else { + // close tag + dump("/>"); + } + + + } + // if it's a piece of text just dump the text + else if (type == Node.TEXT_NODE) { + dump(node.data); + } +} + +list(document.documentElement); +dump("\n"); +]]> + </html:script> +</Book> diff --git a/dom/xml/test/old/simple.xml b/dom/xml/test/old/simple.xml new file mode 100644 index 0000000000..c94708c665 --- /dev/null +++ b/dom/xml/test/old/simple.xml @@ -0,0 +1,10 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="docbook.css" type="text/css"?> +<!DOCTYPE Book SYSTEM "file:///E|/Program%20Files/SoftQuad/XMetaL/Rules/docbook.dtd"> +<Book xmlns:html="http://www.w3.org/1999/xhtml"> + <Title>The Book</Title> + <Chapter> + <Title>Chapter 1.</Title> + <Para>Yada yada <html:img src="mzcolor.gif"/> yada.</Para> + </Chapter> +</Book> diff --git a/dom/xml/test/old/toc/book.css b/dom/xml/test/old/toc/book.css new file mode 100644 index 0000000000..778c4244c2 --- /dev/null +++ b/dom/xml/test/old/toc/book.css @@ -0,0 +1,137 @@ +/* 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/. */ + +/* The book style must be the first style for our JavaScript to work */ +book { + display: block; + padding-left: 2em; + padding-right: 2em; + padding-top: 8px; + font-size: 12pt; + background-color: lightyellow; + font-family: Arial; +} + +book title { + font-weight: bold; + font-size: 24pt; + display: block; + text-align: center; + margin-top: 12pt; + margin-bottom: 3pt; +} + +book subtitle { + display: block; + font-size:12pt; + text-align: center; +} + +book abstract { + display: block; + margin-top: 3pt; +} + +input { + display: block; + margin-left: auto; + margin-right: auto; +} + +chapter { + display: block; +} + +chapter title { + font-weight: bold; + font-size: 16pt; + display: block; + text-align: left; + margin-top: 12pt; + margin-bottom: 3pt; +} + +section { + display: block; +} + +section title { + display: block; + font-size: 10pt; + text-align: left; + margin-top: 12pt; + margin-bottom: 3pt; +} + +contents { + display: block; +} + +para { + display: block; + margin-bottom: auto; + margin-top: auto; + font-size:11pt; +} + +link { + display: inline; + color: blue; + text-decoration: underline; + cursor: pointer; +} + +list { + display: block; + margin-right: 0; + margin-bottom: auto; + margin-top: auto; + list-style-type: disc; + margin-left: 40px; +} + +listitem { + display: list-item; + list-style-position: inside; +} + +emph { + font-style: italic; + font-weight: bold; +} + +ref { + font-style: italic; +} + +heading { + font-weight: bold; +} + +navbar { + font-family: Arial; + font-size: 10pt; + display: block; + float: right; + background-color: #CCE6F3; + color: darkblue; + width: 10em; + margin-right: 0.5em; +} + +navbar title { + font-size: 10pt; + display: block; + background-color: black; + color: white; + margin-bottom:0px; +} + +navbar content { + display: block; + padding: 0.3em; + border: 1px solid black; + font-size: 9pt; +} + diff --git a/dom/xml/test/old/toc/irslogo.gif b/dom/xml/test/old/toc/irslogo.gif Binary files differnew file mode 100644 index 0000000000..daab0ca3ab --- /dev/null +++ b/dom/xml/test/old/toc/irslogo.gif diff --git a/dom/xml/test/old/toc/minus.gif b/dom/xml/test/old/toc/minus.gif Binary files differnew file mode 100644 index 0000000000..8adf8d6add --- /dev/null +++ b/dom/xml/test/old/toc/minus.gif diff --git a/dom/xml/test/old/toc/plus.gif b/dom/xml/test/old/toc/plus.gif Binary files differnew file mode 100644 index 0000000000..55446e34c9 --- /dev/null +++ b/dom/xml/test/old/toc/plus.gif diff --git a/dom/xml/test/old/toc/rights.xml b/dom/xml/test/old/toc/rights.xml new file mode 100644 index 0000000000..520eef3de1 --- /dev/null +++ b/dom/xml/test/old/toc/rights.xml @@ -0,0 +1,292 @@ +<?xml version="1.0"?> +<!-- Our script expects the book.css stylesheet first --> +<?xml-stylesheet href="book.css" type="text/css"?> +<?xml-stylesheet href="toc.css" type="text/css"?> +<!DOCTYPE book [ +<!ATTLIST book id ID #IMPLIED> +<!ATTLIST chapter id ID #IMPLIED> +<!ATTLIST section id ID #IMPLIED> +]> +<book id="book" xmlns:html="http://www.w3.org/1999/xhtml" + xmlns:xlink="http://www.w3.org/1999/xlink"> + <html:a name="book"/> + <html:script src="toc.js"/> + <html:img src="irslogo.gif"/> + <navbar> + <title>Table of contents</title> + <content> + To toggle the Table of Contents, click on this button + <html:input type="button" value="Contents" onclick="createToc();"/> + </content> + </navbar> + + <title>Highlights of 1999 Tax Changes</title> + <subtitle>(Rev. December 1999)</subtitle> + + <chapter id="chap1"> + <html:a name="chap1"/> + <title>Tax Changes for Individuals</title> + <contents> + <section id="chap1sec1"> + <html:a name="chap1sec1"/> + <title>Child Tax Credit Increased</title> + <contents> + <para> +The maximum child tax credit for each qualifying child will increase from $400 to $500 in 1999. + </para> + </contents> + </section> + <section id="chap1sec2"> + <html:a name="chap1sec2"/> + <title>Standard Mileage Rate</title> + <contents> + <para> +Beginning April 1, 1999, the optional standard mileage rate for operating your carfor business decreases to 31 cents a mile for each business mile. Until then, the business standard mileage rate of 32 1/2 cents per mile that was in effect for 1998 will continue to apply. + </para> + </contents> + </section> + <section id="chap1sec3"> + <html:a name="chap1sec3"/> + <title>Estimated Tax Safe Harbor for Higher Income Individuals</title> + <contents> + <para> +For estimated tax payments for tax years beginning in 1999, the safe harbor for higher income individuals (other than farmers and fishermen) has been modified. If your 1998 adjusted gross income was more than $150,000 ($75,000 if you aremarried filing a separate return for 1999), you will have to pay the smaller of 90% of your expected tax for 1999 or 105% (up from 100%) of the tax shown on your 1998 return (provided your 1998 return covered all 12 months) to avoid an estimated tax penalty. + </para> + <para> +For more information on estimated tax, see + <link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p505toc.htm" xlink:show="replace" xlink:actuate="user">Publication 505</link>. + </para> + </contents> + </section> + <section id="chap1sec4"> + <html:a name="chap1sec4"/> + <title>Self-Employed Health Insurance Deduction</title> + <contents> + <para> +For 1999, the health insurance deduction for the self-employed is increased from 45% to 60% of the amount you pay for medical insurance for yourself and your family. For more information, see chapter 10 in + <link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p535toc.htm" xlink:show="replace" xlink:actuate="user">Publication 535</link>. + </para> + </contents> + </section> + <section id="chap1sec5"> + <html:a name="chap1sec5"/> + <title>Social Security and Medicare Taxes</title> + <contents> + <para> +For 1999, the employer and employee will continue to pay: + <list> + <listitem> +1.6.2% each for social security tax (old-age, survivors, and disability insurance), and + </listitem> + <listitem> +2.1.45% each for Medicare tax (hospital insurance). + </listitem> + </list> + </para> + <para> + <heading>Wage limits.</heading> +For social security tax, the maximum amount of 1999 wages subject to the tax has increased to $72,600. For Medicare tax, all covered 1999 wages are subject to the tax. There is no wage base limit. For information about these taxes, see + <link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p15toc.htm" xlink:show="replace" xlink:actuate="user">Publication 15</link>, <ref>Circular E, Employer's Tax Guide</ref>. + </para> + </contents> + </section> + <section id="chap1sec6"> + <html:a name="chap1sec6"/> + <title>Self-Employment Tax</title> + <contents> + <para> +The self-employment tax rate on net earnings remains the same for calendar year1999. This rate, 15.3%, is a total of 12.4% for social security (old-age, survivors, and disability insurance), and 2.9% for Medicare (hospital insurance). + </para> + <para> +The maximum amount subject to the social security part for tax years beginning in 1999 has increased to $72,600. All net earnings of at least $400 are subject to the Medicare part. + </para> + </contents> + </section> + </contents> + </chapter> + + <chapter id="chap2"> + <html:a name="chap2"/> + <title>Tax Changes for Businesses</title> + <contents> + <section id="chap2sec1"> + <html:a name="chap2sec1"/> + <title>Social Security and Medicare Taxes</title> + <contents> + <para> +For 1999, the employer and employee will continue to pay: + <list> + <listitem> +6.2% each for social security tax (old-age, survivors, and disability insurance), and + </listitem> + <listitem> +1.45% each for Medicare tax (hospital insurance). + </listitem> + </list> + </para> + <para> +<heading>Wage limits.</heading> For social security tax, the maximum amount of 1999 wages subject to the tax has increased to $72,600. For Medicare tax, all covered 1999 wages are subject to the tax. There is no wage base limit. For information about these taxes and amounts to withhold, see +<link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p15toc.htm" xlink:show="replace" xlink:actuate="user">Publication 15</link>, <ref>Circular E, Employer's TaxGuide</ref>. + </para> + </contents> + </section> + <section id="chap2sec2"> + <html:a name="chap2sec2"/> + <title>Employment Tax Deposits</title> + <contents> + <para> +Under certain circumstances, the IRS can waive the penalty for a first-time depositor's inadvertent failure to timely deposit employment taxes. For deposits required to be made after January 18, 1999, this waiver is expanded to include the first deposit required to be made after a required change in frequency of a taxpayer's deposits. + </para> + </contents> + </section> + <section id="chap2sec3"> + <html:a name="chap2sec3"/> + <title>Electronic Deposit of Taxes</title> + <contents> + <para> +If you were first required to deposit taxes by electronic funds transfer after June 30, 1997, the IRS will not impose the penalty for not doing so before July 1, 1999. Previously, the IRS had waived the penalty through December 31, 1998. For information about depositing taxes electronically, see <link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p15toc.htm" xlink:show="replace" xlink:actuate="user">Publication 15</link>. + </para> + </contents> + </section> + <section id="chap2sec4"> + <html:a name="chap2sec4"/> + <title>941 TeleFile</title> + <contents> + <para> +Beginning with the first quarter of 1998, many employers were able to file Form941 by phone, toll free. If you receive 941 TeleFile with your Form 941 package, check page TEL-1 of the <ref>941 TeleFile Instructions</ref> to see if you qualify for this quick, convenient, and easy method of filing. + </para> + </contents> + </section> + <section id="chap2sec5"> + <html:a name="chap2sec5"/> + <title>941 On-Line</title> + <contents> + <para> +In 1998, a limited number of employers were allowed to file Form 941 using commercially available software to create the return and then transmitting the return electronically to IRS through a third party. 941 On-Line uses Electronic Data Interchange (EDI) format. In 1999, IRS expects to make the 941 On-Line filing option available nationwide. + </para> + </contents> + </section> + <section id="chap2sec6"> + <html:a name="chap2sec6"/> + <title>Self-Employment Tax </title> + <contents> + <para> +The self-employment tax rate on net earnings remains the same for calendar year 1999. This rate, 15.3%, is a total of 12.4% for social security (old-age, survivors,and disability insurance), and 2.9% for Medicare (hospital insurance). + </para> + <para> +The maximum amount subject to the social security part for tax years beginning in 1999 has increased to $72,600. All net earnings of at least $400 are subject to the Medicare part. + </para> + </contents> + </section> + </contents> + </chapter> + + <chapter id="chap3"> + <html:a name="chap3"/> + <title>IRA and other Retirement Plans</title> + <contents> + <section id="chap3sec1"> + <html:a name="chap3sec1"/> + <title>Hardship Distributions</title> + <contents> + <para> +Beginning in 1999, hardship distributions from 401(k) plans and 403(b) plans are not eligible rollover distributions. They cannot be rolled over into a traditional IRA. For more information on traditional IRAs, see <link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p590toc.htm" xlink:show="replace" xlink:actuate="user">Publication 590</link>. + </para> + </contents> + </section> + </contents> + </chapter> + + <chapter id="chap4"> + <html:a name="chap4"/> + <title>Gift and Estate Taxes</title> + <contents> + <section id="chap4sec1"> + <html:a name="chap4sec1"/> + <title>New Deduction From Gross Estate</title> + <contents> + <para> +For estates of decedents dying after 1997, the executor can elect to deduct the adjusted value of a qualified family-owned business interest, up to a limited amount, from the gross estate. For more information, see section 2057 of the Internal Revenue Code and the instructions for Schedule T, Form 706, <ref>United States Estate (and Generation-Skipping Transfer) Tax Return</ref>. + </para> + </contents> + </section> + <section id="chap4sec2"> + <html:a name="chap4sec2"/> + <title>Suit for Refund</title> + <contents> + <para> +Effective July 23, 1998, an executor no longer needs to wait until all the installment payments have been made before filing a suit for refund with a federal district court or the U.S. Court of Federal Claims if the following conditions are met. + <list> + <listitem> +The estate consists largely of an interest in a closely-held business. + </listitem> + <listitem> +The estate elected to make tax payments through the installment method. + </listitem> + </list> + </para> + <para> +However, all of the following must be true before a suit can be filed. + <list> + <listitem> +All installment payments due on or before the date the suit is filed have been made. + </listitem> + <listitem> +No accelerated installment payments have been made. + </listitem> + <listitem> +No Tax Court case is pending with respect to any estate tax liability. + </listitem> + <listitem> +The time for petitioning the Tax Court has passed if a notice of deficiency was issued to the estate regarding its liability for estate tax. + </listitem> + <listitem> +No proceeding is pending for a declaratory judgment by the Tax Court on whether the estate is eligible to pay tax in installments. + </listitem> + </list> + </para> + <para> +In addition, the executor must <emph>not</emph>: + <list> + <listitem> +Include any previously litigated issues in the current suit for refund, and + </listitem> + <listitem> +Discontinue making timely installment payments while the court considers the suit for refund. + </listitem> + </list> + </para> + </contents> + </section> + </contents> + </chapter> + + <chapter id="chap5"> + <html:a name="chap5"/> + <title>Excise Tax</title> + <contents> + <section id="chap5sec1"> + <html:a name="chap5sec1"/> + <title>Air Transportation Taxes</title> + <contents> + <para> +For 1999, the tax on the use of international air travel facilities will be $12.20 for both arrivals and departures. In the case of air transportation between the continental United States and Alaska or between Alaska and Hawaii, the use-of-international-facilities tax on departures will be $6.10. + </para> + </contents> + </section> + <section id="chap5sec2"> + <html:a name="chap5sec2"/> + <title>Luxury Tax</title> + <contents> + <para> +For 1999, the luxury tax on a passenger vehicle is reduced from 7% to 6% of the amount of the sales price that exceeds the base amount. The base amount for 1999 is $36,000. + </para> + <para> +The base amount is increased for electric vehicles and clean-fuel vehicles. See <link xlink:type="simple" xlink:href="http://www.irs.ustreas.gov/prod/forms_pubs/pubs/p510toc.htm" xlink:show="replace" xlink:actuate="user">Publication 510</link> for information on these amounts. + </para> + </contents> + </section> + </contents> + </chapter> + +</book> diff --git a/dom/xml/test/old/toc/toc.css b/dom/xml/test/old/toc/toc.css new file mode 100644 index 0000000000..99c0c9d327 --- /dev/null +++ b/dom/xml/test/old/toc/toc.css @@ -0,0 +1,77 @@ +/* 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/. */ + +toc { + position:fixed; + top:0; + left:0; + width:12em; + height:100%; + border-right: 1px solid black; + background-color: #CCE6F3; + font-family: Arial; + overflow:auto; + color: darkblue; +} + +toc > title { + display: block; + font-size:12pt; + font-weight: bold; + background-color: black; + color:white; +} + +toclink:visited { + color: purple; +} + +toclink:active { + color: red; +} + +level1 { + display: block; + font-weight:bold; + font-size:12pt; + margin-left: 4px; + margin-bottom: 2px; +} + +level1 > toclink { + list-style-position: inside; + text-decoration: none; + color: darkblue; +} + +level2 { + display: block; + font-size:11pt; + margin-left: 8px; + margin-bottom: 2px; +} + +level2 > toclink { + list-style-position: inside; + text-decoration: none; + color: darkblue; +} + +level3 { + display: list-item; + font-size: 8pt; + margin-left: 12px; + margin-bottom: 2px; +} + +level3 > toclink { + list-style-position: inside; + text-decoration: none; + color: darkblue; +} + +toc img { + margin-right: 1em; +} + diff --git a/dom/xml/test/old/toc/toc.js b/dom/xml/test/old/toc/toc.js new file mode 100644 index 0000000000..f30ffd6cff --- /dev/null +++ b/dom/xml/test/old/toc/toc.js @@ -0,0 +1,131 @@ +/* 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/. */ + +// Event handler for display togglers in Table of Contents +function toggleDisplay(event) { + if (event.target.localName != "img") { + return; + } + var img = event.target; + var div = img.nextSibling.nextSibling; + + // Change the display: property of the container to + // hide and show the container. + if (div.style.display == "none") { + div.style.display = "block"; + img.src = "minus.gif"; + } else { + div.style.display = "none"; + img.src = "plus.gif"; + } +} + +// Function that recurses down the tree, looking for +// structural elements. For each structural element, +// a corresponding element is created in the table of +// contents. +var searchTags = ["book", "chapter", "section"]; +var tocTags = ["level1", "level2", "level3"]; +function addToToc(root, tocFrame) { + var i; + var newTocFrame = tocFrame; + var newTocElement = null; + var newTocLink = null; + + for (i = 0; i < searchTags.length; i++) { + if (root.tagName == searchTags[i]) { + // If we've found a structural element, create the + // equivalent TOC element. + newTocElement = document.createElement(tocTags[i]); + // Create the toclink element that is a link to the + // corresponding structural element. + newTocLink = document.createElement("toclink"); + newTocLink.setAttributeNS( + "http://www.w3.org/1999/xlink", + "xlink:type", + "simple" + ); + newTocLink.setAttributeNS( + "http://www.w3.org/1999/xlink", + "xlink:href", + "#" + root.getAttribute("id") + ); + newTocLink.setAttributeNS( + "http://www.w3.org/1999/xlink", + "xlink:show", + "replace" + ); + newTocElement.appendChild(newTocLink); + + // Create the image and toggling container in the table of contents + if (i < searchTags.length - 1) { + var img = document.createElementNS( + "http://www.w3.org/1999/xhtml", + "img" + ); + img.src = "minus.gif"; + newTocElement.insertBefore(img, newTocLink); + + newTocFrame = document.createElementNS( + "http://www.w3.org/1999/xhtml", + "div" + ); + newTocElement.appendChild(newTocFrame); + } else { + newTocFrame = null; + } + + tocFrame.appendChild(newTocElement); + + break; + } + } + + // Recurse down through the childNodes list + for (i = 0; i < root.childNodes.length; i++) { + var child = root.childNodes[i]; + if (child.nodeType == Node.ELEMENT_NODE) { + if (newTocLink != null && child.tagName == "title") { + var text = child.firstChild.cloneNode(true); + newTocLink.appendChild(text); + } else { + addToToc(child, newTocFrame); + } + } + } +} + +// Create the root table of contents element (a fixed element) +// and its contents. +function createToc() { + if (!document.getElementsByTagName("toc").length) { + var toc = document.createElement("toc"); + var title = document.createElement("title"); + title.appendChild(document.createTextNode("Table of Contents")); + toc.appendChild(title); + + // Recurse down and build up the document element + addToToc(document.documentElement, toc); + + // Since we've created the toc element as a fixed element, + // insert a rule that shifts over the document element by + // the width of the toc element. + document.styleSheets[0].cssRules[0].style.marginLeft = "12em"; + document.documentElement.appendChild(toc); + + // Attach the event handler for table of contents buttons. + // This will only work for content that is already a part + // of a document, which is why we had to wait until here + // to do this. + toc.addEventListener("mouseup", toggleDisplay, 1); + } else { + // Hide the table of contents. + // This is not very intelligent if we have a static document, we should + // just hide/show the toc via stylesheet mungling + document.documentElement.removeChild( + document.getElementsByTagName("toc")[0] + ); + document.styleSheets[0].cssRules[0].style.marginLeft = "0em"; + } +} diff --git a/dom/xml/test/old/xlink/auto.xml b/dom/xml/test/old/xlink/auto.xml new file mode 100644 index 0000000000..91eb15ff43 --- /dev/null +++ b/dom/xml/test/old/xlink/auto.xml @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="link.css" type="text/css"?> +<root xmlns:xlink="http://www.w3.org/1999/xlink"> + <p>Testing simple XLinks that must fire immediately on load.</p> + <mylink xlink:type="simple" xlink:actuate="onLoad" xlink:show="new" xlink:href="resource:/res/samples/test0.html"> +Must not open automatically, illegal</mylink> + <mylink xlink:type="simple" xlink:actuate="onLoad" xlink:show="new" xlink:href="http://www.mozilla.org"> +Must open automatically in new window (www.mozilla.org)</mylink> + <mylink xlink:type="simple" xlink:actuate="onLoad" xlink:show="new" xlink:href="http://www.mozillazine.org"> +Must open automatically in new window (www.mozillazine.org)</mylink> + <mylink xlink:type="simple" xlink:actuate="onLoad" xlink:show="replace" xlink:href="http://www.mozilla.org/mozorg.html"> +Must load automatically in same window - "Refresh" (At a glance)</mylink> + <mylink xlink:type="simple" xlink:actuate="onLoad" xlink:show="replace" xlink:href="http://www.netscape.com"> +Must not load automatically, one refresh link fired already (www.netscape.com)</mylink> +</root> + diff --git a/dom/xml/test/old/xlink/link.css b/dom/xml/test/old/xlink/link.css new file mode 100644 index 0000000000..19dc52198d --- /dev/null +++ b/dom/xml/test/old/xlink/link.css @@ -0,0 +1,22 @@ +/* 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/. */ + +@namespace xlink url(http://www.w3.org/1999/xlink); + +root { + display: block; + padding: +5px; +} + +p { + display: block; +} + +mylink { + display: block; + cursor: pointer; + color: blue; + text-decoration: underline; +} + diff --git a/dom/xml/test/old/xlink/manual.xml b/dom/xml/test/old/xlink/manual.xml new file mode 100644 index 0000000000..fd7d49fc17 --- /dev/null +++ b/dom/xml/test/old/xlink/manual.xml @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="link.css" type="text/css"?> +<root xmlns:xlink="http://www.w3.org/1999/xlink"> + <p>Testing manual simple XLinks.</p> + <mylink xlink:type="simple" xlink:show="new" xlink:href="resource:/res/samples/test0.html"> +Must not open, illegal</mylink> + <mylink xlink:type="simple" xlink:show="new" xlink:href="http://www.mozilla.org"> +Must open in new window (www.mozilla.org)</mylink> + <mylink xlink:type="simple" xlink:show="replace" xlink:href="http://www.mozillazine.org"> +Must open in same window (www.mozillazine.org)</mylink> + <mylink xlink:type="simple" xlink:show="foo" xlink:href="http://www.mozilla.org/"> +Foo</mylink> +</root> + diff --git a/dom/xml/test/old/xmlbase/xmlbase.css b/dom/xml/test/old/xmlbase/xmlbase.css new file mode 100644 index 0000000000..a100186bbc --- /dev/null +++ b/dom/xml/test/old/xmlbase/xmlbase.css @@ -0,0 +1,28 @@ +/* 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/. */ + +@namespace xlink url(http://www.w3.org/1999/xlink); + +title { + font-weight: bold; + display: block; +} + +xlink|link { + color: blue; + text-decoration: underline; + cursor: pointer; + display: inline; + padding-left: +5px; +} + +sect1,sect2,sect3 { + display: block; + padding-left: +20px; +} + +p { + display: block; + padding-left: +5px; +}
\ No newline at end of file diff --git a/dom/xml/test/old/xmlbase/xmlbase.xml b/dom/xml/test/old/xmlbase/xmlbase.xml new file mode 100644 index 0000000000..b4cce1dc51 --- /dev/null +++ b/dom/xml/test/old/xmlbase/xmlbase.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<?xml-stylesheet href="xmlbase.css" type="text/css"?> +<root xmlns:xlink="http://www.w3.org/1999/xlink"> +<title>Root: no xml:base</title> +<xlink:link xlink:type="simple" xlink:href="a.xml">a.xml</xlink:link> +<p>Expected: <current path>/a.xml</p> +<sect1 xml:base="http://www.mozilla.org"> + <title>Sect1: xml:base="http://www.mozilla.org"</title> + <xlink:link xlink:type="simple" xlink:href="b.xml">b.xml</xlink:link> + <p>Expected: http://www.mozilla.org/b.xml</p> + <sect2 xml:base="/base"> + <title>Sect2: xml:base="/base"</title> + <xlink:link xlink:type="simple" xlink:href="c.xml">c.xml</xlink:link> + <p>Expected: http://www.mozilla.org/base/c.xml</p> + <sect3 xml:base=""> + <title>Sect3: xml:base=""</title> + <xlink:link xlink:type="simple" xlink:href="d.xml">d.xml</xlink:link> + <p>Expected: http://www.mozilla.org/base/d.xml</p> + </sect3> + <sect3 xml:base="/"> + <title>Sect3: xml:base="/"</title> + <xlink:link xlink:type="simple" xlink:href="d-2.xml">d-2.xml</xlink:link> + <p>Expected: http://www.mozilla.org/d-2.xml</p> + </sect3> + <sect3 xml:base="/foobar"> + <title>Sect3: xml:base="/foobar"</title> + <xlink:link xlink:type="simple" xlink:href="e.xml">e.xml</xlink:link> + <p>Expected: http://www.mozilla.org/foobar/e.xml</p> + </sect3> + <sect3 xml:base="ding/dong"> + <title>Sect3: xml:base="ding/dong"</title> + <xlink:link xlink:type="simple" xlink:href="f.xml">f.xml</xlink:link> + <p>Expected: http://www.mozilla.org/base/ding/dong/f.xml</p> + </sect3> + </sect2> + <sect2 xml:base="http://www.netscape.com"> + <title>Sect2: xml:base="http://www.netscape.com"</title> + <xlink:link xlink:type="simple" xlink:href="g.xml">g.xml</xlink:link> + <p>Expected: http://www.netscape.com/g.xml</p> + </sect2> + <sect2 xml:base="http://www.netscape.com"> + <title>Sect2: xml:base="http://www.netscape.com"</title> + <xlink:link xlink:type="simple" xlink:href="http://www.mozilla.org/foobar/h.xml">http://www.mozilla.org/foobar/h.xml</xlink:link> + <p>Expected: http://www.mozilla.org/foobar/h.xml</p> + </sect2> + <sect2 xml:base="http://www.netscape.com"> + <title>Sect2: xml:base="http://www.netscape.com"</title> + <xlink:link xlink:type="simple" xlink:href="i.xml" xml:base="wow">i.xml, this element has xml:base="wow"</xlink:link> + <p>Expected: http://www.netscape.com/wow/i.xml</p> + </sect2> +</sect1> +<sect1 xml:base="nothere"> + <title>Sect1: xml:base="nothere"</title> + <xlink:link xlink:type="simple" xlink:href="j.xml">j.xml</xlink:link> + <p>Expected: <current path>/nothere/j.xml</p> +</sect1> +<sect1 xml:base="/not"> + <title>Sect1: xml:base="/not"</title> + <xlink:link xlink:type="simple" xlink:href="k.xml">k.xml</xlink:link> + <p>Expected: file:///not/k.xml</p> +</sect1> +<sect1 xml:base="http://foobar.com/ä ö/"> + <title>Sect1: xml:base="http://foobar.com/ä ö/"</title> + <xlink:link xlink:type="simple" xlink:href="l.xml">l.xml</xlink:link> + <p>Expected: http://foobar.com/%E4%20%F6/l.xml</p> +</sect1> +<sect1 xml:base="http://foobar.com/ /%20/"> + <title>Sect1: xml:base="http://foobar.com/ /%20/"</title> + <xlink:link xlink:type="simple" xlink:href="m.xml">m.xml</xlink:link> + <p>Expected: http://foobar.com/%20/%20/m.xml</p> +</sect1> +<sect1 xml:base="chrome://navigator"> + <title>Sect1: xml:base="chrome://navigator"</title> + <xlink:link xlink:type="simple" xlink:href="n.xml">n.xml</xlink:link> + <p>Expected: |current path|/n.xml because chrome URL is not allowed</p> + <sect2 xml:base="http://www.mozilla.org"> + <title>Sect2: xml:base="http://www.mozilla.org"</title> + <xlink:link xlink:type="simple" xlink:href="o.xml" xml:base="chrome://navigator">o.xml, this element has xml:base="chrome://navigator"</xlink:link> + <p>Expected: http://www.mozilla.org/o.xml because chrome base is not allowed</p> + </sect2> +</sect1> +</root>
\ No newline at end of file diff --git a/dom/xml/test/test_bug232004.xhtml b/dom/xml/test/test_bug232004.xhtml new file mode 100644 index 0000000000..a15129a71e --- /dev/null +++ b/dom/xml/test/test_bug232004.xhtml @@ -0,0 +1,38 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=232004 +--> +<head> + <title>Test for Bug 232004</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script src="/tests/SimpleTest/EventUtils.js"/> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=232004">Mozilla Bug 232004</a> +<p id="display"> + <input id="one" type="text" /> + <input style="display: none" id="two" type="text" /> +</p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +<script class="testbody" type="text/javascript"> +<![CDATA[ + +/** Test for Bug 232004 **/ + +$("one").focus(); +is(document.activeElement, $("one"), "node one should be focused"); + +$("two").focus(); +isnot(document.activeElement, $("two"), + "node two has display:none and should not take focus"); + +]]> +</script> +</pre> +</body> +</html> + diff --git a/dom/xml/test/test_bug293347.html b/dom/xml/test/test_bug293347.html new file mode 100644 index 0000000000..6db99bdaa3 --- /dev/null +++ b/dom/xml/test/test_bug293347.html @@ -0,0 +1,33 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=293347 +--> +<head> + <title>Test for Bug 293347</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=293347">Mozilla Bug 293347</a> +<p id="display"></p> +<pre id="test"> +<script class="testbody" type="text/javascript"> + +SimpleTest.waitForExplicitFinish(); + +function done(iframe) { + let win = iframe.contentWindow; + is(win.document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "div") + .length, 2, "doc still intact"); + is(win.document.body.namespaceURI, "http://www.w3.org/1999/xhtml", + "doc body still intact"); + is(win.didThrow, true, "doc.write throwing"); + SimpleTest.finish(); +} + +</script> +<iframe src="file_bug293347.xml" onload="done(this)"></iframe> +</pre> +</body> +</html> diff --git a/dom/xml/test/test_bug343870.xhtml b/dom/xml/test/test_bug343870.xhtml new file mode 100644 index 0000000000..7fa625211b --- /dev/null +++ b/dom/xml/test/test_bug343870.xhtml @@ -0,0 +1,39 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=343870 +--> +<head> + <title>Test for Bug 343870</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=343870">Mozilla Bug 343870</a> +<p id="display"></p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +<script class="testbody" type="text/javascript"> +<![CDATA[ + +/** Test for Bug 343870 **/ +function doTest() { + var dataDoc = document.getElementById("d").contentDocument; + is(dataDoc.getElementById("lf").firstChild.data, "\n"); + is(dataDoc.getElementById("cr").firstChild.data, "\n"); + is(dataDoc.getElementById("crlf").firstChild.data, "\n"); + is(dataDoc.getElementById("escapedcr").firstChild.data, "\r"); +} + +SimpleTest.waitForExplicitFinish(); +addLoadEvent(doTest); +addLoadEvent(SimpleTest.finish); + +]]> +</script> +</pre> +<iframe id="d" src="file_bug343870.xml"></iframe> +</body> +</html> + diff --git a/dom/xml/test/test_bug355213.xhtml b/dom/xml/test/test_bug355213.xhtml new file mode 100644 index 0000000000..3376a4b8b3 --- /dev/null +++ b/dom/xml/test/test_bug355213.xhtml @@ -0,0 +1,35 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=355213 +--> +<head> + <title>Test for Bug 355213</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=355213">Mozilla Bug 355213</a> +<p id="display"></p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +<script class="testbody" type="text/javascript"> +<![CDATA[ + +/** Test for Bug 355213 **/ + var firstWidth = document.getElementById('display').offsetWidth; + SimpleTest.waitForExplicitFinish(); + addLoadEvent( + function() { + is(firstWidth, document.getElementById('test').offsetWidth, + "Width should not change"); + }); + addLoadEvent(SimpleTest.finish); + +]]> +</script> +</pre> +</body> +</html> + diff --git a/dom/xml/test/test_bug691215.html b/dom/xml/test/test_bug691215.html new file mode 100644 index 0000000000..70a5f7b719 --- /dev/null +++ b/dom/xml/test/test_bug691215.html @@ -0,0 +1,53 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=691215 +--> +<head> + <title>Test for Bug 691215</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=691215">Mozilla Bug 691215</a> +<p id="display"></p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +<script type="application/javascript"> + +/** Test for Bug 691215 **/ + +SimpleTest.waitForExplicitFinish(); + +var BASE_URI = "http://mochi.test:8888/tests/dom/xml/test/"; +var url = BASE_URI + "file_bug691215.xml"; +var w; + +addLoadEvent(function() { + // Need a separate window because we do not prettyprint in iframes. This is + // why this test can't be a crashtest. + w = window.open(url); + // Need to poll for load completion, sadly + setTimeout(checker, 0); +}); + +function checker() { + if (w.location.href != url || + w.document.readyState != "complete") { + setTimeout(checker, 0); + return; + } + var doc = w.document; + var n = doc.createElement("span"); + doc.replaceChild(n, doc.documentElement); + w.close(); + ok(1, "Hey, we got here, that's good"); + SimpleTest.finish(); +} + +</script> +</pre> +</body> +</html> |